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 2008/01/09 00:30:55 UTC

svn commit: r610228 - in /maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira: AbstractJiraDownloader.java JiraDownloader.java JiraIssue.java JiraMojo.java JiraXML.java

Author: dennisl
Date: Tue Jan  8 15:30:49 2008
New Revision: 610228

URL: http://svn.apache.org/viewvc?rev=610228&view=rev
Log:
[MCHANGES-92] JIRA Report Improvements

o Add configuration of "Fix Versions" and "Types".

Modified:
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/AbstractJiraDownloader.java
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraDownloader.java
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraIssue.java
    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

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/AbstractJiraDownloader.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/AbstractJiraDownloader.java?rev=610228&r1=610227&r2=610228&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/AbstractJiraDownloader.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/AbstractJiraDownloader.java Tue Jan  8 15:30:49 2008
@@ -63,6 +63,8 @@
     private int nbEntriesMax;
     /** The filter to apply to query to JIRA. */
     private String filter;
+    /** Ids of fix versions to show, as comma separated string. */
+    private String fixVersionIds;
     /** Ids of status to show, as comma separated string. */
     private String statusIds;
     /** Ids of resolution to show, as comma separated string. */
@@ -71,6 +73,8 @@
     private String priorityIds;
     /** The component to show. */
     private String component;
+    /** Ids of types to show, as comma separated string. */
+    private String typeIds;
     /** The username to log into JIRA. */
     private String jiraUser;
     /** The password to log into JIRA. */
@@ -89,6 +93,8 @@
     protected Map resolutionMap = new HashMap();
     /** Mapping containing all allowed JIRA priority values. */
     protected Map priorityMap = new HashMap();
+    /** Mapping containing all allowed JIRA type values. */
+    protected Map typeMap = new HashMap();
 
     /**
      * Creates a filter given the parameters and some defaults.
@@ -105,6 +111,20 @@
 
         StringBuffer localFilter = new StringBuffer();
 
+        // add fix versions
+        if ( fixVersionIds != null )
+        {
+            String[] fixVersions = fixVersionIds.split( "," );
+
+            for ( int i = 0; i < fixVersions.length; i++ )
+            {
+                if ( fixVersions[i].length() > 0 )
+                {
+                    localFilter.append( "&fixfor=" + fixVersions[i].trim() );
+                }
+            }
+        }
+
         // get the Status Ids
         if ( statusIds != null )
         {
@@ -167,6 +187,22 @@
             }
         }
 
+        // get the Type Ids
+        if ( typeIds != null )
+        {
+            String[] types = typeIds.split( "," );
+
+            for ( int i = 0; i < types.length; i++ )
+            {
+                String typeParam = (String) typeMap.get( types[i].trim() );
+
+                if ( typeParam != null )
+                {
+                    localFilter.append( "&type=" + typeParam);
+                }
+            }
+        }
+
         // add default sorting (by priority and then creation date)
         String sort = "&sorter/field=created&sorter/order=DESC" + "&sorter/field=priority&sorter/order=DESC";
 
@@ -686,6 +722,26 @@
     public void setComponent( String theseComponents )
     {
         this.component = theseComponents;
+    }
+
+    /**
+     * Sets the fix version id(s) to apply to query JIRA.
+     *
+     * @param theseFixVersionIds The id(s) of fix versions to show, as comma separated string
+     */
+    public void setFixVersionIds( String theseFixVersionIds )
+    {
+        this.fixVersionIds = theseFixVersionIds;
+    }
+
+    /**
+     * Sets the typeIds.
+     *
+     * @param theseTypeIds  The id(s) of the types to show, as comma separated string
+     */
+    public void setTypeIds( String theseTypeIds )
+    {
+        typeIds = theseTypeIds;
     }
 
     public void setLog( Log log )

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraDownloader.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraDownloader.java?rev=610228&r1=610227&r2=610228&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraDownloader.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraDownloader.java Tue Jan  8 15:30:49 2008
@@ -48,5 +48,13 @@
         priorityMap.put( "Major", "3" );
         priorityMap.put( "Minor", "4" );
         priorityMap.put( "Trivial", "5" );
+
+        typeMap.put( "Bug", "1" );
+        typeMap.put( "New Feature", "2" );
+        typeMap.put( "Task", "3" );
+        typeMap.put( "Improvement", "4" );
+        typeMap.put( "Wish", "5" );
+        typeMap.put( "Test", "6" );
+        typeMap.put( "Sub-task", "7" );
     }
 }

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraIssue.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraIssue.java?rev=610228&r1=610227&r2=610228&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraIssue.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraIssue.java Tue Jan  8 15:30:49 2008
@@ -26,14 +26,26 @@
  */
 public class JiraIssue
 {
+    private String component;
+
+    private String fixVersion;
+
     private String key;
 
     private String link;
 
+    private String priority;
+
+    private String reporter;
+
     private String summary;
 
     private String status;
 
+    private String type;
+
+    private String version;
+
     private String resolution;
 
     private String assignee;
@@ -100,5 +112,65 @@
     public void setAssignee( String assignee )
     {
         this.assignee = assignee;
+    }
+
+    public String getComponent()
+    {
+        return component;
+    }
+
+    public void setComponent( String component )
+    {
+        this.component = component;
+    }
+
+    public String getFixVersion()
+    {
+        return fixVersion;
+    }
+
+    public void setFixVersion( String fixVersion )
+    {
+        this.fixVersion = fixVersion;
+    }
+
+    public String getPriority()
+    {
+        return priority;
+    }
+
+    public void setPriority( String priority )
+    {
+        this.priority = priority;
+    }
+
+    public String getReporter()
+    {
+        return reporter;
+    }
+
+    public void setReporter( String reporter )
+    {
+        this.reporter = reporter;
+    }
+
+    public String getType()
+    {
+        return type;
+    }
+
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+
+    public void setVersion( String version )
+    {
+        this.version = version;
     }
 }

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=610228&r1=610227&r2=610228&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  8 15:30:49 2008
@@ -41,7 +41,7 @@
 {
     /**
      * Output directory where the report will be placed.
-     * 
+     *
      * @parameter expression="${project.reporting.outputDirectory}"
      * @required
      * @readonly
@@ -50,7 +50,7 @@
 
     /**
      * Path to the JIRA XML file, which will be parsed.
-     * 
+     *
      * @parameter expression="${project.build.directory}/jira-results.xml "
      * @required
      * @readonly
@@ -59,7 +59,7 @@
 
     /**
      * Doxia Site Renderer.
-     * 
+     *
      * @parameter expression="${component.org.apache.maven.doxia.siterenderer.Renderer}"
      * @required
      * @readonly
@@ -68,7 +68,7 @@
 
     /**
      * The Maven Project.
-     * 
+     *
      * @parameter expression="${project}"
      * @required
      * @readonly
@@ -77,7 +77,7 @@
 
     /**
      * Settings XML configuration.
-     * 
+     *
      * @parameter expression="${settings}"
      * @required
      * @readonly
@@ -86,7 +86,7 @@
 
     /**
      * Maximum number of entries to be displayed by the JIRA Report.
-     * 
+     *
      * @parameter default-value=100
      *
      */
@@ -102,6 +102,16 @@
     private String filter;
 
     /**
+     * Sets the fix version id(s) that you want to limit your report to include.
+     * These are JIRA's internal version ids, NOT the human readable display ones.
+     * Multiple fix versions can be separated by commas.
+     * If this is set to empty - that means all fix versions.
+     *
+     * @parameter default-value=""
+     */
+    private String fixVersionIds;
+
+    /**
      * Sets the status(es) that you want to limit your report to include.
      * Valid statuses are: Open, In Progress, Reopened, Resolved and Closed.
      * Multiple values can be separated by commas.
@@ -138,6 +148,17 @@
     private String component;
 
     /**
+     * Sets the types(s) that you want to limit your report to include.
+     * Valid types are: <code>Bug</code>, <code>New Feature</code>,
+     * <code>Task</code>, <code>Improvement</code>, <code>Wish</code>,
+     * <code>Test</code> and <code>Sub-task</code>. Multiple
+     * values can be separated by commas.
+     *
+     * @parameter default-value=""
+     */
+    private String typeIds;
+
+    /**
      * Defines the JIRA username for authentication into a private JIRA installation.
      *
      * @parameter default-value=""
@@ -160,7 +181,7 @@
 
     /**
      * Defines the http password for basic authentication into the JIRA webserver.
-     * 
+     *
      * @parameter default-value=""
      */
     private String webPassword;
@@ -252,6 +273,8 @@
 
         jira.setComponent( component );
 
+        jira.setFixVersionIds( fixVersionIds );
+
         jira.setStatusIds( statusIds );
 
         jira.setResolutionIds( resolutionIds );
@@ -263,6 +286,8 @@
         jira.setJiraUser( jiraUser );
 
         jira.setJiraPassword( jiraPassword );
+
+        jira.setTypeIds( typeIds );
 
         jira.setWebUser( webUser );
 

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=610228&r1=610227&r2=610228&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  8 15:30:49 2008
@@ -94,10 +94,18 @@
         {
             issue.setSummary( currentElement );
         }
+        else if ( qName.equals( "type" ) )
+        {
+            issue.setType( currentElement );
+        }
         else if ( qName.equals( "link" ) && currentParent.equals( "item" ) )
         {
             issue.setLink( currentElement );
         }
+        else if ( qName.equals( "priority" ) )
+        {
+            issue.setPriority( currentElement );
+        }
         else if ( qName.equals( "status" ) )
         {
             issue.setStatus( currentElement );
@@ -109,6 +117,22 @@
         else if ( qName.equals( "assignee" ) )
         {
             issue.setAssignee( currentElement );
+        }
+        else if ( qName.equals( "reporter" ) )
+        {
+            issue.setReporter( currentElement );
+        }
+        else if ( qName.equals( "version" ) )
+        {
+            issue.setVersion( currentElement );
+        }
+        else if ( qName.equals( "fixVersion" ) )
+        {
+            issue.setFixVersion( currentElement );
+        }
+        else if ( qName.equals( "component" ) )
+        {
+            issue.setComponent( currentElement );
         }
 
         currentElement = "";