svn commit: r572843 - in /ofbiz/trunk/specialpurpose/oagis: entitydef/entitymodel.xml servicedef/services.xml src/org/ofbiz/oagis/OagisServices.java src/org/ofbiz/oagis/OagisShipmentServices.java webapp/oagis/WEB-INF/controller.xml

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

svn commit: r572843 - in /ofbiz/trunk/specialpurpose/oagis: entitydef/entitymodel.xml servicedef/services.xml src/org/ofbiz/oagis/OagisServices.java src/org/ofbiz/oagis/OagisShipmentServices.java webapp/oagis/WEB-INF/controller.xml

jonesde
Author: jonesde
Date: Tue Sep  4 17:26:20 2007
New Revision: 572843

URL: http://svn.apache.org/viewvc?rev=572843&view=rev
Log:
Fixed issues with receive Confirm BOD messages, including putting SHIPREQEUST in the db instead of SHIPREQES which was put in before to comply with the OAGIS spec of 10 characters for that field; also issue with including userLogin in the find OagisMessageInfo query, so cleaned up that code; also renamed receiveConfirmBod to be like others, oagisReceiveConfirmBod

Modified:
    ofbiz/trunk/specialpurpose/oagis/entitydef/entitymodel.xml
    ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml
    ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java
    ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java
    ofbiz/trunk/specialpurpose/oagis/webapp/oagis/WEB-INF/controller.xml

Modified: ofbiz/trunk/specialpurpose/oagis/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/entitydef/entitymodel.xml?rev=572843&r1=572842&r2=572843&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/specialpurpose/oagis/entitydef/entitymodel.xml Tue Sep  4 17:26:20 2007
@@ -43,7 +43,7 @@
     <entity entity-name="OagisMessageInfo" package-name="org.ofbiz.specialpurpose.oagis" title="OAGIS Message Info Entity">
         <field name="logicalId" type="very-short"><!-- CNTROLAREA -> SENDER -> LOGICALID; max 10 chars --></field>
         <field name="component" type="very-short"><!-- CNTROLAREA -> SENDER -> COMPONENT; max 10 chars --></field>
-        <field name="task" type="short-varchar"><!-- CNTROLAREA -> SENDER -> TASK; max 10 chars --></field>
+        <field name="task" type="short-varchar"><!-- CNTROLAREA -> SENDER -> TASK; max 10 chars; note that using short-varchar instead of very-short so we can have longer fields in the DB --></field>
         <field name="referenceId" type="id-long-ne">
             <!-- CNTROLAREA -> SENDER -> REFERENCEID; max 40 chars in spec; for messages sent from OFBiz this will be a
                 sequenced ID and be unique on its own; for messages from other systems this may only be unique relative

Modified: ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml?rev=572843&r1=572842&r2=572843&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml (original)
+++ ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml Tue Sep  4 17:26:20 2007
@@ -85,8 +85,8 @@
         <attribute name="errorMapList" type="java.util.List" mode="IN" optional="true"/>
         <attribute name="origRefId" type="String" mode="IN" optional="true"/>
     </service>
-    <service name="receiveConfirmBod" engine="java" transaction-timeout="300"
-        location="org.ofbiz.oagis.OagisServices" invoke="receiveConfirmBod" auth="true">
+    <service name="oagisReceiveConfirmBod" engine="java" transaction-timeout="300"
+        location="org.ofbiz.oagis.OagisServices" invoke="oagisReceiveConfirmBod" auth="true">
         <description>Process incoming ConfirmBod</description>
         <implements service="oagisMessageIdOutInterface"/>
         <attribute name="document" type="org.w3c.dom.Document" mode="IN" optional="false"/>

Modified: ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java?rev=572843&r1=572842&r2=572843&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java Tue Sep  4 17:26:20 2007
@@ -236,7 +236,7 @@
         return ServiceUtil.returnSuccess("Service Completed Successfully");
     }
 
-    public static Map receiveConfirmBod(DispatchContext ctx, Map context) {
+    public static Map oagisReceiveConfirmBod(DispatchContext ctx, Map context) {
         GenericDelegator delegator = ctx.getDelegator();
         LocalDispatcher dispatcher = ctx.getDispatcher();
         Document doc = (Document) context.get("document");
@@ -285,11 +285,10 @@
           
         Timestamp receivedTimestamp = UtilDateTime.nowTimestamp();
         
+        Map omiPkMap = UtilMisc.toMap("logicalId", logicalId, "component", component, "task", task, "referenceId", referenceId);
+
         Map oagisMsgInfoCtx = FastMap.newInstance();
-        oagisMsgInfoCtx.put("logicalId", logicalId);
-        oagisMsgInfoCtx.put("component", component);
-        oagisMsgInfoCtx.put("task", task);
-        oagisMsgInfoCtx.put("referenceId", referenceId);
+        oagisMsgInfoCtx.putAll(omiPkMap);
         oagisMsgInfoCtx.put("authId", authId);
         oagisMsgInfoCtx.put("receivedDate", receivedTimestamp);
         oagisMsgInfoCtx.put("sentDate", sentTimestamp);
@@ -321,16 +320,10 @@
             }
             */
 
-            Map originalOagisMsgCtx = FastMap.newInstance();
-            originalOagisMsgCtx.put("logicalId", dataAreaLogicalId);
-            originalOagisMsgCtx.put("component", dataAreaComponent);
-            originalOagisMsgCtx.put("task", dataAreaTask);
-            originalOagisMsgCtx.put("referenceId", dataAreaReferenceId);
-            originalOagisMsgCtx.put("userLogin", userLogin);
-              
-            GenericValue originalOagisMsgInfo = delegator.findByPrimaryKey("OagisMessageInfo", originalOagisMsgCtx);
-            
             List dataAreaConfirmMsgList = UtilXml.childElementList(dataAreaConfirmElement, "ns:CONFIRMMSG");
+
+            Map originalOmiPkMap = UtilMisc.toMap("logicalId", dataAreaLogicalId, "component", dataAreaComponent, "task", dataAreaTask, "referenceId", dataAreaReferenceId);
+            GenericValue originalOagisMsgInfo = delegator.findByPrimaryKey("OagisMessageInfo", originalOmiPkMap);
             if (originalOagisMsgInfo != null) {
                 Iterator dataAreaConfirmMsgListItr = dataAreaConfirmMsgList.iterator();
                 while (dataAreaConfirmMsgListItr.hasNext()) {
@@ -339,10 +332,12 @@
                     String reasonCode = UtilXml.childElementValue(dataAreaConfirmMsgElement, "of:REASONCODE");
                     
                     Map createOagisMessageErrorInfoForOriginal = FastMap.newInstance();
-                    createOagisMessageErrorInfoForOriginal.putAll(originalOagisMsgCtx);
+                    createOagisMessageErrorInfoForOriginal.putAll(originalOmiPkMap);
                     createOagisMessageErrorInfoForOriginal.put("reasonCode", reasonCode);
                     createOagisMessageErrorInfoForOriginal.put("description", description);
+                    createOagisMessageErrorInfoForOriginal.put("userLogin", userLogin);
                 
+                    // this will run in the same transaction
                     Map oagisMsgErrorInfoResult = dispatcher.runSync("createOagisMessageErrorInfo", createOagisMessageErrorInfoForOriginal);
                     if (ServiceUtil.isError(oagisMsgErrorInfoResult)) {
                         String errMsg = "Error creating OagisMessageErrorInfo: " + ServiceUtil.getErrorMessage(oagisMsgErrorInfoResult);
@@ -351,18 +346,12 @@
                     }
                 }
             } else {
-                String errMsg = "No such message with an error was found; Not creating OagisMessageErrorInfo record(s) for original message; ID info: " + originalOagisMsgCtx;
+                String errMsg = "No such message with an error was found; Not creating OagisMessageErrorInfo record(s) for original message, but saving info for this message anyway; ID info: " + omiPkMap;
                 Debug.logWarning(errMsg, module);
                 errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "OriginalOagisMessageInfoNotFoundError"));
             }
 
             // now attach all of the messages to the CBOD OagisMessageInfo record
-            Map cbodOagisMsgInfoBaseCtx = FastMap.newInstance();
-            cbodOagisMsgInfoBaseCtx.put("logicalId", logicalId);
-            cbodOagisMsgInfoBaseCtx.put("component", component);
-            cbodOagisMsgInfoBaseCtx.put("task", task);
-            cbodOagisMsgInfoBaseCtx.put("referenceId", referenceId);
-            cbodOagisMsgInfoBaseCtx.put("userLogin", userLogin);
             Iterator dataAreaConfirmMsgListItr = dataAreaConfirmMsgList.iterator();
             while (dataAreaConfirmMsgListItr.hasNext()) {
                 Element dataAreaConfirmMsgElement = (Element) dataAreaConfirmMsgListItr.next();
@@ -370,9 +359,10 @@
                 String reasonCode = UtilXml.childElementValue(dataAreaConfirmMsgElement, "of:REASONCODE");
                 
                 Map createOagisMessageErrorInfoForCbod = FastMap.newInstance();
-                createOagisMessageErrorInfoForCbod.putAll(cbodOagisMsgInfoBaseCtx);
+                createOagisMessageErrorInfoForCbod.putAll(omiPkMap);
                 createOagisMessageErrorInfoForCbod.put("reasonCode", reasonCode);
                 createOagisMessageErrorInfoForCbod.put("description", description);
+                createOagisMessageErrorInfoForCbod.put("userLogin", userLogin);
 
                 // this one will also go in another transaction as the create service for the base record did too
                 Map oagisMsgErrorInfoResult = dispatcher.runSync("createOagisMessageErrorInfo", createOagisMessageErrorInfoForCbod, 60, true);
@@ -555,10 +545,10 @@
         
         if (bsrVerb.equalsIgnoreCase("CONFIRM") && bsrNoun.equalsIgnoreCase("BOD")) {
             try {
-                // subServiceResult = dispatcher.runSync("receiveConfirmBod", messageProcessContext);
-                dispatcher.runAsync("receiveConfirmBod", messageProcessContext, true);
+                // subServiceResult = dispatcher.runSync("oagisReceiveConfirmBod", messageProcessContext);
+                dispatcher.runAsync("oagisReceiveConfirmBod", messageProcessContext, true);
             } catch (GenericServiceException e) {
-                String errMsg = "Error running service receiveConfirmBod: " + e.toString();
+                String errMsg = "Error running service oagisReceiveConfirmBod: " + e.toString();
                 errorList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericServiceException"));
                 Debug.logError(e, errMsg, module);
             }

Modified: ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java?rev=572843&r1=572842&r2=572843&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java Tue Sep  4 17:26:20 2007
@@ -728,7 +728,7 @@
                 // prepare map to Create Oagis Message Info
                 comiCtx.put("processingStatusId", "OAGMP_TRIGGERED");
                 comiCtx.put("component", "INVENTORY");
-                comiCtx.put("task", "SHIPREQUES"); // Actual value of task is "SHIPREQUEST" which is more than 10 char
+                comiCtx.put("task", "SHIPREQUEST"); // Actual value of task is "SHIPREQUEST" which is more than 10 char, need this in the db so it will match Confirm BODs, etc
                 comiCtx.put("outgoingMessage", "Y");
                 comiCtx.put("confirmation", "1");
                 comiCtx.put("bsrVerb", "PROCESS");

Modified: ofbiz/trunk/specialpurpose/oagis/webapp/oagis/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/webapp/oagis/WEB-INF/controller.xml?rev=572843&r1=572842&r2=572843&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/webapp/oagis/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/oagis/webapp/oagis/WEB-INF/controller.xml Tue Sep  4 17:26:20 2007
@@ -187,9 +187,9 @@
         <response name="success" type="none"/>
     </request-map>
 
-    <request-map uri="receiveConfirmBod">
+    <request-map uri="oagisReceiveConfirmBod">
         <security https="true" auth="false"/>
-        <event type="stream" invoke="receiveConfirmBod"/>
+        <event type="stream" invoke="oagisReceiveConfirmBod"/>
         <response name="success" type="none"/>
     </request-map>