You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sn...@apache.org on 2007/02/02 22:15:51 UTC

svn commit: r502753 - in /maven/plugins/trunk/maven-changes-plugin/src/main: java/org/apache/maven/plugin/changes/Release.java resources/org/apache/maven/plugin/announcement/announcement.vm

Author: snicoll
Date: Fri Feb  2 13:15:50 2007
New Revision: 502753

URL: http://svn.apache.org/viewvc?view=rev&rev=502753
Log:
Fixes announcement template to handle actions per types.

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

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/Release.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/Release.java?view=diff&rev=502753&r1=502752&r2=502753
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/Release.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/Release.java Fri Feb  2 13:15:50 2007
@@ -18,6 +18,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Iterator;
 
 /**
  * A release in a changes.xml file.
@@ -26,6 +27,15 @@
  */
 public class Release
 {
+    public static final String ADD_ACTION = "add";
+
+    public static final String FIX_ACTION = "fix";
+
+    public static final String UPDATE_ACTION = "update";
+
+    public static final String REMOVE_ACTION = "remove";
+
+
     private List action;
 
     private String dateRelease;
@@ -45,6 +55,10 @@
 
     public List getAction()
     {
+        if (action == null)
+        {
+            action = new ArrayList();
+        }
         return action;
     }
 
@@ -85,5 +99,31 @@
     public String getVersion()
     {
         return version;
+    }
+
+    /**
+     * Returns the actions for the specified type.
+     *
+     * @param actionType the action type
+     * @return the actions with the specified type
+     */
+    public List getActions( final String actionType )
+    {
+        final List result = new ArrayList();
+        if ( getAction() == null )
+        {
+            return new ArrayList();
+        }
+        final Iterator it = getAction().iterator();
+        while ( it.hasNext() )
+        {
+            Action action = (Action) it.next();
+            if ( actionType.equals( action.getType() ) )
+            {
+                result.add( action );
+            }
+        }
+
+        return result;
     }
 }

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/announcement/announcement.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/announcement/announcement.vm?view=diff&rev=502753&r1=502752&r2=502753
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/announcement/announcement.vm (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/announcement/announcement.vm Fri Feb  2 13:15:50 2007
@@ -2,23 +2,17 @@
 
 ${introduction}
 
+#if ($release.getAction().size() == 0)
+No changes defined in ths version.
+#else
 Changes in this version include:
 
-#foreach($actionsN in $release.getAction())
-#if($actionsN.getType()=="add")
-#set($hasNew = 1)
-#end
-#end
-#if($hasNew==1)
-
-New Features:
-
-#end
-#foreach($actions in $release.getAction())
-#if($actions.getType()=="add")
-#set($action=$actions.getAction())
-#set($issue=$actions.getIssue())
-#set($dueto=$actions.getDueTo())
+#if ($release.getActions('add').size() !=0)
+New features:
+#foreach($actionItem in $release.getActions('add'))
+#set($action=$actionItem.getAction())
+#set($issue=$actionItem.getIssue())
+#set($dueto=$actionItem.getDueTo())
 o ${action} #if($!issue != "") Issue: $issue. #end#if($!dueto != "")Thanks to $dueto. #end
 
 #set($issue="")
@@ -26,21 +20,12 @@
 #end 
 #end
 
-#foreach($actionsF in $release.getAction())
-#if($actionsF.getType()=="add")
-#set($hasFix = 1)
-#end
-#end
-#if($hasFix == 1)
-
+#if ($release.getActions('fix').size() !=0)
 Fixed Bugs:
-
-#end
-#foreach( $actions in $release.getAction() )
-#if( $actions.getType() == "fix" )
-#set( $action = $actions.getAction())
-#set($issue=$actions.getIssue())
-#set($dueto=$actions.getDueTo())
+#foreach($actionItem in $release.getActions('fix'))
+#set($action=$actionItem.getAction())
+#set($issue=$actionItem.getIssue())
+#set($dueto=$actionItem.getDueTo())
 o ${action} #if($!issue != "") Issue: $issue. #end#if($!dueto != "")Thanks to $dueto. #end
 
 #set($issue="")
@@ -48,21 +33,12 @@
 #end
 #end
 
-#foreach($actionsC in $release.getAction())
-#if($actionsC.getType()=="add")
-#set($hasFix = 1)
-#end
-#end
-#if($hasFix == 1)
-
+#if ($release.getActions('update').size() !=0)
 Changes:
-
-#end
-#foreach( $actions in $release.getAction() )
-#if( $actions.getType() == "update" )
-#set( $action = $actions.getAction() )
-#set($issue=$actions.getIssue())
-#set($dueto=$actions.getDueTo())
+#foreach($actionItem in $release.getActions('update'))
+#set($action=$actionItem.getAction())
+#set($issue=$actionItem.getIssue())
+#set($dueto=$actionItem.getDueTo())
 o ${action} #if($!issue != "") Issue: $issue. #end#if($!dueto != "")Thanks to $dueto. #end
 
 #set($issue="")
@@ -70,21 +46,12 @@
 #end
 #end
 
-#foreach($actionsR in $release.getAction())
-#if($actionsR.getType()=="add")
-#set($hasFix = 1)
-#end
-#end
-#if($hasFix == 1)
-
+#if ($release.getActions('remove').size() !=0)
 Removed:
-
-#end
-#foreach( $actions in $release.getAction() )
-#if( $actions.getType() == "remove" )
-#set( $action = $actions.getAction() )
-#set($issue=$actions.getIssue())
-#set($dueto=$actions.getDueTo())
+#foreach($actionItem in $release.getActions('remove'))
+#set($action=$actionItem.getAction())
+#set($issue=$actionItem.getIssue())
+#set($dueto=$actionItem.getDueTo())
 o ${action} #if($!issue != "") Issue: $issue. #end#if($!dueto != "")Thanks to $dueto. #end
 
 #set($issue="")
@@ -92,11 +59,12 @@
 #end
 #end
 
+## End of main loop
+#end
 
 For a manual installation, you can download the ${finalName} here:
 
 ${urlDownload}
-
 
 Have fun!
 -${developmentTeam}