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