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