Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ReportPlugin |
|
| 0.0;0 |
1 | /* | |
2 | =================== DO NOT EDIT THIS FILE ==================== | |
3 | Generated by Modello 1.0.1 on 2009-09-09 03:04:48, | |
4 | any modifications will be overwritten. | |
5 | ============================================================== | |
6 | */ | |
7 | ||
8 | package org.apache.maven.model; | |
9 | ||
10 | /** | |
11 | * | |
12 | * | |
13 | * The <code><plugin></code> element contains | |
14 | * informations required for a report plugin. | |
15 | * | |
16 | * | |
17 | * | |
18 | * @version $Revision$ $Date$ | |
19 | */ | |
20 | 12 | 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 | 12 | 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 | 0 | if ( !(reportSet instanceof ReportSet) ) |
73 | { | |
74 | 0 | throw new ClassCastException( "ReportPlugin.addReportSets(reportSet) parameter must be instanceof " + ReportSet.class.getName() ); |
75 | } | |
76 | 0 | getReportSets().add( reportSet ); |
77 | 0 | } //-- 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 | 0 | 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 | 0 | 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 | 0 | 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 | 0 | 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 | 0 | if ( this.reportSets == null ) |
130 | { | |
131 | 0 | this.reportSets = new java.util.ArrayList<ReportSet>(); |
132 | } | |
133 | ||
134 | 0 | 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 | 0 | return this.version; |
145 | } //-- String getVersion() | |
146 | ||
147 | /** | |
148 | * Method removeReportSet. | |
149 | * | |
150 | * @param reportSet | |
151 | */ | |
152 | public void removeReportSet( ReportSet reportSet ) | |
153 | { | |
154 | 0 | if ( !(reportSet instanceof ReportSet) ) |
155 | { | |
156 | 0 | throw new ClassCastException( "ReportPlugin.removeReportSets(reportSet) parameter must be instanceof " + ReportSet.class.getName() ); |
157 | } | |
158 | 0 | getReportSets().remove( reportSet ); |
159 | 0 | } //-- 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 | 6 | this.artifactId = artifactId; |
170 | 6 | } //-- 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 | 0 | this.configuration = configuration; |
180 | 0 | } //-- 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 | 6 | this.groupId = groupId; |
190 | 6 | } //-- 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 | 0 | this.inherited = inherited; |
202 | 0 | } //-- 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 | 0 | this.reportSets = reportSets; |
215 | 0 | } //-- 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 | 4 | this.version = version; |
225 | 4 | } //-- void setVersion( String ) |
226 | ||
227 | ||
228 | ||
229 | 12 | 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 | 0 | this.reportSetMap = null; |
237 | 0 | } |
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 | 0 | if ( reportSetMap == null ) |
246 | { | |
247 | 0 | reportSetMap = new java.util.LinkedHashMap(); |
248 | 0 | if ( getReportSets() != null ) |
249 | { | |
250 | 0 | for ( java.util.Iterator i = getReportSets().iterator(); i.hasNext(); ) |
251 | { | |
252 | 0 | ReportSet reportSet = (ReportSet) i.next(); |
253 | 0 | reportSetMap.put( reportSet.getId(), reportSet ); |
254 | 0 | } |
255 | } | |
256 | } | |
257 | ||
258 | 0 | 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 | 14 | 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 | 14 | return groupId + ":" + artifactId; |
277 | } | |
278 | ||
279 | 12 | private boolean inheritanceApplied = true; |
280 | ||
281 | public void unsetInheritanceApplied() | |
282 | { | |
283 | 0 | this.inheritanceApplied = false; |
284 | 0 | } |
285 | ||
286 | public boolean isInheritanceApplied() | |
287 | { | |
288 | 0 | return inheritanceApplied; |
289 | } | |
290 | ||
291 | /** | |
292 | * @see java.lang.Object#equals(java.lang.Object) | |
293 | */ | |
294 | public boolean equals( Object other ) | |
295 | { | |
296 | 5 | if ( other instanceof ReportPlugin ) |
297 | { | |
298 | 4 | ReportPlugin otherPlugin = (ReportPlugin) other; |
299 | ||
300 | 4 | return getKey().equals( otherPlugin.getKey() ); |
301 | } | |
302 | ||
303 | 1 | return false; |
304 | } | |
305 | ||
306 | /** | |
307 | * @see java.lang.Object#hashCode() | |
308 | */ | |
309 | public int hashCode() | |
310 | { | |
311 | 5 | return getKey().hashCode(); |
312 | } | |
313 | ||
314 | /** | |
315 | * @see java.lang.Object#toString() | |
316 | */ | |
317 | public String toString() | |
318 | { | |
319 | 1 | return "ReportPlugin [" + getKey() + "]"; |
320 | } | |
321 | ||
322 | ||
323 | } |