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 && ( getPoweredBy() == null ? that.getPoweredBy() == null : getPoweredBy().equals( that.getPoweredBy() ) );
229 result = result && ( getSkin() == null ? that.getSkin() == null : getSkin().equals( that.getSkin() ) );
230 result = result && ( getBody() == null ? that.getBody() == null : getBody().equals( that.getBody() ) );
231 result = result && ( getCustom() == null ? that.getCustom() == null : getCustom().equals( that.getCustom() ) );
232
233 return result;
234 }
235
236
237
238
239
240
241 public Banner getBannerLeft()
242 {
243 return this.bannerLeft;
244 }
245
246
247
248
249
250
251 public Banner getBannerRight()
252 {
253 return this.bannerRight;
254 }
255
256
257
258
259
260
261 public Body getBody()
262 {
263 return this.body;
264 }
265
266
267
268
269
270
271
272
273 public String getCombineSelf()
274 {
275 return this.combineSelf;
276 }
277
278
279
280
281
282
283
284
285
286
287
288 public Object getCustom()
289 {
290 return this.custom;
291 }
292
293
294
295
296
297
298
299
300 public String getEdit()
301 {
302 return this.edit;
303 }
304
305
306
307
308
309
310 public String getGoogleAdSenseClient()
311 {
312 return this.googleAdSenseClient;
313 }
314
315
316
317
318
319
320 public String getGoogleAdSenseSlot()
321 {
322 return this.googleAdSenseSlot;
323 }
324
325
326
327
328
329
330 public String getGoogleAnalyticsAccountId()
331 {
332 return this.googleAnalyticsAccountId;
333 }
334
335
336
337
338
339
340
341 public long getLastModified()
342 {
343 return this.lastModified;
344 }
345
346
347
348
349
350
351 public String getModelEncoding()
352 {
353 return this.modelEncoding;
354 }
355
356
357
358
359
360
361 public String getName()
362 {
363 return this.name;
364 }
365
366
367
368
369
370
371 public java.util.List<Logo> getPoweredBy()
372 {
373 if ( this.poweredBy == null )
374 {
375 this.poweredBy = new java.util.ArrayList<Logo>();
376 }
377
378 return this.poweredBy;
379 }
380
381
382
383
384
385
386 public Skin getSkin()
387 {
388 return this.skin;
389 }
390
391
392
393
394
395
396 public int hashCode()
397 {
398 int result = 17;
399
400 result = 37 * result + ( name != null ? name.hashCode() : 0 );
401 result = 37 * result + ( bannerLeft != null ? bannerLeft.hashCode() : 0 );
402 result = 37 * result + ( bannerRight != null ? bannerRight.hashCode() : 0 );
403 result = 37 * result + ( googleAdSenseClient != null ? googleAdSenseClient.hashCode() : 0 );
404 result = 37 * result + ( googleAdSenseSlot != null ? googleAdSenseSlot.hashCode() : 0 );
405 result = 37 * result + ( googleAnalyticsAccountId != null ? googleAnalyticsAccountId.hashCode() : 0 );
406 result = 37 * result + ( publishDate != null ? publishDate.hashCode() : 0 );
407 result = 37 * result + ( version != null ? version.hashCode() : 0 );
408 result = 37 * result + ( poweredBy != null ? poweredBy.hashCode() : 0 );
409 result = 37 * result + ( skin != null ? skin.hashCode() : 0 );
410 result = 37 * result + ( body != null ? body.hashCode() : 0 );
411 result = 37 * result + ( custom != null ? custom.hashCode() : 0 );
412
413 return result;
414 }
415
416
417
418
419
420
421 public void removePoweredBy( Logo logo )
422 {
423 getPoweredBy().remove( logo );
424 }
425
426
427
428
429
430
431 public void setBannerLeft( Banner bannerLeft )
432 {
433 this.bannerLeft = bannerLeft;
434 }
435
436
437
438
439
440
441 public void setBannerRight( Banner bannerRight )
442 {
443 this.bannerRight = bannerRight;
444 }
445
446
447
448
449
450
451 public void setBody( Body body )
452 {
453 this.body = body;
454 }
455
456
457
458
459
460
461
462
463 public void setCombineSelf( String combineSelf )
464 {
465 this.combineSelf = combineSelf;
466 }
467
468
469
470
471
472
473
474
475
476
477
478 public void setCustom( Object custom )
479 {
480 this.custom = custom;
481 }
482
483
484
485
486
487
488
489
490 public void setEdit( String edit )
491 {
492 this.edit = edit;
493 }
494
495
496
497
498
499
500 public void setGoogleAdSenseClient( String googleAdSenseClient )
501 {
502 this.googleAdSenseClient = googleAdSenseClient;
503 }
504
505
506
507
508
509
510 public void setGoogleAdSenseSlot( String googleAdSenseSlot )
511 {
512 this.googleAdSenseSlot = googleAdSenseSlot;
513 }
514
515
516
517
518
519
520 public void setGoogleAnalyticsAccountId( String googleAnalyticsAccountId )
521 {
522 this.googleAnalyticsAccountId = googleAnalyticsAccountId;
523 }
524
525
526
527
528
529
530
531 public void setLastModified( long lastModified )
532 {
533 this.lastModified = lastModified;
534 }
535
536
537
538
539
540
541 public void setModelEncoding( String modelEncoding )
542 {
543 this.modelEncoding = modelEncoding;
544 }
545
546
547
548
549
550
551 public void setName( String name )
552 {
553 this.name = name;
554 }
555
556
557
558
559
560
561 public void setPoweredBy( java.util.List<Logo> poweredBy )
562 {
563 this.poweredBy = poweredBy;
564 }
565
566
567
568
569
570
571 public void setPublishDate( PublishDate publishDate )
572 {
573 this.publishDate = publishDate;
574 }
575
576
577
578
579
580
581 public void setSkin( Skin skin )
582 {
583 this.skin = skin;
584 }
585
586
587
588
589
590
591 public void setVersion( Version version )
592 {
593 this.version = version;
594 }
595
596
597
598
599
600
601 public java.lang.String toString()
602 {
603 StringBuilder buf = new StringBuilder( 128 );
604
605 buf.append( "name = '" );
606 buf.append( getName() );
607 buf.append( "'" );
608 buf.append( "\n" );
609 buf.append( "bannerLeft = '" );
610 buf.append( getBannerLeft() );
611 buf.append( "'" );
612 buf.append( "\n" );
613 buf.append( "bannerRight = '" );
614 buf.append( getBannerRight() );
615 buf.append( "'" );
616 buf.append( "\n" );
617 buf.append( "googleAdSenseClient = '" );
618 buf.append( getGoogleAdSenseClient() );
619 buf.append( "'" );
620 buf.append( "\n" );
621 buf.append( "googleAdSenseSlot = '" );
622 buf.append( getGoogleAdSenseSlot() );
623 buf.append( "'" );
624 buf.append( "\n" );
625 buf.append( "googleAnalyticsAccountId = '" );
626 buf.append( getGoogleAnalyticsAccountId() );
627 buf.append( "'" );
628 buf.append( "\n" );
629 buf.append( "publishDate = '" );
630 buf.append( getPublishDate() );
631 buf.append( "'" );
632 buf.append( "\n" );
633 buf.append( "version = '" );
634 buf.append( getVersion() );
635 buf.append( "'" );
636 buf.append( "\n" );
637 buf.append( "poweredBy = '" );
638 buf.append( getPoweredBy() );
639 buf.append( "'" );
640 buf.append( "\n" );
641 buf.append( "skin = '" );
642 buf.append( getSkin() );
643 buf.append( "'" );
644 buf.append( "\n" );
645 buf.append( "body = '" );
646 buf.append( getBody() );
647 buf.append( "'" );
648 buf.append( "\n" );
649 buf.append( "custom = '" );
650 buf.append( getCustom() );
651 buf.append( "'" );
652
653 return buf.toString();
654 }
655
656
657
658 public static final String MERGE = "merge";
659
660 public static final String OVERRIDE = "override";
661
662 public boolean isMergeParent()
663 {
664 return !OVERRIDE.equals( combineSelf );
665 }
666
667 public PublishDate getPublishDate()
668 {
669 if ( publishDate == null )
670 return new PublishDate();
671 else
672 return publishDate;
673 }
674
675 public boolean isDefaultPublishDate()
676 {
677 return publishDate == null;
678 }
679
680 public Version getVersion()
681 {
682 if ( version == null )
683 return new Version();
684 else
685 return version;
686 }
687
688 public boolean isDefaultVersion()
689 {
690 return version == null;
691 }
692
693 private java.util.Map<String, Menu> menusByRef;
694
695
696
697
698
699 public Menu getMenuRef( String key )
700 {
701 if ( menusByRef == null )
702 {
703 menusByRef = new java.util.HashMap<String, Menu>();
704
705 if ( body != null )
706 {
707 for ( Menu menu : body.getMenus() )
708 {
709 if ( menu.getRef() != null )
710 {
711 menusByRef.put( menu.getRef(), menu );
712 }
713 }
714 }
715 }
716 return menusByRef.get( key );
717 }
718
719
720
721
722 public void removeMenuRef( String key )
723 {
724 if ( body != null )
725 {
726 for ( java.util.Iterator<Menu> i = body.getMenus().iterator(); i.hasNext(); )
727 {
728 Menu menu = i.next();
729 if ( key.equals( menu.getRef() ) )
730 {
731 i.remove();
732 }
733 }
734 }
735 }
736
737
738
739
740 public java.util.List<Menu> getMenus()
741 {
742 java.util.List menus;
743 if ( body != null && body.getMenus() != null )
744 {
745 menus = body.getMenus();
746 }
747 else
748 {
749 menus = java.util.Collections.emptyList();
750 }
751 return menus;
752 }
753
754
755
756
757
758
759
760 public boolean isLink( String href )
761 {
762 return DecorationUtils.isLink( href );
763 }
764
765
766
767
768
769
770 public Object getCustomChild( String path )
771 {
772 return DecorationUtils.getCustomChild( (org.codehaus.plexus.util.xml.Xpp3Dom) custom, path );
773 }
774
775
776
777
778
779 public String getCustomValue( String path )
780 {
781 return DecorationUtils.getCustomValue( (org.codehaus.plexus.util.xml.Xpp3Dom) custom, path );
782 }
783
784
785
786
787
788 public String getCustomValue( String path, String defaultValue )
789 {
790 return DecorationUtils.getCustomValue( (org.codehaus.plexus.util.xml.Xpp3Dom) custom, path, defaultValue );
791 }
792
793 }