maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r677512 - in /maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model: ModelMarshaller.java ModelTransformerContext.java
Date Thu, 17 Jul 2008 06:47:46 GMT
Author: sisbell
Date: Wed Jul 16 23:47:45 2008
New Revision: 677512

URL: http://svn.apache.org/viewvc?rev=677512&view=rev
Log:
Just using the original sorter a second time solves the ordering problem.

Modified:
    maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelMarshaller.java
    maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelTransformerContext.java

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelMarshaller.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelMarshaller.java?rev=677512&r1=677511&r2=677512&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelMarshaller.java
(original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelMarshaller.java
Wed Jul 16 23:47:45 2008
@@ -113,29 +113,23 @@
         int n = 1;
         for (ModelProperty mp : modelProperties) {
             String uri = mp.getUri();
-            System.out.println(mp);
+            String val = (mp.getValue() != null) ? "\"" + mp.getValue() + "\"" : null;
+         //   System.out.println("new ModelProperty(\"" + mp.getUri() +"\" , " + val +"),");
             if (!uri.startsWith(baseUri)) {
                 throw new IllegalArgumentException("Passed in model property that does not
match baseUri: Property URI = "
                         + uri + ", Base URI = " + baseUri);
             }
             List<String> tagNames = getTagNamesFromUri(basePosition, uri);
-           // System.out.println(lastUriTags.size() + ":" + tagNames.size());
-           // String s = (lastUriTags.size() > 0) ? "LAST = " + lastUriTags.get(lastUriTags.size()-1)
: "";
-           // String t = ((tagNames.size() > 0) ? ", CURRENT = " + tagNames.get(tagNames.size()-1)
: ":");
-           // System.out.println(s + t);
             if (lastUriTags.size() > tagNames.size()) {
                 for (int i = lastUriTags.size() - 1; i >= tagNames.size(); i--) {
-             //       System.out.println("End tag without value: "+ toEndTag(lastUriTags.get(i
- 1).trim()));
                     sb.append(toEndTag(lastUriTags.get(i - 1)));
                 }
             }
             String tag = tagNames.get(tagNames.size() - 1);
             sb.append(toStartTag(tag));
-           // System.out.println(toStartTag(tag).trim());
             if (mp.getResolvedValue() != null) {
                 sb.append(mp.getResolvedValue());
                 sb.append(toEndTag(tag));
-             //   System.out.println("End tag with value: "+ tag.trim() + ", value = " +
 mp.getResolvedValue().trim());
                 n = 2;
             } else {
                 n = 1;
@@ -143,7 +137,6 @@
             lastUriTags = tagNames;
         }
         for (int i = lastUriTags.size() - n; i >= 1; i--) {
-            //System.out.println("END T = " + toEndTag(lastUriTags.get(i)) );
             sb.append(toEndTag(lastUriTags.get(i)));
         }
         return sb.toString();

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelTransformerContext.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelTransformerContext.java?rev=677512&r1=677511&r2=677512&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelTransformerContext.java
(original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelTransformerContext.java
Wed Jul 16 23:47:45 2008
@@ -53,10 +53,10 @@
                                  ModelTransformer toModelTransformer,
                                  Collection<InterpolatorProperty> interpolatorProperties)
throws IOException {
         List<InterpolatorProperty> properties = new ArrayList<InterpolatorProperty>(interpolatorProperties);
-        List<ModelProperty> originalProperties = fromModelTransformer.transformToModelProperties(domainModels);
 
         String baseUriForModel = fromModelTransformer.getBaseUri();
-        List<ModelProperty> modelProperties = sort(originalProperties, baseUriForModel);
+        List<ModelProperty> modelProperties = sort(fromModelTransformer.transformToModelProperties(domainModels),
+                baseUriForModel);
         ModelDataSource modelDataSource = new DefaultModelDataSource();
         modelDataSource.init(modelProperties, factories);
 
@@ -123,8 +123,8 @@
             }
         }
 
+        mps = sort(mps, baseUriForModel );
 
-        Collections.sort(mps, new ModelPropertyCompator(originalProperties));
         try {
             DomainModel domainModel = toModelTransformer.transformToDomainModel(mps);
             domainModel.setEventHistory(modelDataSource.getEventHistory());
@@ -187,22 +187,4 @@
         logger.info("Properties removed through sort: " + (properties.size() - processedProperties.size()));
         return processedProperties;
     }
-
-    private class ModelPropertyCompator implements Comparator {
-
-        private List<ModelProperty> original;
-
-        public ModelPropertyCompator(List<ModelProperty> original) {
-            this.original = original;
-        }
-
-        public int compare(Object o1, Object o2) {
-            if(original.indexOf(o1) > original.indexOf(o2)) {
-                return 1;
-            } else {
-                return -1;
-            }
-
-        }
-    }
 }



Mime
View raw message