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