svn commit: r634192 - in /ofbiz/trunk/framework: service/src/org/ofbiz/service/eca/ServiceEcaRule.java webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r634192 - in /ofbiz/trunk/framework: service/src/org/ofbiz/service/eca/ServiceEcaRule.java webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java webtools/src/org/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java

jonesde
Author: jonesde
Date: Thu Mar  6 00:34:45 2008
New Revision: 634192

URL: http://svn.apache.org/viewvc?rev=634192&view=rev
Log:
Fixed issue with format of output, colons aren't good in filenames; fixed issue where triggering ecas weren't getting registered

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaRule.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/service/src/org/ofbiz/service/eca/ServiceEcaRule.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaRule.java?rev=634192&r1=634191&r2=634192&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaRule.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaRule.java Thu Mar  6 00:34:45 2008
@@ -85,6 +85,14 @@
         return this.serviceName + ":" + this.eventName;
     }
     
+    public String getServiceName() {
+        return this.serviceName;
+    }
+    
+    public String getEventName() {
+        return this.eventName;
+    }
+    
     public List<ServiceEcaAction> getEcaActionList() {
         List<ServiceEcaAction> actionList = FastList.newInstance();
         for (Object actionOrSet: this.actionsAndSets) {

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=634192&r1=634191&r2=634192&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 Mar  6 00:34:45 2008
@@ -296,6 +296,9 @@
         List<ServiceArtifactInfo> allServiceList = FastList.newInstance();
         List<ServiceEcaArtifactInfo> allServiceEcaList = FastList.newInstance();
         
+        // make sure that any prefix that might have been set on this is cleared
+        this.setDisplayPrefix("");
+        
         // put this service in the master list
         allDiagramEntitiesWithPrefixes.add(this.modelService.name);
         
@@ -304,7 +307,7 @@
         if (callingServiceSet != null) {
             // set the prefix and add to the all list
             for (ServiceArtifactInfo callingService: callingServiceSet) {
-                callingService.setDisplayPrefix("Calling:");
+                callingService.setDisplayPrefix("Calling_");
                 allDiagramEntitiesWithPrefixes.add(callingService.getDisplayPrefixedName());
                 allServiceList.add(callingService);
             }
@@ -312,18 +315,29 @@
         
         // all services this service calls
         Set<ServiceArtifactInfo> calledServiceSet = this.getServicesCalledByService();
-        
         for (ServiceArtifactInfo calledService: calledServiceSet) {
-            calledService.setDisplayPrefix("Called:");
+            calledService.setDisplayPrefix("Called_");
             allDiagramEntitiesWithPrefixes.add(calledService.getDisplayPrefixedName());
             allServiceList.add(calledService);
         }
         
+        Map<String, Integer> displaySuffixNumByEcaName = FastMap.newInstance();
+        
         // all SECAs and triggering services that call this service as an action
         Set<ServiceEcaArtifactInfo> callingServiceEcaSet = this.getServiceEcaRulesCallingService();
         if (callingServiceEcaSet != null) {
             for (ServiceEcaArtifactInfo callingServiceEca: callingServiceEcaSet) {
-                callingServiceEca.setDisplayPrefix("Triggering:");
+                callingServiceEca.setDisplayPrefix("Triggering_");
+                
+                Integer displaySuffix = displaySuffixNumByEcaName.get(callingServiceEca.getDisplayPrefixedName());
+                if (displaySuffix == null) {
+                    displaySuffix = 1;
+                } else {
+                    displaySuffix++;
+                }
+                displaySuffixNumByEcaName.put(callingServiceEca.getDisplayPrefixedName(), displaySuffix);
+                callingServiceEca.setDisplaySuffixNum(displaySuffix);
+                
                 allDiagramEntitiesWithPrefixes.add(callingServiceEca.getDisplayPrefixedName());
                 allServiceEcaList.add(callingServiceEca);
             }
@@ -331,9 +345,18 @@
 
         // all SECAs and corresponding services triggered by this service
         Set<ServiceEcaArtifactInfo> calledServiceEcaSet = this.getServiceEcaRulesTriggeredByService();
-        
         for (ServiceEcaArtifactInfo calledServiceEca: calledServiceEcaSet) {
-            calledServiceEca.setDisplayPrefix("Called:");
+            calledServiceEca.setDisplayPrefix("Triggered_");
+            
+            Integer displaySuffix = displaySuffixNumByEcaName.get(calledServiceEca.getDisplayPrefixedName());
+            if (displaySuffix == null) {
+                displaySuffix = 1;
+            } else {
+                displaySuffix++;
+            }
+            displaySuffixNumByEcaName.put(calledServiceEca.getDisplayPrefixedName(), displaySuffix);
+            calledServiceEca.setDisplaySuffixNum(displaySuffix);
+            
             allDiagramEntitiesWithPrefixes.add(calledServiceEca.getDisplayPrefixedName());
             allServiceEcaList.add(calledServiceEca);
         }
@@ -353,7 +376,7 @@
         
         // write this service description file
         Map<String, Object> thisServiceEoModelMap = createEoModelMap(callingServiceSet, calledServiceSet, callingServiceEcaSet, calledServiceEcaSet, useMoreDetailedNames);
-        UtilPlist.writePlistFile(thisServiceEoModelMap, eomodeldFullPath, this.getDisplayPrefixedName() + ".plist", true);
+        UtilPlist.writePlistFile(thisServiceEoModelMap, eomodeldFullPath, this.modelService.name + ".plist", true);
 
         // write service description files
         for (ServiceArtifactInfo callingService: callingServiceSet) {

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=634192&r1=634191&r2=634192&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 Mar  6 00:34:45 2008
@@ -27,6 +27,7 @@
 import javolution.util.FastSet;
 
 import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.service.eca.ServiceEcaAction;
 import org.ofbiz.service.eca.ServiceEcaCondition;
 import org.ofbiz.service.eca.ServiceEcaRule;
@@ -38,6 +39,7 @@
     protected ArtifactInfoFactory aif;
     protected ServiceEcaRule serviceEcaRule;
     protected String displayPrefix = null;
+    protected int displaySuffixNum = 0;
     
     protected Set<ServiceArtifactInfo> servicesCalledByThisServiceEca = FastSet.newInstance();
     
@@ -55,6 +57,7 @@
         // populate the services called Set
         for (ServiceEcaAction ecaAction: serviceEcaRule.getEcaActionList()) {
             servicesCalledByThisServiceEca.add(aif.getServiceArtifactInfo(ecaAction.getServiceName()));
+            UtilMisc.addToSetInMap(this, aif.allServiceEcaInfosReferringToServiceName, ecaAction.getServiceName());
         }
     }
     
@@ -66,8 +69,12 @@
         this.displayPrefix = displayPrefix;
     }
     
+    public void setDisplaySuffixNum(int displaySuffixNum) {
+        this.displaySuffixNum = displaySuffixNum;
+    }
+    
     public String getDisplayPrefixedName() {
-        return (this.displayPrefix != null ? this.displayPrefix : "") + this.serviceEcaRule.getShortDisplayName();
+        return (this.displayPrefix != null ? this.displayPrefix : "") + this.serviceEcaRule.getServiceName() + "_" + this.serviceEcaRule.getEventName() + "_" + displaySuffixNum;
     }
     
     public Set<ServiceArtifactInfo> getServicesCalledByServiceEcaActions() {