maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From denn...@apache.org
Subject svn commit: r554194 - /maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/JiraAnnouncementParser.java
Date Sat, 07 Jul 2007 12:50:01 GMT
Author: dennisl
Date: Sat Jul  7 05:50:00 2007
New Revision: 554194

URL: http://svn.apache.org/viewvc?view=rev&rev=554194
Log:
o Refactor the creation of Actions into a factory method.

Modified:
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/JiraAnnouncementParser.java

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/JiraAnnouncementParser.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/JiraAnnouncementParser.java?view=diff&rev=554194&r1=554193&r2=554194
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/JiraAnnouncementParser.java
(original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/JiraAnnouncementParser.java
Sat Jul  7 05:50:00 2007
@@ -167,44 +167,13 @@
 
         Release release = new Release();
 
-        String type = "";
 
         for ( int i = 0; i < issues.size(); i++ )
         {
             JiraAnnouncement issue = (JiraAnnouncement) issues.get( i );
 
-            Action action = new Action();
-
-            action.setIssue( issue.getKey() );
-
-            if ( issue.getType().equals( "Bug" ) )
-            {
-                type = "fix";
-            }
-            else if ( issue.getType().equals( "New Feature" ) )
-            {
-                type = "add";
-            }
-            else if ( issue.getType().equals( "Improvement" ) )
-            {
-                type = "update";
-            }
-            action.setType( type );
-
-            action.setDev( issue.getAssignee() );
-
-            //action.setDueTo( issue.getReporter() );
-
-            if ( issue.getComments() != null && !issue.getComments().isEmpty() )
-            {
-                int commentSize = issue.getComments().size();
-
-                action.setAction( issue.getComments().get( commentSize - 1 ).toString() );
-            }
-            else
-            {
-                action.setAction( "" );
-            }
+            Action action = createAction( issue );
+            
             release.addAction( action );
 
             release.setDescription( issue.getSummary() );
@@ -214,5 +183,49 @@
             releases.add( release );
         }
         return releases;
+    }
+
+    /**
+     * Create an <code>Action</code> from a JIRA issue.
+     *
+     * @param issue The issue to extract the information from
+     * @return An <code>Action</code>
+     */
+    private Action createAction( JiraAnnouncement issue )
+    {
+        Action action = new Action();
+
+        action.setIssue( issue.getKey() );
+
+        String type = "";
+        if ( issue.getType().equals( "Bug" ) )
+        {
+            type = "fix";
+        }
+        else if ( issue.getType().equals( "New Feature" ) )
+        {
+            type = "add";
+        }
+        else if ( issue.getType().equals( "Improvement" ) )
+        {
+            type = "update";
+        }
+        action.setType( type );
+
+        action.setDev( issue.getAssignee() );
+
+        //action.setDueTo( issue.getReporter() );
+
+        if ( issue.getComments() != null && !issue.getComments().isEmpty() )
+        {
+            int commentSize = issue.getComments().size();
+
+            action.setAction( issue.getComments().get( commentSize - 1 ).toString() );
+        }
+        else
+        {
+            action.setAction( "" );
+        }
+        return action;
     }
 }



Mime
View raw message