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