View Javadoc

1   /*
2    * Copyright 2008-2010 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package de.smartics.maven.issues.bugzilla;
18  
19  import java.util.Locale;
20  
21  /**
22   * The report to generate a tabular representation of issues.
23   *
24   * @goal bugzilla-issues-report
25   * @phase site
26   * @requiresProject
27   * @description Generates a release plan report using issues from the issues
28   *              management system rendering them in a simple table.
29   * @author <a href="mailto:robert.reiner@smartics.de">Robert Reiner</a>
30   * @version $Revision:591 $
31   */
32  public class TabularReportMojo extends AbstractBugzillaReportMojo
33  {
34    // ********************************* Fields *********************************
35  
36    // --- constants ------------------------------------------------------------
37  
38    // --- members --------------------------------------------------------------
39  
40    /**
41     * Specifies the name of the file to write the issues report (without
42     * extension).
43     *
44     * @required
45     * @parameter expression="${issues.release.report.fileName}"
46     *            default-value="issues-tabular-report"
47     * @since 1.0
48     */
49    private String outputName;
50  
51    /**
52     * The name of the class that runs the rendering of the report page.
53     *
54     * @required
55     * @parameter default-value=
56     *            "de.smartics.maven.issues.bugzilla.TabularReportRenderer"
57     * @since 1.0
58     */
59    private String reportRenderer;
60  
61    /**
62     * Sets the status(es) that you want to limit your report to include. Valid
63     * statuses are: UNCONFIRMED, NEW, ASSIGNED, REOPENED, RESOLVED, VERIFIED, and
64     * CLOSED. Multiple values can be separated by commas.
65     *
66     * @parameter default-value="CLOSED"
67     * @since 1.0
68     */
69    private String status;
70  
71    /**
72     * Lists the columns to be rendered. Each element of this list is a property
73     * of an issue. The identifiers given here must match the ones defined in the
74     * referenced issue management system. E.g. for Bugzilla these are defined in
75     * <code>org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute</code>.
76     * <p>
77     * The values are separated by comma.
78     * </p>
79     *
80     * @parameter default-value=
81     *            "bug_id,short_desc,bug_status,resolution,bug_severity"
82     * @required
83     * @since 1.0
84     */
85    private String columns;
86  
87    /**
88     * Lists the column width to be used to set to the columns. If the value is
89     * <code>0</code> (zero) no width will be set explicitly for that column.
90     *
91     * @parameter default-value="65,0,100,100,100"
92     * @required
93     * @since 1.0
94     */
95    private String columnWidths;
96  
97    /**
98     * The flag to determine if only the current release version is to be rendered
99     * (<code>true</code>) or all versions are to be considered (
100    * <code>false</code>).
101    *
102    * @parameter default-value="false"
103    * @required
104    * @since 1.0
105    */
106   private boolean currentReleaseVersionOnly;
107 
108   // ****************************** Initializer *******************************
109 
110   // ****************************** Constructors ******************************
111 
112   // ****************************** Inner Classes *****************************
113 
114   // ********************************* Methods ********************************
115 
116   // --- init -----------------------------------------------------------------
117 
118   // --- get&set --------------------------------------------------------------
119 
120   /**
121    * {@inheritDoc}
122    *
123    * @see org.apache.maven.reporting.MavenReport#getOutputName()
124    */
125   public String getOutputName()
126   {
127     return outputName;
128   }
129 
130   /**
131    * Returns the value for status.
132    * <p>
133    * Sets the status(es) that you want to limit your report to include. Valid
134    * statuses are: UNCONFIRMED, NEW, ASSIGNED, REOPENED, RESOLVED, VERIFIED, and
135    * CLOSED. Multiple values can be separated by commas.
136    *
137    * @return the value for status.
138    */
139   public String getStatus()
140   {
141     return status;
142   }
143 
144   // ... plugin metadata ......................................................
145 
146   /**
147    * {@inheritDoc}
148    *
149    * @see org.apache.maven.reporting.AbstractMavenReport#getName(java.util.Locale)
150    */
151   public String getName(final Locale locale)
152   {
153     return getTitle() != null ? getTitle() : getBundle(locale).getString(
154         "report.name.release");
155   }
156 
157   /**
158    * {@inheritDoc}
159    *
160    * @see org.apache.maven.reporting.AbstractMavenReport#getDescription(java.util.Locale)
161    */
162   public String getDescription(final Locale locale)
163   {
164     return description != null ? description : getBundle(locale).getString(
165         "report.description.release");
166   }
167 
168   // ... report related .......................................................
169 
170   /**
171    * Returns the name of the class that runs the rendering of the report page.
172    *
173    * @return the name of the class that runs the rendering of the report page.
174    */
175   protected String getReportRenderer()
176   {
177     return reportRenderer;
178   }
179 
180   /**
181    * Returns the value for columns.
182    * <p>
183    * Lists the columns to be rendered. Each element of this list is a property
184    * of an issue. The identifiers given here must match the ones defined in the
185    * referenced issue management system. E.g. for Bugzilla these are defined in
186    * {@link org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute}.
187    * <p>
188    * The values are separated by comma.
189    * </p>
190    *
191    * @return the value for columns.
192    */
193   protected String getColumns()
194   {
195     return columns;
196   }
197 
198   /**
199    * Returns the value for columnWidths.
200    * <p>
201    * Lists the column width to be used to set to the columns. If the value is
202    * <code>0</code> (zero) no width will be set explicitly for that column.
203    * </p>
204    *
205    * @return the value for columnWidths.
206    */
207   protected String getColumnWidths()
208   {
209     return columnWidths;
210   }
211 
212   /**
213    * Returns the flag to determine if only the current release version is to be
214    * rendered (<code>true</code>) or all versions are to be considered (
215    * <code>false</code>).
216    *
217    * @return the flag to determine if only the current release version is to be
218    *         rendered (<code>true</code>) or all versions are to be considered (
219    *         <code>false</code>).
220    */
221   public boolean isCurrentReleaseVersionOnly()
222   {
223     return currentReleaseVersionOnly;
224   }
225 
226   // --- business -------------------------------------------------------------
227 
228   // --- object basics --------------------------------------------------------
229 
230 }