View Javadoc

1   /*
2    =================== DO NOT EDIT THIS FILE ====================
3    Generated by Modello 1.0.1 on 2009-09-09 03:30:24,
4    any modifications will be overwritten.
5    ==============================================================
6    */
7   
8   package org.apache.maven.model;
9   
10  /**
11   * 
12   *         
13   *         The <code>&lt;plugin&gt;</code> element contains
14   * informations required for a report plugin.
15   *         
16   *       
17   * 
18   * @version $Revision$ $Date$
19   */
20  public class ReportPlugin
21      implements java.io.Serializable
22  {
23  
24        //--------------------------/
25       //- Class/Member Variables -/
26      //--------------------------/
27  
28      /**
29       * The group ID of the reporting plugin in the repository.
30       */
31      private String groupId = "org.apache.maven.plugins";
32  
33      /**
34       * The artifact ID of the reporting plugin in the repository.
35       */
36      private String artifactId;
37  
38      /**
39       * The version of the reporting plugin to be used.
40       */
41      private String version;
42  
43      /**
44       * Whether the configuration in this plugin should be made
45       * available to projects
46       *             that inherit from this one.
47       */
48      private String inherited;
49  
50      /**
51       * The configuration of the reporting plugin.
52       */
53      private Object configuration;
54  
55      /**
56       * Field reportSets.
57       */
58      private java.util.List<ReportSet> reportSets;
59  
60  
61        //-----------/
62       //- Methods -/
63      //-----------/
64  
65      /**
66       * Method addReportSet.
67       * 
68       * @param reportSet
69       */
70      public void addReportSet( ReportSet reportSet )
71      {
72          if ( !(reportSet instanceof ReportSet) )
73          {
74              throw new ClassCastException( "ReportPlugin.addReportSets(reportSet) parameter must be instanceof " + ReportSet.class.getName() );
75          }
76          getReportSets().add( reportSet );
77      } //-- void addReportSet( ReportSet )
78  
79      /**
80       * Get the artifact ID of the reporting plugin in the
81       * repository.
82       * 
83       * @return String
84       */
85      public String getArtifactId()
86      {
87          return this.artifactId;
88      } //-- String getArtifactId()
89  
90      /**
91       * Get the configuration of the reporting plugin.
92       * 
93       * @return Object
94       */
95      public Object getConfiguration()
96      {
97          return this.configuration;
98      } //-- Object getConfiguration()
99  
100     /**
101      * Get the group ID of the reporting plugin in the repository.
102      * 
103      * @return String
104      */
105     public String getGroupId()
106     {
107         return this.groupId;
108     } //-- String getGroupId()
109 
110     /**
111      * Get whether the configuration in this plugin should be made
112      * available to projects
113      *             that inherit from this one.
114      * 
115      * @return String
116      */
117     public String getInherited()
118     {
119         return this.inherited;
120     } //-- String getInherited()
121 
122     /**
123      * Method getReportSets.
124      * 
125      * @return List
126      */
127     public java.util.List<ReportSet> getReportSets()
128     {
129         if ( this.reportSets == null )
130         {
131             this.reportSets = new java.util.ArrayList<ReportSet>();
132         }
133 
134         return this.reportSets;
135     } //-- java.util.List<ReportSet> getReportSets()
136 
137     /**
138      * Get the version of the reporting plugin to be used.
139      * 
140      * @return String
141      */
142     public String getVersion()
143     {
144         return this.version;
145     } //-- String getVersion()
146 
147     /**
148      * Method removeReportSet.
149      * 
150      * @param reportSet
151      */
152     public void removeReportSet( ReportSet reportSet )
153     {
154         if ( !(reportSet instanceof ReportSet) )
155         {
156             throw new ClassCastException( "ReportPlugin.removeReportSets(reportSet) parameter must be instanceof " + ReportSet.class.getName() );
157         }
158         getReportSets().remove( reportSet );
159     } //-- void removeReportSet( ReportSet )
160 
161     /**
162      * Set the artifact ID of the reporting plugin in the
163      * repository.
164      * 
165      * @param artifactId
166      */
167     public void setArtifactId( String artifactId )
168     {
169         this.artifactId = artifactId;
170     } //-- void setArtifactId( String )
171 
172     /**
173      * Set the configuration of the reporting plugin.
174      * 
175      * @param configuration
176      */
177     public void setConfiguration( Object configuration )
178     {
179         this.configuration = configuration;
180     } //-- void setConfiguration( Object )
181 
182     /**
183      * Set the group ID of the reporting plugin in the repository.
184      * 
185      * @param groupId
186      */
187     public void setGroupId( String groupId )
188     {
189         this.groupId = groupId;
190     } //-- void setGroupId( String )
191 
192     /**
193      * Set whether the configuration in this plugin should be made
194      * available to projects
195      *             that inherit from this one.
196      * 
197      * @param inherited
198      */
199     public void setInherited( String inherited )
200     {
201         this.inherited = inherited;
202     } //-- void setInherited( String )
203 
204     /**
205      * Set multiple specifications of a set of reports, each having
206      * (possibly) different
207      *             configuration. This is the reporting parallel to
208      * an <code>execution</code> in the build.
209      * 
210      * @param reportSets
211      */
212     public void setReportSets( java.util.List<ReportSet> reportSets )
213     {
214         this.reportSets = reportSets;
215     } //-- void setReportSets( java.util.List )
216 
217     /**
218      * Set the version of the reporting plugin to be used.
219      * 
220      * @param version
221      */
222     public void setVersion( String version )
223     {
224         this.version = version;
225     } //-- void setVersion( String )
226 
227 
228             
229     private java.util.Map reportSetMap = null;
230 
231     /**
232      * Reset the <code>reportSetMap</code> field to <code>null</code>
233      */
234     public void flushReportSetMap()
235     {
236         this.reportSetMap = null;
237     }
238 
239     /**
240      * @return a Map of reportSets field with <code>ReportSet#getId()</code> as key
241      * @see org.apache.maven.model.ReportSet#getId()
242      */
243     public java.util.Map getReportSetsAsMap()
244     {
245         if ( reportSetMap == null )
246         {
247             reportSetMap = new java.util.LinkedHashMap();
248             if ( getReportSets() != null )
249             {
250                 for ( java.util.Iterator i = getReportSets().iterator(); i.hasNext(); )
251                 {
252                     ReportSet reportSet = (ReportSet) i.next();
253                     reportSetMap.put( reportSet.getId(), reportSet );
254                 }
255             }
256         }
257 
258         return reportSetMap;
259     }
260 
261     /**
262      * @return the key of the report plugin, ie <code>groupId:artifactId</code>
263      */
264     public String getKey()
265     {
266         return constructKey( groupId, artifactId );
267     }
268 
269     /**
270      * @param groupId
271      * @param artifactId
272      * @return the key of the report plugin, ie <code>groupId:artifactId</code>
273      */
274     public static String constructKey( String groupId, String artifactId )
275     {
276         return groupId + ":" + artifactId;
277     }
278 
279     private boolean inheritanceApplied = true;
280 
281     public void unsetInheritanceApplied()
282     {
283         this.inheritanceApplied = false;
284     }
285 
286     public boolean isInheritanceApplied()
287     {
288         return inheritanceApplied;
289     }
290 
291     /**
292      * @see java.lang.Object#equals(java.lang.Object)
293      */
294     public boolean equals( Object other )
295     {
296         if ( other instanceof ReportPlugin )
297         {
298             ReportPlugin otherPlugin = (ReportPlugin) other;
299 
300             return getKey().equals( otherPlugin.getKey() );
301         }
302 
303         return false;
304     }
305 
306     /**
307      * @see java.lang.Object#hashCode()
308      */
309     public int hashCode()
310     {
311         return getKey().hashCode();
312     }
313 
314     /**
315      * @see java.lang.Object#toString()
316      */
317     public String toString()
318     {
319         return "ReportPlugin [" + getKey() + "]";
320     }
321             
322           
323 }