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