You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by de...@apache.org on 2011/01/04 19:36:43 UTC

svn commit: r1055136 - in /maven/plugins/trunk/maven-changes-plugin/src/main: java/org/apache/maven/plugin/jira/ resources/

Author: dennisl
Date: Tue Jan  4 18:36:42 2011
New Revision: 1055136

URL: http://svn.apache.org/viewvc?rev=1055136&view=rev
Log:
[MCHANGES-215] Make it possible to add the columns created, id and updated to a JIRA Report

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/JiraXML.java
    maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report.properties
    maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report_de.properties
    maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report_fr.properties
    maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report_sv.properties

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=1055136&r1=1055135&r2=1055136&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 Tue Jan  4 18:36:42 2011
@@ -52,7 +52,9 @@ public class JiraMojo
     {
         JIRA_COLUMNS.put( "Assignee", new Integer( IssuesReportHelper.COLUMN_ASSIGNEE ) );
         JIRA_COLUMNS.put( "Component", new Integer( IssuesReportHelper.COLUMN_COMPONENT ) );
+        JIRA_COLUMNS.put( "Created", new Integer( IssuesReportHelper.COLUMN_CREATED ) );
         JIRA_COLUMNS.put( "Fix Version", new Integer( IssuesReportHelper.COLUMN_FIX_VERSION ) );
+        JIRA_COLUMNS.put( "Id", new Integer( IssuesReportHelper.COLUMN_ID ) );
         JIRA_COLUMNS.put( "Key", new Integer( IssuesReportHelper.COLUMN_KEY ) );
         JIRA_COLUMNS.put( "Priority", new Integer( IssuesReportHelper.COLUMN_PRIORITY ) );
         JIRA_COLUMNS.put( "Reporter", new Integer( IssuesReportHelper.COLUMN_REPORTER ) );
@@ -60,6 +62,7 @@ public class JiraMojo
         JIRA_COLUMNS.put( "Status", new Integer( IssuesReportHelper.COLUMN_STATUS ) );
         JIRA_COLUMNS.put( "Summary", new Integer( IssuesReportHelper.COLUMN_SUMMARY ) );
         JIRA_COLUMNS.put( "Type", new Integer( IssuesReportHelper.COLUMN_TYPE ) );
+        JIRA_COLUMNS.put( "Updated", new Integer( IssuesReportHelper.COLUMN_UPDATED ) );
         JIRA_COLUMNS.put( "Version", new Integer( IssuesReportHelper.COLUMN_VERSION ) );
     }
 
@@ -181,15 +184,15 @@ public class JiraMojo
     private String typeIds;
 
     /**
-     * Sets the column names that you want to show in the report. The columns
+     * Sets the names of the columns that you want in the report. The columns
      * will appear in the report in the same order as you specify them here.
      * Multiple values can be separated by commas.
      * <p>
      * Valid columns are: <code>Key</code>, <code>Summary</code>,
      * <code>Status</code>, <code>Resolution</code>, <code>Assignee</code>,
      * <code>Reporter</code>, <code>Type</code>, <code>Priority</code>,
-     * <code>Version</code>, <code>Fix Version</code> and
-     * <code>Component</code>.
+     * <code>Version</code>, <code>Fix Version</code>, <code>Component</code>,
+     * <code>Created</code>, <code>Id</code> and <code>Updated</code>.
      * </p>
      *
      * @parameter default-value="Key,Summary,Status,Resolution,Assignee"

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraXML.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraXML.java?rev=1055136&r1=1055135&r2=1055136&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraXML.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraXML.java Tue Jan  4 18:36:42 2011
@@ -22,8 +22,11 @@ package org.apache.maven.plugin.jira;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
@@ -52,6 +55,8 @@ public class JiraXML
 
     private Issue issue;
 
+    private SimpleDateFormat sdf;
+
     public JiraXML( File xmlPath, String encoding )
     {
         SAXParserFactory factory = SAXParserFactory.newInstance();
@@ -59,6 +64,7 @@ public class JiraXML
 
         issueList = new ArrayList();
 
+        sdf = new SimpleDateFormat( "EEE, d MMM yyyy HH:mm:ss Z (z)", Locale.ENGLISH );
         try
         {
             SAXParser saxParser = factory.newSAXParser();
@@ -98,6 +104,14 @@ public class JiraXML
 
             currentParent = "item";
         }
+        else if ( qName.equals( "key" ) )
+        {
+            String id = attrs.getValue( "id" );
+            if ( id != null )
+            {
+                issue.setId( id.trim() );
+            }
+        }
     }
 
     public void endElement( String namespaceURI, String sName, String qName )
@@ -165,6 +179,28 @@ public class JiraXML
         {
             issue.setTitle( currentElement.toString().trim() );
         }
+        else if ( qName.equals( "created" ) && currentParent.equals( "item" ) )
+        {
+            try
+            {
+                issue.setCreated( sdf.parse( currentElement.toString().trim() ) );
+            }
+            catch ( ParseException e )
+            {
+                throw new SAXException( "Unable to parse the date: 'created'.", e );
+            }
+        }
+        else if ( qName.equals( "updated" ) && currentParent.equals( "item" ) )
+        {
+            try
+            {
+                issue.setUpdated( sdf.parse( currentElement.toString().trim() ) );
+            }
+            catch ( ParseException e )
+            {
+                throw new SAXException( "Unable to parse the date: 'updated'.", e );
+            }
+        }
 
         currentElement.setLength( 0 );
     }

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report.properties?rev=1055136&r1=1055135&r2=1055136&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report.properties (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report.properties Tue Jan  4 18:36:42 2011
@@ -22,7 +22,9 @@ report.issues.error=An error occured tha
 report.issues.header=JIRA Report
 report.issues.label.assignee=By
 report.issues.label.component=Component
+report.issues.label.created=Created
 report.issues.label.fixVersion=Fix Version
+report.issues.label.id=#
 report.issues.label.key=Key
 report.issues.label.priority=Priority
 report.issues.label.reporter=Reporter
@@ -30,4 +32,5 @@ report.issues.label.resolution=Resolutio
 report.issues.label.status=Status
 report.issues.label.summary=Summary
 report.issues.label.type=Type
+report.issues.label.updated=Updated
 report.issues.label.version=Version

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report_de.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report_de.properties?rev=1055136&r1=1055135&r2=1055136&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report_de.properties (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report_de.properties Tue Jan  4 18:36:42 2011
@@ -22,7 +22,9 @@ report.issues.error=Es ist ein Fehler au
 report.issues.header=JIRA-Bericht
 report.issues.label.assignee=Durch
 report.issues.label.component=Komponente
+report.issues.label.created=Erstellt
 report.issues.label.fixVersion=Korrigierte Version
+report.issues.label.id=#
 report.issues.label.key=Schlüssel
 report.issues.label.priority=Priorität
 report.issues.label.reporter=Reporter
@@ -30,4 +32,5 @@ report.issues.label.resolution=Lösung
 report.issues.label.status=Status
 report.issues.label.summary=Zusammenfassung
 report.issues.label.type=Typ
+report.issues.label.updated=Ge\u00E4ndert
 report.issues.label.version=Version

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report_fr.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report_fr.properties?rev=1055136&r1=1055135&r2=1055136&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report_fr.properties (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report_fr.properties Tue Jan  4 18:36:42 2011
@@ -22,7 +22,9 @@ report.issues.error=Une erreur est surve
 report.issues.header=Rapport JIRA
 report.issues.label.assignee=Par
 report.issues.label.component=Composant
+report.issues.label.created=Cr\u00E9e
 report.issues.label.fixVersion=Version de correction
+report.issues.label.id=#
 report.issues.label.key=Clef
 report.issues.label.priority=Priorit\u00E9
 report.issues.label.reporter=Rapporteur
@@ -30,4 +32,5 @@ report.issues.label.resolution=R\u00E9so
 report.issues.label.status=Statut
 report.issues.label.summary=Description
 report.issues.label.type=Type
+report.issues.label.updated=Modifi\u00E9
 report.issues.label.version=Version

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report_sv.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report_sv.properties?rev=1055136&r1=1055135&r2=1055136&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report_sv.properties (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/resources/jira-report_sv.properties Tue Jan  4 18:36:42 2011
@@ -22,7 +22,9 @@ report.issues.error=Ett fel intr\u00e4ff
 report.issues.header=JIRA-rapport
 report.issues.label.assignee=Av
 report.issues.label.component=Komponent
+report.issues.label.created=Skapades
 report.issues.label.fixVersion=Fix Version
+report.issues.label.id=#
 report.issues.label.key=Nyckel
 report.issues.label.priority=Prioritet
 report.issues.label.reporter=Rapport\u00f6r
@@ -30,4 +32,5 @@ report.issues.label.resolution=L\u00f6sn
 report.issues.label.status=Status
 report.issues.label.summary=Summering
 report.issues.label.type=Typ
+report.issues.label.updated=Uppdaterades
 report.issues.label.version=Version