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 String googleAdSenseClient;
53
54
55
56
57 private String googleAdSenseSlot;
58
59
60
61
62 private String googleAnalyticsAccountId;
63
64
65
66
67 private PublishDate publishDate;
68
69
70
71
72 private Version version;
73
74
75
76
77
78
79
80
81 private String edit;
82
83
84
85
86 private java.util.List<Logo> poweredBy;
87
88
89
90
91 private Skin skin;
92
93
94
95
96 private Body body;
97
98
99
100
101
102
103
104
105
106
107
108 private Object custom;
109
110
111
112
113 private long lastModified = 0L;
114
115
116
117
118 private String modelEncoding = "UTF-8";
119
120
121
122
123
124
125
126
127
128
129
130 public void addPoweredBy( Logo logo )
131 {
132 getPoweredBy().add( logo );
133 }
134
135
136
137
138
139
140 public DecorationModel clone()
141 {
142 try
143 {
144 DecorationModel copy = (DecorationModel) super.clone();
145
146 if ( this.bannerLeft != null )
147 {
148 copy.bannerLeft = (Banner) this.bannerLeft.clone();
149 }
150
151 if ( this.bannerRight != null )
152 {
153 copy.bannerRight = (Banner) this.bannerRight.clone();
154 }
155
156 if ( this.publishDate != null )
157 {
158 copy.publishDate = (PublishDate) this.publishDate.clone();
159 }
160
161 if ( this.version != null )
162 {
163 copy.version = (Version) this.version.clone();
164 }
165
166 if ( this.poweredBy != null )
167 {
168 copy.poweredBy = new java.util.ArrayList<Logo>();
169 for ( Logo item : this.poweredBy )
170 {
171 copy.poweredBy.add( ( (Logo) item).clone() );
172 }
173 }
174
175 if ( this.skin != null )
176 {
177 copy.skin = (Skin) this.skin.clone();
178 }
179
180 if ( this.body != null )
181 {
182 copy.body = (Body) this.body.clone();
183 }
184
185 if ( this.custom != null )
186 {
187 copy.custom = new org.codehaus.plexus.util.xml.Xpp3Dom( (org.codehaus.plexus.util.xml.Xpp3Dom) this.custom );
188 }
189
190 return copy;
191 }
192 catch ( java.lang.Exception ex )
193 {
194 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
195 + " does not support clone()" ).initCause( ex );
196 }
197 }
198
199
200
201
202
203
204
205 public boolean equals( Object other )
206 {
207 if ( this == other )
208 {
209 return true;
210 }
211
212 if ( !( other instanceof DecorationModel ) )
213 {
214 return false;
215 }
216
217 DecorationModel that = (DecorationModel) other;
218 boolean result = true;
219
220 result = result && ( getName() == null ? that.getName() == null : getName().equals( that.getName() ) );
221 result = result && ( getBannerLeft() == null ? that.getBannerLeft() == null : getBannerLeft().equals( that.getBannerLeft() ) );
222 result = result && ( getBannerRight() == null ? that.getBannerRight() == null : getBannerRight().equals( that.getBannerRight() ) );
223 result = result && ( getGoogleAdSenseClient() == null ? that.getGoogleAdSenseClient() == null : getGoogleAdSenseClient().equals( that.getGoogleAdSenseClient() ) );
224 result = result && ( getGoogleAdSenseSlot() == null ? that.getGoogleAdSenseSlot() == null : getGoogleAdSenseSlot().equals( that.getGoogleAdSenseSlot() ) );
225 result = result && ( getGoogleAnalyticsAccountId() == null ? that.getGoogleAnalyticsAccountId() == null : getGoogleAnalyticsAccountId().equals( that.getGoogleAnalyticsAccountId() ) );
226 result = result && ( getPublishDate() == null ? that.getPublishDate() == null : getPublishDate().equals( that.getPublishDate() ) );
227 result = result && ( getVersion() == null ? that.getVersion() == null : getVersion().equals( that.getVersion() ) );
228 result = result && ( getEdit() == null ? that.getEdit() == null : getEdit().equals( that.getEdit() ) );
229 result = result && ( getPoweredBy() == null ? that.getPoweredBy() == null : getPoweredBy().equals( that.getPoweredBy() ) );
230 result = result && ( getSkin() == null ? that.getSkin() == null : getSkin().equals( that.getSkin() ) );
231 result = result && ( getBody() == null ? that.getBody() == null : getBody().equals( that.getBody() ) );
232 result = result && ( getCustom() == null ? that.getCustom() == null : getCustom().equals( that.getCustom() ) );
233
234 return result;
235 }
236
237
238
239
240
241
242 public Banner getBannerLeft()
243 {
244 return this.bannerLeft;
245 }
246
247
248
249
250
251
252 public Banner getBannerRight()
253 {
254 return this.bannerRight;
255 }
256
257
258
259
260
261
262 public Body getBody()
263 {
264 return this.body;
265 }
266
267
268
269
270
271
272
273
274 public String getCombineSelf()
275 {
276 return this.combineSelf;
277 }
278
279
280
281
282
283
284
285
286
287
288
289 public Object getCustom()
290 {
291 return this.custom;
292 }
293
294
295
296
297
298
299
300
301 public String getEdit()
302 {
303 return this.edit;
304 }
305
306
307
308
309
310
311 public String getGoogleAdSenseClient()
312 {
313 return this.googleAdSenseClient;
314 }
315
316
317
318
319
320
321 public String getGoogleAdSenseSlot()
322 {
323 return this.googleAdSenseSlot;
324 }
325
326
327
328
329
330
331 public String getGoogleAnalyticsAccountId()
332 {
333 return this.googleAnalyticsAccountId;
334 }
335
336
337
338
339
340
341
342 public long getLastModified()
343 {
344 return this.lastModified;
345 }
346
347
348
349
350
351
352 public String getModelEncoding()
353 {
354 return this.modelEncoding;
355 }
356
357
358
359
360
361
362 public String getName()
363 {
364 return this.name;
365 }
366
367
368
369
370
371
372 public java.util.List<Logo> getPoweredBy()
373 {
374 if ( this.poweredBy == null )
375 {
376 this.poweredBy = new java.util.ArrayList<Logo>();
377 }
378
379 return this.poweredBy;
380 }
381
382
383
384
385
386
387 public Skin getSkin()
388 {
389 return this.skin;
390 }
391
392
393
394
395
396
397 public int hashCode()
398 {
399 int result = 17;
400
401 result = 37 * result + ( name != null ? name.hashCode() : 0 );
402 result = 37 * result + ( bannerLeft != null ? bannerLeft.hashCode() : 0 );
403 result = 37 * result + ( bannerRight != null ? bannerRight.hashCode() : 0 );
404 result = 37 * result + ( googleAdSenseClient != null ? googleAdSenseClient.hashCode() : 0 );
405 result = 37 * result + ( googleAdSenseSlot != null ? googleAdSenseSlot.hashCode() : 0 );
406 result = 37 * result + ( googleAnalyticsAccountId != null ? googleAnalyticsAccountId.hashCode() : 0 );
407 result = 37 * result + ( publishDate != null ? publishDate.hashCode() : 0 );
408 result = 37 * result + ( version != null ? version.hashCode() : 0 );
409 result = 37 * result + ( edit != null ? edit.hashCode() : 0 );
410 result = 37 * result + ( poweredBy != null ? poweredBy.hashCode() : 0 );
411 result = 37 * result + ( skin != null ? skin.hashCode() : 0 );
412 result = 37 * result + ( body != null ? body.hashCode() : 0 );
413 result = 37 * result + ( custom != null ? custom.hashCode() : 0 );
414
415 return result;
416 }
417
418
419
420
421
422
423 public void removePoweredBy( Logo logo )
424 {
425 getPoweredBy().remove( logo );
426 }
427
428
429
430
431
432
433 public void setBannerLeft( Banner bannerLeft )
434 {
435 this.bannerLeft = bannerLeft;
436 }
437
438
439
440
441
442
443 public void setBannerRight( Banner bannerRight )
444 {
445 this.bannerRight = bannerRight;
446 }
447
448
449
450
451
452
453 public void setBody( Body body )
454 {
455 this.body = body;
456 }
457
458
459
460
461
462
463
464
465 public void setCombineSelf( String combineSelf )
466 {
467 this.combineSelf = combineSelf;
468 }
469
470
471
472
473
474
475
476
477
478
479
480 public void setCustom( Object custom )
481 {
482 this.custom = custom;
483 }
484
485
486
487
488
489
490
491
492 public void setEdit( String edit )
493 {
494 this.edit = edit;
495 }
496
497
498
499
500
501
502 public void setGoogleAdSenseClient( String googleAdSenseClient )
503 {
504 this.googleAdSenseClient = googleAdSenseClient;
505 }
506
507
508
509
510
511
512 public void setGoogleAdSenseSlot( String googleAdSenseSlot )
513 {
514 this.googleAdSenseSlot = googleAdSenseSlot;
515 }
516
517
518
519
520
521
522 public void setGoogleAnalyticsAccountId( String googleAnalyticsAccountId )
523 {
524 this.googleAnalyticsAccountId = googleAnalyticsAccountId;
525 }
526
527
528
529
530
531
532
533 public void setLastModified( long lastModified )
534 {
535 this.lastModified = lastModified;
536 }
537
538
539
540
541
542
543 public void setModelEncoding( String modelEncoding )
544 {
545 this.modelEncoding = modelEncoding;
546 }
547
548
549
550
551
552
553 public void setName( String name )
554 {
555 this.name = name;
556 }
557
558
559
560
561
562
563 public void setPoweredBy( java.util.List<Logo> poweredBy )
564 {
565 this.poweredBy = poweredBy;
566 }
567
568
569
570
571
572
573 public void setPublishDate( PublishDate publishDate )
574 {
575 this.publishDate = publishDate;
576 }
577
578
579
580
581
582
583 public void setSkin( Skin skin )
584 {
585 this.skin = skin;
586 }
587
588
589
590
591
592
593 public void setVersion( Version version )
594 {
595 this.version = version;
596 }
597
598
599
600
601
602
603 public java.lang.String toString()
604 {
605 StringBuilder buf = new StringBuilder( 128 );
606
607 buf.append( "name = '" );
608 buf.append( getName() );
609 buf.append( "'" );
610 buf.append( "\n" );
611 buf.append( "bannerLeft = '" );
612 buf.append( getBannerLeft() );
613 buf.append( "'" );
614 buf.append( "\n" );
615 buf.append( "bannerRight = '" );
616 buf.append( getBannerRight() );
617 buf.append( "'" );
618 buf.append( "\n" );
619 buf.append( "googleAdSenseClient = '" );
620 buf.append( getGoogleAdSenseClient() );
621 buf.append( "'" );
622 buf.append( "\n" );
623 buf.append( "googleAdSenseSlot = '" );
624 buf.append( getGoogleAdSenseSlot() );
625 buf.append( "'" );
626 buf.append( "\n" );
627 buf.append( "googleAnalyticsAccountId = '" );
628 buf.append( getGoogleAnalyticsAccountId() );
629 buf.append( "'" );
630 buf.append( "\n" );
631 buf.append( "publishDate = '" );
632 buf.append( getPublishDate() );
633 buf.append( "'" );
634 buf.append( "\n" );
635 buf.append( "version = '" );
636 buf.append( getVersion() );
637 buf.append( "'" );
638 buf.append( "\n" );
639 buf.append( "edit = '" );
640 buf.append( getEdit() );
641 buf.append( "'" );
642 buf.append( "\n" );
643 buf.append( "poweredBy = '" );
644 buf.append( getPoweredBy() );
645 buf.append( "'" );
646 buf.append( "\n" );
647 buf.append( "skin = '" );
648 buf.append( getSkin() );
649 buf.append( "'" );
650 buf.append( "\n" );
651 buf.append( "body = '" );
652 buf.append( getBody() );
653 buf.append( "'" );
654 buf.append( "\n" );
655 buf.append( "custom = '" );
656 buf.append( getCustom() );
657 buf.append( "'" );
658
659 return buf.toString();
660 }
661
662
663
664 public static final String MERGE = "merge";
665
666 public static final String OVERRIDE = "override";
667
668 public boolean isMergeParent()
669 {
670 return !OVERRIDE.equals( combineSelf );
671 }
672
673 public PublishDate getPublishDate()
674 {
675 if ( publishDate == null )
676 return new PublishDate();
677 else
678 return publishDate;
679 }
680
681 public boolean isDefaultPublishDate()
682 {
683 return publishDate == null;
684 }
685
686 public Version getVersion()
687 {
688 if ( version == null )
689 return new Version();
690 else
691 return version;
692 }
693
694 public boolean isDefaultVersion()
695 {
696 return version == null;
697 }
698
699 private java.util.Map<String, Menu> menusByRef;
700
701
702
703
704
705 public Menu getMenuRef( String key )
706 {
707 if ( menusByRef == null )
708 {
709 menusByRef = new java.util.HashMap<String, Menu>();
710
711 if ( body != null )
712 {
713 for ( Menu menu : body.getMenus() )
714 {
715 if ( menu.getRef() != null )
716 {
717 menusByRef.put( menu.getRef(), menu );
718 }
719 }
720 }
721 }
722 return menusByRef.get( key );
723 }
724
725
726
727
728 public void removeMenuRef( String key )
729 {
730 if ( body != null )
731 {
732 for ( java.util.Iterator<Menu> i = body.getMenus().iterator(); i.hasNext(); )
733 {
734 Menu menu = i.next();
735 if ( key.equals( menu.getRef() ) )
736 {
737 i.remove();
738 }
739 }
740 }
741 }
742
743
744
745
746 public java.util.List<Menu> getMenus()
747 {
748 java.util.List menus;
749 if ( body != null && body.getMenus() != null )
750 {
751 menus = body.getMenus();
752 }
753 else
754 {
755 menus = java.util.Collections.emptyList();
756 }
757 return menus;
758 }
759
760
761
762
763
764
765
766 public boolean isLink( String href )
767 {
768 return DecorationUtils.isLink( href );
769 }
770
771
772
773
774
775
776 public Object getCustomChild( String path )
777 {
778 return DecorationUtils.getCustomChild( (org.codehaus.plexus.util.xml.Xpp3Dom) custom, path );
779 }
780
781
782
783
784
785 public String getCustomValue( String path )
786 {
787 return DecorationUtils.getCustomValue( (org.codehaus.plexus.util.xml.Xpp3Dom) custom, path );
788 }
789
790
791
792
793
794 public String getCustomValue( String path, String defaultValue )
795 {
796 return DecorationUtils.getCustomValue( (org.codehaus.plexus.util.xml.Xpp3Dom) custom, path, defaultValue );
797 }
798
799 }