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