You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mr...@apache.org on 2011/01/25 20:52:12 UTC
svn commit: r1063427 - in /ofbiz/trunk/specialpurpose/oagis:
config/OagisUiLabels.xml src/org/ofbiz/oagis/OagisInventoryServices.java
src/org/ofbiz/oagis/OagisServices.java
src/org/ofbiz/oagis/OagisShipmentServices.java
Author: mrisaliti
Date: Tue Jan 25 19:52:12 2011
New Revision: 1063427
URL: http://svn.apache.org/viewvc?rev=1063427&view=rev
Log:
Internationalization of java services for oagis component (OFBIZ-4091)
Modified:
ofbiz/trunk/specialpurpose/oagis/config/OagisUiLabels.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
Modified: ofbiz/trunk/specialpurpose/oagis/config/OagisUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/config/OagisUiLabels.xml?rev=1063427&r1=1063426&r2=1063427&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/config/OagisUiLabels.xml (original)
+++ ofbiz/trunk/specialpurpose/oagis/config/OagisUiLabels.xml Tue Jan 25 19:52:12 2011
@@ -158,6 +158,74 @@
<value xml:lang="th">à¹à¸à¹à¹à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸à¸à¸à¹à¸à¸à¸§à¸²à¸¡</value>
<value xml:lang="zh">ç¼è¾æ¶æ¯ä¿¡æ¯</value>
</property>
+ <property key="OagisErrorBusinessLevel">
+ <value xml:lang="en">Found business level errors in message processing, not saving those changes but saving error messages; first error is: ${errorString}</value>
+ <value xml:lang="it">Trovato livello di business errori nel messaggio, non salvati questi cambiamenti ma salvando trovati messaggi di errore; prima errore è: ${errorString}</value>
+ </property>
+ <property key="OagisErrorFindOagisMessageInfo">
+ <value xml:lang="en">Could not find OagisMessageInfo record with key ${oagisMessageInfoKey}, not returning message.</value>
+ <value xml:lang="it">Non è possibile trovare il record di OagisMessageInfo con la chiave ${oagisMessageInfoKey}, non restituito messaggio.</value>
+ </property>
+ <property key="OagisErrorMessageAlreadyProcessed">
+ <value xml:lang="en">Message received for shipmentId ${shipmentId} message ID ${omiPkMap} was already partially processed but is not in a system error state, needs manual review; message ID: ${omiPkMap}</value>
+ <value xml:lang="it">Messaggio ricevuto per la spedizione ${shipmentId} messagggio ID ${omiPkMap} era già parzialmente eseguito ma non è in uno stato di errore di sistema, necessaria revisione manuale; messaggio ID: ${omiPkMap}</value>
+ </property>
+ <property key="OagisErrorNotFoundFullMessageXml">
+ <value xml:lang="en">There was no fullMessageXml text in OagisMessageInfo record with key ${oagisMessageInfoKey}, not returning message.</value>
+ <value xml:lang="it">Non c'è nessun testo fullMessageXml nel record di OagisMessageInfo con la chiave ${oagisMessageInfoKey}, non restituito messaggio.</value>
+ </property>
+ <property key="OagisErrorDeliveryMessage">
+ <value xml:lang="en">For Acknowledge Delivery message could not determine if it is for a PO or RMA or Status Change. DOCTYPE from message is ${docType}, DISPOSITN is ${disposition}</value>
+ <value xml:lang="it">Per il messaggio Acknowledge Delivery non è possibile determinare se questo è dovuto ad un PO o RMA o ad un cambio di stato. DOCTYPE dal messaggio è ${docType}, DISPOSITN è ${disposition}</value>
+ </property>
+ <property key="OagisErrorDeliveryMessagePO">
+ <value xml:lang="en">System Error processing Acknowledge Delivery PO message for message ${omiPkMap}: </value>
+ <value xml:lang="it">System Error processing Acknowledge Delivery PO message for message ${omiPkMap}: </value>
+ </property>
+ <property key="OagisErrorParsingMessage">
+ <value xml:lang="en">Unable to parse received message</value>
+ <value xml:lang="it">Non è possibile fare il parsing del messaggio ricevuto</value>
+ </property>
+ <property key="OagisErrorParsingXMLMessage">
+ <value xml:lang="en">Was able to receive and parse the XML message, but BSR->NOUN ${bsrNoun} and/or BSR->VERB ${bsrVerb} are empty</value>
+ <value xml:lang="it">E' possibile ricevere e parsing il messaggio XML, ma BSR->NOUN ${bsrNoun} e/o BSR->VERB ${bsrVerb} sono vuoti</value>
+ </property>
+ <property key="OagisErrorPostingMessage">
+ <value xml:lang="en">Error posting message to server with URL ${sendToUrl}: ${errorString}</value>
+ <value xml:lang="it">Errore durante il post del messaggio al server con URL ${sendToUrl}: ${errorString}</value>
+ </property>
+ <property key="OagisErrorReceivingAgainMessage">
+ <value xml:lang="en">Error trying to re-receive message with ID ${oagisMessageInfoKey}</value>
+ <value xml:lang="it">Errore tentando di ricevere nuovamente il messaggio con ID ${oagisMessageInfoKey}</value>
+ </property>
+ <property key="OagisErrorSavingMessage">
+ <value xml:lang="en">Error saving message to file ${saveToFilename}: ${errorString}</value>
+ <value xml:lang="it">Errore durante il salvataggio del messaggio sul file ${saveToFilename}: ${errorString}</value>
+ </property>
+ <property key="OagisErrorSendingInformations">
+ <value xml:lang="en">No send to information pass (url, file, or out stream)</value>
+ <value xml:lang="it">Nessuna informazione da inviare passa (url, file, o out stream)</value>
+ </property>
+ <property key="OagisErrorOagisSendProcessShipment">
+ <value xml:lang="en">Error calling oagisSendProcessShipment service for orders with items no longer on backorder: ${errorString}</value>
+ <value xml:lang="it">Errore durante l'esecuzione del servizio oagisSendProcessShipment per gli ordini con righe non più in backorder: ${errorString}</value>
+ </property>
+ <property key="OagisErrorMessageShowShipment">
+ <value xml:lang="en">System Error processing Show Shipment message for shipmentId ${shipmentId} message ${omiPkMap}: </value>
+ <value xml:lang="it">Errore di sistema eseguendo il messaggio Show Shipment per la spedizione ${shipmentId} messaggio ${omiPkMap}: </value>
+ </property>
+ <property key="OagisErrorProcessShipment">
+ <value xml:lang="en">System Error doing Process Shipment message for orderId ${orderId} shipmentId ${shipmentId} message ${omiPkMap}: </value>
+ <value xml:lang="it">Errore di sistema eseguendo il messaggio Process Shipment per l'ordine ${orderId} spedizione ${shipmentId} messaggio ${omiPkMap}: </value>
+ </property>
+ <property key="OagisErrorUnknownMessageType">
+ <value xml:lang="en">Unknown Message Type Received, verb/noun combination not supported: verb=${bsrVerb}, noun=${bsrNoun}</value>
+ <value xml:lang="it">Tipo messaggio ricevuto sconosciuto, verb/noun combinazione non supportata: verb=${bsrVerb}, noun=${bsrNoun}</value>
+ </property>
+ <property key="OagisErrorWritingMessage">
+ <value xml:lang="en">Error writing message to output stream: ${errorString}</value>
+ <value xml:lang="it">Errore scrivendo messaggio sullo stream di output: ${errorString}</value>
+ </property>
<property key="OagisErrorInCreatingDataForOagisMessageInfoEntity">
<value xml:lang="en">Error in creating data for OagisMessageInfo Entity</value>
<value xml:lang="fr">Erreur à la création de la date pour l'entité OagisMessageInfo</value>
@@ -172,6 +240,46 @@
<value xml:lang="th">à¸à¸´à¸à¸à¸¥à¸²à¸à¹à¸à¸à¸²à¸£à¸ªà¹à¸à¸à¸à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¸à¸²à¸à¸«à¸à¹à¸²à¸à¸</value>
<value xml:lang="zh">ä»å±å¹å¯¼åºæ¶æ¯æ¶åºé</value>
</property>
+ <property key="OagisErrorLookupByReferenceError">
+ <value xml:lang="en">Looked up by referenceId because logicalId, component, or task were not passed in but found more than one ${messageSize} record with referenceId ${referenceId}</value>
+ <value xml:lang="it">Ricerca per referenceId perchè logicalId, componente, o compito non passato ma trovato più di ${messageSize} record con referenceId ${referenceId}</value>
+ </property>
+ <property key="OagisErrorMessage">
+ <value xml:lang="en">Error rendering message: ${errorString}</value>
+ <value xml:lang="it">Errore rendering messaggio: ${errorString}</value>
+ </property>
+ <property key="OagisErrorProcessingConfirmBOD">
+ <value xml:lang="en">System Error processing Confirm BOD message: ${errorString}</value>
+ <value xml:lang="it">Errore di sistema eseguendo la conferma BOD messaggio: ${errorString}</value>
+ </property>
+ <property key="OagisErrorProcessingMessage">
+ <value xml:lang="en">Errors found processing message; information saved and return error sent back</value>
+ <value xml:lang="it">Errori trovati eseguendo il messaggio; informazione salvata ed errore restituito indietro</value>
+ </property>
+ <property key="OagisErrorProcessingSyncInventory">
+ <value xml:lang="en">System Error processing Sync Inventory message: ${errorString}</value>
+ <value xml:lang="it">Errore di sistema processando il messaggio di Sync Inventory message: ${errorString}/value>
+ </property>
+ <property key="OagisErrorReceivingDeliveryMessageReturn">
+ <value xml:lang="en">System Error doing Receive Delivery message for returnId ${returnId} orderId ${orderId} message ${omiPkMap}: </value>
+ <value xml:lang="it">Errore di sistema durante la ricezione messaggio di consegna per il reso ${returnId} ordine ${orderId} messaggio ${omiPkMap}: </value>
+ </property>
+ <property key="OagisFoundExistingMessage">
+ <value xml:lang="en">Found existing message info(s) in OAGMP_OGEN_SUCCESS, so not sending Process Shipment message for order ${orderId} existing message(s) are: </value>
+ <value xml:lang="it">Trovati informazioni messaggi esistenti in OAGMP_OGEN_SUCCESS, così nessun messaggio inviato Process Shipment message per l'ordine ${orderId} messaggi esistenti sono: </value>
+ </property>
+ <property key="OagisFoundExistingMessageSent">
+ <value xml:lang="en">Found existing message info(s) in OAGMP_SENT status, so not sending Process Shipment message for order ${orderId} existing message(s) are: </value>
+ <value xml:lang="it">Trovati informazioni messaggi esistenti in stato OAGMP_SENT, così nessun messaggio inviato Process Shipment message per l'ordine ${orderId} messaggi esistenti sono: </value>
+ </property>
+ <property key="OagisFoundExistingMessageForReturn">
+ <value xml:lang="en">Found existing message info(s) in OAGMP_OGEN_SUCCESS, so not sending Receive Delivery message for return ${returnId} existing message(s) are: </value>
+ <value xml:lang="it">Trovati informazioni messaggi esistenti in stato OAGMP_OGEN_SUCCESS, così nessun invio di messaggio Receive Delivery per il reso ${returnId} messaggi esistenti sono: </value>
+ </property>
+ <property key="OagisFoundExistingMessageForReturnSent">
+ <value xml:lang="en">Found existing message info(s) in OAGMP_SENT, so not sending Receive Delivery message for return ${returnId} existing message(s) are: </value>
+ <value xml:lang="it">Trovati informazioni messaggi esistenti in stato OAGMP_SENT, così nessun invio di messaggio Receive Delivery per il reso ${returnId} messaggi esistenti sono: </value>
+ </property>
<property key="OagisInventoryDescription">
<value xml:lang="en">Inventory Description</value>
<value xml:lang="fr">Description de stock</value>
@@ -246,6 +354,54 @@
<value xml:lang="th">à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¹à¸«à¸¡à¹</value>
<value xml:lang="zh">æ°å»ºæ¶æ¯ä¿¡æ¯</value>
</property>
+ <property key="OagisOrderIdNotASalesOrder">
+ <value xml:lang="en">OrderHeader not a sales order (SALES_ORDER) with ID ${orderId}</value>
+ <value xml:lang="it">Testata ordine non è un'ordine di vendita (SALES_ORDER) ${orderId}</value>
+ </property>
+ <property key="OagisOrderIdNotFound">
+ <value xml:lang="en">Could not find OrderHeader with ID ${orderId}</value>
+ <value xml:lang="it">Non è possibile trovare la testata ordine ${orderId}</value>
+ </property>
+ <property key="OagisOrderIdNotInApprovedStatus">
+ <value xml:lang="en">OrderHeader not in the approved status (ORDER_APPROVED) with ID ${orderId}, is in the ${orderStatusId} status</value>
+ <value xml:lang="it">Testata ordine non in stato approvato (ORDER_APPROVED) ${orderId}, è in stato ${orderStatusId}</value>
+ </property>
+ <property key="OagisOrderIdNotTelecomNumberFound">
+ <value xml:lang="en">In Send ProcessShipment Telecom number not found for orderId ${orderId}</value>
+ <value xml:lang="it">Nell'invio di ProcessShipment il numero di telefono non è stato trovato per l'ordine ${orderId}</value>
+ </property>
+ <property key="OagisOrderIdNotValidStore">
+ <value xml:lang="en">Order ${orderId} placed is not for valid Store(s)</value>
+ <value xml:lang="it">Ordine ${orderId} non è valido per il negozio</value>
+ </property>
+ <property key="OagisOrderIdPaymentNotAuthorized">
+ <value xml:lang="en">No authorized payment available, not sending Process Shipment</value>
+ <value xml:lang="it">Nessun pagamento disponibile autorizzato, non inviato Process Shipment</value>
+ </property>
+ <property key="OagisOrderIdWithShipment">
+ <value xml:lang="en">Not sending Process Shipment message because found Shipment that is already being processed, is in status ${statusId}</value>
+ <value xml:lang="it">Non inviato messaggio Process Shipment perchè trovata spedizione che è già stata eseguita, è in stato ${statusId}</value>
+ </property>
+ <property key="OagisOrderIdWithoutShippingAddress">
+ <value xml:lang="en">Cannot send Process Shipment for order ${orderId}, it has no shipping address.</value>
+ <value xml:lang="it">Non è possibile inviare Process Shipment per l'ordine ${orderId}, questo non ha un'indirizzo di spedizione.</value>
+ </property>
+ <property key="OagisReturnIdNotFound">
+ <value xml:lang="en">Could not find Return with ID ${returnId}</value>
+ <value xml:lang="it">Non è possibile trovare la testata reso ${returnId}</value>
+ </property>
+ <property key="OagisReturnIdNotValid">
+ <value xml:lang="en">No valid Order with ${orderId} found, cannot process Return</value>
+ <value xml:lang="it">Nessun ordine valido ${orderId} trovato, non è possibile eseguire il reso</value>
+ </property>
+ <property key="OagisReturnIdNotInAcceptedStatus">
+ <value xml:lang="en">Return with ID ${returnId} no in accepted status (RETURN_ACCEPTED)</value>
+ <value xml:lang="it">Reso ${returnId} non è in stato accettato (RETURN_ACCEPTED)</value>
+ </property>
+ <property key="OagisServiceCompletedSuccessfully">
+ <value xml:lang="en">Service Completed Successfully</value>
+ <value xml:lang="it">Servizio completato con successo</value>
+ </property>
<property key="OagisQuantityDiff">
<value xml:lang="en">Qty Difference</value>
<value xml:lang="fr">Différence en Qté </value>
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=1063427&r1=1063426&r2=1063427&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java Tue Jan 25 19:52:12 2011
@@ -54,16 +54,14 @@ import org.w3c.dom.Element;
public class OagisInventoryServices {
public static final String module = OagisInventoryServices.class.getName();
-
+ public static final String resource = "OagisUiLabels";
public static final Double doubleZero = new Double(0.0);
public static final Double doubleOne = new Double(1.0);
-
public static final String syncInventoryFacilityId = UtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.SyncInventoryFacilityId");
public static Map<String, Object> oagisReceiveSyncInventory(DispatchContext ctx, Map<String, Object> context) {
Document doc = (Document) context.get("document");
boolean isErrorRetry = Boolean.TRUE.equals(context.get("isErrorRetry"));
-
Delegator delegator = ctx.getDelegator();
LocalDispatcher dispatcher = ctx.getDispatcher();
Locale locale = (Locale) context.get("locale");
@@ -285,10 +283,9 @@ public class OagisInventoryServices {
Debug.logImportant("No sendTo email address found in process oagisReceiveSyncInventory service: inventoryMapList: " + inventoryMapList, module);
}
} catch (Throwable t) {
- String errMsg = "System Error processing Sync Inventory message: " + t.toString();
- Debug.logInfo(t, errMsg, module);
+ Debug.logInfo(t, "System Error processing Sync Inventory message: " + t.toString(), module);
// in this case we don't want to return a Confirm BOD, so return an error now
- return ServiceUtil.returnError(errMsg);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorProcessingSyncInventory", UtilMisc.toMap("errorString", t.toString()), locale));
}
}
@@ -337,7 +334,7 @@ public class OagisInventoryServices {
}
// return success here so that the message won't be retried and the Confirm BOD, etc won't be sent multiple times
- result.putAll(ServiceUtil.returnSuccess("Errors found processing message; information saved and return error sent back"));
+ result.putAll(ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisErrorProcessingMessage", locale)));
return result;
} else {
try {
@@ -350,14 +347,14 @@ public class OagisInventoryServices {
}
}
- result.putAll(ServiceUtil.returnSuccess("Service Completed Successfully"));
+ result.putAll(ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisServiceCompletedSuccessfully", locale)));
return result;
}
public static Map<String, Object> oagisReceiveAcknowledgeDeliveryPo(DispatchContext ctx, Map<String, Object> context) {
Document doc = (Document) context.get("document");
boolean isErrorRetry = Boolean.TRUE.equals(context.get("isErrorRetry"));
-
+ Locale locale = (Locale) context.get("locale");
LocalDispatcher dispatcher = ctx.getDispatcher();
Delegator delegator = ctx.getDelegator();
List<Map<String, String>> errorMapList = FastList.newInstance();
@@ -414,9 +411,8 @@ public class OagisInventoryServices {
isErrorRetry = true;
} else {
// message already in the db, but is not in a system error state...
- String errMsg = "Message received for message ID [" + omiPkMap + "] was already partially processed but is not in a system error state, needs manual review; message ID: " + omiPkMap;
- Debug.logError(errMsg, module);
- return ServiceUtil.returnError(errMsg);
+ Debug.logError("Message received for message ID [" + omiPkMap + "] was already partially processed but is not in a system error state, needs manual review; message ID: " + omiPkMap, module);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorMessageAlreadyProcessed", UtilMisc.toMap("shipmentId", "", "omiPkMap", omiPkMap), locale));
}
}
@@ -551,7 +547,7 @@ public class OagisInventoryServices {
}
}
} catch (Throwable t) {
- String errMsg = "System Error processing Acknowledge Delivery PO message for message [" + omiPkMap + "]: " + t.toString();
+ String errMsg = UtilProperties.getMessage(resource, "OagisErrorDeliveryMessagePO", UtilMisc.toMap("omiPkMap", omiPkMap), locale) + t.toString();
errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "SystemError"));
try {
@@ -617,10 +613,9 @@ public class OagisInventoryServices {
String errMsg = "Error sending Confirm BOD: " + e.toString();
Debug.logError(e, errMsg, module);
}
-
- String errMsg = "Found business level errors in message processing, not saving results; first error is: " + errorMapList.get(0);
-
+
// return success here so that the message won't be retried and the Confirm BOD, etc won't be sent multiple times
+ String errMsg = UtilProperties.getMessage(resource, "OagisErrorBusinessLevel", UtilMisc.toMap("errorString", ""), locale) + errorMapList.get(0);
result.putAll(ServiceUtil.returnSuccess(errMsg));
// however, we still don't want to save the partial results, so set rollbackOnly
@@ -642,14 +637,14 @@ public class OagisInventoryServices {
}
}
- result.putAll(ServiceUtil.returnSuccess("Service Completed Successfully"));
+ result.putAll(ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisServiceCompletedSuccessfully", locale)));
return result;
}
public static Map<String, Object> oagisReceiveAcknowledgeDeliveryRma(DispatchContext ctx, Map<String, Object> context) {
Document doc = (Document) context.get("document");
boolean isErrorRetry = Boolean.TRUE.equals(context.get("isErrorRetry"));
-
+ Locale locale = (Locale) context.get("locale");
LocalDispatcher dispatcher = ctx.getDispatcher();
Delegator delegator = ctx.getDelegator();
List<Map<String, String>> errorMapList = FastList.newInstance();
@@ -658,8 +653,7 @@ public class OagisInventoryServices {
try {
userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system"));
} catch (GenericEntityException e) {
- String errMsg = "Error Getting UserLogin: " + e.toString();
- Debug.logError(e, errMsg, module);
+ Debug.logError(e, "Error Getting UserLogin: " + e.toString(), module);
}
// parse the message
@@ -717,9 +711,8 @@ public class OagisInventoryServices {
isErrorRetry = true;
} else {
// message already in the db, but is not in a system error state...
- String errMsg = "Message received for message ID [" + omiPkMap + "] was already partially processed but is not in a system error state, needs manual review; message ID: " + omiPkMap;
- Debug.logError(errMsg, module);
- return ServiceUtil.returnError(errMsg);
+ Debug.logError("Message received for message ID [" + omiPkMap + "] was already partially processed but is not in a system error state, needs manual review; message ID: " + omiPkMap, module);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorMessageAlreadyProcessed", UtilMisc.toMap("shipmentId", "", "omiPkMap", omiPkMap), locale));
}
}
@@ -1158,7 +1151,7 @@ public class OagisInventoryServices {
}
}
- result.putAll(ServiceUtil.returnSuccess("Service Completed Successfully"));
+ result.putAll(ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisServiceCompletedSuccessfully", locale)));
result.put("inventoryItemIdList", invItemIds);
return result;
}
@@ -1166,7 +1159,7 @@ public class OagisInventoryServices {
public static Map<String, Object> oagisReceiveAcknowledgeDeliveryStatus(DispatchContext ctx, Map<String, Object> context) {
Document doc = (Document) context.get("document");
boolean isErrorRetry = Boolean.TRUE.equals(context.get("isErrorRetry"));
-
+ Locale locale = (Locale) context.get("locale");
LocalDispatcher dispatcher = ctx.getDispatcher();
Delegator delegator = ctx.getDelegator();
List<Map<String, String>> errorMapList = FastList.newInstance();
@@ -1229,9 +1222,8 @@ public class OagisInventoryServices {
isErrorRetry = true;
} else {
// message already in the db, but is not in a system error state...
- String errMsg = "Message received for message ID [" + omiPkMap + "] was already partially processed but is not in a system error state, needs manual review; message ID: " + omiPkMap;
- Debug.logError(errMsg, module);
- return ServiceUtil.returnError(errMsg);
+ Debug.logError("Message received for message ID [" + omiPkMap + "] was already partially processed but is not in a system error state, needs manual review; message ID: " + omiPkMap, module);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorMessageAlreadyProcessed", UtilMisc.toMap("shipmentId", "", "omiPkMap", omiPkMap), locale));
}
}
@@ -1486,7 +1478,7 @@ public class OagisInventoryServices {
}
}
- result.putAll(ServiceUtil.returnSuccess("Service Completed Successfully"));
+ result.putAll(ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisServiceCompletedSuccessfully", locale)));
result.put("inventoryItemIdList", invItemIds);
return result;
}
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=1063427&r1=1063426&r2=1063427&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java Tue Jan 25 19:52:12 2011
@@ -103,7 +103,7 @@ public class OagisServices {
public static Map<String, Object> oagisSendConfirmBod(DispatchContext ctx, Map<String, Object> context) {
Delegator delegator = ctx.getDelegator();
LocalDispatcher dispatcher = ctx.getDispatcher();
-
+ Locale locale = (Locale) context.get("locale");
String errorReferenceId = (String) context.get("referenceId");
List<Map<String, String>> errorMapList = UtilGenerics.checkList(context.get("errorMapList"));
@@ -166,9 +166,6 @@ public class OagisServices {
oagisMsgInfoContext.put("userLogin", userLogin);
try {
dispatcher.runSync("createOagisMessageInfo", oagisMsgInfoContext, 60, true);
- /*
- if (ServiceUtil.isError(oagisMsgInfoResult)) return ServiceUtil.returnError("Error creating OagisMessageInfo");
- */
} catch (GenericServiceException e) {
Debug.logError(e, "Saving message to database failed", module);
}
@@ -201,12 +198,13 @@ public class OagisServices {
writer.close();
outText = writer.toString();
} catch (Exception e) {
- String errMsg = "Error rendering message: " + e.toString();
- Debug.logError(e, errMsg, module);
- return ServiceUtil.returnError(errMsg);
+ Debug.logError(e, "Error rendering message: " + e.toString(), module);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorMessage", UtilMisc.toMap("errorString", e.toString()), locale));
}
- if (Debug.infoOn()) Debug.logInfo("Finished rendering oagisSendConfirmBod message for errorReferenceId [" + errorReferenceId + "]", module);
+ if (Debug.infoOn()) {
+ Debug.logInfo("Finished rendering oagisSendConfirmBod message for errorReferenceId [" + errorReferenceId + "]", module);
+ }
try {
oagisMsgInfoContext.put("processingStatusId", "OAGMP_OGEN_SUCCESS");
@@ -219,7 +217,7 @@ public class OagisServices {
Debug.logError(e, errMsg, module);
}
- Map<String, Object> sendMessageReturn = OagisServices.sendMessageText(outText, out, sendToUrl, saveToDirectory, saveToFilename);
+ Map<String, Object> sendMessageReturn = OagisServices.sendMessageText(outText, out, sendToUrl, saveToDirectory, saveToFilename, locale);
if (sendMessageReturn != null) {
return sendMessageReturn;
}
@@ -232,8 +230,7 @@ public class OagisServices {
String errMsg = UtilProperties.getMessage(ServiceUtil.resource, "OagisErrorInCreatingDataForOagisMessageInfoEntity", (Locale) context.get("locale"));
Debug.logError(e, errMsg, module);
}
-
- return ServiceUtil.returnSuccess("Service Completed Successfully");
+ return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisServiceCompletedSuccessfully", locale));
}
public static Map<String, Object> oagisReceiveConfirmBod(DispatchContext ctx, Map<String, Object> context) {
@@ -241,7 +238,7 @@ public class OagisServices {
LocalDispatcher dispatcher = ctx.getDispatcher();
Document doc = (Document) context.get("document");
List<Map<String, String>> errorMapList = FastList.newInstance();
-
+ Locale locale = (Locale) context.get("locale");
GenericValue userLogin = null;
try {
userLogin = delegator.findByPrimaryKey("UserLogin",UtilMisc.toMap("userLoginId", "system"));
@@ -373,9 +370,8 @@ public class OagisServices {
}
}
} catch (Throwable t) {
- String errMsg = "System Error processing Confirm BOD message: " + t.toString();
- Debug.logError(t, errMsg, module);
- return ServiceUtil.returnError(errMsg);
+ Debug.logError(t, "System Error processing Confirm BOD message: " + t.toString(), module);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorProcessingConfirmBOD", UtilMisc.toMap("errorString", t.toString()), locale));
}
Map<String, Object> result = FastMap.newInstance();
@@ -416,7 +412,7 @@ public class OagisServices {
}
// return success here so that the message won't be retried and the Confirm BOD, etc won't be sent multiple times
- result.putAll(ServiceUtil.returnSuccess("Errors found processing message; information saved and return error sent back"));
+ result.putAll(ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisErrorProcessingMessage", locale)));
return result;
} else {
oagisMsgInfoCtx.put("processingStatusId", "OAGMP_PROC_SUCCESS");
@@ -428,15 +424,15 @@ public class OagisServices {
Debug.logError(e, errMsg, module);
}
}
-
- result.putAll(ServiceUtil.returnSuccess("Service Completed Successfully"));
+ result.putAll(ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisServiceCompletedSuccessfully", locale)));
+
return result;
}
public static Map<String, Object> oagisReReceiveMessage(DispatchContext ctx, Map<String, Object> context) {
Delegator delegator = ctx.getDelegator();
LocalDispatcher dispatcher = ctx.getDispatcher();
-
+ Locale locale = (Locale) context.get("locale");
String logicalId = (String) context.get("logicalId");
String component = (String) context.get("component");
String task = (String) context.get("task");
@@ -452,32 +448,32 @@ public class OagisServices {
if (oagisMessageInfoList.size() == 1) {
oagisMessageInfo = oagisMessageInfoList.get(0);
} else if (oagisMessageInfoList.size() > 1) {
- return ServiceUtil.returnError("Looked up by referenceId because logicalId, component, or task were not passed in but found more than one [" + oagisMessageInfoList.size() + "] record with referenceId [" + referenceId + "]");
+ Integer messageSize = new Integer(oagisMessageInfoList.size());
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorLookupByReferenceError", UtilMisc.toMap("messageSize", messageSize.toString(), "referenceId", referenceId), locale));
}
} else {
oagisMessageInfo = delegator.findByPrimaryKey("OagisMessageInfo", oagisMessageInfoKey);
}
if (oagisMessageInfo == null) {
- return ServiceUtil.returnError("Could not find OagisMessageInfo record with key [" + oagisMessageInfoKey + "], not rerunning message.");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorFindOagisMessageInfo", UtilMisc.toMap("oagisMessageInfoKey", oagisMessageInfoKey), locale));
}
String fullMessageXml = oagisMessageInfo.getString("fullMessageXml");
if (UtilValidate.isEmpty(fullMessageXml)) {
- return ServiceUtil.returnError("There was no fullMessageXml text in OagisMessageInfo record with key [" + oagisMessageInfoKey + "], not rerunning message.");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorNotFoundFullMessageXml", UtilMisc.toMap("oagisMessageInfoKey", oagisMessageInfoKey), locale));
}
// we know we have text now, run it!
ByteArrayInputStream bis = new ByteArrayInputStream(fullMessageXml.getBytes("UTF-8"));
Map<String, Object> result = dispatcher.runSync("oagisMessageHandler", UtilMisc.toMap("inputStream", bis, "isErrorRetry", Boolean.TRUE));
if (ServiceUtil.isError(result)) {
- return ServiceUtil.returnError("Error trying to re-receive message with ID [" + oagisMessageInfoKey + "]", null, null, result);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorReceivingAgainMessage", UtilMisc.toMap("oagisMessageInfoKey", oagisMessageInfoKey), locale), null, null, result);
}
return ServiceUtil.returnSuccess();
} catch (Exception e) {
- String errMsg = "Error re-receiving message with ID [" + oagisMessageInfoKey + "]: " + e.toString();
- Debug.logError(e, errMsg, module);
- return ServiceUtil.returnError(errMsg);
+ Debug.logError(e, "Error re-receiving message with ID [" + oagisMessageInfoKey + "]: " + e.toString(), module);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorReceivingAgainMessage", UtilMisc.toMap("oagisMessageInfoKey", oagisMessageInfoKey), locale) + e.toString());
}
}
@@ -487,7 +483,7 @@ public class OagisServices {
InputStream in = (InputStream) context.get("inputStream");
List<Map<String, String>> errorList = FastList.newInstance();
Boolean isErrorRetry = (Boolean) context.get("isErrorRetry");
-
+ Locale locale = (Locale) context.get("locale");
GenericValue userLogin = null;
try {
userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system"));
@@ -528,7 +524,7 @@ public class OagisServices {
}
if (UtilValidate.isNotEmpty(errorList)) {
- return ServiceUtil.returnError("Unable to parse received message");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorParsingMessage", locale));
}
Element rootElement = doc.getDocumentElement();
@@ -545,7 +541,7 @@ public class OagisServices {
String referenceId = UtilXml.childElementValue(senderElement, "of:REFERENCEID");
if (UtilValidate.isEmpty(bsrVerb) || UtilValidate.isEmpty(bsrNoun)) {
- return ServiceUtil.returnError("Was able to receive and parse the XML message, but BSR->NOUN [" + bsrNoun + "] and/or BSR->VERB [" + bsrVerb + "] are empty");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorParsingXMLMessage", UtilMisc.toMap("bsrNoun", bsrNoun, "bsrVerb", bsrVerb), locale));
}
GenericValue oagisMessageInfo = null;
@@ -553,8 +549,7 @@ public class OagisServices {
try {
oagisMessageInfo = delegator.findByPrimaryKey("OagisMessageInfo", oagisMessageInfoKey);
} catch (GenericEntityException e) {
- String errMsg = "Error Getting Entity OagisMessageInfo: " + e.toString();
- Debug.logError(e, errMsg, module);
+ Debug.logError(e, "Error Getting Entity OagisMessageInfo: " + e.toString(), module);
}
Map<String, Object> messageProcessContext = UtilMisc.toMap("document", doc, "userLogin", userLogin);
@@ -582,8 +577,7 @@ public class OagisServices {
// run async because this will send a message back to the other server and may take some time, and/or fail
dispatcher.runAsync("oagisSendConfirmBod", sendConfirmBodCtx, null, true, 60, true);
} catch (GenericServiceException e) {
- String errMsg = "Error sending Confirm BOD: " + e.toString();
- Debug.logError(e, errMsg, module);
+ Debug.logError(e, "Error sending Confirm BOD: " + e.toString(), module);
}
Map<String, Object> result = ServiceUtil.returnSuccess(responseMsg);
result.put("contentType", "text/plain");
@@ -657,12 +651,11 @@ public class OagisServices {
Debug.logError(e, errMsg, module);
}
} else {
- return ServiceUtil.returnError("For Acknowledge Delivery message could not determine if it is for a PO or RMA or Status Change. DOCTYPE from message is [" + docType + "], DISPOSITN is [" + disposition + "]");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorDeliveryMessage", UtilMisc.toMap("docType", docType, "disposition", disposition), locale));
}
} else {
- String errMsg = "Unknown Message Type Received, verb/noun combination not supported: verb=[" + bsrVerb + "], noun=[" + bsrNoun + "]";
- Debug.logError(errMsg, module);
- return ServiceUtil.returnError(errMsg);
+ Debug.logError("Unknown Message Type Received, verb/noun combination not supported: verb=[" + bsrVerb + "], noun=[" + bsrNoun + "]", module);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorUnknownMessageType", UtilMisc.toMap("bsrVerb", bsrVerb, "bsrNoun", bsrNoun), locale));
}
Map<String, Object> result = ServiceUtil.returnSuccess();
@@ -684,16 +677,15 @@ public class OagisServices {
return result;
}
- public static Map<String, Object> sendMessageText(String outText, OutputStream out, String sendToUrl, String saveToDirectory, String saveToFilename) {
+ public static Map<String, Object> sendMessageText(String outText, OutputStream out, String sendToUrl, String saveToDirectory, String saveToFilename, Locale locale) {
if (out != null) {
Writer outWriter = new OutputStreamWriter(out);
try {
outWriter.write(outText);
outWriter.close();
} catch (IOException e) {
- String errMsg = "Error writing message to output stream: " + e.toString();
- Debug.logError(e, errMsg, module);
- return ServiceUtil.returnError(errMsg);
+ Debug.logError(e, "Error writing message to output stream: " + e.toString(), module);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorWritingMessage", UtilMisc.toMap("errorString", e.toString()), locale));
}
} else if (UtilValidate.isNotEmpty(saveToFilename) && UtilValidate.isNotEmpty(saveToDirectory)) {
try {
@@ -705,9 +697,8 @@ public class OagisServices {
outWriter.write(outText);
outWriter.close();
} catch (Exception e) {
- String errMsg = "Error saving message to file [" + saveToFilename + "]: " + e.toString();
- Debug.logError(e, errMsg, module);
- return ServiceUtil.returnError(errMsg);
+ Debug.logError(e, "Error saving message to file [" + saveToFilename + "]: " + e.toString(), module);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorSavingMessage", UtilMisc.toMap("saveToFilename", saveToFilename, "errorString", e.toString()), locale));
}
} else if (UtilValidate.isNotEmpty(sendToUrl)) {
HttpClient http = new HttpClient(sendToUrl);
@@ -730,13 +721,12 @@ public class OagisServices {
try {
http.post(outText);
} catch (Exception e) {
- String errMsg = "Error posting message to server with URL [" + sendToUrl + "]: " + e.toString();
- Debug.logError(e, errMsg, module);
- return ServiceUtil.returnError(errMsg);
+ Debug.logError(e, "Error posting message to server with URL [" + sendToUrl + "]: " + e.toString(), module);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorPostingMessage", UtilMisc.toMap("sendToUrl", sendToUrl, "errorString", e.toString()), locale));
}
} else {
if (Debug.infoOn()) Debug.logInfo("No send to information, so here is the message: " + outText, module);
- return ServiceUtil.returnError("No send to information pass (url, file, or out stream)");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorSendingInformations", locale));
}
return null;
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=1063427&r1=1063426&r2=1063427&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java Tue Jan 25 19:52:12 2011
@@ -89,7 +89,7 @@ public class OagisShipmentServices {
public static Map<String, Object> oagisReceiveShowShipment(DispatchContext ctx, Map<String, Object> context) {
Document doc = (Document) context.get("document");
boolean isErrorRetry = Boolean.TRUE.equals(context.get("isErrorRetry"));
-
+ Locale locale = (Locale) context.get("locale");
LocalDispatcher dispatcher = ctx.getDispatcher();
Delegator delegator = ctx.getDelegator();
Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
@@ -149,9 +149,8 @@ public class OagisShipmentServices {
isErrorRetry = true;
} else {
// message already in the db, but is not in a system error state...
- String errMsg = "Message received for shipmentId [" + shipmentId + "] message ID [" + omiPkMap + "] was already partially processed but is not in a system error state, needs manual review; message ID: " + omiPkMap;
- Debug.logError(errMsg, module);
- return ServiceUtil.returnError(errMsg);
+ Debug.logError("Message received for shipmentId [" + shipmentId + "] message ID [" + omiPkMap + "] was already partially processed but is not in a system error state, needs manual review; message ID: " + omiPkMap, module);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorMessageAlreadyProcessed", UtilMisc.toMap("shipmentId", shipmentId, "omiPkMap", omiPkMap), locale));
}
}
@@ -532,7 +531,7 @@ public class OagisShipmentServices {
}
}
} catch (Throwable t) {
- String errMsg = "System Error processing Show Shipment message for shipmentId [" + shipmentId + "] message [" + omiPkMap + "]: " + t.toString();
+ String errMsg = UtilProperties.getMessage(resource, "OagisErrorMessageShowShipment", UtilMisc.toMap("shipmentId", shipmentId, "omiPkMap", omiPkMap), locale);
errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "SystemError"));
try {
@@ -551,7 +550,7 @@ public class OagisShipmentServices {
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);
+ return ServiceUtil.returnError(errMsg + t.toString());
}
}
@@ -594,10 +593,8 @@ public class OagisShipmentServices {
String errMsg = "Error sending Confirm BOD: " + e.toString();
Debug.logError(e, errMsg, module);
}
-
- String errMsg = "Found business level errors in message processing, not saving those changes but saving error messages; first error is: " + errorMapList.get(0);
-
// return success here so that the message won't be retried and the Confirm BOD, etc won't be sent multiple times
+ String errMsg = UtilProperties.getMessage(resource, "OagisErrorBusinessLevel", UtilMisc.toMap("errorString", ""), locale) + errorMapList.get(0).toString();
result.putAll(ServiceUtil.returnSuccess(errMsg));
// however, we still don't want to save the partial results, so set rollbackOnly
@@ -618,13 +615,13 @@ public class OagisShipmentServices {
}
}
- result.putAll(ServiceUtil.returnSuccess("Service Completed Successfully"));
+ result.putAll(ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisServiceCompletedSuccessfully", locale)));
return result;
}
public static Map<String, Object> oagisSendProcessShipmentsFromBackOrderSet(DispatchContext ctx, Map<String, Object> context) {
LocalDispatcher dispatcher = ctx.getDispatcher();
-
+ Locale locale = (Locale) context.get("locale");
Set<String> noLongerOnBackOrderIdSet = UtilGenerics.checkSet(context.get("noLongerOnBackOrderIdSet"), String.class);
Debug.logInfo("Running oagisSendProcessShipmentsFromBackOrderSet with noLongerOnBackOrderIdSet=" + noLongerOnBackOrderIdSet, module);
if (UtilValidate.isEmpty(noLongerOnBackOrderIdSet)) {
@@ -636,8 +633,7 @@ public class OagisShipmentServices {
dispatcher.runAsync("oagisSendProcessShipment", UtilMisc.toMap("orderId", orderId), true);
}
} catch (GenericServiceException e) {
- String errMsg = "Error calling oagisSendProcessShipment service for orders with items no longer on backorder: " + e.toString();
- return ServiceUtil.returnError(errMsg);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisErrorOagisSendProcessShipment", UtilMisc.toMap("errorString", e.toString()), locale));
}
return ServiceUtil.returnSuccess();
@@ -647,6 +643,7 @@ public class OagisShipmentServices {
LocalDispatcher dispatcher = ctx.getDispatcher();
Delegator delegator = ctx.getDelegator();
String orderId = (String) context.get("orderId");
+ Locale locale = (Locale) context.get("locale");
// Check if order is not on back order before processing shipment
try {
@@ -710,32 +707,30 @@ public class OagisShipmentServices {
UtilMisc.toMap("orderId", orderId, "task", task, "component", component));
if (EntityUtil.filterByAnd(previousOagisMessageInfoList, UtilMisc.toMap("processingStatusId", "OAGMP_OGEN_SUCCESS")).size() > 0) {
// this isn't really an error, just a failed constraint so return success
- String successMsg = "Found existing message info(s) in OAGMP_OGEN_SUCCESS, so not sending Process Shipment message for order [" + orderId + "] existing message(s) are: " + EntityUtil.filterByAnd(previousOagisMessageInfoList, UtilMisc.toMap("processingStatusId", "OAGMP_OGEN_SUCCESS"));
- return ServiceUtil.returnSuccess(successMsg);
+ return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisFoundExistingMessage", UtilMisc.toMap("orderId", orderId), locale) + EntityUtil.filterByAnd(previousOagisMessageInfoList, UtilMisc.toMap("processingStatusId", "OAGMP_OGEN_SUCCESS")));
}
if (EntityUtil.filterByAnd(previousOagisMessageInfoList, UtilMisc.toMap("processingStatusId", "OAGMP_SENT")).size() > 0) {
// this isn't really an error, just a failed constraint so return success
- String successMsg = "Found existing message info(s) in OAGMP_SENT status, so not sending Process Shipment message for order [" + orderId + "] existing message(s) are: " + EntityUtil.filterByAnd(previousOagisMessageInfoList, UtilMisc.toMap("processingStatusId", "OAGMP_SENT"));
- return ServiceUtil.returnSuccess(successMsg);
+ return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisFoundExistingMessageSent", UtilMisc.toMap("orderId", orderId), locale) + EntityUtil.filterByAnd(previousOagisMessageInfoList, UtilMisc.toMap("processingStatusId", "OAGMP_SENT")));
}
orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));
if (orderHeader == null) {
- return ServiceUtil.returnError("Could not find OrderHeader with ID [" + orderId + "]");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisOrderIdNotFound", UtilMisc.toMap("orderId", orderId), locale));
}
List<String> validStores = StringUtil.split(UtilProperties.getPropertyValue("oagis.properties", "Oagis.Order.ValidProductStores"), ",");
if (UtilValidate.isNotEmpty(validStores)) {
if (!validStores.contains(orderHeader.getString("productStoreId"))) {
- return ServiceUtil.returnSuccess("Order [" + orderId + "] placed is not for valid Store(s)");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisOrderIdNotValidStore", UtilMisc.toMap("orderId", orderId), locale));
}
}
String orderStatusId = orderHeader.getString("statusId");
if (!"ORDER_APPROVED".equals(orderStatusId)) {
- return ServiceUtil.returnSuccess("OrderHeader not in the approved status (ORDER_APPROVED) with ID [" + orderId + "], is in the [" + orderStatusId + "] status");
+ return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisOrderIdNotInApprovedStatus", UtilMisc.toMap("orderId", orderId, "orderStatusId", orderStatusId), locale));
}
if (!"SALES_ORDER".equals(orderHeader.getString("orderTypeId"))) {
- return ServiceUtil.returnError("OrderHeader not a sales order (SALES_ORDER) with ID [" + orderId + "]");
+ return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisOrderIdNotASalesOrder", UtilMisc.toMap("orderId", orderId), locale));
}
// first check some things...
@@ -746,7 +741,7 @@ public class OagisShipmentServices {
return ServiceUtil.returnSuccess();
}
if (!orderReadHelper.hasShippingAddress()) {
- return ServiceUtil.returnError("Cannot send Process Shipment for order [" + orderId + "], it has no shipping address.");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisOrderIdWithoutShippingAddress", UtilMisc.toMap("orderId", orderId), locale));
}
// check payment authorization
@@ -756,7 +751,7 @@ public class OagisShipmentServices {
authServiceContext.put("reAuth", true);
Map<String, Object> authResult = dispatcher.runSync("authOrderPayments", authServiceContext);
if (!authResult.get("processResult").equals("APPROVED")) {
- return ServiceUtil.returnError("No authorized payment available, not sending Process Shipment");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisOrderIdPaymentNotAuthorized", locale));
}
referenceId = delegator.getNextSeqId("OagisMessageInfo");
@@ -803,7 +798,7 @@ public class OagisShipmentServices {
// if picked, packed, shipped, delivered then complain, no reason to process the shipment!
String statusId = shipment.getString("statusId");
if ("SHIPMENT_PICKED".equals(statusId) || "SHIPMENT_PACKED".equals(statusId) || "SHIPMENT_SHIPPED".equals(statusId) || "SHIPMENT_DELIVERED".equals(statusId)) {
- return ServiceUtil.returnError("Not sending Process Shipment message because found Shipment that is already being processed, is in status [" + statusId + "]");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisOrderIdWithShipment", UtilMisc.toMap("statusId", statusId), locale));
}
shipmentId = shipment.getString("shipmentId");
} else {
@@ -824,7 +819,7 @@ public class OagisShipmentServices {
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 + "]");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisOrderIdNotTelecomNumberFound", UtilMisc.toMap("orderId", orderId), locale));
}
bodyParameters.put("telecomNumber", telecomNumber);
@@ -917,7 +912,7 @@ public class OagisShipmentServices {
Debug.logError(e, errMsg, module);
}
- Map<String, Object> sendMessageReturn = OagisServices.sendMessageText(outText, out, sendToUrl, saveToDirectory, saveToFilename);
+ Map<String, Object> sendMessageReturn = OagisServices.sendMessageText(outText, out, sendToUrl, saveToDirectory, saveToFilename, locale);
if (sendMessageReturn != null && ServiceUtil.isError(sendMessageReturn)) {
try {
Map<String, Object> uomiCtx = FastMap.newInstance();
@@ -944,7 +939,7 @@ public class OagisShipmentServices {
Debug.logError(e, errMsg, module);
}
} catch (Throwable t) {
- String errMsg = "System Error doing Process Shipment message for orderId [" + orderId + "] shipmentId [" + shipmentId + "] message [" + omiPkMap + "]: " + t.toString();
+ String errMsg = UtilProperties.getMessage(resource, "OagisErrorProcessShipment", UtilMisc.toMap("orderId", orderId, "shipmentId", shipmentId, "omiPkMap", omiPkMap), locale) + t.toString();
Debug.logError(t, errMsg, module);
// if we have a referenceId and the omiPkMap not null, save the error status
@@ -986,7 +981,7 @@ public class OagisShipmentServices {
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
String returnId = (String) context.get("returnId");
-
+ Locale locale = (Locale) context.get("locale");
String sendToUrl = (String) context.get("sendToUrl");
if (UtilValidate.isEmpty(sendToUrl)) {
sendToUrl = UtilProperties.getPropertyValue("oagis.properties", "url.send.receiveDelivery");
@@ -1029,22 +1024,20 @@ public class OagisShipmentServices {
UtilMisc.toMap("returnId", returnId, "task", task, "component", component));
if (EntityUtil.filterByAnd(previousOagisMessageInfoList, UtilMisc.toMap("processingStatusId", "OAGMP_OGEN_SUCCESS")).size() > 0) {
// this isn't really an error, just a failed constraint so return success
- String successMsg = "Found existing message info(s) in OAGMP_OGEN_SUCCESS, so not sending Receive Delivery message for return [" + returnId + "] existing message(s) are: " + EntityUtil.filterByAnd(previousOagisMessageInfoList, UtilMisc.toMap("processingStatusId", "OAGMP_OGEN_SUCCESS"));
- return ServiceUtil.returnSuccess(successMsg);
+ return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisFoundExistingMessageForReturn", UtilMisc.toMap("returnId", returnId), locale) + EntityUtil.filterByAnd(previousOagisMessageInfoList, UtilMisc.toMap("processingStatusId", "OAGMP_OGEN_SUCCESS")));
}
if (EntityUtil.filterByAnd(previousOagisMessageInfoList, UtilMisc.toMap("processingStatusId", "OAGMP_SENT")).size() > 0) {
// this isn't really an error, just a failed constraint so return success
- String successMsg = "Found existing message info(s) in OAGMP_SENT status, so not sending Receive Delivery message for return [" + returnId + "] existing message(s) are: " + EntityUtil.filterByAnd(previousOagisMessageInfoList, UtilMisc.toMap("processingStatusId", "OAGMP_SENT"));
- return ServiceUtil.returnSuccess(successMsg);
+ return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisFoundExistingMessageForReturnSent", UtilMisc.toMap("returnId", returnId), locale) + EntityUtil.filterByAnd(previousOagisMessageInfoList, UtilMisc.toMap("processingStatusId", "OAGMP_SENT")));
}
GenericValue returnHeader = delegator.findByPrimaryKey("ReturnHeader", UtilMisc.toMap("returnId", returnId));
if (returnHeader == null) {
- return ServiceUtil.returnError("Could not find Return with ID [" + returnId + "]");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisReturnIdNotFound", UtilMisc.toMap("returnId", returnId), locale));
}
String statusId = returnHeader.getString("statusId");
if (!"RETURN_ACCEPTED".equals(statusId)) {
- return ServiceUtil.returnError("Return with ID [" + returnId + "] no in accepted status (RETURN_ACCEPTED)");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisReturnIdNotInAcceptedStatus", UtilMisc.toMap("returnId", returnId), locale));
}
List<GenericValue> returnItems = delegator.findByAnd("ReturnItem", UtilMisc.toMap("returnId", returnId));
@@ -1088,7 +1081,7 @@ public class OagisShipmentServices {
GenericValue orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));
if (orderHeader == null) {
- return ServiceUtil.returnError("No valid Order with [" + orderId + "] found, cannot process Return");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisReturnIdNotValid", UtilMisc.toMap("orderId", orderId), locale));
}
String partyId = returnHeader.getString("fromPartyId");
@@ -1163,7 +1156,7 @@ public class OagisShipmentServices {
Debug.logError(e, errMsg, module);
}
- Map<String, Object> sendMessageReturn = OagisServices.sendMessageText(outText, out, sendToUrl, saveToDirectory, saveToFilename);
+ Map<String, Object> sendMessageReturn = OagisServices.sendMessageText(outText, out, sendToUrl, saveToDirectory, saveToFilename, locale);
if (sendMessageReturn != null && ServiceUtil.isError(sendMessageReturn)) {
try {
Map<String, Object> uomiCtx = FastMap.newInstance();
@@ -1189,7 +1182,7 @@ public class OagisShipmentServices {
Debug.logError(e, errMsg, module);
}
} catch (Throwable t) {
- String errMsg = "System Error doing Receive Delivery message for returnId [" + returnId + "] orderId [" + orderId + "] message [" + omiPkMap + "]: " + t.toString();
+ String errMsg = UtilProperties.getMessage(resource, "OagisErrorReceivingDeliveryMessageReturn", UtilMisc.toMap("returnId", returnId, "orderId", orderId, "omiPkMap", omiPkMap), locale);
Debug.logError(t, errMsg, module);
// if we have a referenceId and the omiPkMap not null, save the error status
@@ -1221,8 +1214,7 @@ public class OagisShipmentServices {
Debug.logError(e, errMsg2, module);
}
}
-
- return ServiceUtil.returnError(errMsg);
+ return ServiceUtil.returnError(errMsg + t.toString());
}
return result;
}