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   * Section for management of reports and their configuration.
28   * 
29   * @version $Revision$ $Date$
30   */
31  @SuppressWarnings( "all" )
32  public class Reporting
33      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
34  {
35  
36        //--------------------------/
37       //- Class/Member Variables -/
38      //--------------------------/
39  
40      /**
41       * 
42       *             
43       *             If true, then the default reports are not
44       * included in the site generation.
45       *             This includes the reports in the "Project Info"
46       * menu. Note: While the type
47       *             of this field is <code>String</code> for
48       * technical reasons, the semantic type is actually
49       *             <code>Boolean</code>. Default value is
50       * <code>false</code>.
51       *             
52       *           
53       */
54      private String excludeDefaults;
55  
56      /**
57       * 
58       *             
59       *             Where to store all of the generated reports. The
60       * default is
61       *             <code>${project.build.directory}/site</code>.
62       *             
63       *           
64       */
65      private String outputDirectory;
66  
67      /**
68       * Field plugins.
69       */
70      private java.util.List<ReportPlugin> plugins;
71  
72      /**
73       * Field locations.
74       */
75      private java.util.Map<Object, InputLocation> locations;
76  
77      /**
78       * Field location.
79       */
80      private InputLocation location;
81  
82      /**
83       * Field excludeDefaultsLocation.
84       */
85      private InputLocation excludeDefaultsLocation;
86  
87      /**
88       * Field outputDirectoryLocation.
89       */
90      private InputLocation outputDirectoryLocation;
91  
92      /**
93       * Field pluginsLocation.
94       */
95      private InputLocation pluginsLocation;
96  
97  
98        //-----------/
99       //- Methods -/
100     //-----------/
101 
102     /**
103      * Method addPlugin.
104      * 
105      * @param reportPlugin a reportPlugin object.
106      */
107     public void addPlugin( ReportPlugin reportPlugin )
108     {
109         getPlugins().add( reportPlugin );
110     } //-- void addPlugin( ReportPlugin )
111 
112     /**
113      * Method clone.
114      * 
115      * @return Reporting
116      */
117     public Reporting clone()
118     {
119         try
120         {
121             Reporting copy = (Reporting) super.clone();
122 
123             if ( this.plugins != null )
124             {
125                 copy.plugins = new java.util.ArrayList<ReportPlugin>();
126                 for ( ReportPlugin item : this.plugins )
127                 {
128                     copy.plugins.add( ( (ReportPlugin) item).clone() );
129                 }
130             }
131 
132             if ( copy.locations != null )
133             {
134                 copy.locations = new java.util.LinkedHashMap( copy.locations );
135             }
136 
137             return copy;
138         }
139         catch ( java.lang.Exception ex )
140         {
141             throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
142                 + " does not support clone()" ).initCause( ex );
143         }
144     } //-- Reporting clone()
145 
146     /**
147      * Get if true, then the default reports are not included in
148      * the site generation.
149      *             This includes the reports in the "Project Info"
150      * menu. Note: While the type
151      *             of this field is <code>String</code> for
152      * technical reasons, the semantic type is actually
153      *             <code>Boolean</code>. Default value is
154      * <code>false</code>.
155      * 
156      * @return String
157      */
158     public String getExcludeDefaults()
159     {
160         return this.excludeDefaults;
161     } //-- String getExcludeDefaults()
162 
163     /**
164      * 
165      * 
166      * @param key a key object.
167      * @return InputLocation
168      */
169     public InputLocation getLocation( Object key )
170     {
171         if ( key instanceof String )
172         {
173             switch ( ( String ) key )
174             {
175                 case "" :
176                 {
177                     return this.location;
178                 }
179                 case "excludeDefaults" :
180                 {
181                     return excludeDefaultsLocation;
182                 }
183                 case "outputDirectory" :
184                 {
185                     return outputDirectoryLocation;
186                 }
187                 case "plugins" :
188                 {
189                     return pluginsLocation;
190                 }
191                 default :
192                 {
193                     return getOtherLocation( key );
194                 }
195                 }
196             }
197             else
198             {
199                 return getOtherLocation( key );
200             }
201     } //-- InputLocation getLocation( Object )
202 
203     /**
204      * 
205      * 
206      * @param key a key object.
207      * @param location a location object.
208      */
209     public void setLocation( Object key, InputLocation location )
210     {
211         if ( key instanceof String )
212         {
213             switch ( ( String ) key )
214             {
215                 case "" :
216                 {
217                     this.location = location;
218                     return;
219                 }
220                 case "excludeDefaults" :
221                 {
222                     excludeDefaultsLocation = location;
223                     return;
224                 }
225                 case "outputDirectory" :
226                 {
227                     outputDirectoryLocation = location;
228                     return;
229                 }
230                 case "plugins" :
231                 {
232                     pluginsLocation = location;
233                     return;
234                 }
235                 default :
236                 {
237                     setOtherLocation( key, location );
238                     return;
239                 }
240             }
241         }
242         else
243         {
244             setOtherLocation( key, location );
245         }
246     } //-- void setLocation( Object, InputLocation )
247 
248     /**
249      * 
250      * 
251      * @param key a key object.
252      * @param location a location object.
253      */
254     public void setOtherLocation( Object key, InputLocation location )
255     {
256         if ( location != null )
257         {
258             if ( this.locations == null )
259             {
260                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
261             }
262             this.locations.put( key, location );
263         }
264     } //-- void setOtherLocation( Object, InputLocation )
265 
266     /**
267      * 
268      * 
269      * @param key a key object.
270      * @return InputLocation
271      */
272     private InputLocation getOtherLocation( Object key )
273     {
274         return ( locations != null ) ? locations.get( key ) : null;
275     } //-- InputLocation getOtherLocation( Object )
276 
277     /**
278      * Get where to store all of the generated reports. The default
279      * is
280      *             <code>${project.build.directory}/site</code>.
281      * 
282      * @return String
283      */
284     public String getOutputDirectory()
285     {
286         return this.outputDirectory;
287     } //-- String getOutputDirectory()
288 
289     /**
290      * Method getPlugins.
291      * 
292      * @return List
293      */
294     public java.util.List<ReportPlugin> getPlugins()
295     {
296         if ( this.plugins == null )
297         {
298             this.plugins = new java.util.ArrayList<ReportPlugin>();
299         }
300 
301         return this.plugins;
302     } //-- java.util.List<ReportPlugin> getPlugins()
303 
304     /**
305      * Method removePlugin.
306      * 
307      * @param reportPlugin a reportPlugin object.
308      */
309     public void removePlugin( ReportPlugin reportPlugin )
310     {
311         getPlugins().remove( reportPlugin );
312     } //-- void removePlugin( ReportPlugin )
313 
314     /**
315      * Set if true, then the default reports are not included in
316      * the site generation.
317      *             This includes the reports in the "Project Info"
318      * menu. Note: While the type
319      *             of this field is <code>String</code> for
320      * technical reasons, the semantic type is actually
321      *             <code>Boolean</code>. Default value is
322      * <code>false</code>.
323      * 
324      * @param excludeDefaults a excludeDefaults object.
325      */
326     public void setExcludeDefaults( String excludeDefaults )
327     {
328         this.excludeDefaults = excludeDefaults;
329     } //-- void setExcludeDefaults( String )
330 
331     /**
332      * Set where to store all of the generated reports. The default
333      * is
334      *             <code>${project.build.directory}/site</code>.
335      * 
336      * @param outputDirectory a outputDirectory object.
337      */
338     public void setOutputDirectory( String outputDirectory )
339     {
340         this.outputDirectory = outputDirectory;
341     } //-- void setOutputDirectory( String )
342 
343     /**
344      * Set the reporting plugins to use and their configuration.
345      * 
346      * @param plugins a plugins object.
347      */
348     public void setPlugins( java.util.List<ReportPlugin> plugins )
349     {
350         this.plugins = plugins;
351     } //-- void setPlugins( java.util.List )
352 
353     
354             
355     public boolean isExcludeDefaults()
356     {
357         return ( excludeDefaults != null ) ? Boolean.parseBoolean( excludeDefaults ) : false;
358     }
359 
360     public void setExcludeDefaults( boolean excludeDefaults )
361     {
362         this.excludeDefaults = String.valueOf( excludeDefaults );
363     }
364 
365     java.util.Map<String, ReportPlugin> reportPluginMap;
366 
367     /**
368      * Reset the <code>reportPluginMap</code> field to <code>null</code>
369      */
370     public synchronized void flushReportPluginMap()
371     {
372         this.reportPluginMap = null;
373     }
374 
375     /**
376      * @return a Map of plugins field with <code>ReportPlugin#getKey()</code> as key
377      * @see org.apache.maven.model.ReportPlugin#getKey()
378      */
379     public synchronized java.util.Map<String, ReportPlugin> getReportPluginsAsMap()
380     {
381         if ( reportPluginMap == null )
382         {
383             reportPluginMap = new java.util.LinkedHashMap<String, ReportPlugin>();
384             if ( getPlugins() != null )
385             {
386                 for ( java.util.Iterator<ReportPlugin> it = getPlugins().iterator(); it.hasNext(); )
387                 {
388                     ReportPlugin reportPlugin = (ReportPlugin) it.next();
389                     reportPluginMap.put( reportPlugin.getKey(), reportPlugin );
390                 }
391             }
392         }
393 
394         return reportPluginMap;
395     }
396             
397           
398 }