View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   // Generated by Modello 1.8.1,
3   // any modifications will be overwritten.
4   // ==============================================================
5   
6   package org.apache.maven.doxia.site.decoration;
7   
8   /**
9    * 
10   *          The <code>&lt;project&gt;</code> element is the root of
11   * the site decoration descriptor.
12   *       
13   * 
14   * @version $Revision$ $Date$
15   */
16  @SuppressWarnings( "all" )
17  public class DecorationModel
18      implements java.io.Serializable, java.lang.Cloneable
19  {
20  
21        //--------------------------/
22       //- Class/Member Variables -/
23      //--------------------------/
24  
25      /**
26       * The full name of the project.
27       */
28      private String name;
29  
30      /**
31       * 
32       *              Whether to inherit configuration from a parent
33       * project site descriptor (<code>merge</code>)
34       *            or not (<code>override</code>).
35       *            
36       */
37      private String combineSelf = "merge";
38  
39      /**
40       * Banner logo on the masthead of the site to the left.
41       */
42      private Banner bannerLeft;
43  
44      /**
45       * Banner logo on the masthead of the site to the right.
46       */
47      private Banner bannerRight;
48  
49      /**
50       * Your Google AdSense client id.
51       */
52      private String googleAdSenseClient;
53  
54      /**
55       * Your Google AdSense slot id.
56       */
57      private String googleAdSenseSlot;
58  
59      /**
60       * The id for your Google Analytics account.
61       */
62      private String googleAnalyticsAccountId;
63  
64      /**
65       * Modify the date published display properties.
66       */
67      private PublishDate publishDate;
68  
69      /**
70       * Modify the version published display properties.
71       */
72      private Version version;
73  
74      /**
75       * Field poweredBy.
76       */
77      private java.util.List<Logo> poweredBy;
78  
79      /**
80       * The artifact containing the skin for the site.
81       */
82      private Skin skin;
83  
84      /**
85       * The main site content decoration.
86       */
87      private Body body;
88  
89      /**
90       * 
91       *             Custom configuration for use with customized
92       * Velocity templates. Data from this field are
93       *             accessible in Velocity template from
94       * <code>$decoration.custom</code> variable as DOM content.
95       *             Example: <code>$decoration.custom.getChild(
96       * 'customElement' ).getValue()</code>
97       *           
98       */
99      private Object custom;
100 
101     /**
102      * Timestamp of the last modification of this decoration model.
103      */
104     private long lastModified = 0L;
105 
106     /**
107      * Field modelEncoding.
108      */
109     private String modelEncoding = "UTF-8";
110 
111 
112       //-----------/
113      //- Methods -/
114     //-----------/
115 
116     /**
117      * Method addPoweredBy.
118      * 
119      * @param logo
120      */
121     public void addPoweredBy( Logo logo )
122     {
123         getPoweredBy().add( logo );
124     } //-- void addPoweredBy( Logo )
125 
126     /**
127      * Method clone.
128      * 
129      * @return DecorationModel
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     } //-- DecorationModel clone()
189 
190     /**
191      * Method equals.
192      * 
193      * @param other
194      * @return boolean
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     } //-- boolean equals( Object )
226 
227     /**
228      * Get banner logo on the masthead of the site to the left.
229      * 
230      * @return Banner
231      */
232     public Banner getBannerLeft()
233     {
234         return this.bannerLeft;
235     } //-- Banner getBannerLeft()
236 
237     /**
238      * Get banner logo on the masthead of the site to the right.
239      * 
240      * @return Banner
241      */
242     public Banner getBannerRight()
243     {
244         return this.bannerRight;
245     } //-- Banner getBannerRight()
246 
247     /**
248      * Get the main site content decoration.
249      * 
250      * @return Body
251      */
252     public Body getBody()
253     {
254         return this.body;
255     } //-- Body getBody()
256 
257     /**
258      * Get whether to inherit configuration from a parent project
259      * site descriptor (<code>merge</code>)
260      *            or not (<code>override</code>).
261      * 
262      * @return String
263      */
264     public String getCombineSelf()
265     {
266         return this.combineSelf;
267     } //-- String getCombineSelf()
268 
269     /**
270      * Get custom configuration for use with customized Velocity
271      * templates. Data from this field are
272      *             accessible in Velocity template from
273      * <code>$decoration.custom</code> variable as DOM content.
274      *             Example: <code>$decoration.custom.getChild(
275      * 'customElement' ).getValue()</code>
276      * 
277      * @return Object
278      */
279     public Object getCustom()
280     {
281         return this.custom;
282     } //-- Object getCustom()
283 
284     /**
285      * Get your Google AdSense client id.
286      * 
287      * @return String
288      */
289     public String getGoogleAdSenseClient()
290     {
291         return this.googleAdSenseClient;
292     } //-- String getGoogleAdSenseClient()
293 
294     /**
295      * Get your Google AdSense slot id.
296      * 
297      * @return String
298      */
299     public String getGoogleAdSenseSlot()
300     {
301         return this.googleAdSenseSlot;
302     } //-- String getGoogleAdSenseSlot()
303 
304     /**
305      * Get the id for your Google Analytics account.
306      * 
307      * @return String
308      */
309     public String getGoogleAnalyticsAccountId()
310     {
311         return this.googleAnalyticsAccountId;
312     } //-- String getGoogleAnalyticsAccountId()
313 
314     /**
315      * Get timestamp of the last modification of this decoration
316      * model.
317      * 
318      * @return long
319      */
320     public long getLastModified()
321     {
322         return this.lastModified;
323     } //-- long getLastModified()
324 
325     /**
326      * Get the modelEncoding field.
327      * 
328      * @return String
329      */
330     public String getModelEncoding()
331     {
332         return this.modelEncoding;
333     } //-- String getModelEncoding()
334 
335     /**
336      * Get the full name of the project.
337      * 
338      * @return String
339      */
340     public String getName()
341     {
342         return this.name;
343     } //-- String getName()
344 
345     /**
346      * Method getPoweredBy.
347      * 
348      * @return List
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     } //-- java.util.List<Logo> getPoweredBy()
359 
360     /**
361      * Get the artifact containing the skin for the site.
362      * 
363      * @return Skin
364      */
365     public Skin getSkin()
366     {
367         return this.skin;
368     } //-- Skin getSkin()
369 
370     /**
371      * Method hashCode.
372      * 
373      * @return int
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     } //-- int hashCode()
394 
395     /**
396      * Method removePoweredBy.
397      * 
398      * @param logo
399      */
400     public void removePoweredBy( Logo logo )
401     {
402         getPoweredBy().remove( logo );
403     } //-- void removePoweredBy( Logo )
404 
405     /**
406      * Set banner logo on the masthead of the site to the left.
407      * 
408      * @param bannerLeft
409      */
410     public void setBannerLeft( Banner bannerLeft )
411     {
412         this.bannerLeft = bannerLeft;
413     } //-- void setBannerLeft( Banner )
414 
415     /**
416      * Set banner logo on the masthead of the site to the right.
417      * 
418      * @param bannerRight
419      */
420     public void setBannerRight( Banner bannerRight )
421     {
422         this.bannerRight = bannerRight;
423     } //-- void setBannerRight( Banner )
424 
425     /**
426      * Set the main site content decoration.
427      * 
428      * @param body
429      */
430     public void setBody( Body body )
431     {
432         this.body = body;
433     } //-- void setBody( Body )
434 
435     /**
436      * Set whether to inherit configuration from a parent project
437      * site descriptor (<code>merge</code>)
438      *            or not (<code>override</code>).
439      * 
440      * @param combineSelf
441      */
442     public void setCombineSelf( String combineSelf )
443     {
444         this.combineSelf = combineSelf;
445     } //-- void setCombineSelf( String )
446 
447     /**
448      * Set custom configuration for use with customized Velocity
449      * templates. Data from this field are
450      *             accessible in Velocity template from
451      * <code>$decoration.custom</code> variable as DOM content.
452      *             Example: <code>$decoration.custom.getChild(
453      * 'customElement' ).getValue()</code>
454      * 
455      * @param custom
456      */
457     public void setCustom( Object custom )
458     {
459         this.custom = custom;
460     } //-- void setCustom( Object )
461 
462     /**
463      * Set your Google AdSense client id.
464      * 
465      * @param googleAdSenseClient
466      */
467     public void setGoogleAdSenseClient( String googleAdSenseClient )
468     {
469         this.googleAdSenseClient = googleAdSenseClient;
470     } //-- void setGoogleAdSenseClient( String )
471 
472     /**
473      * Set your Google AdSense slot id.
474      * 
475      * @param googleAdSenseSlot
476      */
477     public void setGoogleAdSenseSlot( String googleAdSenseSlot )
478     {
479         this.googleAdSenseSlot = googleAdSenseSlot;
480     } //-- void setGoogleAdSenseSlot( String )
481 
482     /**
483      * Set the id for your Google Analytics account.
484      * 
485      * @param googleAnalyticsAccountId
486      */
487     public void setGoogleAnalyticsAccountId( String googleAnalyticsAccountId )
488     {
489         this.googleAnalyticsAccountId = googleAnalyticsAccountId;
490     } //-- void setGoogleAnalyticsAccountId( String )
491 
492     /**
493      * Set timestamp of the last modification of this decoration
494      * model.
495      * 
496      * @param lastModified
497      */
498     public void setLastModified( long lastModified )
499     {
500         this.lastModified = lastModified;
501     } //-- void setLastModified( long )
502 
503     /**
504      * Set the modelEncoding field.
505      * 
506      * @param modelEncoding
507      */
508     public void setModelEncoding( String modelEncoding )
509     {
510         this.modelEncoding = modelEncoding;
511     } //-- void setModelEncoding( String )
512 
513     /**
514      * Set the full name of the project.
515      * 
516      * @param name
517      */
518     public void setName( String name )
519     {
520         this.name = name;
521     } //-- void setName( String )
522 
523     /**
524      * Set powered by logos list.
525      * 
526      * @param poweredBy
527      */
528     public void setPoweredBy( java.util.List<Logo> poweredBy )
529     {
530         this.poweredBy = poweredBy;
531     } //-- void setPoweredBy( java.util.List )
532 
533     /**
534      * Set modify the date published display properties.
535      * 
536      * @param publishDate
537      */
538     public void setPublishDate( PublishDate publishDate )
539     {
540         this.publishDate = publishDate;
541     } //-- void setPublishDate( PublishDate )
542 
543     /**
544      * Set the artifact containing the skin for the site.
545      * 
546      * @param skin
547      */
548     public void setSkin( Skin skin )
549     {
550         this.skin = skin;
551     } //-- void setSkin( Skin )
552 
553     /**
554      * Set modify the version published display properties.
555      * 
556      * @param version
557      */
558     public void setVersion( Version version )
559     {
560         this.version = version;
561     } //-- void setVersion( Version )
562 
563     /**
564      * Method toString.
565      * 
566      * @return String
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     } //-- java.lang.String toString()
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      * @param key not null
664      * @return the menu ref defined by the given key.
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      * @param key not null
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      * @return the menus list or EMPTY_LIST.
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      * @since 1.7
725      * @see DecorationUtils#isLink
726      */
727     public boolean isLink( String href )
728     {
729         return DecorationUtils.isLink( href );
730     }
731           
732 }