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 2011/01/06 21:39:15 UTC
svn commit: r1056063 -
/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java
Author: dennisl
Date: Thu Jan 6 20:39:14 2011
New Revision: 1056063
URL: http://svn.apache.org/viewvc?rev=1056063&view=rev
Log:
Refactoring: Sort methods.
Modified:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java
Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java?rev=1056063&r1=1056062&r2=1056063&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java Thu Jan 6 20:39:14 2011
@@ -319,6 +319,144 @@ public class ChangesReportGenerator
}
}
+ /**
+ * Construct a text or link that mention the people that helped with an action.
+ *
+ * @param sink The sink
+ * @param action The action that was done
+ * @param bundle A resource bundle for i18n
+ * @param dueTos Other people that helped with an action
+ */
+ private void constructDueTo( Sink sink, Action action, ResourceBundle bundle, List dueTos )
+ {
+
+ // Create a Map with key : dueTo name, value : dueTo email
+ Map namesEmailMap = new LinkedHashMap();
+
+ // Only add the dueTo specified as attributes, if it has either a dueTo or a dueToEmail
+ if ( StringUtils.isNotEmpty( action.getDueTo() ) || StringUtils.isNotEmpty( action.getDueToEmail() ) )
+ {
+ namesEmailMap.put( action.getDueTo(), action.getDueToEmail() );
+ }
+
+ for ( Iterator iterator = dueTos.iterator(); iterator.hasNext(); )
+ {
+ DueTo dueTo = (DueTo) iterator.next();
+ namesEmailMap.put( dueTo.getName(), dueTo.getEmail() );
+ }
+
+ if ( namesEmailMap.isEmpty() )
+ {
+ return;
+ }
+
+ sink.text( " " + bundle.getString( "report.changes.text.thanx" ) + " " );
+ int i = 0;
+ for ( Iterator iterator = namesEmailMap.keySet().iterator(); iterator.hasNext(); )
+ {
+ String currentDueTo = (String) iterator.next();
+ String currentDueToEmail = (String) namesEmailMap.get( currentDueTo );
+ i++;
+
+ if ( StringUtils.isNotEmpty( currentDueToEmail ) )
+ {
+ sinkLink( sink, currentDueTo, "mailto:" + currentDueToEmail );
+ }
+ else if ( StringUtils.isNotEmpty( currentDueTo ) )
+ {
+ sink.text( currentDueTo );
+ }
+
+ if ( i < namesEmailMap.size() )
+ {
+ sink.text( ", " );
+ }
+ }
+
+ sink.text( "." );
+ }
+
+ /**
+ * Construct links to the issues that were solved by an action.
+ *
+ * @param issue The issue specified by attributes
+ * @param system The issue management system
+ * @param sink The sink
+ * @param fixes The List of issues specified as fixes elements
+ */
+ private void constructIssueLink( String issue, String system, Sink sink, List fixes )
+ {
+ if ( StringUtils.isNotEmpty( issue ) )
+ {
+ sink.link( parseIssueLink( issue, system ) );
+
+ sink.text( issue );
+
+ sink.link_();
+
+ if ( !fixes.isEmpty() )
+ {
+ sink.text( ", " );
+ }
+ }
+
+ for ( Iterator iterator = fixes.iterator(); iterator.hasNext(); )
+ {
+ FixedIssue fixedIssue = (FixedIssue) iterator.next();
+ String currentIssueId = fixedIssue.getIssue();
+ if ( StringUtils.isNotEmpty( currentIssueId ) )
+ {
+ sink.link( parseIssueLink( currentIssueId, system ) );
+
+ sink.text( currentIssueId );
+
+ sink.link_();
+ }
+
+ if ( iterator.hasNext() )
+ {
+ sink.text( ", " );
+ }
+ }
+ }
+
+ /**
+ * Construct a text that references (but does not link to) the issues that
+ * were solved by an action.
+ *
+ * @param issue The issue specified by attributes
+ * @param sink The sink
+ * @param fixes The List of issues specified as fixes elements
+ */
+ private void constructIssueText( String issue, Sink sink, List fixes )
+ {
+ if ( StringUtils.isNotEmpty( issue ) )
+ {
+ sink.text( issue );
+
+ if ( !fixes.isEmpty() )
+ {
+ sink.text( ", " );
+ }
+ }
+
+ for ( Iterator iterator = fixes.iterator(); iterator.hasNext(); )
+ {
+ FixedIssue fixedIssue = (FixedIssue) iterator.next();
+
+ String currentIssueId = fixedIssue.getIssue();
+ if ( StringUtils.isNotEmpty( currentIssueId ) )
+ {
+ sink.text( currentIssueId );
+ }
+
+ if ( iterator.hasNext() )
+ {
+ sink.text( ", " );
+ }
+ }
+ }
+
private void constructReleaseHistory( Sink sink, ResourceBundle bundle )
{
sink.section2();
@@ -566,142 +704,4 @@ public class ChangesReportGenerator
sink.tableCell_();
}
- /**
- * Construct links to the issues that were solved by an action.
- *
- * @param issue The issue specified by attributes
- * @param system The issue management system
- * @param sink The sink
- * @param fixes The List of issues specified as fixes elements
- */
- private void constructIssueLink( String issue, String system, Sink sink, List fixes )
- {
- if ( StringUtils.isNotEmpty( issue ) )
- {
- sink.link( parseIssueLink( issue, system ) );
-
- sink.text( issue );
-
- sink.link_();
-
- if ( !fixes.isEmpty() )
- {
- sink.text( ", " );
- }
- }
-
- for ( Iterator iterator = fixes.iterator(); iterator.hasNext(); )
- {
- FixedIssue fixedIssue = (FixedIssue) iterator.next();
- String currentIssueId = fixedIssue.getIssue();
- if ( StringUtils.isNotEmpty( currentIssueId ) )
- {
- sink.link( parseIssueLink( currentIssueId, system ) );
-
- sink.text( currentIssueId );
-
- sink.link_();
- }
-
- if ( iterator.hasNext() )
- {
- sink.text( ", " );
- }
- }
- }
-
- /**
- * Construct a text that references (but does not link to) the issues that
- * were solved by an action.
- *
- * @param issue The issue specified by attributes
- * @param sink The sink
- * @param fixes The List of issues specified as fixes elements
- */
- private void constructIssueText( String issue, Sink sink, List fixes )
- {
- if ( StringUtils.isNotEmpty( issue ) )
- {
- sink.text( issue );
-
- if ( !fixes.isEmpty() )
- {
- sink.text( ", " );
- }
- }
-
- for ( Iterator iterator = fixes.iterator(); iterator.hasNext(); )
- {
- FixedIssue fixedIssue = (FixedIssue) iterator.next();
-
- String currentIssueId = fixedIssue.getIssue();
- if ( StringUtils.isNotEmpty( currentIssueId ) )
- {
- sink.text( currentIssueId );
- }
-
- if ( iterator.hasNext() )
- {
- sink.text( ", " );
- }
- }
- }
-
- /**
- * Construct a text or link that mention the people that helped with an action.
- *
- * @param sink The sink
- * @param action The action that was done
- * @param bundle A resource bundle for i18n
- * @param dueTos Other people that helped with an action
- */
- private void constructDueTo( Sink sink, Action action, ResourceBundle bundle, List dueTos )
- {
-
- // Create a Map with key : dueTo name, value : dueTo email
- Map namesEmailMap = new LinkedHashMap();
-
- // Only add the dueTo specified as attributes, if it has either a dueTo or a dueToEmail
- if ( StringUtils.isNotEmpty( action.getDueTo() ) || StringUtils.isNotEmpty( action.getDueToEmail() ) )
- {
- namesEmailMap.put( action.getDueTo(), action.getDueToEmail() );
- }
-
- for ( Iterator iterator = dueTos.iterator(); iterator.hasNext(); )
- {
- DueTo dueTo = (DueTo) iterator.next();
- namesEmailMap.put( dueTo.getName(), dueTo.getEmail() );
- }
-
- if ( namesEmailMap.isEmpty() )
- {
- return;
- }
-
- sink.text( " " + bundle.getString( "report.changes.text.thanx" ) + " " );
- int i = 0;
- for ( Iterator iterator = namesEmailMap.keySet().iterator(); iterator.hasNext(); )
- {
- String currentDueTo = (String) iterator.next();
- String currentDueToEmail = (String) namesEmailMap.get( currentDueTo );
- i++;
-
- if ( StringUtils.isNotEmpty( currentDueToEmail ) )
- {
- sinkLink( sink, currentDueTo, "mailto:" + currentDueToEmail );
- }
- else if ( StringUtils.isNotEmpty( currentDueTo ) )
- {
- sink.text( currentDueTo );
- }
-
- if ( i < namesEmailMap.size() )
- {
- sink.text( ", " );
- }
- }
-
- sink.text( "." );
- }
-
}