svn commit: r633364 - in /ofbiz/trunk/framework: service/src/org/ofbiz/service/ModelService.java webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java

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

svn commit: r633364 - in /ofbiz/trunk/framework: service/src/org/ofbiz/service/ModelService.java webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java

jonesde
Author: jonesde
Date: Mon Mar  3 21:04:54 2008
New Revision: 633364

URL: http://svn.apache.org/viewvc?rev=633364&view=rev
Log:
Fixed a couple of things, fleshed out a little more data gathering for artifact info

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java?rev=633364&r1=633363&r2=633364&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java Mon Mar  3 21:04:54 2008
@@ -18,44 +18,57 @@
  *******************************************************************************/
 package org.ofbiz.service;
 
-import java.util.*;
-import java.lang.reflect.Method;
-import java.lang.reflect.Field;
 import java.io.Serializable;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.AbstractMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.TimeZone;
+import java.util.TreeSet;
 
-import javax.wsdl.*;
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.soap.SOAPAddress;
 import javax.wsdl.extensions.soap.SOAPBinding;
 import javax.wsdl.extensions.soap.SOAPBody;
 import javax.wsdl.extensions.soap.SOAPOperation;
-import javax.wsdl.extensions.soap.SOAPAddress;
 import javax.wsdl.factory.WSDLFactory;
 import javax.xml.namespace.QName;
 
 import javolution.util.FastList;
 import javolution.util.FastMap;
 
-import com.ibm.wsdl.extensions.soap.SOAPBindingImpl;
-import com.ibm.wsdl.extensions.soap.SOAPBodyImpl;
-import com.ibm.wsdl.extensions.soap.SOAPOperationImpl;
-import com.ibm.wsdl.extensions.soap.SOAPAddressImpl;
-
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.ObjectType;
 import org.ofbiz.base.util.UtilDateTime;
+import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.entity.model.ModelField;
-import org.ofbiz.entity.model.ModelFieldType;
-import org.ofbiz.entity.model.ModelFieldTypeReader;
-import org.ofbiz.entity.model.ModelKeyMap;
-import org.ofbiz.entity.model.ModelRelation;
 import org.ofbiz.service.group.GroupModel;
 import org.ofbiz.service.group.GroupServiceModel;
 import org.ofbiz.service.group.ServiceGroupReader;
-
 import org.w3c.dom.Document;
+
+import com.ibm.wsdl.extensions.soap.SOAPAddressImpl;
+import com.ibm.wsdl.extensions.soap.SOAPBindingImpl;
+import com.ibm.wsdl.extensions.soap.SOAPBodyImpl;
+import com.ibm.wsdl.extensions.soap.SOAPOperationImpl;
 
 /**
  * Generic Service Model Class

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java?rev=633364&r1=633363&r2=633364&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java Mon Mar  3 21:04:54 2008
@@ -60,36 +60,42 @@
     
     public Map<String, EntityArtifactInfo> allEntityInfos = FastMap.newInstance();
     public Map<String, ServiceArtifactInfo> allServiceInfos = FastMap.newInstance();
+    public Map<ServiceEcaRule, ServiceEcaArtifactInfo> allServiceEcaInfos = FastMap.newInstance();
     public Map<String, FormWidgetArtifactInfo> allFormInfos = FastMap.newInstance();
     public Map<String, ScreenWidgetArtifactInfo> allScreenInfos = FastMap.newInstance();
 
     // reverse-associative caches for walking backward in the diagram
     public Map<String, Set<ServiceEcaArtifactInfo>> allServiceEcaInfosReferringToServiceName = FastMap.newInstance();
     public Map<String, Set<ServiceArtifactInfo>> allServiceInfosReferringToServiceName = FastMap.newInstance();
+    public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosReferringToServiceName = FastMap.newInstance();
+    public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToServiceName = FastMap.newInstance();
+    
     public Map<String, Set<ServiceArtifactInfo>> allServiceInfosReferringToEntityName = FastMap.newInstance();
-    public Map<String, Set<ServiceArtifactInfo>> allFormInfosReferringToServiceName = FastMap.newInstance();
-    public Map<String, Set<ServiceArtifactInfo>> allFormInfosReferringToEntityName = FastMap.newInstance();
-    public Map<String, Set<ServiceArtifactInfo>> allScreenInfosReferringToServiceName = FastMap.newInstance();
-    public Map<String, Set<ServiceArtifactInfo>> allScreenInfosReferringToEntityName = FastMap.newInstance();
+    public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosReferringToEntityName = FastMap.newInstance();
+    public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToEntityName = FastMap.newInstance();
+
+    public Map<ServiceEcaRule, Set<ServiceArtifactInfo>> allServiceInfosReferringToServiceEcaRule = FastMap.newInstance();
     
-    public static ArtifactInfoFactory makeArtifactInfoFactory(String delegatorName) throws GenericEntityException {
+    public static ArtifactInfoFactory makeArtifactInfoFactory(String delegatorName) throws GeneralException {
         if (UtilValidate.isEmpty(delegatorName)) {
             delegatorName = "default";
         }
         
-        ArtifactInfoFactory aic = artifactInfoFactoryCache.get(delegatorName);
-        if (aic == null) {
-            aic = new ArtifactInfoFactory(delegatorName);
+        ArtifactInfoFactory aif = artifactInfoFactoryCache.get(delegatorName);
+        if (aif == null) {
+            aif = new ArtifactInfoFactory(delegatorName);
         }
-        return aic;
+        return aif;
     }
     
-    protected ArtifactInfoFactory(String delegatorName) throws GenericEntityException {
+    protected ArtifactInfoFactory(String delegatorName) throws GeneralException {
         this.delegatorName = delegatorName;
         this.entityModelReader = ModelReader.getModelReader(delegatorName);
         this.dispatchContext = new DispatchContext("ArtifactInfoDispCtx", null, this.getClass().getClassLoader(), null);
         this.entityEcaCache = EntityEcaUtil.getEntityEcaCache(EntityEcaUtil.getEntityEcaReaderName(delegatorName));
         this.serviceEcaCache = ServiceEcaUtil.ecaCache;
+        
+        this.prepareAll();
     }
     
     public void prepareAll() throws GeneralException {
@@ -103,7 +109,7 @@
             this.getServiceArtifactInfo(serviceName);
         }
         
-        // TODO: how to get all Service ECAs to prepare?
+        // how to get all Service ECAs to prepare? don't worry about it, will be populated from service load, ie all ECAs for each service
         
         // TODO: how to get all forms to prepare?
         
@@ -148,6 +154,15 @@
         if (curInfo == null) {
             curInfo = new ServiceArtifactInfo(serviceName, this);
             this.allServiceInfos.put(serviceName, curInfo);
+        }
+        return curInfo;
+    }
+    
+    public ServiceEcaArtifactInfo getServiceEcaArtifactInfo(ServiceEcaRule ecaRule) throws GeneralException {
+        ServiceEcaArtifactInfo curInfo = this.allServiceEcaInfos.get(ecaRule);
+        if (curInfo == null) {
+            curInfo = new ServiceEcaArtifactInfo(ecaRule, this);
+            this.allServiceEcaInfos.put(ecaRule, curInfo);
         }
         return curInfo;
     }

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=633364&r1=633363&r2=633364&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 Mon Mar  3 21:04:54 2008
@@ -32,9 +32,10 @@
 import org.ofbiz.base.util.UtilFormatOut;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.ModelParam;
 import org.ofbiz.service.ModelService;
+import org.ofbiz.service.eca.ServiceEcaRule;
+import org.ofbiz.service.eca.ServiceEcaUtil;
 
 /**
  *
@@ -96,9 +97,16 @@
         }
     }
     
-    protected void populateTriggeredServiceEcas() {
-        // TODO populate serviceEcasTriggeredByThisService and for each the reverse-associate cache in the aif
-        
+    protected void populateTriggeredServiceEcas() throws GeneralException {
+        // populate serviceEcasTriggeredByThisService and for each the reverse-associate cache in the aif
+        Map<String, List<ServiceEcaRule>> serviceEventMap = ServiceEcaUtil.getServiceEventMap(this.modelService.name);
+        for (List<ServiceEcaRule> ecaRuleList: serviceEventMap.values()) {
+            for (ServiceEcaRule ecaRule: ecaRuleList) {
+                this.serviceEcasTriggeredByThisService.add(aif.getServiceEcaArtifactInfo(ecaRule));
+                // the reverse reference
+                UtilMisc.addToSetInMap(this, aif.allServiceInfosReferringToServiceEcaRule, ecaRule);
+            }
+        }
     }
     
     public ModelService getModelService() {