Author: vbaranov
Date: 2008-03-19 09:31:38 -0400 (Wed, 19 Mar 2008)
New Revision: 6945
Modified:
branches/3.1.x/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java
Log:
http://jira.jboss.com/jira/browse/RF-2526
Modified:
branches/3.1.x/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java
===================================================================
---
branches/3.1.x/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java 2008-03-19
13:28:56 UTC (rev 6944)
+++
branches/3.1.x/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java 2008-03-19
13:31:38 UTC (rev 6945)
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -279,6 +280,33 @@
}
}
}
+ // sort taglib models by artifactIds in ASC order
+ Collections.sort(taglibModels, new Comparator() {
+ /**
+ * Compares two <code>Model</code> objects by artifactIds
+ * for sorting in ASC order
+ * @param m1 - model object
+ * @param m2 - model object
+ * @return result of comparing
+ */
+ public int compare(Object o1, Object o2) {
+ // cast incoming parameters to Model objects
+ if(!(o1 instanceof Model) || !(o2 instanceof Model)) {
+ throw new IllegalArgumentException("Only Model objects should be
compared!");
+ }
+ Model m1 = (Model) o1;
+ Model m2 = (Model) o2;
+ // check incoming parameters for null
+ if ((m1 == null) || (m1.getArtifactId() == null)) {
+ return -1;
+ } else
+ if ((m2 == null) || (m2.getArtifactId() == null)) {
+ return 1;
+ }
+
+ return m1.getArtifactId().compareTo(m2.getArtifactId());
+ }
+ });
generateTaglib(taglibModels, taglib);
}
} else {