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