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 2006/01/03 16:13:18 UTC

svn commit: r365658 - in /maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence: ./ src/main/java/org/apache/maven/wiki/confluence/ src/main/java/org/apache/maven/wiki/confluence/blog/

Author: snicoll
Date: Tue Jan  3 07:13:09 2006
New Revision: 365658

URL: http://svn.apache.org/viewcvs?rev=365658&view=rev
Log:
Added project release blog entry management.

Added:
    maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/
    maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/ConfluenceMarkupUtil.java   (with props)
    maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/
    maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/AbstractProjectReleaseBlogEntryRenderer.java   (with props)
    maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ActionPerTypeComparator.java   (with props)
    maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ActionType.java   (with props)
    maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ClassicalProjectReleaseBlogEntryRenderer.java   (with props)
    maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/HierarchicalProjectReleaseBlogEntryRenderer.java   (with props)
    maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ProjectReleaseBlogEntryRenderer.java   (with props)
Modified:
    maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/pom.xml

Modified: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/pom.xml
URL: http://svn.apache.org/viewcvs/maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/pom.xml?rev=365658&r1=365657&r2=365658&view=diff
==============================================================================
--- maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/pom.xml (original)
+++ maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/pom.xml Tue Jan  3 07:13:09 2006
@@ -20,6 +20,18 @@
       <artifactId>plexus-utils</artifactId>
       <version>1.0.4</version>
     </dependency>
+    <dependency>
+      <groupId>org.codehaus.mojo</groupId>
+      <artifactId>changes-maven-plugin</artifactId>
+      <version>2.0-beta-2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.1</version>
+    </dependency>
+
+
   </dependencies>
   <build>
     <plugins>

Added: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/ConfluenceMarkupUtil.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/ConfluenceMarkupUtil.java?rev=365658&view=auto
==============================================================================
--- maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/ConfluenceMarkupUtil.java (added)
+++ maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/ConfluenceMarkupUtil.java Tue Jan  3 07:13:09 2006
@@ -0,0 +1,139 @@
+package org.apache.maven.wiki.confluence;
+
+import org.apache.maven.changes.Action;
+import org.apache.maven.changes.Release;
+import org.apache.maven.project.MavenProject;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Markup utilities.
+ *
+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
+ * @version $Id$
+ */
+public class ConfluenceMarkupUtil
+{
+    public static final String NEW_LINE = System.getProperty( "line.separator" );
+
+    /**
+     * Appends the issue id. If a <tt>shortcutKey</tt> is specified, a link to
+     * the issue is created.
+     * <p/>
+     * If the issue id is <tt>null</tt>, appends <tt>{{none}}</tt>.
+     *
+     * @param sb          the stringbuffer to use
+     * @param issueId     the issue id
+     * @param shortcutKey the shortcut key or null if no shortcut should be created
+     */
+    public static void appendIssueId( StringBuffer sb, String issueId, String shortcutKey )
+    {
+        if ( issueId == null )
+        {
+            sb.append( "{{none}}" );
+        }
+        else if ( shortcutKey != null )
+        {
+            sb.append( "[" ).append( issueId ).append( "|" ).append( issueId ).append( "@" ).append(
+                shortcutKey ).append( "]" );
+        }
+        else
+        {
+            sb.append( issueId );
+        }
+    }
+
+    /**
+     * Appends the author. If <tt>addLinkToProfile</tt> is true, a link to the
+     * confluence profile of the specified author is created.
+     *
+     * @param sb               the stringbuffer to use
+     * @param author           the author id
+     * @param addLinkToProfile whether or not a link to the user profile should be created
+     */
+    public static void appendAuthor( StringBuffer sb, String author, boolean addLinkToProfile )
+    {
+        if ( addLinkToProfile )
+        {
+            sb.append( "[~" ).append( author ).append( "]" );
+        }
+        else
+        {
+            sb.append( author );
+        }
+    }
+
+    /**
+     * Appends the description.
+     *
+     * @param sb          the stringbuffer to use
+     * @param issueAction the issue action
+     */
+    public static void appendDescription( StringBuffer sb, Action issueAction )
+    {
+        sb.append( issueAction.getAction() );
+    }
+
+    /**
+     * Appends the default introduction for a project release.
+     *
+     * @param sb      the stringbuffer to use
+     * @param project the project being released
+     * @param release the release content
+     */
+    public static void appendProjectReleaseDefaultIntroduction( StringBuffer sb, MavenProject project, Release release )
+    {
+        sb.append( "The " ).append( project.getGroupId() ).append( " team is pleased to announce the " );
+
+        // Generate a link towards the project home page
+        sb.append( "[" ).append( project.getName() ).append( "|" ).append( project.getUrl() ).append( "]" );
+        sb.append( release.getVersion() ).append( " release!" );
+    }
+
+    /**
+     * Appends the default conclusion for a project release.
+     *
+     * @param sb      the stringbuffer to use
+     * @param project the project being released
+     */
+    public static void appendProjectReleaseDefaultConclusion( StringBuffer sb, MavenProject project )
+    {
+        sb.append( "Have fun!" );
+        sb.append( NEW_LINE );
+        sb.append( "-The " ).append( project.getGroupId() ).append( " team" );
+    }
+
+    /**
+     * Initializes a new table with the specified headers.
+     *
+     * @param sb      the stringbuffer to use
+     * @param headers the table headers
+     */
+    public static void initializeTableHeader( StringBuffer sb, String[] headers )
+    {
+        if ( headers == null || headers.length == 0 )
+        {
+            return;
+        }
+
+        sb.append( "||" );
+        for ( int i = 0; i < headers.length; i++ )
+        {
+            sb.append( headers[i] ).append( "||" );
+        }
+    }
+}

Propchange: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/ConfluenceMarkupUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/ConfluenceMarkupUtil.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/AbstractProjectReleaseBlogEntryRenderer.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/AbstractProjectReleaseBlogEntryRenderer.java?rev=365658&view=auto
==============================================================================
--- maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/AbstractProjectReleaseBlogEntryRenderer.java (added)
+++ maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/AbstractProjectReleaseBlogEntryRenderer.java Tue Jan  3 07:13:09 2006
@@ -0,0 +1,37 @@
+package org.apache.maven.wiki.confluence.blog;
+
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.changes.Release;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * A base implementation of the {@link ProjectReleaseBlogEntryRenderer} interface.
+ *
+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
+ * @version $Id$
+ */
+public abstract class AbstractProjectReleaseBlogEntryRenderer implements ProjectReleaseBlogEntryRenderer
+{
+
+    public String generateProjectReleaseTitle( final MavenProject project, final Release release )
+    {
+        StringBuffer sb = new StringBuffer();
+        sb.append(project.getName()).append(" ").append(release.getVersion()).append(" released");
+        return sb.toString();
+    }
+}

Propchange: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/AbstractProjectReleaseBlogEntryRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/AbstractProjectReleaseBlogEntryRenderer.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ActionPerTypeComparator.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ActionPerTypeComparator.java?rev=365658&view=auto
==============================================================================
--- maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ActionPerTypeComparator.java (added)
+++ maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ActionPerTypeComparator.java Tue Jan  3 07:13:09 2006
@@ -0,0 +1,45 @@
+package org.apache.maven.wiki.confluence.blog;
+
+import org.apache.maven.changes.Action;
+
+import java.util.Comparator;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Sort actions per action type.
+ * <p/>
+ * TODO move this to the changes mojo
+ *
+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
+ * @version $Id$
+ */
+public class ActionPerTypeComparator
+    implements Comparator
+{
+
+    public int compare( Object o1, Object o2 )
+    {
+        Action a1 = (Action) o1;
+        Action a2 = (Action) o2;
+
+        ActionType at1 = ActionType.getIssueActionType( a1.getType() );
+        ActionType at2 = ActionType.getIssueActionType( a2.getType() );
+
+        return at1.compareTo( at2 );
+    }
+}

Propchange: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ActionPerTypeComparator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ActionPerTypeComparator.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ActionType.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ActionType.java?rev=365658&view=auto
==============================================================================
--- maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ActionType.java (added)
+++ maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ActionType.java Tue Jan  3 07:13:09 2006
@@ -0,0 +1,114 @@
+package org.apache.maven.wiki.confluence.blog;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * The action type.
+ *
+ * TODO: move this to the changes mojo
+ *
+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
+ * @version $Id$
+ */
+final class ActionType implements Comparable {
+    private static final Map types = new HashMap();
+
+    /**
+     * An action representing a fix.
+     */
+    public static final ActionType FIX = newIssueActionType("fix", 1);
+
+    /**
+     * An action representing a new feature.
+     */
+    public static final ActionType ADD = newIssueActionType("add", 2);
+
+    /**
+     * An action representing an improvement.
+     */
+    public static final ActionType UPDATE = newIssueActionType("update", 3);
+
+    /**
+     * An action representing a removal.
+     */
+    public static final ActionType REMOVE = newIssueActionType("remove", 4);
+
+
+    /**
+     * Returns the <code>IssuActionType</code> based on its name.
+     *
+     * @param name the name of the action
+     * @return the issue action or null if no such action exists.
+     */
+    public static ActionType getIssueActionType(final String name) {
+        if (name == null) {
+            throw new NullPointerException("Issue type could not be null.");
+        } else {
+            return (ActionType) types.get(name.toLowerCase());
+        }
+    }
+
+    private static ActionType newIssueActionType(String name, int position) {
+        ActionType iat = new ActionType(name, position);
+        types.put(name, iat);
+
+        return iat;
+    }
+
+    private final String name;
+    private final Integer position;
+
+    private ActionType(String name, int position) {
+        this.name = name;
+        this.position = new Integer(position);
+    }
+
+    public int compareTo(Object o) {
+        if (o == null) {
+            throw new NullPointerException("Could not compare to null.");
+        }
+        if (ActionType.class.isInstance(o)) {
+            ActionType iat = (ActionType) o;
+            return position.compareTo(iat.position);
+        } else {
+            throw new IllegalArgumentException("Could not compare with["+o.getClass().getName()+"] " +
+                    "expected["+getClass().getName()+"]");
+        }
+    }
+
+    public String toString() {
+        return name;
+    }
+
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        final ActionType that = (ActionType) o;
+
+        if (name != null ? !name.equals(that.name) : that.name != null) return false;
+
+        return true;
+    }
+
+    public int hashCode() {
+        return (name != null ? name.hashCode() : 0);
+    }
+}
\ No newline at end of file

Propchange: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ActionType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ActionType.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ClassicalProjectReleaseBlogEntryRenderer.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ClassicalProjectReleaseBlogEntryRenderer.java?rev=365658&view=auto
==============================================================================
--- maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ClassicalProjectReleaseBlogEntryRenderer.java (added)
+++ maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ClassicalProjectReleaseBlogEntryRenderer.java Tue Jan  3 07:13:09 2006
@@ -0,0 +1,71 @@
+package org.apache.maven.wiki.confluence.blog;
+
+import org.apache.maven.changes.Action;
+import org.apache.maven.changes.Release;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.wiki.confluence.ConfluenceMarkupUtil;
+
+import java.util.Iterator;
+import java.util.List;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Displays a table of issues being resolved in the given release.
+ *
+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
+ * @version $Id$
+ */
+public class ClassicalProjectReleaseBlogEntryRenderer
+    extends AbstractProjectReleaseBlogEntryRenderer
+{
+
+    public String generateProjectReleaseContent( final MavenProject project, final Release release )
+    {
+        StringBuffer sb = new StringBuffer();
+        ConfluenceMarkupUtil.appendProjectReleaseDefaultIntroduction( sb, project, release );
+
+        sb.append( ConfluenceMarkupUtil.NEW_LINE );
+        sb.append( ConfluenceMarkupUtil.NEW_LINE );
+
+        appendIssueActions( sb, release.getAction() );
+
+        sb.append( ConfluenceMarkupUtil.NEW_LINE );
+
+        ConfluenceMarkupUtil.appendProjectReleaseDefaultConclusion( sb, project );
+        return sb.toString();
+    }
+
+    private void appendIssueActions( StringBuffer sb, List issueActions )
+    {
+        ConfluenceMarkupUtil.initializeTableHeader( sb, new String[]{"issue", "changes", "author"} );
+        sb.append( ConfluenceMarkupUtil.NEW_LINE );
+        final Iterator it = issueActions.iterator();
+        while ( it.hasNext() )
+        {
+            Action issueAction = (Action) it.next();
+            sb.append( "|" );
+            ConfluenceMarkupUtil.appendIssueId( sb, issueAction.getIssue(), "jira" );
+            sb.append( "|" );
+            ConfluenceMarkupUtil.appendDescription( sb, issueAction );
+            sb.append( "|" );
+            ConfluenceMarkupUtil.appendAuthor( sb, issueAction.getDev(), true );
+            sb.append( "|" );
+            sb.append( ConfluenceMarkupUtil.NEW_LINE );
+        }
+    }
+}

Propchange: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ClassicalProjectReleaseBlogEntryRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ClassicalProjectReleaseBlogEntryRenderer.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/HierarchicalProjectReleaseBlogEntryRenderer.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/HierarchicalProjectReleaseBlogEntryRenderer.java?rev=365658&view=auto
==============================================================================
--- maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/HierarchicalProjectReleaseBlogEntryRenderer.java (added)
+++ maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/HierarchicalProjectReleaseBlogEntryRenderer.java Tue Jan  3 07:13:09 2006
@@ -0,0 +1,113 @@
+package org.apache.maven.wiki.confluence.blog;
+
+import org.apache.maven.changes.Action;
+import org.apache.maven.changes.Release;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.wiki.confluence.ConfluenceMarkupUtil;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Displays one table per issue type with the issues being resolved
+ * in the given release.
+ *
+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
+ * @version $Id$
+ */
+public class HierarchicalProjectReleaseBlogEntryRenderer
+    extends AbstractProjectReleaseBlogEntryRenderer
+{
+
+    public String generateProjectReleaseContent( final MavenProject project, final Release release )
+    {
+        StringBuffer sb = new StringBuffer();
+        ConfluenceMarkupUtil.appendProjectReleaseDefaultIntroduction( sb, project, release );
+
+        sb.append( ConfluenceMarkupUtil.NEW_LINE );
+
+        // clone and sort the actions
+        List sortedActions = new ArrayList( release.getAction() );
+        Collections.sort( sortedActions, new ActionPerTypeComparator() );
+
+        int currentIndex = 0;
+        // Append fixes
+        sb.append( ConfluenceMarkupUtil.NEW_LINE );
+        currentIndex = appendIssueActions( sb, sortedActions, ActionType.FIX, "Bug fixes:", currentIndex );
+        sb.append( ConfluenceMarkupUtil.NEW_LINE );
+
+        // Append changes
+        sb.append( ConfluenceMarkupUtil.NEW_LINE );
+        currentIndex = appendIssueActions( sb, sortedActions, ActionType.ADD, "New Features:", currentIndex );
+        sb.append( ConfluenceMarkupUtil.NEW_LINE );
+
+        // Append improvements
+        sb.append( ConfluenceMarkupUtil.NEW_LINE );
+        currentIndex = appendIssueActions( sb, sortedActions, ActionType.UPDATE, "Changes:", currentIndex );
+        sb.append( ConfluenceMarkupUtil.NEW_LINE );
+
+        // Append removal
+        sb.append( ConfluenceMarkupUtil.NEW_LINE );
+        currentIndex = appendIssueActions( sb, sortedActions, ActionType.REMOVE, "Removed features:", currentIndex );
+        sb.append( ConfluenceMarkupUtil.NEW_LINE );
+
+        ConfluenceMarkupUtil.appendProjectReleaseDefaultConclusion( sb, project );
+        return sb.toString();
+    }
+
+    private int appendIssueActions( StringBuffer sb, List issueActions, ActionType expectedType, String header,
+                                    int currentIndex )
+    {
+        if ( currentIndex >= issueActions.size() )
+        {
+            return issueActions.size();
+        }
+
+        boolean encouteredElement = false;
+        for ( int i = currentIndex; i < issueActions.size(); i++ )
+        {
+            Action issueAction = (Action) issueActions.get( i );
+            if ( expectedType.equals( ActionType.getIssueActionType( issueAction.getType() ) ) )
+            {
+                if ( !encouteredElement )
+                {
+                    encouteredElement = true;
+                    sb.append( "h2. " ).append( header );
+                    sb.append( ConfluenceMarkupUtil.NEW_LINE );
+                    ConfluenceMarkupUtil.initializeTableHeader( sb, new String[]{"issue", "changes", "author"} );
+                    sb.append( ConfluenceMarkupUtil.NEW_LINE );
+                }
+                sb.append( "|" );
+                ConfluenceMarkupUtil.appendIssueId( sb, issueAction.getIssue(), "jira" );
+                sb.append( "|" );
+                ConfluenceMarkupUtil.appendDescription( sb, issueAction );
+                sb.append( "|" );
+                ConfluenceMarkupUtil.appendAuthor( sb, issueAction.getDev(), true );
+                sb.append( "|" );
+                sb.append( ConfluenceMarkupUtil.NEW_LINE );
+            }
+            else
+            {
+                return i;
+            }
+        }
+        return issueActions.size();
+    }
+}

Propchange: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/HierarchicalProjectReleaseBlogEntryRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/HierarchicalProjectReleaseBlogEntryRenderer.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ProjectReleaseBlogEntryRenderer.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ProjectReleaseBlogEntryRenderer.java?rev=365658&view=auto
==============================================================================
--- maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ProjectReleaseBlogEntryRenderer.java (added)
+++ maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ProjectReleaseBlogEntryRenderer.java Tue Jan  3 07:13:09 2006
@@ -0,0 +1,48 @@
+package org.apache.maven.wiki.confluence.blog;
+
+import org.apache.maven.changes.Release;
+import org.apache.maven.project.MavenProject;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * A blog entry renderer for project release.
+ *
+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
+ * @version $Id$
+ */
+public interface ProjectReleaseBlogEntryRenderer
+{
+
+    /**
+     * Generates the blog entry title for the specified project release.
+     *
+     * @param project the maven project being released
+     * @param release the release
+     * @return the blog entry title
+     */
+    String generateProjectReleaseTitle(final MavenProject project, final Release release);
+
+    /**
+     * Generates the blog entry for the specified project release.
+     *
+     * @param project the maven project being released
+     * @param release the release
+     * @return the blog entry content
+     */
+    String generateProjectReleaseContent(final MavenProject project, final Release release);
+}

Propchange: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ProjectReleaseBlogEntryRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/wiki/wiki-management-providers/wiki-management-provider-confluence/src/main/java/org/apache/maven/wiki/confluence/blog/ProjectReleaseBlogEntryRenderer.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision