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