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