View Javadoc
1   /*
2    Licensed to the Apache Software Foundation (ASF) under one
3    or more contributor license agreements.  See the NOTICE file
4    distributed with this work for additional information
5    regarding copyright ownership.  The ASF licenses this file
6    to you under the Apache License, Version 2.0 (the
7    "License"); you may not use this file except in compliance
8    with the License.  You may obtain a copy of the License at
9    
10       http://www.apache.org/licenses/LICENSE-2.0
11   
12   Unless required by applicable law or agreed to in writing,
13   software distributed under the License is distributed on an
14   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   KIND, either express or implied.  See the License for the
16   specific language governing permissions and limitations
17   under the License.
18   =================== DO NOT EDIT THIS FILE ====================
19   Generated by Modello 2.4.0,
20   any modifications will be overwritten.
21   ==============================================================
22   */
23  
24  package org.apache.maven.model;
25  
26  /**
27   * 
28   *         
29   *         The <code>&lt;plugin&gt;</code> element in
30   * <code>&lt;reporting&gt;&lt;plugins&gt;</code> contains
31   * informations required for a report plugin.
32   *         
33   *       
34   * 
35   * @version $Revision$ $Date$
36   */
37  @SuppressWarnings( "all" )
38  public class ReportPlugin
39      extends ConfigurationContainer
40      implements java.io.Serializable, java.lang.Cloneable
41  {
42  
43        //--------------------------/
44       //- Class/Member Variables -/
45      //--------------------------/
46  
47      /**
48       * The group ID of the reporting plugin in the repository.
49       */
50      private String groupId = "org.apache.maven.plugins";
51  
52      /**
53       * The artifact ID of the reporting plugin in the repository.
54       */
55      private String artifactId;
56  
57      /**
58       * 
59       *             
60       *             The version of the reporting plugin to be used.
61       * Starting with Maven 3, if no version is defined explicitely,
62       *             version is searched in
63       * <code>build/plugins</code> then in
64       * <code>build/pluginManagement</code>.
65       *             
66       *           
67       */
68      private String version;
69  
70      /**
71       * Field reportSets.
72       */
73      private java.util.List<ReportSet> reportSets;
74  
75  
76        //-----------/
77       //- Methods -/
78      //-----------/
79  
80      /**
81       * Method addReportSet.
82       * 
83       * @param reportSet a reportSet object.
84       */
85      public void addReportSet( ReportSet reportSet )
86      {
87          getReportSets().add( reportSet );
88      } //-- void addReportSet( ReportSet )
89  
90      /**
91       * Method clone.
92       * 
93       * @return ReportPlugin
94       */
95      public ReportPlugin clone()
96      {
97          try
98          {
99              ReportPlugin copy = (ReportPlugin) super.clone();
100 
101             if ( this.reportSets != null )
102             {
103                 copy.reportSets = new java.util.ArrayList<ReportSet>();
104                 for ( ReportSet item : this.reportSets )
105                 {
106                     copy.reportSets.add( ( (ReportSet) item).clone() );
107                 }
108             }
109 
110             return copy;
111         }
112         catch ( java.lang.Exception ex )
113         {
114             throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
115                 + " does not support clone()" ).initCause( ex );
116         }
117     } //-- ReportPlugin clone()
118 
119     /**
120      * Get the artifact ID of the reporting plugin in the
121      * repository.
122      * 
123      * @return String
124      */
125     public String getArtifactId()
126     {
127         return this.artifactId;
128     } //-- String getArtifactId()
129 
130     /**
131      * Get the group ID of the reporting plugin in the repository.
132      * 
133      * @return String
134      */
135     public String getGroupId()
136     {
137         return this.groupId;
138     } //-- String getGroupId()
139 
140     /**
141      * Method getReportSets.
142      * 
143      * @return List
144      */
145     public java.util.List<ReportSet> getReportSets()
146     {
147         if ( this.reportSets == null )
148         {
149             this.reportSets = new java.util.ArrayList<ReportSet>();
150         }
151 
152         return this.reportSets;
153     } //-- java.util.List<ReportSet> getReportSets()
154 
155     /**
156      * Get the version of the reporting plugin to be used. Starting
157      * with Maven 3, if no version is defined explicitely,
158      *             version is searched in
159      * <code>build/plugins</code> then in
160      * <code>build/pluginManagement</code>.
161      * 
162      * @return String
163      */
164     public String getVersion()
165     {
166         return this.version;
167     } //-- String getVersion()
168 
169     /**
170      * Method removeReportSet.
171      * 
172      * @param reportSet a reportSet object.
173      */
174     public void removeReportSet( ReportSet reportSet )
175     {
176         getReportSets().remove( reportSet );
177     } //-- void removeReportSet( ReportSet )
178 
179     /**
180      * Set the artifact ID of the reporting plugin in the
181      * repository.
182      * 
183      * @param artifactId a artifactId object.
184      */
185     public void setArtifactId( String artifactId )
186     {
187         this.artifactId = artifactId;
188     } //-- void setArtifactId( String )
189 
190     /**
191      * Set the group ID of the reporting plugin in the repository.
192      * 
193      * @param groupId a groupId object.
194      */
195     public void setGroupId( String groupId )
196     {
197         this.groupId = groupId;
198     } //-- void setGroupId( String )
199 
200     /**
201      * Set multiple specifications of a set of reports, each having
202      * (possibly) different
203      *             configuration. This is the reporting parallel to
204      * an <code>execution</code> in the build.
205      * 
206      * @param reportSets a reportSets object.
207      */
208     public void setReportSets( java.util.List<ReportSet> reportSets )
209     {
210         this.reportSets = reportSets;
211     } //-- void setReportSets( java.util.List )
212 
213     /**
214      * Set the version of the reporting plugin to be used. Starting
215      * with Maven 3, if no version is defined explicitely,
216      *             version is searched in
217      * <code>build/plugins</code> then in
218      * <code>build/pluginManagement</code>.
219      * 
220      * @param version a version object.
221      */
222     public void setVersion( String version )
223     {
224         this.version = version;
225     } //-- void setVersion( String )
226 
227     
228             
229     private java.util.Map<String, ReportSet> 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<String, ReportSet> getReportSetsAsMap()
244     {
245         if ( reportSetMap == null )
246         {
247             reportSetMap = new java.util.LinkedHashMap<String, ReportSet>();
248             if ( getReportSets() != null )
249             {
250                 for ( java.util.Iterator<ReportSet> 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 The group ID of the plugin in the repository
271      * @param artifactId The artifact ID of the reporting plugin in the repository
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           
280 }