maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From denn...@apache.org
Subject svn commit: r1054710 - in /maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin: jira/JiraMojo.java jira/JiraReportGenerator.java trac/TracMojo.java trac/TracReportGenerator.java
Date Mon, 03 Jan 2011 18:56:09 GMT
Author: dennisl
Date: Mon Jan  3 18:56:09 2011
New Revision: 1054710

URL: http://svn.apache.org/viewvc?rev=1054710&view=rev
Log:
Refactoring: Move valid column names from the ReportGenerator to the Mojo.

Modified:
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraReportGenerator.java
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/trac/TracMojo.java
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/trac/TracReportGenerator.java

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java?rev=1054710&r1=1054709&r2=1054710&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java
(original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java
Mon Jan  3 18:56:09 2011
@@ -39,6 +39,20 @@ import org.apache.maven.settings.Setting
 public class JiraMojo
     extends AbstractChangesReport
 {
+    private static final String[] JIRA_COLUMNS = new String[] {
+        /* 0  */ "Key",
+        /* 1  */ "Summary",
+        /* 2  */ "Status",
+        /* 3  */ "Resolution",
+        /* 4  */ "Assignee",
+        /* 5  */ "Reporter",
+        /* 6  */ "Type",
+        /* 7  */ "Priority",
+        /* 8  */ "Version",
+        /* 9  */ "Fix Version",
+        /* 10 */ "Component"
+    };
+
     /**
      * Path to the JIRA XML file, which will be parsed.
      *
@@ -260,7 +274,7 @@ public class JiraMojo
                 JiraXML jira = new JiraXML( jiraXmlPath, jiraXmlEncoding );
                 List issueList = jira.getIssueList();
 
-                report = new JiraReportGenerator( columnNames );
+                report = new JiraReportGenerator( columnNames, JIRA_COLUMNS );
 
                 if ( onlyCurrentVersion )
                 {

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraReportGenerator.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraReportGenerator.java?rev=1054710&r1=1054709&r2=1054710&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraReportGenerator.java
(original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraReportGenerator.java
Mon Jan  3 18:56:09 2011
@@ -46,20 +46,10 @@ public class JiraReportGenerator
     private static final int COLUMN_FIX_VERSION = 9;
     private static final int COLUMN_COMPONENT = 10;
 
-    private static final String[] JIRA_COLUMNS = new String[] {
-        /* 0  */ "Key",
-        /* 1  */ "Summary",
-        /* 2  */ "Status",
-        /* 3  */ "Resolution",
-        /* 4  */ "Assignee",
-        /* 5  */ "Reporter",
-        /* 6  */ "Type",
-        /* 7  */ "Priority",
-        /* 8  */ "Version",
-        /* 9  */ "Fix Version",
-        /* 10 */ "Component"
-    };
-
+    /**
+     * Holds the id:s for the columns to include in the report, in the order
+     * that they should appear in the report.
+     */
     private int[] columnOrder;
 
     public JiraReportGenerator()
@@ -69,8 +59,9 @@ public class JiraReportGenerator
 
     /**
      * @param columnNames The names of the columns to include in the report
+     * @param columns All column names available to this issue management system
      */
-    public JiraReportGenerator( String columnNames )
+    public JiraReportGenerator( String columnNames, String[] columns )
         throws MavenReportException
     {
         String[] columnNamesArray = columnNames.split( "," );
@@ -80,10 +71,11 @@ public class JiraReportGenerator
         {
             // Default to -1, indicating that the column should not be included in the report
             columnOrder[i] = -1;
-            for ( int columnIndex = 0; columnIndex < JIRA_COLUMNS.length; columnIndex++
)
+            // Loop through the names of all columns
+            for ( int columnIndex = 0; columnIndex < columns.length; columnIndex++ )
             {
                 String columnName = columnNamesArray[i].trim();
-                if ( JIRA_COLUMNS[columnIndex].equalsIgnoreCase( columnName ) )
+                if ( columns[columnIndex].equalsIgnoreCase( columnName ) )
                 {
                     // Found a valid column name - add it
                     columnOrder[i] = columnIndex;

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/trac/TracMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/trac/TracMojo.java?rev=1054710&r1=1054709&r2=1054710&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/trac/TracMojo.java
(original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/trac/TracMojo.java
Mon Jan  3 18:56:09 2011
@@ -44,6 +44,24 @@ public class TracMojo
     extends AbstractChangesReport
 {
     /**
+     * Valid Trac columns.
+     */
+    private static final String[] TRAC_COLUMNS = {
+            /* 0 */ "id",
+            /* 1 */ "type",
+            /* 2 */ "summary",
+            /* 3 */ "status",
+            /* 4 */ "resolution",
+            /* 5 */ "milestone",
+            /* 6 */ "owner",
+            /* 7 */ "priority",
+            /* 8 */ "reporter",
+            /* 9 */ "component",
+            /* 10 */ "created",
+            /* 11 */ "changed"
+    };
+
+    /**
      * Defines the Trac username for authentication into a private Trac
      * installation.
      *
@@ -113,7 +131,7 @@ public class TracMojo
             List issueList = issueDownloader.getIssueList();
 
             // Generate the report
-            TracReportGenerator report = new TracReportGenerator( columnNames );
+            TracReportGenerator report = new TracReportGenerator( columnNames, TRAC_COLUMNS
);
 
             if ( issueList.isEmpty() )
             {

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/trac/TracReportGenerator.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/trac/TracReportGenerator.java?rev=1054710&r1=1054709&r2=1054710&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/trac/TracReportGenerator.java
(original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/trac/TracReportGenerator.java
Mon Jan  3 18:56:09 2011
@@ -49,27 +49,9 @@ public class TracReportGenerator
     private static final int COLUMN_CREATED = 10;
     private static final int COLUMN_CHANGED = 11;
 
-    /**
-     * Valid Trac columns.
-     */
-    private static final String[] TRAC_COLUMNS = {
-            /* 0 */ "id",
-            /* 1 */ "type",
-            /* 2 */ "summary",
-            /* 3 */ "status",
-            /* 4 */ "resolution",
-            /* 5 */ "milestone",
-            /* 6 */ "owner",
-            /* 7 */ "priority",
-            /* 8 */ "reporter",
-            /* 9 */ "component",
-            /* 10 */ "created",
-            /* 11 */ "changed"
-    };
-
     private int[] columnOrder;
 
-    public TracReportGenerator( String columnNames )
+    public TracReportGenerator( String columnNames, String[] columns )
         throws MavenReportException
     {
         String[] columnNamesArray = columnNames.split( "," );
@@ -79,10 +61,10 @@ public class TracReportGenerator
         {
             // Default to -1, indicating that the column should not be included in the report
             columnOrder[i] = -1;
-            for ( int columnIndex = 0; columnIndex < TRAC_COLUMNS.length; columnIndex++
)
+            for ( int columnIndex = 0; columnIndex < columns.length; columnIndex++ )
             {
                 String columnName = columnNamesArray[i].trim();
-                if ( TRAC_COLUMNS[columnIndex].equalsIgnoreCase( columnName ) )
+                if ( columns[columnIndex].equalsIgnoreCase( columnName ) )
                 {
                     // Found a valid column name - add it
                     columnOrder[i] = columnIndex;



Mime
View raw message