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