Author: jonesde
Date: Thu Aug 2 16:10:09 2007
New Revision: 562284
URL:
http://svn.apache.org/viewvc?view=rev&rev=562284Log:
A change and a note for future change related to receiving duplicate messages
Modified:
ofbiz/trunk/specialpurpose/oagis/script/org/ofbiz/oagis/OagisMessageServices.xml
ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java
Modified: ofbiz/trunk/specialpurpose/oagis/script/org/ofbiz/oagis/OagisMessageServices.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/script/org/ofbiz/oagis/OagisMessageServices.xml?view=diff&rev=562284&r1=562283&r2=562284==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/script/org/ofbiz/oagis/OagisMessageServices.xml (original)
+++ ofbiz/trunk/specialpurpose/oagis/script/org/ofbiz/oagis/OagisMessageServices.xml Thu Aug 2 16:10:09 2007
@@ -24,6 +24,14 @@
<simple-method method-name="createOagisMessageInfo" short-description="Create MessageInfo">
<make-value entity-name="OagisMessageInfo" value-name="newEntity"/>
<set-pk-fields map-name="parameters" value-name="newEntity" />
+
+ <!-- make sure it doesn't already exist: motivation: if it already exists we'll get a HUGE error message on the create with the whole XML file in it if debug is on for that, so we want a smaller error message -->
+ <find-by-primary-key map-name="newEntity" value-name="currentOagisMessageInfo"/>
+ <if-not-empty field-name="currentOagisMessageInfo">
+ <add-error><fail-message message="This message was already received, ie we have a duplicate combined ID for the message: ${newEntity}"/></add-error>
+ <check-errors/>
+ </if-not-empty>
+
<set-nonpk-fields map-name="parameters" value-name="newEntity"/>
<create-value value-name="newEntity"/>
<!--if-compare value="1" field-name="newEntity.confirmation" operator="equals" type="Integer">
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?view=diff&rev=562284&r1=562283&r2=562284==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java Thu Aug 2 16:10:09 2007
@@ -370,6 +370,8 @@
String bsrVerb = UtilXml.childElementValue(bsrElement, "of:VERB");
String bsrNoun = UtilXml.childElementValue(bsrElement, "of:NOUN");
+ // TODO: before dispatching the message, make sure the combined ID (primary of OagisMessageInfo entity) is not in the database, ie hasn't been received already
+
if (bsrVerb.equalsIgnoreCase("CONFIRM") && bsrNoun.equalsIgnoreCase("BOD")) {
try {
serviceResult = dispatcher.runSync("receiveConfirmBod", UtilMisc.toMap("document",doc));