svn commit: r634523 - in /ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo: ServiceArtifactInfo.java 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: r634523 - in /ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo: ServiceArtifactInfo.java ServiceEcaArtifactInfo.java

jonesde
Author: jonesde
Date: Thu Mar  6 20:07:02 2008
New Revision: 634523

URL: http://svn.apache.org/viewvc?rev=634523&view=rev
Log:
A few misc improvements to skip internal service params, use filename safe chars, check nulls

Modified:
    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/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=634523&r1=634522&r2=634523&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 20:07:02 2008
@@ -379,13 +379,17 @@
         UtilPlist.writePlistFile(thisServiceEoModelMap, eomodeldFullPath, this.modelService.name + ".plist", true);
 
         // write service description files
-        for (ServiceArtifactInfo callingService: callingServiceSet) {
-            Map<String, Object> serviceEoModelMap = callingService.createEoModelMap(null, UtilMisc.toSet(this), null, null, useMoreDetailedNames);
-            UtilPlist.writePlistFile(serviceEoModelMap, eomodeldFullPath, callingService.getDisplayPrefixedName() + ".plist", true);
+        if (callingServiceSet != null) {
+            for (ServiceArtifactInfo callingService: callingServiceSet) {
+                Map<String, Object> serviceEoModelMap = callingService.createEoModelMap(null, UtilMisc.toSet(this), null, null, useMoreDetailedNames);
+                UtilPlist.writePlistFile(serviceEoModelMap, eomodeldFullPath, callingService.getDisplayPrefixedName() + ".plist", true);
+            }
         }
-        for (ServiceArtifactInfo calledService: calledServiceSet) {
-            Map<String, Object> serviceEoModelMap = calledService.createEoModelMap(UtilMisc.toSet(this), null, null, null, useMoreDetailedNames);
-            UtilPlist.writePlistFile(serviceEoModelMap, eomodeldFullPath, calledService.getDisplayPrefixedName() + ".plist", true);
+        if (calledServiceSet != null) {
+            for (ServiceArtifactInfo calledService: calledServiceSet) {
+                Map<String, Object> serviceEoModelMap = calledService.createEoModelMap(UtilMisc.toSet(this), null, null, null, useMoreDetailedNames);
+                UtilPlist.writePlistFile(serviceEoModelMap, eomodeldFullPath, calledService.getDisplayPrefixedName() + ".plist", true);
+            }
         }
         
         // write SECA description files
@@ -394,24 +398,26 @@
                 // add List<ServiceArtifactInfo> for services that trigger this eca rule
                 Set<ServiceArtifactInfo> ecaCallingServiceSet = callingServiceEca.getServicesTriggeringServiceEca();
                 for (ServiceArtifactInfo ecaCallingService: ecaCallingServiceSet) {
-                    ecaCallingService.setDisplayPrefix("Triggering:");
+                    ecaCallingService.setDisplayPrefix("Triggering_");
                 }
                 ecaCallingServiceSet.add(this);
                 
-                Map<String, Object> serviceEcaEoModelMap = callingServiceEca.createEoModelMap(ecaCallingServiceSet, useMoreDetailedNames);
+                Map<String, Object> serviceEcaEoModelMap = callingServiceEca.createEoModelMap(ecaCallingServiceSet, null, useMoreDetailedNames);
                 UtilPlist.writePlistFile(serviceEcaEoModelMap, eomodeldFullPath, callingServiceEca.getDisplayPrefixedName() + ".plist", true);
             }
         }
-        for (ServiceEcaArtifactInfo calledServiceEca: calledServiceEcaSet) {
-            // add List<ServiceArtifactInfo> for services this eca rule calls in action
-            Set<ServiceArtifactInfo> ecaCalledServiceSet = calledServiceEca.getServicesCalledByServiceEcaActions();
-            for (ServiceArtifactInfo ecaCalledService: ecaCalledServiceSet) {
-                ecaCalledService.setDisplayPrefix("Called:");
+        if (calledServiceEcaSet != null) {
+            for (ServiceEcaArtifactInfo calledServiceEca: calledServiceEcaSet) {
+                // add List<ServiceArtifactInfo> for services this eca rule calls in action
+                Set<ServiceArtifactInfo> ecaCalledServiceSet = calledServiceEca.getServicesCalledByServiceEcaActions();
+                for (ServiceArtifactInfo ecaCalledService: ecaCalledServiceSet) {
+                    ecaCalledService.setDisplayPrefix("Triggered_");
+                }
+                ecaCalledServiceSet.add(this);
+                
+                Map<String, Object> serviceEcaEoModelMap = calledServiceEca.createEoModelMap(null, ecaCalledServiceSet, useMoreDetailedNames);
+                UtilPlist.writePlistFile(serviceEcaEoModelMap, eomodeldFullPath, calledServiceEca.getDisplayPrefixedName() + ".plist", true);
             }
-            ecaCalledServiceSet.add(this);
-            
-            Map<String, Object> serviceEcaEoModelMap = calledServiceEca.createEoModelMap(ecaCalledServiceSet, useMoreDetailedNames);
-            UtilPlist.writePlistFile(serviceEcaEoModelMap, eomodeldFullPath, calledServiceEca.getDisplayPrefixedName() + ".plist", true);
         }
     }
 
@@ -429,6 +435,9 @@
         List<String> classPropertiesList = FastList.newInstance();
         topLevelMap.put("classProperties", classPropertiesList);
         for (ModelParam param: this.modelService.getModelParamList()) {
+            // skip the internal parameters, very redundant in the diagrams
+            if (param.internal) continue;
+            
             if (useMoreDetailedNames) {
                 classPropertiesList.add(param.getShortDisplayDescription());
             } else {

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=634523&r1=634522&r2=634523&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 20:07:02 2008
@@ -85,8 +85,9 @@
         return aif.allServiceInfosReferringToServiceEcaRule.get(this.serviceEcaRule);
     }
 
-    public Map<String, Object> createEoModelMap(Set<ServiceArtifactInfo> relatedServiceSet, boolean useMoreDetailedNames) {
-        if (relatedServiceSet == null) relatedServiceSet = FastSet.newInstance();
+    public Map<String, Object> createEoModelMap(Set<ServiceArtifactInfo> triggeringServiceSet, Set<ServiceArtifactInfo> triggeredServiceSet, boolean useMoreDetailedNames) {
+        if (triggeringServiceSet == null) triggeringServiceSet = FastSet.newInstance();
+        if (triggeredServiceSet == null) triggeredServiceSet = FastSet.newInstance();
         Map<String, Object> topLevelMap = FastMap.newInstance();
 
         topLevelMap.put("name", this.getDisplayPrefixedName());
@@ -129,19 +130,23 @@
         // relationships
         List<Map<String, Object>> relationshipsMapList = FastList.newInstance();
         
-        for (ServiceArtifactInfo sai: relatedServiceSet) {
+        for (ServiceArtifactInfo sai: triggeringServiceSet) {
             Map<String, Object> relationshipMap = FastMap.newInstance();
             relationshipsMapList.add(relationshipMap);
             
             relationshipMap.put("name", sai.getDisplayPrefixedName());
             relationshipMap.put("destination", sai.getDisplayPrefixedName());
+            relationshipMap.put("isToMany", "N");
+            relationshipMap.put("isMandatory", "Y");
+        }
+        for (ServiceArtifactInfo sai: triggeredServiceSet) {
+            Map<String, Object> relationshipMap = FastMap.newInstance();
+            relationshipsMapList.add(relationshipMap);
             
-            // not sure if we can use these, or need them, for this type of diagram
-            //relationshipMap.put("isToMany", "N");
-            //relationshipMap.put("joinSemantic", "EOInnerJoin");
-            //relationshipMap.put("joins", joinsMapList);
-            //joinsMap.put("sourceAttribute", keyMap.getFieldName());
-            //joinsMap.put("destinationAttribute", keyMap.getRelFieldName());
+            relationshipMap.put("name", sai.getDisplayPrefixedName());
+            relationshipMap.put("destination", sai.getDisplayPrefixedName());
+            relationshipMap.put("isToMany", "Y");
+            relationshipMap.put("isMandatory", "Y");
         }
         
         if (relationshipsMapList.size() > 0) {