Author: mrisaliti
Date: Wed Jan 5 21:49:33 2011
New Revision: 1055656
URL: http://svn.apache.org/viewvc?rev=1055656&view=rev
Log:
Internationalization of ServiceUtil.returnSuccess, ServiceUtil.returnFailure,
ServiceUtil.returnError (OFBIZ-4091)
Modified:
ofbiz/trunk/applications/party/config/PartyUiLabels.xml
ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java
ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java
Modified: ofbiz/trunk/applications/party/config/PartyUiLabels.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/config/PartyUiLabels.xml?rev=1055656&r1=1055655&r2=1055656&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/config/PartyUiLabels.xml (original)
+++ ofbiz/trunk/applications/party/config/PartyUiLabels.xml Wed Jan 5 21:49:33
2011
@@ -3270,6 +3270,38 @@
<value xml:lang="zh">åå
¬çµè¯</value>
<value xml:lang="zh_TW">辦å
¬é»è©±</value>
</property>
+ <property key="PartyCannotCreatePartyDataSource">
+ <value xml:lang="en">Cannot create PartyDataSource</value>
+ <value xml:lang="it">Non è possibile creare la sorgente dati</value>
+ </property>
+ <property key="PartyCannotCreateRoleTypeEntity">
+ <value xml:lang="en">Cannot create role type entity (write failure):
${errMessage}</value>
+ <value xml:lang="it">Non è possibile creare il tipo ruolo (fallimento
in scrittura): ${errMessage}</value>
+ </property>
+ <property key="PartyCannotGetUserLoginFromParty">
+ <value xml:lang="en">Required parameter 'userLoginId' cannot be
empty.</value>
+ <value xml:lang="it">Parametro 'userLoginId' richiesto non può essere
vuoto.</value>
+ </property>
+ <property key="PartyCannotCopyPartyContactMech">
+ <value xml:lang="en">Failed to copy contact mechs. Error:
${errorString}</value>
+ <value xml:lang="it">Fallita copia contatti. Errore:
${errorString}</value>
+ </property>
+ <property key="PartyCannotGetPartyContactMech">
+ <value xml:lang="en">Both 'partyId' and 'userLogin' are empty.</value>
+ <value xml:lang="it">Entrambi 'soggetto' e 'utente' sono vuoti.</value>
+ </property>
+ <property key="PartyCannotGetPartyContactMech">
+ <value xml:lang="en">Both 'partyId' and 'userLogin' are empty.</value>
+ <value xml:lang="it">Entrambi 'soggetto' e 'utente' sono vuoti.</value>
+ </property>
+ <property key="PartyCannotLinkPartyToItSelf">
+ <value xml:lang="en">Cannot link the same party with itself</value>
+ <value xml:lang="it">Non è possibile collegare lo stesso soggetto a
se stesso</value>
+ </property>
+ <property key="PartyCannotMergeDisabledParty">
+ <value xml:lang="en">Cannot merge records into a disabled
party!</value>
+ <value xml:lang="it">Non è possibile fondere i soggetti se il
soggetto è disabilitato!</value>
+ </property>
<property key="PartyCannotUpdateContactBecauseNotWithSpecifiedParty">
<value xml:lang="de">FEHLER: Kann die Kontaktinformationen nicht
aktualisieren da sie nicht zum angegeben Akteur gehören.</value>
<value xml:lang="en">ERROR: Cannot update specified contact info
because it does not correspond to the specified party.</value>
@@ -3556,6 +3588,18 @@
<value xml:lang="it">Creare opportunità </value>
<value xml:lang="pt_BR">Criar oportunidade</value>
</property>
+ <property key="PartyCommEventMessageIgnoredDetectedByExternalSpamChecker">
+ <value xml:lang="en"> Message Ignored: detected by external spam
checker</value>
+ <value xml:lang="it"> Messaggio Ignorato: individuato da un
verificatore esterno di spam</value>
+ </property>
+ <property key="PartyCommEventMessageIgnoredDuplicateMessageId">
+ <value xml:lang="en"> Message Ignored: duplicate messageId</value>
+ <value xml:lang="it"> Messaggio Ignorato: messaggio duplicato</value>
+ </property>
+ <property key="PartyCommEventMessageIgnoredNoFromAddressSpecified">
+ <value xml:lang="en"> Message Ignored: no 'From' address
specified</value>
+ <value xml:lang="it"> Messaggio Ignorato: nessu indirizzo 'Da'
specificato</value>
+ </property>
<property key="PartyCommEventOrders">
<value xml:lang="en">Communication Event Orders</value>
<value xml:lang="hi_IN">सà¤à¤à¤¾à¤° à¤à¤à¤¨à¤¾ à¤à¥
à¤à¤¦à¥à¤¶</value>
@@ -5940,6 +5984,14 @@
<value xml:lang="zh">æ¾ä¸å°å®¶åºçµè¯å·ç ã</value>
<value xml:lang="zh_TW">æ²æå®¶è£¡é»è©±è碼ã</value>
</property>
+ <property key="PartyImportInvalidCsvFile">
+ <value xml:lang="en">Invalid format for CSV
(key,value,sequence)</value>
+ <value xml:lang="it">Formato file CSV non valido (chiave, valore,
sequenza)</value>
+ </property>
+ <property key="PartyImportNoRecordsFoundInFile">
+ <value xml:lang="en">No records found in file</value>
+ <value xml:lang="it">Formato file CSV non valido (chiave, valore,
sequenza)</value>
+ </property>
<property key="PartyInProgresstEmails">
<value xml:lang="en">Emails scheduled to be sent</value>
<value xml:lang="fr">Courriels prêts à être envoyés</value>
@@ -6644,6 +6696,22 @@
<value xml:lang="zh">æ¥æ¾äººå</value>
<value xml:lang="zh_TW">æ¥æ¾äººå¡</value>
</property>
+ <property key="PartyLookupStateProvinceGeoError">
+ <value xml:lang="en">Error looking up StateProvinceGeo:
${errMessage}</value>
+ <value xml:lang="it">Errore durante la ricerca dello stato/provincia:
${errMessage}</value>
+ </property>
+ <property key="PartyLookupPartyError">
+ <value xml:lang="en">Failure in party find operation, rolling back
transaction: ${errMessage}</value>
+ <value xml:lang="it">Fallita l'operazione di ricerca soggetto,
transazione annullata: ${errMessage}</value>
+ </property>
+ <property key="PartyLookupPartyTypeError">
+ <value xml:lang="en">Error looking up PartyTypes: ${errMessage}</value>
+ <value xml:lang="it">Errore durante la ricerca del tipo soggetto:
${errMessage}</value>
+ </property>
+ <property key="PartyLookupRoleTypeError">
+ <value xml:lang="en">Error looking up RoleTypes: ${errMessage}</value>
+ <value xml:lang="it">Errore durante la ricerca del tipo ruolo:
${errMessage}</value>
+ </property>
<property key="PartyLookupUserLoginAndPartyDetails">
<value xml:lang="de">Benutzeranmeldung und Akteur suchen</value>
<value xml:lang="en">Lookup User Login And Party Details</value>
@@ -7659,6 +7727,10 @@
<value xml:lang="zh">æ²¡ææ¾å°ä¼åï¼ä¼åæ è¯</value>
<value xml:lang="zh_TW">æ²ææ¾å°ç¸ç¬¦æå¡ID</value>
</property>
+ <property key="PartyNoPartyWithDataSourceId">
+ <value xml:lang="en">Data source with ID ${dataSourceId} was not
found</value>
+ <value xml:lang="it">Sorgente dati ${dataSourceId} non è stato
trovato</value>
+ </property>
<property key="PartyNoPartyRelationshipsFound">
<value xml:lang="de">Keine Beziehungen gefunden.</value>
<value xml:lang="en">No relationships found.</value>
@@ -7799,6 +7871,10 @@
<value xml:lang="zh">没æä¾è´§å</value>
<value xml:lang="zh_TW">æ²æä¾è²¨å</value>
</property>
+ <property key="PartyNoteCreationError">
+ <value xml:lang="en">Unable to create Note: ${errorString}</value>
+ <value xml:lang="it">Non è possibile creare la nota:
${errorString}</value>
+ </property>
<property key="PartyNoUserLogin">
<value xml:lang="de">Keine Benutzeranmeldung gefunden für diesen
Akteur.</value>
<value xml:lang="en">No UserLogin(s) found for this party.</value>
@@ -8119,6 +8195,10 @@
<value xml:lang="zh">ä¼åæ¥èª</value>
<value xml:lang="zh_TW">æå¡ä¾èª</value>
</property>
+ <property key="PartyPartyFromDoesNotExists">
+ <value xml:lang="en">Party From does not exist!</value>
+ <value xml:lang="it">Soggetto Da non esiste!</value>
+ </property>
<property key="PartyPartyGroupInformation">
<value xml:lang="de">Akteurgruppe Information</value>
<value xml:lang="en">Party Group Information</value>
@@ -8336,6 +8416,14 @@
<value xml:lang="zh">ä¼åå°</value>
<value xml:lang="zh_TW">æå¡å°</value>
</property>
+ <property key="PartyPartyToDoesNotExists">
+ <value xml:lang="en">Party To does not exist!</value>
+ <value xml:lang="it">Soggetto A non esiste!</value>
+ </property>
+ <property key="PartyPartyTypeIdNotFound">
+ <value xml:lang="en">The specified partyTypeId ${partyTypeId} could
not be found or is not a sub-type of PARTY_GROUP</value>
+ <value xml:lang="it">Il tipo soggetto specificato ${partyTypeId} non
è stato trovato o non è un sotto-tipo di PARTY_GROUP</value>
+ </property>
<property key="PartyPartyWithId">
<value xml:lang="de">des Akteur mit der ID</value>
<value xml:lang="en">of the Party with ID </value>
@@ -9170,6 +9258,18 @@
<value xml:lang="zh">ä¼åå
³ç³»å®å
¨</value>
<value xml:lang="zh_TW">æå¡éä¿å®å
¨</value>
</property>
+ <property key="PartyRelationshipTypeAlreadyExists">
+ <value xml:lang="en">Could not create party relationship type: already
exists</value>
+ <value xml:lang="it">Non è possibile creare il tipo rapporto
soggetto: esiste già </value>
+ </property>
+ <property key="PartyRelationshipTypeReadFailure">
+ <value xml:lang="en">Could not create party relationship type (read
failure): ${errorString}</value>
+ <value xml:lang="it">Non è possibile creare il tipo rapporto soggetto
(fallita lettura): ${errorString}</value>
+ </property>
+ <property key="PartyRelationshipTypeWriteFailure">
+ <value xml:lang="en">Could not create party relationship type (write
failure): ${errorString}</value>
+ <value xml:lang="it">Non è possibile creare il tipo rapporto soggetto
(fallita scrittura): ${errorString}</value>
+ </property>
<property key="PartyRelationshipValidFromRoleType">
<value xml:lang="de">Gültig von Rolle Typ</value>
<value xml:lang="en">Valid From Role Type</value>
@@ -10098,6 +10198,10 @@
<value xml:lang="zh">缺å°ç</value>
<value xml:lang="zh_TW">缺å°ç</value>
</property>
+ <property key="PartyStatusCannotBeChanged">
+ <value xml:lang="en">Cannot change party status from
${partyFromStatusId} to ${partyToStatusId}</value>
+ <value xml:lang="it">Non è possibile cambiare lo stato del soggetto
da ${partyFromStatusId} a ${partyToStatusId}</value>
+ </property>
<property key="PartyStillActive">
<value xml:lang="de">Immer noch aktiv</value>
<value xml:lang="en">Still Active</value>
Modified:
ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java?rev=1055656&r1=1055655&r2=1055656&view=diff
==============================================================================
---
ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
(original)
+++
ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
Wed Jan 5 21:49:33 2011
@@ -684,13 +684,12 @@ public class CommunicationEventServices
* @return
*/
public static Map<String, Object> storeIncomingEmail(DispatchContext dctx,
Map<String, ? extends Object> context) {
-
Delegator delegator = dctx.getDelegator();
LocalDispatcher dispatcher = dctx.getDispatcher();
MimeMessageWrapper wrapper = (MimeMessageWrapper)
context.get("messageWrapper");
-
Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Locale locale = (Locale) context.get("locale");
String partyIdTo = null;
String partyIdFrom = null;
String contentType = null;
@@ -725,14 +724,16 @@ public class CommunicationEventServices
String msgHeaderValue = wrapper.getHeader(spamHeaderName)[0];
if (msgHeaderValue != null &&
msgHeaderValue.startsWith(configHeaderValue)) {
Debug.logInfo("Incoming Email message ignored, was
detected by external spam checker", module);
- return ServiceUtil.returnSuccess(" Message Ignored:
detected by external spam checker");
+ return
ServiceUtil.returnSuccess(UtilProperties.getMessage(resource,
+
"PartyCommEventMessageIgnoredDetectedByExternalSpamChecker", locale));
}
}
// if no 'from' addresses specified ignore the message
if (addressesFrom == null) {
Debug.logInfo("Incoming Email message ignored, had not 'from'
email address", module);
- return ServiceUtil.returnSuccess(" Message Ignored: no 'From'
address specified");
+ return
ServiceUtil.returnSuccess(UtilProperties.getMessage(resource,
+ "PartyCommEventMessageIgnoredNoFromAddressSpecified",
locale));
}
// make sure this isn't a duplicate
@@ -745,7 +746,8 @@ public class CommunicationEventServices
}
if (!commEvents.isEmpty()) {
Debug.logInfo("Ignoring Duplicate Email: " + aboutThisEmail,
module);
- return ServiceUtil.returnSuccess(" Message Ignored: duplicate
messageId");
+ return
ServiceUtil.returnSuccess(UtilProperties.getMessage(resource,
+ "PartyCommEventMessageIgnoredDuplicateMessageId",
locale));
}
// get the related partId's
@@ -1273,7 +1275,6 @@ public class CommunicationEventServices
} else {
if (Debug.infoOn()) {
Debug.logInfo("Unable to find
ContactListCommStatus with the matching messageId : " + messageId, module);
-
}
}
}
Modified:
ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java?rev=1055656&r1=1055655&r2=1055656&view=diff
==============================================================================
---
ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
(original)
+++
ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
Wed Jan 5 21:49:33 2011
@@ -56,7 +56,8 @@ import org.ofbiz.service.GenericServiceE
public class ContactMechServices {
public static final String module = ContactMechServices.class.getName();
- public static final String resource = "PartyErrorUiLabels";
+ public static final String resource = "PartyUiLabels";
+ public static final String resourceError = "PartyErrorUiLabels";
/**
* Creates a ContactMech
@@ -70,13 +71,11 @@ public class ContactMechServices {
Delegator delegator = ctx.getDelegator();
Security security = ctx.getSecurity();
GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Locale locale = (Locale) context.get("locale");
Timestamp now = UtilDateTime.nowTimestamp();
List<GenericValue> toBeStored = FastList.newInstance();
String partyId = ServiceUtil.getPartyIdCheckSecurity(userLogin,
security, context, result, "PARTYMGR", "_PCM_CREATE");
- String errMsg = null;
- Locale locale = (Locale) context.get("locale");
-
if (result.size() > 0)
return result;
@@ -87,8 +86,8 @@ public class ContactMechServices {
try {
newCmId = delegator.getNextSeqId("ContactMech");
} catch (IllegalArgumentException e) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_create_contact_info_id_generation_failure",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_create_contact_info_id_generation_failure",
locale));
}
GenericValue tempContactMech = delegator.makeValue("ContactMech",
UtilMisc.toMap("contactMechId", newCmId, "contactMechTypeId",
contactMechTypeId));
@@ -100,11 +99,11 @@ public class ContactMechServices {
}
if ("POSTAL_ADDRESS".equals(contactMechTypeId)) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.service_createContactMech_not_be_used_for_POSTAL_ADDRESS",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.service_createContactMech_not_be_used_for_POSTAL_ADDRESS",
locale));
} else if ("TELECOM_NUMBER".equals(contactMechTypeId)) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.service_createContactMech_not_be_used_for_TELECOM_NUMBER",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.service_createContactMech_not_be_used_for_TELECOM_NUMBER",
locale));
} else {
tempContactMech.set("infoString", context.get("infoString"));
}
@@ -113,9 +112,9 @@ public class ContactMechServices {
delegator.storeAll(toBeStored);
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), module);
- Map<String, String> messageMap = UtilMisc.toMap("errMessage",
e.getMessage());
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_create_contact_info_write",
messageMap, locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "contactmechservices.could_not_create_contact_info_write",
+ UtilMisc.toMap("errMessage", e.getMessage()), locale));
}
result.put("contactMechId", newCmId);
@@ -135,14 +134,13 @@ public class ContactMechServices {
Delegator delegator = ctx.getDelegator();
Security security = ctx.getSecurity();
GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Locale locale = (Locale) context.get("locale");
Timestamp now = UtilDateTime.nowTimestamp();
List<GenericValue> toBeStored = FastList.newInstance();
boolean isModified = false;
String partyId = ServiceUtil.getPartyIdCheckSecurity(userLogin,
security, context, result, "PARTYMGR", "_PCM_UPDATE");
- String errMsg = null;
- Locale locale = (Locale) context.get("locale");
-
+
if (result.size() > 0)
return result;
@@ -150,8 +148,8 @@ public class ContactMechServices {
try {
newCmId = delegator.getNextSeqId("ContactMech");
} catch (IllegalArgumentException e) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_change_contact_info_id_generation_failure",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_change_contact_info_id_generation_failure",
locale));
}
String contactMechId = (String) context.get("contactMechId");
@@ -171,8 +169,8 @@ public class ContactMechServices {
List<GenericValue> partyContactMechs =
EntityUtil.filterByDate(delegator.findByAnd("PartyContactMech",
UtilMisc.toMap("partyId", partyId, "contactMechId", contactMechId),
UtilMisc.toList("fromDate")), true);
partyContactMech = EntityUtil.getFirst(partyContactMechs);
if (partyContactMech == null) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.cannot_update_specified_contact_info_not_corresponds",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.cannot_update_specified_contact_info_not_corresponds",
locale));
} else {
toBeStored.add(partyContactMech);
}
@@ -182,8 +180,8 @@ public class ContactMechServices {
}
}
if (contactMech == null) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_find_specified_contact_info_read",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_find_specified_contact_info_read", locale));
}
String contactMechTypeId = contactMech.getString("contactMechTypeId");
@@ -194,11 +192,11 @@ public class ContactMechServices {
GenericValue relatedEntityToSet = null;
if ("POSTAL_ADDRESS".equals(contactMechTypeId)) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.service_updateContactMech_not_be_used_for_POSTAL_ADDRESS",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.service_updateContactMech_not_be_used_for_POSTAL_ADDRESS",
locale));
} else if ("TELECOM_NUMBER".equals(contactMechTypeId)) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.service_updateContactMech_not_be_used_for_TELECOM_NUMBER",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.service_updateContactMech_not_be_used_for_TELECOM_NUMBER",
locale));
} else {
newContactMech.set("infoString", context.get("infoString"));
}
@@ -231,9 +229,9 @@ public class ContactMechServices {
}
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), module);
- Map<String, String> messageMap = UtilMisc.toMap("errMessage",
e.getMessage());
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_change_contact_info_read",
messageMap, locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_change_contact_info_read",
+ UtilMisc.toMap("errMessage", e.getMessage()), locale));
}
partyContactMech.set("thruDate", now);
@@ -241,15 +239,15 @@ public class ContactMechServices {
delegator.storeAll(toBeStored);
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), module);
- Map<String, String> messageMap = UtilMisc.toMap("errMessage",
e.getMessage());
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_change_contact_info_write",
messageMap, locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_change_contact_info_write",
+ UtilMisc.toMap("errMessage", e.getMessage()), locale));
}
} else {
- String sucMsg =
UtilProperties.getMessage(resource,"contactmechservices.no_changes_made_not_updating",
locale);
result.put("newContactMechId", contactMechId);
result.put(ModelService.RESPONSE_MESSAGE,
ModelService.RESPOND_SUCCESS);
- result.put(ModelService.SUCCESS_MESSAGE, sucMsg);
+ result.put(ModelService.SUCCESS_MESSAGE,
UtilProperties.getMessage(resourceError,
+ "contactmechservices.no_changes_made_not_updating",
locale));
return result;
}
@@ -270,11 +268,10 @@ public class ContactMechServices {
Delegator delegator = ctx.getDelegator();
Security security = ctx.getSecurity();
GenericValue userLogin = (GenericValue) context.get("userLogin");
-
- String partyId = ServiceUtil.getPartyIdCheckSecurity(userLogin,
security, context, result, "PARTYMGR", "_PCM_DELETE");
- String errMsg = null;
Locale locale = (Locale) context.get("locale");
-
+
+ String partyId = ServiceUtil.getPartyIdCheckSecurity(userLogin,
security, context, result, "PARTYMGR", "_PCM_DELETE");
+
if (result.size() > 0)
return result;
@@ -289,14 +286,14 @@ public class ContactMechServices {
partyContactMech = EntityUtil.getFirst(partyContactMechs);
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), module);
- Map<String, String> messageMap = UtilMisc.toMap("errMessage",
e.getMessage());
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_delete_contact_info_read",
messageMap, locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "contactmechservices.could_not_delete_contact_info_read",
+ UtilMisc.toMap("errMessage", e.getMessage()), locale));
}
if (partyContactMech == null) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_delete_contact_info_no_contact_found",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_delete_contact_info_no_contact_found", locale));
}
partyContactMech.set("thruDate", UtilDateTime.nowTimestamp());
@@ -304,8 +301,8 @@ public class ContactMechServices {
partyContactMech.store();
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), module);
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_delete_contact_info_write",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "contactmechservices.could_not_delete_contact_info_write",
locale));
}
result.put(ModelService.RESPONSE_MESSAGE,
ModelService.RESPOND_SUCCESS);
@@ -327,13 +324,12 @@ public class ContactMechServices {
Delegator delegator = ctx.getDelegator();
Security security = ctx.getSecurity();
GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Locale locale = (Locale) context.get("locale");
Timestamp now = UtilDateTime.nowTimestamp();
List<GenericValue> toBeStored = FastList.newInstance();
String partyId = ServiceUtil.getPartyIdCheckSecurity(userLogin,
security, context, result, "PARTYMGR", "_PCM_CREATE");
- String errMsg = null;
- Locale locale = (Locale) context.get("locale");
-
+
if (result.size() > 0)
return result;
@@ -343,8 +339,8 @@ public class ContactMechServices {
try {
newCmId = delegator.getNextSeqId("ContactMech");
} catch (IllegalArgumentException e) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_create_contact_info_id_generation_failure",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_create_contact_info_id_generation_failure",
locale));
}
GenericValue tempContactMech = delegator.makeValue("ContactMech",
UtilMisc.toMap("contactMechId", newCmId, "contactMechTypeId",
contactMechTypeId));
@@ -378,9 +374,9 @@ public class ContactMechServices {
delegator.storeAll(toBeStored);
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), module);
- Map<String, String> messageMap = UtilMisc.toMap("errMessage",
e.getMessage());
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_create_contact_info_write",
messageMap, locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "contactmechservices.could_not_create_contact_info_write",
+ UtilMisc.toMap("errMessage", e.getMessage()), locale));
}
result.put("contactMechId", newCmId);
@@ -400,15 +396,13 @@ public class ContactMechServices {
Delegator delegator = ctx.getDelegator();
Security security = ctx.getSecurity();
GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Locale locale = (Locale) context.get("locale");
Timestamp now = UtilDateTime.nowTimestamp();
List<GenericValue> toBeStored = FastList.newInstance();
boolean isModified = false;
String partyId = ServiceUtil.getPartyIdCheckSecurity(userLogin,
security, context, result, "PARTYMGR", "_PCM_UPDATE");
- String errMsg = null;
- Locale locale = (Locale) context.get("locale");
-
-
+
if (result.size() > 0) {
return result;
}
@@ -417,8 +411,8 @@ public class ContactMechServices {
try {
newCmId = delegator.getNextSeqId("ContactMech");
} catch (IllegalArgumentException e) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_change_contact_info_id_generation_failure",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_change_contact_info_id_generation_failure",
locale));
}
String contactMechId = (String) context.get("contactMechId");
@@ -438,8 +432,8 @@ public class ContactMechServices {
List<GenericValue> partyContactMechs =
EntityUtil.filterByDate(delegator.findByAnd("PartyContactMech",
UtilMisc.toMap("partyId", partyId, "contactMechId", contactMechId),
UtilMisc.toList("fromDate")), true);
partyContactMech = EntityUtil.getFirst(partyContactMechs);
if (partyContactMech == null) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.cannot_update_specified_contact_info_not_corresponds",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.cannot_update_specified_contact_info_not_corresponds",
locale));
} else {
toBeStored.add(partyContactMech);
}
@@ -449,8 +443,8 @@ public class ContactMechServices {
}
}
if (contactMech == null) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_find_specified_contact_info_read",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_find_specified_contact_info_read", locale));
}
// never change a contact mech, just create a new one with the changes
@@ -486,9 +480,9 @@ public class ContactMechServices {
}
relatedEntityToSet.set("contactMechId", newCmId);
} else {
- Map<String, String> messageMap =
UtilMisc.toMap("contactMechTypeId", contactMech.getString("contactMechTypeId"));
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_update_contact_as_POSTAL_ADDRESS_specified",
messageMap, locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_update_contact_as_POSTAL_ADDRESS_specified",
+ UtilMisc.toMap("contactMechTypeId",
contactMech.getString("contactMechTypeId")), locale));
}
if (newPartyContactMech != null) {
@@ -523,9 +517,9 @@ public class ContactMechServices {
}
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), module);
- Map<String, String> messageMap =
UtilMisc.toMap("errMessage", e.getMessage());
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_change_contact_info_read",
messageMap, locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_change_contact_info_read",
+ UtilMisc.toMap("errMessage", e.getMessage()),
locale));
}
partyContactMech.set("thruDate", now);
@@ -535,15 +529,15 @@ public class ContactMechServices {
delegator.storeAll(toBeStored);
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), module);
- Map<String, String> messageMap = UtilMisc.toMap("errMessage",
e.getMessage());
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_change_contact_info_write",
messageMap, locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_change_contact_info_write",
+ UtilMisc.toMap("errMessage", e.getMessage()), locale));
}
} else {
- String sucMsg =
UtilProperties.getMessage(resource,"contactmechservices.no_changes_made_not_updating",
locale);
result.put("newContactMechId", contactMechId);
result.put(ModelService.RESPONSE_MESSAGE,
ModelService.RESPOND_SUCCESS);
- result.put(ModelService.SUCCESS_MESSAGE, sucMsg);
+ result.put(ModelService.SUCCESS_MESSAGE,
UtilProperties.getMessage(resourceError,
+ "contactmechservices.no_changes_made_not_updating",
locale));
return result;
}
@@ -567,13 +561,12 @@ public class ContactMechServices {
Delegator delegator = ctx.getDelegator();
Security security = ctx.getSecurity();
GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Locale locale = (Locale) context.get("locale");
Timestamp now = UtilDateTime.nowTimestamp();
List<GenericValue> toBeStored = FastList.newInstance();
String partyId = ServiceUtil.getPartyIdCheckSecurity(userLogin,
security, context, result, "PARTYMGR", "_PCM_CREATE");
- String errMsg = null;
- Locale locale = (Locale) context.get("locale");
-
+
if (result.size() > 0)
return result;
@@ -583,8 +576,8 @@ public class ContactMechServices {
try {
newCmId = delegator.getNextSeqId("ContactMech");
} catch (IllegalArgumentException e) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_create_contact_info_id_generation_failure",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_create_contact_info_id_generation_failure",
locale));
}
GenericValue tempContactMech = delegator.makeValue("ContactMech",
UtilMisc.toMap("contactMechId", newCmId, "contactMechTypeId",
contactMechTypeId));
@@ -600,9 +593,9 @@ public class ContactMechServices {
delegator.storeAll(toBeStored);
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), module);
- Map<String, String> messageMap = UtilMisc.toMap("errMessage",
e.getMessage());
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_create_contact_info_write",
messageMap, locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "contactmechservices.could_not_create_contact_info_write",
+ UtilMisc.toMap("errMessage", e.getMessage()), locale));
}
result.put("contactMechId", newCmId);
@@ -622,14 +615,13 @@ public class ContactMechServices {
Delegator delegator = ctx.getDelegator();
Security security = ctx.getSecurity();
GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Locale locale = (Locale) context.get("locale");
Timestamp now = UtilDateTime.nowTimestamp();
List<GenericValue> toBeStored = FastList.newInstance();
boolean isModified = false;
String partyId = ServiceUtil.getPartyIdCheckSecurity(userLogin,
security, context, result, "PARTYMGR", "_PCM_UPDATE");
- String errMsg = null;
- Locale locale = (Locale) context.get("locale");
-
+
if (result.size() > 0)
return result;
@@ -637,8 +629,8 @@ public class ContactMechServices {
try {
newCmId = delegator.getNextSeqId("ContactMech");
} catch (IllegalArgumentException e) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_change_contact_info_id_generation_failure",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_change_contact_info_id_generation_failure",
locale));
}
String contactMechId = (String) context.get("contactMechId");
@@ -657,12 +649,12 @@ public class ContactMechServices {
partyContactMech = null;
}
if (contactMech == null) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_find_specified_contact_info_read",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_find_specified_contact_info_read", locale));
}
if (partyContactMech == null) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.cannot_update_specified_contact_info_not_corresponds",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.cannot_update_specified_contact_info_not_corresponds",
locale));
}
toBeStored.add(partyContactMech);
@@ -691,9 +683,9 @@ public class ContactMechServices {
relatedEntityToSet.set("contactMechId", newCmId);
newPartyContactMech.set("extension", context.get("extension"));
} else {
- Map<String, String> messageMap =
UtilMisc.toMap("contactMechTypeId", contactMech.getString("contactMechTypeId"));
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_update_contact_as_TELECOM_NUMBER_specified",
messageMap, locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_update_contact_as_TELECOM_NUMBER_specified",
+ UtilMisc.toMap("contactMechTypeId",
contactMech.getString("contactMechTypeId")), locale));
}
newPartyContactMech.set("roleTypeId", context.get("roleTypeId"));
@@ -724,9 +716,9 @@ public class ContactMechServices {
}
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), module);
- Map<String, String> messageMap = UtilMisc.toMap("errMessage",
e.getMessage());
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_change_contact_info_read",
messageMap, locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_change_contact_info_read",
+ UtilMisc.toMap("errMessage", e.getMessage()), locale));
}
partyContactMech.set("thruDate", now);
@@ -734,15 +726,15 @@ public class ContactMechServices {
delegator.storeAll(toBeStored);
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), module);
- Map<String, String> messageMap = UtilMisc.toMap("errMessage",
e.getMessage());
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_change_contact_info_write",
messageMap, locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_change_contact_info_write",
+ UtilMisc.toMap("errMessage", e.getMessage()), locale));
}
} else {
- String sucMsg =
UtilProperties.getMessage(resource,"contactmechservices.no_changes_made_not_updating",
locale);
result.put("newContactMechId", contactMechId);
result.put(ModelService.RESPONSE_MESSAGE,
ModelService.RESPOND_SUCCESS);
- result.put(ModelService.SUCCESS_MESSAGE, sucMsg);
+ result.put(ModelService.SUCCESS_MESSAGE,
UtilProperties.getMessage(resourceError,
+ "contactmechservices.no_changes_made_not_updating",
locale));
return result;
}
@@ -831,7 +823,8 @@ public class ContactMechServices {
if (tempVal != null) {
// exists already with valid date, show warning
- errMsg = UtilProperties.getMessage(resource,
"contactmechservices.could_not_create_new_purpose_already_exists", locale);
+ errMsg = UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_create_new_purpose_already_exists", locale);
errMsg += ": " + tempVal.getPrimaryKey().toString();
return ServiceUtil.returnError(errMsg);
} else {
@@ -844,9 +837,9 @@ public class ContactMechServices {
delegator.create(newPartyContactMechPurpose);
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
- Map<String, String> messageMap = UtilMisc.toMap("errMessage",
e.getMessage());
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_add_purpose_write",
messageMap, locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "contactmechservices.could_not_add_purpose_write",
+ UtilMisc.toMap("errMessage", e.getMessage()), locale));
}
}
@@ -861,11 +854,10 @@ public class ContactMechServices {
Delegator delegator = ctx.getDelegator();
Security security = ctx.getSecurity();
GenericValue userLogin = (GenericValue) context.get("userLogin");
-
- String partyId = ServiceUtil.getPartyIdCheckSecurity(userLogin,
security, context, result, "PARTYMGR", "_PCM_DELETE");
- String errMsg = null;
Locale locale = (Locale) context.get("locale");
+ String partyId = ServiceUtil.getPartyIdCheckSecurity(userLogin,
security, context, result, "PARTYMGR", "_PCM_DELETE");
+
if (result.size() > 0) {
return result;
}
@@ -898,9 +890,9 @@ public class ContactMechServices {
}
} catch (GenericServiceException e) {
Debug.logWarning(e.getMessage(), module);
- Map<String, String> messageMap = UtilMisc.toMap("errMessage",
e.getMessage());
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_delete_purpose_from_contact_mechanism_read",
messageMap, locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_delete_purpose_from_contact_mechanism_read",
+ UtilMisc.toMap("errMessage", e.getMessage()), locale));
}
}
result.put(ModelService.RESPONSE_MESSAGE,
ModelService.RESPOND_SUCCESS);
@@ -919,11 +911,10 @@ public class ContactMechServices {
Delegator delegator = ctx.getDelegator();
Security security = ctx.getSecurity();
GenericValue userLogin = (GenericValue) context.get("userLogin");
-
- String partyId = ServiceUtil.getPartyIdCheckSecurity(userLogin,
security, context, result, "PARTYMGR", "_PCM_DELETE");
- String errMsg = null;
Locale locale = (Locale) context.get("locale");
+ String partyId = ServiceUtil.getPartyIdCheckSecurity(userLogin,
security, context, result, "PARTYMGR", "_PCM_DELETE");
+
if (result.size() > 0)
return result;
@@ -937,14 +928,14 @@ public class ContactMechServices {
try {
pcmp = delegator.findByPrimaryKey("PartyContactMechPurpose",
UtilMisc.toMap("partyId", partyId, "contactMechId", contactMechId,
"contactMechPurposeTypeId", contactMechPurposeTypeId, "fromDate", fromDate));
if (pcmp == null) {
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_delete_purpose_from_contact_mechanism_not_found",
locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_delete_purpose_from_contact_mechanism_not_found",
locale));
}
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
- Map<String, String> messageMap = UtilMisc.toMap("errMessage",
e.getMessage());
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_delete_purpose_from_contact_mechanism_read",
messageMap, locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_delete_purpose_from_contact_mechanism_read",
+ UtilMisc.toMap("errMessage", e.getMessage()), locale));
}
pcmp.set("thruDate", UtilDateTime.nowTimestamp());
@@ -952,9 +943,9 @@ public class ContactMechServices {
pcmp.store();
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
- Map<String, String> messageMap = UtilMisc.toMap("errMessage",
e.getMessage());
- errMsg =
UtilProperties.getMessage(resource,"contactmechservices.could_not_delete_purpose_from_contact_mechanism_write",
messageMap, locale);
- return ServiceUtil.returnError(errMsg);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"contactmechservices.could_not_delete_purpose_from_contact_mechanism_write",
+ UtilMisc.toMap("errMessage", e.getMessage()), locale));
}
result.put(ModelService.RESPONSE_MESSAGE,
ModelService.RESPOND_SUCCESS);
@@ -973,11 +964,13 @@ public class ContactMechServices {
Delegator delegator = ctx.getDelegator();
GenericValue userLogin = (GenericValue) context.get("userLogin");
String partyId = (String)context.get("partyId");
+ Locale locale = (Locale) context.get("locale");
if (UtilValidate.isEmpty(partyId)) {
if (userLogin != null) {
partyId = userLogin.getString("partyId");
} else {
- return ServiceUtil.returnError("Both 'partyId' and 'userLogin'
are empty.");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "PartyCannotGetPartyContactMech", locale));
}
}
Boolean bShowOld = (Boolean)context.get("showOld");
@@ -998,6 +991,7 @@ public class ContactMechServices {
String partyIdFrom = (String) context.get("partyIdFrom");
String partyIdTo = (String) context.get("partyIdTo");
+ Locale locale = (Locale) context.get("locale");
try {
// grab all of the non-expired contact mechs using this party
worker method
@@ -1032,7 +1026,9 @@ public class ContactMechServices {
}
} catch (GenericServiceException e) {
Debug.logError(e, e.getMessage(), module);
- return ServiceUtil.returnError("Failed to copy contact mechs.
Error: " + e.getMessage());
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "PartyCannotCopyPartyContactMech",
+ UtilMisc.toMap("errorString", e.getMessage()), locale));
}
return ServiceUtil.returnSuccess();
}
Modified:
ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java?rev=1055656&r1=1055655&r2=1055656&view=diff
==============================================================================
---
ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java
(original)
+++
ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java
Wed Jan 5 21:49:33 2011
@@ -20,6 +20,7 @@
package org.ofbiz.party.party;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import javolution.util.FastMap;
@@ -27,6 +28,7 @@ import javolution.util.FastMap;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilDateTime;
import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
@@ -46,7 +48,8 @@ import org.ofbiz.service.ServiceUtil;
public class PartyRelationshipServices {
public static final String module =
PartyRelationshipServices.class.getName();
- public static final String resource = "PartyErrorUiLabels";
+ public static final String resource = "PartyUiLabels";
+ public static final String resourceError = "PartyErrorUiLabels";
/** Creates a PartyRelationshipType
*...@param ctx The DispatchContext that this service is operating in
@@ -58,6 +61,7 @@ public class PartyRelationshipServices {
Delegator delegator = ctx.getDelegator();
Security security = ctx.getSecurity();
GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Locale locale = (Locale) context.get("locale");
ServiceUtil.getPartyIdCheckSecurity(userLogin, security, context,
result, "PARTYMGR", "_CREATE");
@@ -75,18 +79,23 @@ public class PartyRelationshipServices {
try {
if (delegator.findOne(partyRelationshipType.getEntityName(),
partyRelationshipType.getPrimaryKey(), false) != null) {
- return ServiceUtil.returnError("Could not create party
relationship type: already exists");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "PartyRelationshipTypeAlreadyExists", locale));
}
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
- return ServiceUtil.returnError("Could not create party
relationship type (read failure): " + e.getMessage());
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "PartyRelationshipTypeReadFailure",
+ UtilMisc.toMap("errorString", e.getMessage()), locale));
}
try {
partyRelationshipType.create();
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
- return ServiceUtil.returnError("Could not create party
relationship type (write failure): " + e.getMessage());
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "PartyRelationshipTypeWriteFailure",
+ UtilMisc.toMap("errorString", e.getMessage()), locale));
}
result.put(ModelService.RESPONSE_MESSAGE,
ModelService.RESPOND_SUCCESS);
@@ -103,6 +112,7 @@ public class PartyRelationshipServices {
Map<String, Object> result = FastMap.newInstance();
Delegator delegator = ctx.getDelegator();
LocalDispatcher dispatcher = ctx.getDispatcher();
+ Locale locale = (Locale) context.get("locale");
try {
List<GenericValue> partyRelationShipList =
PartyRelationshipHelper.getActivePartyRelationships(delegator, context);
@@ -146,12 +156,16 @@ public class PartyRelationshipServices {
dispatcher.runSync("createPartyRelationship", context); //
Create new one
} catch (GenericServiceException e) {
Debug.logWarning(e.getMessage(), module);
- return ServiceUtil.returnError("Could not create party
relationship (write failure): " + e.getMessage());
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"partyrelationshipservices.could_not_create_party_role_write",
+ UtilMisc.toMap("errorString", e.getMessage()),
locale));
}
}
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
- return ServiceUtil.returnError("Could not create party
relationship (write failure): " + e.getMessage());
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"partyrelationshipservices.could_not_create_party_role_write",
+ UtilMisc.toMap("errorString", e.getMessage()), locale));
}
result.put(ModelService.RESPONSE_MESSAGE,
ModelService.RESPOND_SUCCESS);
return result;