001// =================== DO NOT EDIT THIS FILE ====================
002// Generated by Modello 1.8.1,
003// any modifications will be overwritten.
004// ==============================================================
005
006package org.apache.maven.model;
007
008/**
009 * 
010 *         
011 *         The <code>&lt;plugin&gt;</code> element contains
012 * informations required for a report plugin.
013 *         
014 *       
015 * 
016 * @version $Revision$ $Date$
017 */
018@SuppressWarnings( "all" )
019public class ReportPlugin
020    extends ConfigurationContainer
021    implements java.io.Serializable, java.lang.Cloneable
022{
023
024      //--------------------------/
025     //- Class/Member Variables -/
026    //--------------------------/
027
028    /**
029     * The group ID of the reporting plugin in the repository.
030     */
031    private String groupId = "org.apache.maven.plugins";
032
033    /**
034     * The artifact ID of the reporting plugin in the repository.
035     */
036    private String artifactId;
037
038    /**
039     * The version of the reporting plugin to be used.
040     */
041    private String version;
042
043    /**
044     * Field reportSets.
045     */
046    private java.util.List<ReportSet> reportSets;
047
048
049      //-----------/
050     //- Methods -/
051    //-----------/
052
053    /**
054     * Method addReportSet.
055     * 
056     * @param reportSet
057     */
058    public void addReportSet( ReportSet reportSet )
059    {
060        getReportSets().add( reportSet );
061    } //-- void addReportSet( ReportSet )
062
063    /**
064     * Method clone.
065     * 
066     * @return ReportPlugin
067     */
068    public ReportPlugin clone()
069    {
070        try
071        {
072            ReportPlugin copy = (ReportPlugin) super.clone();
073
074            if ( this.reportSets != null )
075            {
076                copy.reportSets = new java.util.ArrayList<ReportSet>();
077                for ( ReportSet item : this.reportSets )
078                {
079                    copy.reportSets.add( ( (ReportSet) item).clone() );
080                }
081            }
082
083            return copy;
084        }
085        catch ( java.lang.Exception ex )
086        {
087            throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
088                + " does not support clone()" ).initCause( ex );
089        }
090    } //-- ReportPlugin clone()
091
092    /**
093     * Get the artifact ID of the reporting plugin in the
094     * repository.
095     * 
096     * @return String
097     */
098    public String getArtifactId()
099    {
100        return this.artifactId;
101    } //-- String getArtifactId()
102
103    /**
104     * Get the group ID of the reporting plugin in the repository.
105     * 
106     * @return String
107     */
108    public String getGroupId()
109    {
110        return this.groupId;
111    } //-- String getGroupId()
112
113    /**
114     * Method getReportSets.
115     * 
116     * @return List
117     */
118    public java.util.List<ReportSet> getReportSets()
119    {
120        if ( this.reportSets == null )
121        {
122            this.reportSets = new java.util.ArrayList<ReportSet>();
123        }
124
125        return this.reportSets;
126    } //-- java.util.List<ReportSet> getReportSets()
127
128    /**
129     * Get the version of the reporting plugin to be used.
130     * 
131     * @return String
132     */
133    public String getVersion()
134    {
135        return this.version;
136    } //-- String getVersion()
137
138    /**
139     * Method removeReportSet.
140     * 
141     * @param reportSet
142     */
143    public void removeReportSet( ReportSet reportSet )
144    {
145        getReportSets().remove( reportSet );
146    } //-- void removeReportSet( ReportSet )
147
148    /**
149     * Set the artifact ID of the reporting plugin in the
150     * repository.
151     * 
152     * @param artifactId
153     */
154    public void setArtifactId( String artifactId )
155    {
156        this.artifactId = artifactId;
157    } //-- void setArtifactId( String )
158
159    /**
160     * Set the group ID of the reporting plugin in the repository.
161     * 
162     * @param groupId
163     */
164    public void setGroupId( String groupId )
165    {
166        this.groupId = groupId;
167    } //-- void setGroupId( String )
168
169    /**
170     * Set multiple specifications of a set of reports, each having
171     * (possibly) different
172     *             configuration. This is the reporting parallel to
173     * an <code>execution</code> in the build.
174     * 
175     * @param reportSets
176     */
177    public void setReportSets( java.util.List<ReportSet> reportSets )
178    {
179        this.reportSets = reportSets;
180    } //-- void setReportSets( java.util.List )
181
182    /**
183     * Set the version of the reporting plugin to be used.
184     * 
185     * @param version
186     */
187    public void setVersion( String version )
188    {
189        this.version = version;
190    } //-- void setVersion( String )
191
192    
193            
194    private java.util.Map<String, ReportSet> reportSetMap = null;
195
196    /**
197     * Reset the <code>reportSetMap</code> field to <code>null</code>
198     */
199    public void flushReportSetMap()
200    {
201        this.reportSetMap = null;
202    }
203
204    /**
205     * @return a Map of reportSets field with <code>ReportSet#getId()</code> as key
206     * @see org.apache.maven.model.ReportSet#getId()
207     */
208    public java.util.Map<String, ReportSet> getReportSetsAsMap()
209    {
210        if ( reportSetMap == null )
211        {
212            reportSetMap = new java.util.LinkedHashMap<String, ReportSet>();
213            if ( getReportSets() != null )
214            {
215                for ( java.util.Iterator<ReportSet> i = getReportSets().iterator(); i.hasNext(); )
216                {
217                    ReportSet reportSet = (ReportSet) i.next();
218                    reportSetMap.put( reportSet.getId(), reportSet );
219                }
220            }
221        }
222
223        return reportSetMap;
224    }
225
226    /**
227     * @return the key of the report plugin, ie <code>groupId:artifactId</code>
228     */
229    public String getKey()
230    {
231        return constructKey( groupId, artifactId );
232    }
233
234    /**
235     * @param groupId
236     * @param artifactId
237     * @return the key of the report plugin, ie <code>groupId:artifactId</code>
238     */
239    public static String constructKey( String groupId, String artifactId )
240    {
241        return groupId + ":" + artifactId;
242    }
243            
244          
245}