You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2008/04/03 18:02:18 UTC

svn commit: r644386 - in /ofbiz/trunk/framework: base/src/base/org/ofbiz/base/util/ webtools/src/org/ofbiz/webtools/artifactinfo/

Author: jonesde
Date: Thu Apr  3 09:02:16 2008
New Revision: 644386

URL: http://svn.apache.org/viewvc?rev=644386&view=rev
Log:
Artifact info related artifact lists are now all sorted

Modified:
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilMisc.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilMisc.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilMisc.java?rev=644386&r1=644385&r2=644386&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilMisc.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilMisc.java Thu Apr  3 09:02:16 2008
@@ -19,7 +19,6 @@
 package org.ofbiz.base.util;
 
 import java.math.BigDecimal;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
@@ -29,6 +28,7 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
+import java.util.TreeSet;
 
 import javolution.util.FastList;
 import javolution.util.FastMap;
@@ -493,6 +493,15 @@
         Set<V> theSet = UtilGenerics.checkSet(theMap.get(setKey));
         if (theSet == null) {
             theSet = FastSet.newInstance();
+            theMap.put(setKey, theSet);
+        }
+        theSet.add(element);
+    }
+    
+    public static <K, V> void addToSortedSetInMap(V element, Map<K, Set<V>> theMap, K setKey) {
+        Set<V> theSet = UtilGenerics.checkSet(theMap.get(setKey));
+        if (theSet == null) {
+            theSet = new TreeSet<V>();
             theMap.put(setKey, theSet);
         }
         theSet.add(element);

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java?rev=644386&r1=644385&r2=644386&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java Thu Apr  3 09:02:16 2008
@@ -22,8 +22,7 @@
 import java.net.URL;
 import java.util.Map;
 import java.util.Set;
-
-import javolution.util.FastSet;
+import java.util.TreeSet;
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
@@ -44,8 +43,8 @@
     protected Map<String, Object> requestInfoMap;
     
     protected ServiceArtifactInfo serviceCalledByRequestEvent = null;
-    protected Set<ControllerRequestArtifactInfo> requestsThatAreResponsesToThisRequest = FastSet.newInstance();
-    protected Set<ControllerViewArtifactInfo> viewsThatAreResponsesToThisRequest = FastSet.newInstance();
+    protected Set<ControllerRequestArtifactInfo> requestsThatAreResponsesToThisRequest = new TreeSet<ControllerRequestArtifactInfo>();
+    protected Set<ControllerViewArtifactInfo> viewsThatAreResponsesToThisRequest = new TreeSet<ControllerViewArtifactInfo>();
     
     public ControllerRequestArtifactInfo(URL controllerXmlUrl, String requestUri, ArtifactInfoFactory aif) throws GeneralException {
         super(aif);
@@ -73,7 +72,7 @@
                 this.serviceCalledByRequestEvent = this.aif.getServiceArtifactInfo(serviceName);
                 if (this.serviceCalledByRequestEvent != null) {
                     // add the reverse association
-                    UtilMisc.addToSetInMap(this, aif.allRequestInfosReferringToServiceName, this.serviceCalledByRequestEvent.getUniqueId());
+                    UtilMisc.addToSortedSetInMap(this, aif.allRequestInfosReferringToServiceName, this.serviceCalledByRequestEvent.getUniqueId());
                 }
             } catch (GeneralException e) {
                 Debug.logWarning(e.toString(), module);
@@ -91,7 +90,7 @@
                     ControllerViewArtifactInfo artInfo = this.aif.getControllerViewArtifactInfo(controllerXmlUrl, viewUri);
                     this.viewsThatAreResponsesToThisRequest.add(artInfo);
                     // add the reverse association
-                    UtilMisc.addToSetInMap(this, this.aif.allRequestInfosReferringToView, artInfo.getUniqueId());
+                    UtilMisc.addToSortedSetInMap(this, this.aif.allRequestInfosReferringToView, artInfo.getUniqueId());
                 } catch (GeneralException e) {
                     Debug.logWarning(e.toString(), module);
                 }
@@ -103,7 +102,7 @@
                 try {
                     ControllerRequestArtifactInfo artInfo = this.aif.getControllerRequestArtifactInfo(controllerXmlUrl, otherRequestUri);
                     this.requestsThatAreResponsesToThisRequest.add(artInfo);
-                    UtilMisc.addToSetInMap(this, this.aif.allRequestInfosReferringToRequest, artInfo.getUniqueId());
+                    UtilMisc.addToSortedSetInMap(this, this.aif.allRequestInfosReferringToRequest, artInfo.getUniqueId());
                 } catch (GeneralException e) {
                     Debug.logWarning(e.toString(), module);
                 }
@@ -111,12 +110,12 @@
                 String otherRequestUri = responseValue.substring(17);
                 ControllerRequestArtifactInfo artInfo = this.aif.getControllerRequestArtifactInfo(controllerXmlUrl, otherRequestUri);
                 this.requestsThatAreResponsesToThisRequest.add(artInfo);
-                UtilMisc.addToSetInMap(this, this.aif.allRequestInfosReferringToRequest, artInfo.getUniqueId());
+                UtilMisc.addToSortedSetInMap(this, this.aif.allRequestInfosReferringToRequest, artInfo.getUniqueId());
             } else if (responseValue.startsWith("request-redirect-noparam:")) {
                 String otherRequestUri = responseValue.substring(25);
                 ControllerRequestArtifactInfo artInfo = this.aif.getControllerRequestArtifactInfo(controllerXmlUrl, otherRequestUri);
                 this.requestsThatAreResponsesToThisRequest.add(artInfo);
-                UtilMisc.addToSetInMap(this, this.aif.allRequestInfosReferringToRequest, artInfo.getUniqueId());
+                UtilMisc.addToSortedSetInMap(this, this.aif.allRequestInfosReferringToRequest, artInfo.getUniqueId());
             }
         }
     }

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java?rev=644386&r1=644385&r2=644386&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java Thu Apr  3 09:02:16 2008
@@ -70,7 +70,7 @@
                     this.screenCalledByThisView = this.aif.getScreenWidgetArtifactInfo(fullScreenName.substring(poundIndex+1), fullScreenName.substring(0, poundIndex));
                     if (this.screenCalledByThisView != null) {
                         // add the reverse association
-                        UtilMisc.addToSetInMap(this, aif.allViewInfosReferringToScreen, this.screenCalledByThisView.getUniqueId());
+                        UtilMisc.addToSortedSetInMap(this, aif.allViewInfosReferringToScreen, this.screenCalledByThisView.getUniqueId());
                     }
                 } catch (GeneralException e) {
                     Debug.logWarning(e.toString(), module);

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java?rev=644386&r1=644385&r2=644386&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java Thu Apr  3 09:02:16 2008
@@ -22,6 +22,7 @@
 import java.net.URL;
 import java.util.List;
 import java.util.Set;
+import java.util.TreeSet;
 
 import javolution.util.FastSet;
 
@@ -38,8 +39,8 @@
 public class EntityArtifactInfo extends ArtifactInfoBase {
     protected ModelEntity modelEntity;
     
-    protected Set<EntityArtifactInfo> entitiesRelatedOne = FastSet.newInstance();
-    protected Set<EntityArtifactInfo> entitiesRelatedMany = FastSet.newInstance();
+    protected Set<EntityArtifactInfo> entitiesRelatedOne = new TreeSet<EntityArtifactInfo>();
+    protected Set<EntityArtifactInfo> entitiesRelatedMany = new TreeSet<EntityArtifactInfo>();
     
     public EntityArtifactInfo(String entityName, ArtifactInfoFactory aif) throws GenericEntityException {
         super(aif);

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java?rev=644386&r1=644385&r2=644386&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java Thu Apr  3 09:02:16 2008
@@ -22,6 +22,7 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Set;
+import java.util.TreeSet;
 
 import javax.xml.parsers.ParserConfigurationException;
 
@@ -47,11 +48,11 @@
     protected String formName;
     protected String formLocation;
     
-    protected Set<EntityArtifactInfo> entitiesUsedInThisForm = FastSet.newInstance();
-    protected Set<ServiceArtifactInfo> servicesUsedInThisForm = FastSet.newInstance();
+    protected Set<EntityArtifactInfo> entitiesUsedInThisForm = new TreeSet<EntityArtifactInfo>();
+    protected Set<ServiceArtifactInfo> servicesUsedInThisForm = new TreeSet<ServiceArtifactInfo>();
     protected FormWidgetArtifactInfo formThisFormExtends = null;
-    protected Set<ControllerRequestArtifactInfo> requestsLinkedToInForm = FastSet.newInstance();
-    protected Set<ControllerRequestArtifactInfo> requestsTargetedByInForm = FastSet.newInstance();
+    protected Set<ControllerRequestArtifactInfo> requestsLinkedToInForm = new TreeSet<ControllerRequestArtifactInfo>();
+    protected Set<ControllerRequestArtifactInfo> requestsTargetedByInForm = new TreeSet<ControllerRequestArtifactInfo>();
     
     public FormWidgetArtifactInfo(String formName, String formLocation, ArtifactInfoFactory aif) throws GeneralException {
         super(aif);
@@ -96,7 +97,7 @@
             // the forward reference
             this.formThisFormExtends = aif.getFormWidgetArtifactInfo(formName);
             // the reverse reference
-            UtilMisc.addToSetInMap(this, aif.allFormInfosExtendingForm, formName);
+            UtilMisc.addToSortedSetInMap(this, aif.allFormInfosExtendingForm, formName);
         }
     }
     protected void populateUsedEntities() throws GeneralException {
@@ -117,7 +118,7 @@
             // the forward reference
             this.entitiesUsedInThisForm.add(aif.getEntityArtifactInfo(entityName));
             // the reverse reference
-            UtilMisc.addToSetInMap(this, aif.allFormInfosReferringToEntityName, entityName);
+            UtilMisc.addToSortedSetInMap(this, aif.allFormInfosReferringToEntityName, entityName);
         }
     }
     protected void populateUsedServices() throws GeneralException {
@@ -140,7 +141,7 @@
             // the forward reference
             this.servicesUsedInThisForm.add(aif.getServiceArtifactInfo(serviceName));
             // the reverse reference
-            UtilMisc.addToSetInMap(this, aif.allFormInfosReferringToServiceName, serviceName);
+            UtilMisc.addToSortedSetInMap(this, aif.allFormInfosReferringToServiceName, serviceName);
         }
     }
 
@@ -158,7 +159,7 @@
                 // the forward reference
                 this.requestsLinkedToInForm.add(aif.getControllerRequestArtifactInfo(UtilURL.fromUrlString(controllerXmlUrl), requestUri));
                 // the reverse reference
-                UtilMisc.addToSetInMap(this, aif.allFormInfosReferringToRequest, requestUniqueId);
+                UtilMisc.addToSortedSetInMap(this, aif.allFormInfosReferringToRequest, requestUniqueId);
             }
         }
     }
@@ -176,7 +177,7 @@
                 // the forward reference
                 this.requestsTargetedByInForm.add(aif.getControllerRequestArtifactInfo(UtilURL.fromUrlString(controllerXmlUrl), requestUri));
                 // the reverse reference
-                UtilMisc.addToSetInMap(this, aif.allFormInfosTargetingRequest, requestUniqueId);
+                UtilMisc.addToSortedSetInMap(this, aif.allFormInfosTargetingRequest, requestUniqueId);
             }
         }
     }

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java?rev=644386&r1=644385&r2=644386&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java Thu Apr  3 09:02:16 2008
@@ -22,6 +22,7 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Set;
+import java.util.TreeSet;
 
 import javax.xml.parsers.ParserConfigurationException;
 
@@ -48,10 +49,10 @@
     protected String screenName;
     protected String screenLocation;
     
-    protected Set<EntityArtifactInfo> entitiesUsedInThisScreen = FastSet.newInstance();
-    protected Set<ServiceArtifactInfo> servicesUsedInThisScreen = FastSet.newInstance();
-    protected Set<FormWidgetArtifactInfo> formsIncludedInThisScreen = FastSet.newInstance();
-    protected Set<ControllerRequestArtifactInfo> requestsLinkedToInScreen = FastSet.newInstance();
+    protected Set<EntityArtifactInfo> entitiesUsedInThisScreen = new TreeSet<EntityArtifactInfo>();
+    protected Set<ServiceArtifactInfo> servicesUsedInThisScreen = new TreeSet<ServiceArtifactInfo>();
+    protected Set<FormWidgetArtifactInfo> formsIncludedInThisScreen = new TreeSet<FormWidgetArtifactInfo>();
+    protected Set<ControllerRequestArtifactInfo> requestsLinkedToInScreen = new TreeSet<ControllerRequestArtifactInfo>();
     
     public ScreenWidgetArtifactInfo(String screenName, String screenLocation, ArtifactInfoFactory aif) throws GeneralException {
         super(aif);
@@ -97,7 +98,7 @@
             // the forward reference
             this.servicesUsedInThisScreen.add(aif.getServiceArtifactInfo(serviceName));
             // the reverse reference
-            UtilMisc.addToSetInMap(this, aif.allScreenInfosReferringToServiceName, serviceName);
+            UtilMisc.addToSortedSetInMap(this, aif.allScreenInfosReferringToServiceName, serviceName);
         }
     }
     protected void populateUsedEntities() throws GeneralException {
@@ -120,7 +121,7 @@
             // the forward reference
             this.entitiesUsedInThisScreen.add(aif.getEntityArtifactInfo(entityName));
             // the reverse reference
-            UtilMisc.addToSetInMap(this, aif.allScreenInfosReferringToEntityName, entityName);
+            UtilMisc.addToSortedSetInMap(this, aif.allScreenInfosReferringToEntityName, entityName);
         }
     }
     protected void populateIncludedForms() throws GeneralException {
@@ -144,7 +145,7 @@
             // the forward reference
             this.formsIncludedInThisScreen.add(aif.getFormWidgetArtifactInfo(formName));
             // the reverse reference
-            UtilMisc.addToSetInMap(this, aif.allScreenInfosReferringToForm, formName);
+            UtilMisc.addToSortedSetInMap(this, aif.allScreenInfosReferringToForm, formName);
         }
     }
     
@@ -162,7 +163,7 @@
                 // the forward reference
                 this.requestsLinkedToInScreen.add(aif.getControllerRequestArtifactInfo(UtilURL.fromUrlString(controllerXmlUrl), requestUri));
                 // the reverse reference
-                UtilMisc.addToSetInMap(this, aif.allScreenInfosReferringToRequest, requestUniqueId);
+                UtilMisc.addToSortedSetInMap(this, aif.allScreenInfosReferringToRequest, requestUniqueId);
             }
         }
     }

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java?rev=644386&r1=644385&r2=644386&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java Thu Apr  3 09:02:16 2008
@@ -26,6 +26,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeSet;
 
 import javolution.util.FastList;
 import javolution.util.FastMap;
@@ -57,9 +58,9 @@
     protected ModelService modelService;
     protected String displayPrefix = null;
     
-    Set<EntityArtifactInfo> entitiesUsedByThisService = FastSet.newInstance();
-    Set<ServiceArtifactInfo> servicesCalledByThisService = FastSet.newInstance();
-    Set<ServiceEcaArtifactInfo> serviceEcasTriggeredByThisService = FastSet.newInstance();
+    Set<EntityArtifactInfo> entitiesUsedByThisService = new TreeSet<EntityArtifactInfo>();
+    Set<ServiceArtifactInfo> servicesCalledByThisService = new TreeSet<ServiceArtifactInfo>();
+    Set<ServiceEcaArtifactInfo> serviceEcasTriggeredByThisService = new TreeSet<ServiceEcaArtifactInfo>();
     
     public ServiceArtifactInfo(String serviceName, ArtifactInfoFactory aif) throws GeneralException {
         super(aif);
@@ -133,7 +134,7 @@
             // the forward reference
             this.entitiesUsedByThisService.add(aif.getEntityArtifactInfo(entityName));
             // the reverse reference
-            UtilMisc.addToSetInMap(this, aif.allServiceInfosReferringToEntityName, entityName);
+            UtilMisc.addToSortedSetInMap(this, aif.allServiceInfosReferringToEntityName, entityName);
         }
     }
     
@@ -206,7 +207,7 @@
             // the forward reference
             this.servicesCalledByThisService.add(aif.getServiceArtifactInfo(serviceName));
             // the reverse reference
-            UtilMisc.addToSetInMap(this, aif.allServiceInfosReferringToServiceName, serviceName);
+            UtilMisc.addToSortedSetInMap(this, aif.allServiceInfosReferringToServiceName, serviceName);
         }
     }
     
@@ -218,7 +219,7 @@
             for (ServiceEcaRule ecaRule: ecaRuleList) {
                 this.serviceEcasTriggeredByThisService.add(aif.getServiceEcaArtifactInfo(ecaRule));
                 // the reverse reference
-                UtilMisc.addToSetInMap(this, aif.allServiceInfosReferringToServiceEcaRule, ecaRule);
+                UtilMisc.addToSortedSetInMap(this, aif.allServiceInfosReferringToServiceEcaRule, ecaRule);
             }
         }
     }

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java?rev=644386&r1=644385&r2=644386&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java Thu Apr  3 09:02:16 2008
@@ -23,6 +23,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeSet;
 
 import javolution.util.FastList;
 import javolution.util.FastMap;
@@ -43,7 +44,7 @@
     protected String displayPrefix = null;
     protected int displaySuffixNum = 0;
     
-    protected Set<ServiceArtifactInfo> servicesCalledByThisServiceEca = FastSet.newInstance();
+    protected Set<ServiceArtifactInfo> servicesCalledByThisServiceEca = new TreeSet<ServiceArtifactInfo>();
     
     public ServiceEcaArtifactInfo(ServiceEcaRule serviceEcaRule, ArtifactInfoFactory aif) throws GeneralException {
         super(aif);
@@ -59,7 +60,7 @@
         // populate the services called Set
         for (ServiceEcaAction ecaAction: serviceEcaRule.getEcaActionList()) {
             servicesCalledByThisServiceEca.add(aif.getServiceArtifactInfo(ecaAction.getServiceName()));
-            UtilMisc.addToSetInMap(this, aif.allServiceEcaInfosReferringToServiceName, ecaAction.getServiceName());
+            UtilMisc.addToSortedSetInMap(this, aif.allServiceEcaInfosReferringToServiceName, ecaAction.getServiceName());
         }
     }