maven-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=1054787&view=rev
Log:
o Refactoring: Merge JiraReportGenerator and TracReportGenerator into one unified IssuesReportGenerator
class.

Added:
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/issues/IssuesReportGenerator.java
  (contents, props changed)
      - copied, changed from r1054782, maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraReportGenerator.java
Removed:
    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/TracReportGenerator.java
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/trac/TracMojo.java

Copied: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/issues/IssuesReportGenerator.java
(from r1054782, 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/issues/IssuesReportGenerator.java?p2=maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/issues/IssuesReportGenerator.java&p1=maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraReportGenerator.java&r1=1054782&r2=1054787&rev=1054787&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/issues/IssuesReportGenerator.java
Mon Jan  3 21:58:09 2011
@@ -1,4 +1,4 @@
-package org.apache.maven.plugin.jira;
+package org.apache.maven.plugin.issues;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -20,19 +20,23 @@ package org.apache.maven.plugin.jira;
  */
 
 import org.apache.maven.doxia.sink.Sink;
-import org.apache.maven.plugin.issues.Issue;
-import org.apache.maven.plugin.issues.IssuesReportHelper;
+import org.apache.maven.plugin.jira.JiraMojo;
 import org.apache.maven.reporting.MavenReportException;
+import org.codehaus.plexus.util.StringUtils;
 
+import java.text.SimpleDateFormat;
 import java.util.List;
+import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
 /**
- * Generates a JIRA report.
+ * Generates a report on issues.
  *
+ * @author Noriko Kinugasa
+ * @author Dennis Lundberg
  * @version $Id$
  */
-public class JiraReportGenerator
+public class IssuesReportGenerator
 {
     /**
      * Holds the id:s for the columns to include in the report, in the order
@@ -43,7 +47,7 @@ public class JiraReportGenerator
     /**
      * @param includedColumns The id:s of the columns to include in the report
      */
-    public JiraReportGenerator( int[] includedColumns )
+    public IssuesReportGenerator( int[] includedColumns )
         throws MavenReportException
     {
         this.columns = includedColumns;
@@ -92,14 +96,26 @@ public class JiraReportGenerator
                     sinkHeader( sink, bundle.getString( "report.issues.label.by" ) );
                     break;
 
+                case JiraMojo.COLUMN_CHANGED:
+                    sinkHeader( sink, bundle.getString( "report.issues.label.changed" ) );
+                    break;
+
                 case JiraMojo.COLUMN_COMPONENT:
                     sinkHeader( sink, bundle.getString( "report.issues.label.component" )
);
                     break;
 
+                case JiraMojo.COLUMN_CREATED:
+                    sinkHeader( sink, bundle.getString( "report.issues.label.created" ) );
+                    break;
+
                 case JiraMojo.COLUMN_FIX_VERSION:
                     sinkHeader( sink, bundle.getString( "report.issues.label.fixVersion"
) );
                     break;
 
+                case JiraMojo.COLUMN_ID:
+                    sinkHeader( sink, bundle.getString( "report.issues.label.id" ) );
+                    break;
+
                 case JiraMojo.COLUMN_KEY:
                     sinkHeader( sink, bundle.getString( "report.issues.label.key" ) );
                     break;
@@ -150,6 +166,16 @@ public class JiraReportGenerator
 
         for ( int idx = 0; idx < issueList.size(); idx++ )
         {
+            SimpleDateFormat sdf;
+            try
+            {
+                sdf = new SimpleDateFormat( bundle.getString( "report.issues.dateformat"
) );
+            }
+            catch ( MissingResourceException mre )
+            {
+                sdf = new SimpleDateFormat();
+            }
+
             Issue issue = (Issue) issueList.get( idx );
 
             sink.tableRow();
@@ -162,14 +188,30 @@ public class JiraReportGenerator
                         sinkCell( sink, issue.getAssignee() );
                         break;
 
+                    case JiraMojo.COLUMN_CHANGED:
+                        sinkCell( sink, sdf.format( issue.getUpdated() ) );
+                        break;
+
                     case JiraMojo.COLUMN_COMPONENT:
                         sinkCell( sink, IssuesReportHelper.printValues( issue.getComponents()
) );
                         break;
 
+                    case JiraMojo.COLUMN_CREATED:
+                        sinkCell( sink, sdf.format( issue.getCreated() ) );
+                        break;
+
                     case JiraMojo.COLUMN_FIX_VERSION:
                         sinkCell( sink, IssuesReportHelper.printValues( issue.getFixVersions()
) );
                         break;
 
+                    case JiraMojo.COLUMN_ID:
+                        sink.tableCell();
+                        sink.link( issue.getLink() );
+                        sink.text( issue.getId() );
+                        sink.link_();
+                        sink.tableCell_();
+                        break;
+
                     case JiraMojo.COLUMN_KEY:
                         sink.tableCell();
                         sink.link( issue.getLink() );

Propchange: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/issues/IssuesReportGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/issues/IssuesReportGenerator.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

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=1054787&r1=1054786&r2=1054787&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 21:58:09 2011
@@ -29,6 +29,7 @@ import java.util.ResourceBundle;
 
 import org.apache.maven.plugin.changes.AbstractChangesReport;
 import org.apache.maven.plugin.changes.ProjectUtils;
+import org.apache.maven.plugin.issues.IssuesReportGenerator;
 import org.apache.maven.reporting.MavenReportException;
 import org.apache.maven.settings.Settings;
 
@@ -288,7 +289,7 @@ public class JiraMojo
 
         configureIssueDownloader( issueDownloader );
 
-        JiraReportGenerator report;
+        IssuesReportGenerator report;
 
         try
         {
@@ -306,7 +307,7 @@ public class JiraMojo
                     throw new MavenReportException(
                         "maven-changes-plugin: None of the configured columnNames '" + columnNames
+ "' are valid." );
                 }
-                report = new JiraReportGenerator( toIntArray( columnIds ) );
+                report = new IssuesReportGenerator( toIntArray( columnIds ) );
 
                 if ( onlyCurrentVersion )
                 {
@@ -318,14 +319,14 @@ public class JiraMojo
             }
             else
             {
-                report = new JiraReportGenerator( null );
+                report = new IssuesReportGenerator( null );
 
                 report.doGenerateEmptyReport( getBundle( locale ), getSink() );
             }
         }
         catch ( MavenReportException mre )
         {
-            // Rethrow this error from JiraReportGenerator( String )
+            // Rethrow this error from IssuesReportGenerator( String )
             // so that the build fails
             throw mre;
         }

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=1054787&r1=1054786&r2=1054787&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 21:58:09 2011
@@ -29,6 +29,7 @@ import java.util.ResourceBundle;
 import org.apache.maven.doxia.siterenderer.Renderer;
 import org.apache.maven.plugin.changes.AbstractChangesReport;
 import org.apache.maven.plugin.changes.ProjectUtils;
+import org.apache.maven.plugin.issues.IssuesReportGenerator;
 import org.apache.maven.plugin.jira.JiraMojo;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.reporting.MavenReportException;
@@ -145,7 +146,7 @@ public class TracMojo
             }
 
             // Generate the report
-            TracReportGenerator report = new TracReportGenerator( JiraMojo.toIntArray( columnIds
) );
+            IssuesReportGenerator report = new IssuesReportGenerator( JiraMojo.toIntArray(
columnIds ) );
 
             if ( issueList.isEmpty() )
             {



Mime
View raw message