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/01 02:52:30 UTC
svn commit: r571662 - in /ofbiz/trunk/specialpurpose/oagis: data/
src/org/ofbiz/oagis/ webapp/oagis/message/
Author: jonesde
Date: Fri Aug 31 17:52:29 2007
New Revision: 571662
URL: http://svn.apache.org/viewvc?rev=571662&view=rev
Log:
A few things for more robust error handling based on some recent errors seen
Modified:
ofbiz/trunk/specialpurpose/oagis/data/OagisTypeData.xml
ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java
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/message/ProcessShipment.ftl
Modified: ofbiz/trunk/specialpurpose/oagis/data/OagisTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/data/OagisTypeData.xml?rev=571662&r1=571661&r2=571662&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/data/OagisTypeData.xml (original)
+++ ofbiz/trunk/specialpurpose/oagis/data/OagisTypeData.xml Fri Aug 31 17:52:29 2007
@@ -23,6 +23,7 @@
<StatusItem description="In Message Received" sequenceId="01" statusCode="RECEIVED" statusId="OAGMP_RECEIVED" statusTypeId="OAGIS_MP_STATUS"/>
<StatusItem description="In Processed - Success" sequenceId="05" statusCode="PROC_SUCCESS" statusId="OAGMP_PROC_SUCCESS" statusTypeId="OAGIS_MP_STATUS"/>
<StatusItem description="In Processed - Error" sequenceId="06" statusCode="PROC_ERROR" statusId="OAGMP_PROC_ERROR" statusTypeId="OAGIS_MP_STATUS"/>
+ <StatusItem description="In Processed - System Error" sequenceId="07" statusCode="SYS_ERROR" statusId="OAGMP_SYS_ERROR" statusTypeId="OAGIS_MP_STATUS"/>
<StatusItem description="Error Confirm Sent" sequenceId="09" statusCode="ERRCONFSENT" statusId="OAGMP_ERRCONFSENT" statusTypeId="OAGIS_MP_STATUS"/>
<StatusItem description="Out Message Triggered" sequenceId="11" statusCode="TRIGGERED" statusId="OAGMP_TRIGGERED" statusTypeId="OAGIS_MP_STATUS"/>
@@ -36,11 +37,12 @@
<StatusValidChange condition="" statusId="OAGMP_RECEIVED" statusIdTo="OAGMP_PROC_SUCCESS" transitionName="Processing Succeeded"/>
<StatusValidChange condition="" statusId="OAGMP_RECEIVED" statusIdTo="OAGMP_PROC_ERROR" transitionName="Processing Errored"/>
+ <StatusValidChange condition="" statusId="OAGMP_RECEIVED" statusIdTo="OAGMP_SYS_ERROR" transitionName="Processing System Error"/>
<StatusValidChange condition="" statusId="OAGMP_PROC_ERROR" statusIdTo="OAGMP_ERRCONFSENT" transitionName="Error Confirm Sent"/>
<!-- this transition is to restart and re-process failed incoming messages -->
<StatusValidChange condition="" statusId="OAGMP_PROC_ERROR" statusIdTo="OAGMP_RECEIVED" transitionName="Error Recoved to Received"/>
+ <StatusValidChange condition="" statusId="OAGMP_SYS_ERROR" statusIdTo="OAGMP_RECEIVED" transitionName="Error Recoved to Received"/>
<StatusValidChange condition="" statusId="OAGMP_ERRCONFSENT" statusIdTo="OAGMP_RECEIVED" transitionName="Error Recoved to Received"/>
-
<StatusValidChange condition="" statusId="OAGMP_TRIGGERED" statusIdTo="OAGMP_OGEN_SUCCESS" transitionName="Out Generation Succeeded"/>
<StatusValidChange condition="" statusId="OAGMP_TRIGGERED" statusIdTo="OAGMP_OGEN_ERROR" transitionName="Out Generation Errored"/>
Modified: ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java?rev=571662&r1=571661&r2=571662&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java Fri Aug 31 17:52:29 2007
@@ -1292,7 +1292,8 @@
String inventoryItemTypeId = "NON_SERIAL_INV_ITEM";
uiiCtx.put("inventoryItemTypeId", inventoryItemTypeId);
- // TODO: somehow do status changes for non-serialized inventory
+ // TODO: later somehow do status changes for non-serialized inventory
+
}
}
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=571662&r1=571661&r2=571662&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java Fri Aug 31 17:52:29 2007
@@ -506,14 +506,15 @@
// call async, no additional results to return: Map subServiceResult = FastMap.newInstance();
if (UtilValidate.isNotEmpty(oagisMessageInfo)) {
if ("OAGMP_PROC_ERROR".equals(oagisMessageInfo.getString("processingStatusId")) ||
- "OAGMP_ERRCONFSENT".equals(oagisMessageInfo.getString("processingStatusId"))) {
+ "OAGMP_ERRCONFSENT".equals(oagisMessageInfo.getString("processingStatusId")) ||
+ "OAGMP_SYS_ERROR".equals(oagisMessageInfo.getString("processingStatusId"))) {
// there was an error last time, tell the service this is a retry
messageProcessContext.put("isErrorRetry", Boolean.TRUE);
} else {
String responseMsg = "Message already received with ID: " + oagisMessageInfoKey;
Debug.logError(responseMsg, module);
- List errorMapList = UtilMisc.toList(UtilMisc.toMap("reasonCode", "MessageAlreadyReceive", "description", responseMsg));
+ List errorMapList = UtilMisc.toList(UtilMisc.toMap("reasonCode", "MessageAlreadyReceived", "description", responseMsg));
Map sendConfirmBodCtx = FastMap.newInstance();
sendConfirmBodCtx.put("logicalId", logicalId);
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=571662&r1=571661&r2=571662&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java Fri Aug 31 17:52:29 2007
@@ -125,12 +125,37 @@
Element dataAreaElement = UtilXml.firstChildElement(showShipmentElement, "ns:DATAAREA"); // n
Element daShowShipmentElement = UtilXml.firstChildElement(dataAreaElement, "ns:SHOW_SHIPMENT"); // n
Element shipmentElement = UtilXml.firstChildElement(daShowShipmentElement, "ns:SHIPMENT"); // n
- String shipmentId = UtilXml.childElementValue(shipmentElement, "of:DOCUMENTID"); // of
+ String shipmentId = UtilXml.childElementValue(shipmentElement, "of:DOCUMENTID"); // of
+
+ // always log this to make messages easier to find
+ Debug.log("Processing oagisReceiveShowShipment for shipmentId [" + shipmentId + "] referenceId [" + referenceId + "]", module);
+
+ Map omiPkMap = UtilMisc.toMap("logicalId", logicalId, "component", component, "task", task, "referenceId", referenceId);
+
+ // before getting into this check to see if we've tried once and had an error, if so set isErrorRetry even if it wasn't passed in
+ GenericValue previousOagisMessageInfo = null;
+ try {
+ previousOagisMessageInfo = delegator.findByPrimaryKey("OagisMessageInfo", omiPkMap);
+ } catch (GenericEntityException e) {
+ String errMsg = "Error getting OagisMessageInfo from database for shipment ID [" + shipmentId + "]: " + e.toString();
+ Debug.logInfo(e, errMsg, module);
+ // anything else to do about this? we don't really want to send the error back or anything...
+ }
+
+ if (previousOagisMessageInfo != null) {
+ if ("OAGMP_PROC_ERROR".equals(previousOagisMessageInfo.getString("processingStatusId")) ||
+ "OAGMP_ERRCONFSENT".equals(previousOagisMessageInfo.getString("processingStatusId")) ||
+ "OAGMP_SYS_ERROR".equals(previousOagisMessageInfo.getString("processingStatusId"))) {
+ isErrorRetry = true;
+ } else {
+ // message already in the db, but is not in an error state...
+ String errMsg = "Message received for shipmentId [" + shipmentId + "] was already partially processed but is not in an error state, needs manual review; message ID: " + omiPkMap;
+ Debug.logError(errMsg, module);
+ return ServiceUtil.returnError(errMsg);
+ }
+ }
- oagisMsgInfoCtx.put("logicalId", logicalId);
- oagisMsgInfoCtx.put("component", component);
- oagisMsgInfoCtx.put("task", task);
- oagisMsgInfoCtx.put("referenceId", referenceId);
+ oagisMsgInfoCtx.putAll(omiPkMap);
oagisMsgInfoCtx.put("confirmation", confirmation);
oagisMsgInfoCtx.put("authId", authId);
oagisMsgInfoCtx.put("outgoingMessage", "N");
@@ -163,7 +188,7 @@
}
*/
} catch (GenericServiceException e) {
- String errMsg = "Error creating OagisMessageInfo for the Incoming Message: "+e.toString();
+ String errMsg = "Error creating OagisMessageInfo for the Incoming Message: " + e.toString();
// don't pass this back, nothing they can do about it: errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericServiceException"));
Debug.logError(e, errMsg, module);
}
@@ -172,7 +197,7 @@
try {
shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
} catch (GenericEntityException e) {
- String errMsg = "Error getting Shipment from database: " + e.toString();
+ String errMsg = "Error getting Shipment from database for ID [" + shipmentId + "]: " + e.toString();
Debug.logInfo(e, errMsg, module);
errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericEntityException"));
}
@@ -480,7 +505,15 @@
TransactionUtil.setRollbackOnly("Found business level errors in message processing, not saving results", null);
}
} catch (Throwable t) {
- String errMsg = "System Error processing Show Shipment message: " + t.toString();
+ try {
+ oagisMsgInfoCtx.put("processingStatusId", "OAGMP_SYS_ERROR");
+ dispatcher.runSync("updateOagisMessageInfo", oagisMsgInfoCtx, 60, true);
+ } catch (GenericServiceException e) {
+ String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString();
+ Debug.logError(e, errMsg, module);
+ }
+
+ String errMsg = "System Error processing Show Shipment message for shipmentId [" + shipmentId + "]: " + t.toString();
Debug.logInfo(t, errMsg, module);
// in this case we don't want to return a Confirm BOD, so return an error now
return ServiceUtil.returnError(errMsg);
@@ -734,7 +767,11 @@
String emailString = orderReadHelper.getOrderEmailString();
bodyParameters.put("emailString", emailString);
String contactMechId = shipment.getString("destinationTelecomNumberId");
+
GenericValue telecomNumber = delegator.findByPrimaryKey("TelecomNumber", UtilMisc.toMap("contactMechId", contactMechId));
+ if (telecomNumber == null) {
+ return ServiceUtil.returnError("In Send ProcessShipment Telecom number not found for orderId [" + orderId + "]");
+ }
bodyParameters.put("telecomNumber", telecomNumber);
orderItemShipGroup = EntityUtil.getFirst(delegator.findByAnd("OrderItemShipGroup", UtilMisc.toMap("orderId", orderId)));
Modified: ofbiz/trunk/specialpurpose/oagis/webapp/oagis/message/ProcessShipment.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/webapp/oagis/message/ProcessShipment.ftl?rev=571662&r1=571661&r2=571662&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/webapp/oagis/message/ProcessShipment.ftl (original)
+++ ofbiz/trunk/specialpurpose/oagis/webapp/oagis/message/ProcessShipment.ftl Fri Aug 31 17:52:29 2007
@@ -79,7 +79,9 @@
<of:FAX></of:FAX>
<of:POSTALCODE>${address.postalCode?if_exists}</of:POSTALCODE>
<of:STATEPROVN>${address.stateProvinceGeoId?if_exists}</of:STATEPROVN>
+ <#if telecomNumber?has_content>
<of:TELEPHONE><#if telecomNumber.countryCode?has_content>${telecomNumber.countryCode}-</#if>${telecomNumber.areaCode?if_exists}-${telecomNumber.contactNumber?if_exists}</of:TELEPHONE>
+ </#if>
</os:ADDRESS>
<os:CONTACT>
<#-- NOTE: this is the attention name -->