1
2
3
4
5
6 package org.apache.maven.doxia.site.decoration;
7
8
9
10
11
12
13
14
15
16 @SuppressWarnings( "all" )
17 public class DecorationModel
18 implements java.io.Serializable, java.lang.Cloneable
19 {
20
21
22
23
24
25
26
27
28 private String name;
29
30
31
32
33
34
35
36
37 private String combineSelf = "merge";
38
39
40
41
42 private Banner bannerLeft;
43
44
45
46
47 private Banner bannerRight;
48
49
50
51
52 private PublishDate publishDate;
53
54
55
56
57 private Version version;
58
59
60
61
62
63
64
65
66 private String edit;
67
68
69
70
71 private java.util.List<Logo> poweredBy;
72
73
74
75
76 private Skin skin;
77
78
79
80
81 private Body body;
82
83
84
85
86
87
88
89
90
91
92
93 private Object custom;
94
95
96
97
98 private long lastModified = 0L;
99
100
101
102
103 private String modelEncoding = "UTF-8";
104
105
106
107
108
109
110
111
112
113
114
115 public void addPoweredBy( Logo logo )
116 {
117 getPoweredBy().add( logo );
118 }
119
120
121
122
123
124
125 public DecorationModel clone()
126 {
127 try
128 {
129 DecorationModel copy = (DecorationModel) super.clone();
130
131 if ( this.bannerLeft != null )
132 {
133 copy.bannerLeft = (Banner) this.bannerLeft.clone();
134 }
135
136 if ( this.bannerRight != null )
137 {
138 copy.bannerRight = (Banner) this.bannerRight.clone();
139 }
140
141 if ( this.publishDate != null )
142 {
143 copy.publishDate = (PublishDate) this.publishDate.clone();
144 }
145
146 if ( this.version != null )
147 {
148 copy.version = (Version) this.version.clone();
149 }
150
151 if ( this.poweredBy != null )
152 {
153 copy.poweredBy = new java.util.ArrayList<Logo>();
154 for ( Logo item : this.poweredBy )
155 {
156 copy.poweredBy.add( ( (Logo) item).clone() );
157 }
158 }
159
160 if ( this.skin != null )
161 {
162 copy.skin = (Skin) this.skin.clone();
163 }
164
165 if ( this.body != null )
166 {
167 copy.body = (Body) this.body.clone();
168 }
169
170 if ( this.custom != null )
171 {
172 copy.custom = new org.codehaus.plexus.util.xml.Xpp3Dom( (org.codehaus.plexus.util.xml.Xpp3Dom) this.custom );
173 }
174
175 return copy;
176 }
177 catch ( java.lang.Exception ex )
178 {
179 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
180 + " does not support clone()" ).initCause( ex );
181 }
182 }
183
184
185
186
187
188
189
190 public boolean equals( Object other )
191 {
192 if ( this == other )
193 {
194 return true;
195 }
196
197 if ( !( other instanceof DecorationModel ) )
198 {
199 return false;
200 }
201
202 DecorationModel that = (DecorationModel) other;
203 boolean result = true;
204
205 result = result && ( getName() == null ? that.getName() == null : getName().equals( that.getName() ) );
206 result = result && ( getBannerLeft() == null ? that.getBannerLeft() == null : getBannerLeft().equals( that.getBannerLeft() ) );
207 result = result && ( getBannerRight() == null ? that.getBannerRight() == null : getBannerRight().equals( that.getBannerRight() ) );
208 result = result && ( getPublishDate() == null ? that.getPublishDate() == null : getPublishDate().equals( that.getPublishDate() ) );
209 result = result && ( getVersion() == null ? that.getVersion() == null : getVersion().equals( that.getVersion() ) );
210 result = result && ( getEdit() == null ? that.getEdit() == null : getEdit().equals( that.getEdit() ) );
211 result = result && ( getPoweredBy() == null ? that.getPoweredBy() == null : getPoweredBy().equals( that.getPoweredBy() ) );
212 result = result && ( getSkin() == null ? that.getSkin() == null : getSkin().equals( that.getSkin() ) );
213 result = result && ( getBody() == null ? that.getBody() == null : getBody().equals( that.getBody() ) );
214 result = result && ( getCustom() == null ? that.getCustom() == null : getCustom().equals( that.getCustom() ) );
215
216 return result;
217 }
218
219
220
221
222
223
224 public Banner getBannerLeft()
225 {
226 return this.bannerLeft;
227 }
228
229
230
231
232
233
234 public Banner getBannerRight()
235 {
236 return this.bannerRight;
237 }
238
239
240
241
242
243
244 public Body getBody()
245 {
246 return this.body;
247 }
248
249
250
251
252
253
254
255
256 public String getCombineSelf()
257 {
258 return this.combineSelf;
259 }
260
261
262
263
264
265
266
267
268
269
270
271 public Object getCustom()
272 {
273 return this.custom;
274 }
275
276
277
278
279
280
281
282
283 public String getEdit()
284 {
285 return this.edit;
286 }
287
288
289
290
291
292
293
294 public long getLastModified()
295 {
296 return this.lastModified;
297 }
298
299
300
301
302
303
304 public String getModelEncoding()
305 {
306 return this.modelEncoding;
307 }
308
309
310
311
312
313
314 public String getName()
315 {
316 return this.name;
317 }
318
319
320
321
322
323
324 public java.util.List<Logo> getPoweredBy()
325 {
326 if ( this.poweredBy == null )
327 {
328 this.poweredBy = new java.util.ArrayList<Logo>();
329 }
330
331 return this.poweredBy;
332 }
333
334
335
336
337
338
339 public Skin getSkin()
340 {
341 return this.skin;
342 }
343
344
345
346
347
348
349 public int hashCode()
350 {
351 int result = 17;
352
353 result = 37 * result + ( name != null ? name.hashCode() : 0 );
354 result = 37 * result + ( bannerLeft != null ? bannerLeft.hashCode() : 0 );
355 result = 37 * result + ( bannerRight != null ? bannerRight.hashCode() : 0 );
356 result = 37 * result + ( publishDate != null ? publishDate.hashCode() : 0 );
357 result = 37 * result + ( version != null ? version.hashCode() : 0 );
358 result = 37 * result + ( edit != null ? edit.hashCode() : 0 );
359 result = 37 * result + ( poweredBy != null ? poweredBy.hashCode() : 0 );
360 result = 37 * result + ( skin != null ? skin.hashCode() : 0 );
361 result = 37 * result + ( body != null ? body.hashCode() : 0 );
362 result = 37 * result + ( custom != null ? custom.hashCode() : 0 );
363
364 return result;
365 }
366
367
368
369
370
371
372 public void removePoweredBy( Logo logo )
373 {
374 getPoweredBy().remove( logo );
375 }
376
377
378
379
380
381
382 public void setBannerLeft( Banner bannerLeft )
383 {
384 this.bannerLeft = bannerLeft;
385 }
386
387
388
389
390
391
392 public void setBannerRight( Banner bannerRight )
393 {
394 this.bannerRight = bannerRight;
395 }
396
397
398
399
400
401
402 public void setBody( Body body )
403 {
404 this.body = body;
405 }
406
407
408
409
410
411
412
413
414 public void setCombineSelf( String combineSelf )
415 {
416 this.combineSelf = combineSelf;
417 }
418
419
420
421
422
423
424
425
426
427
428
429 public void setCustom( Object custom )
430 {
431 this.custom = custom;
432 }
433
434
435
436
437
438
439
440
441 public void setEdit( String edit )
442 {
443 this.edit = edit;
444 }
445
446
447
448
449
450
451
452 public void setLastModified( long lastModified )
453 {
454 this.lastModified = lastModified;
455 }
456
457
458
459
460
461
462 public void setModelEncoding( String modelEncoding )
463 {
464 this.modelEncoding = modelEncoding;
465 }
466
467
468
469
470
471
472 public void setName( String name )
473 {
474 this.name = name;
475 }
476
477
478
479
480
481
482 public void setPoweredBy( java.util.List<Logo> poweredBy )
483 {
484 this.poweredBy = poweredBy;
485 }
486
487
488
489
490
491
492 public void setPublishDate( PublishDate publishDate )
493 {
494 this.publishDate = publishDate;
495 }
496
497
498
499
500
501
502 public void setSkin( Skin skin )
503 {
504 this.skin = skin;
505 }
506
507
508
509
510
511
512 public void setVersion( Version version )
513 {
514 this.version = version;
515 }
516
517
518
519
520
521
522 public java.lang.String toString()
523 {
524 StringBuilder buf = new StringBuilder( 128 );
525
526 buf.append( "name = '" );
527 buf.append( getName() );
528 buf.append( "'" );
529 buf.append( "\n" );
530 buf.append( "bannerLeft = '" );
531 buf.append( getBannerLeft() );
532 buf.append( "'" );
533 buf.append( "\n" );
534 buf.append( "bannerRight = '" );
535 buf.append( getBannerRight() );
536 buf.append( "'" );
537 buf.append( "\n" );
538 buf.append( "publishDate = '" );
539 buf.append( getPublishDate() );
540 buf.append( "'" );
541 buf.append( "\n" );
542 buf.append( "version = '" );
543 buf.append( getVersion() );
544 buf.append( "'" );
545 buf.append( "\n" );
546 buf.append( "edit = '" );
547 buf.append( getEdit() );
548 buf.append( "'" );
549 buf.append( "\n" );
550 buf.append( "poweredBy = '" );
551 buf.append( getPoweredBy() );
552 buf.append( "'" );
553 buf.append( "\n" );
554 buf.append( "skin = '" );
555 buf.append( getSkin() );
556 buf.append( "'" );
557 buf.append( "\n" );
558 buf.append( "body = '" );
559 buf.append( getBody() );
560 buf.append( "'" );
561 buf.append( "\n" );
562 buf.append( "custom = '" );
563 buf.append( getCustom() );
564 buf.append( "'" );
565
566 return buf.toString();
567 }
568
569
570
571 public static final String MERGE = "merge";
572
573 public static final String OVERRIDE = "override";
574
575 public boolean isMergeParent()
576 {
577 return !OVERRIDE.equals( combineSelf );
578 }
579
580 public PublishDate getPublishDate()
581 {
582 if ( publishDate == null )
583 return new PublishDate();
584 else
585 return publishDate;
586 }
587
588 public boolean isDefaultPublishDate()
589 {
590 return publishDate == null;
591 }
592
593 public Version getVersion()
594 {
595 if ( version == null )
596 return new Version();
597 else
598 return version;
599 }
600
601 public boolean isDefaultVersion()
602 {
603 return version == null;
604 }
605
606 private java.util.Map<String, Menu> menusByRef;
607
608
609
610
611
612 public Menu getMenuRef( String key )
613 {
614 if ( menusByRef == null )
615 {
616 menusByRef = new java.util.HashMap<String, Menu>();
617
618 if ( body != null )
619 {
620 for ( Menu menu : body.getMenus() )
621 {
622 if ( menu.getRef() != null )
623 {
624 menusByRef.put( menu.getRef(), menu );
625 }
626 }
627 }
628 }
629 return menusByRef.get( key );
630 }
631
632
633
634
635 public void removeMenuRef( String key )
636 {
637 if ( body != null )
638 {
639 for ( java.util.Iterator<Menu> i = body.getMenus().iterator(); i.hasNext(); )
640 {
641 Menu menu = i.next();
642 if ( key.equals( menu.getRef() ) )
643 {
644 i.remove();
645 }
646 }
647 }
648 }
649
650
651
652
653 public java.util.List<Menu> getMenus()
654 {
655 java.util.List menus;
656 if ( body != null && body.getMenus() != null )
657 {
658 menus = body.getMenus();
659 }
660 else
661 {
662 menus = java.util.Collections.emptyList();
663 }
664 return menus;
665 }
666
667
668 }