Return-Path: Delivered-To: apmail-maven-commits-archive@www.apache.org Received: (qmail 21455 invoked from network); 7 Jul 2007 12:50:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Jul 2007 12:50:23 -0000 Received: (qmail 41121 invoked by uid 500); 7 Jul 2007 12:50:25 -0000 Delivered-To: apmail-maven-commits-archive@maven.apache.org Received: (qmail 40897 invoked by uid 500); 7 Jul 2007 12:50:25 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 40881 invoked by uid 99); 7 Jul 2007 12:50:25 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Jul 2007 05:50:25 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Jul 2007 05:50:22 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 98D321A981A; Sat, 7 Jul 2007 05:50:01 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@maven.apache.org From: dennisl@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070707125001.98D321A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 Action from a JIRA issue. + * + * @param issue The issue to extract the information from + * @return An Action + */ + 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; } }