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 2007/09/18 12:04:52 UTC

svn commit: r576815 - in /ofbiz/trunk/framework/service: dtd/service-eca.xsd src/org/ofbiz/service/ServiceDispatcher.java src/org/ofbiz/service/eca/ServiceEcaAction.java

Author: jonesde
Date: Tue Sep 18 03:04:50 2007
New Revision: 576815

URL: http://svn.apache.org/viewvc?rev=576815&view=rev
Log:
Added global-commit-post-run event that gets a context after the service and eca rules run

Modified:
    ofbiz/trunk/framework/service/dtd/service-eca.xsd
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java

Modified: ofbiz/trunk/framework/service/dtd/service-eca.xsd
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/dtd/service-eca.xsd?rev=576815&r1=576814&r2=576815&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/dtd/service-eca.xsd (original)
+++ ofbiz/trunk/framework/service/dtd/service-eca.xsd Tue Sep 18 03:04:50 2007
@@ -46,8 +46,9 @@
         <xs:attribute name="event" use="required">
             <xs:simpleType>
                 <xs:restriction base="xs:token">
-                    <xs:enumeration value="global-commit"/>
-                    <xs:enumeration value="global-rollback"/>
+                    <xs:enumeration value="global-commit"><xs:annotation><xs:documentation>Runs when the transaction the service is running in is successfully committed.</xs:documentation></xs:annotation></xs:enumeration>
+                    <xs:enumeration value="global-commit-post-run"><xs:annotation><xs:documentation>Like global-commit, but gets its context post/after the run of the service and all non-global ECA rules.</xs:documentation></xs:annotation></xs:enumeration>
+                    <xs:enumeration value="global-rollback"><xs:annotation><xs:documentation>Runs when the transaction the service is running in is rolled back.</xs:documentation></xs:annotation></xs:enumeration>
                     <xs:enumeration value="auth"/>
                     <xs:enumeration value="in-validate"/>
                     <xs:enumeration value="out-validate"/>

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java?rev=576815&r1=576814&r2=576815&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java Tue Sep 18 03:04:50 2007
@@ -472,6 +472,9 @@
                 isFailure = ServiceUtil.isFailure(result);
                 isError = ServiceUtil.isError(result);
                 
+                // global-commit-post-run ECA, like global-commit but gets the context after the service is run
+                if (eventMap != null) ServiceEcaUtil.evalRules(modelService.name, eventMap, "global-commit-post-run", ctx, ecaContext, result, isError, isFailure);
+                
                 // check for failure and log on info level; this is used for debugging
                 if (isFailure) {
                     Debug.logWarning("Service Failure [" + modelService.name + "]: " + ServiceUtil.getErrorMessage(result), module);

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java?rev=576815&r1=576814&r2=576815&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java Tue Sep 18 03:04:50 2007
@@ -89,6 +89,8 @@
                 xaw.setRollbackService(serviceName, context, "async".equals(serviceMode), persist); // using the actual context so we get updates
             } else if (eventName.equals("global-commit")) {
                 xaw.setCommitService(serviceName, context, "async".equals(serviceMode), persist);   // using the actual context so we get updates
+            } else if (eventName.equals("global-commit-post-run")) {
+                xaw.setCommitService(serviceName, context, "async".equals(serviceMode), persist);   // using the actual context so we get updates
             }
             try {
                 xaw.enlist();