You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2017/12/31 12:30:49 UTC
svn commit: r1819735 [1/2] - in /ofbiz/ofbiz-plugins/trunk:
birt/src/main/java/org/apache/ofbiz/birt/
birt/src/main/java/org/apache/ofbiz/birt/email/
birt/src/main/java/org/apache/ofbiz/birt/flexible/
ebay/src/main/java/org/apache/ofbiz/ebay/ ebaystore...
Author: jleroux
Date: Sun Dec 31 12:30:48 2017
New Revision: 1819735
URL: http://svn.apache.org/viewvc?rev=1819735&view=rev
Log:
Improved: Handle service response effectively
(OFBIZ-9981)
As per discussion on Dev ML:
==========================
Every service calling from java/groovy must handle errors by service util
methods such as isError, returnError etc.
and similarly in case of XML <call-service, there should be <check-error/>
to make sure service was executed successfully.
Apart from this, one suggestion is to include *Debug.logError* in
*ServiceUtil.returnProblem* so that in case of any error occurred and handled,
it will always be logged on the console.
==========================
jleroux: this is the plugins part with some slight changes
Thanks: Suraj Khurana and Anushi Gupta
Modified:
ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java
ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/email/BirtEmailServices.java
ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java
ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayHelper.java
ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java
ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java
ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java
ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java
ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPrefEvents.java
ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java
ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java
ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreInventoryServices.java
ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java
ofbiz/ofbiz-plugins/trunk/ldap/src/main/java/org/apache/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java
ofbiz/ofbiz-plugins/trunk/lucene/src/main/java/org/apache/ofbiz/content/search/SearchEvents.java
ofbiz/ofbiz-plugins/trunk/lucene/src/main/java/org/apache/ofbiz/content/search/SearchServices.java
ofbiz/ofbiz-plugins/trunk/lucene/src/main/java/org/apache/ofbiz/content/test/LuceneTests.java
ofbiz/ofbiz-plugins/trunk/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumServices.java
ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/ProductUtil.java
ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/SolrProductSearch.java
ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/test/SolrTests.java
ofbiz/ofbiz-plugins/trunk/webpos/src/main/java/org/apache/ofbiz/webpos/WebPosEvents.java
Modified: ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java (original)
+++ ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java Sun Dec 31 12:30:48 2017
@@ -272,20 +272,45 @@ public final class BirtWorker {
reportForm = reportFormExpd.expandString(context);
//create content and dataressource strucutre
- dispatcher.runSync("createDataResource", UtilMisc.toMap("dataResourceId", dataResourceId, "dataResourceTypeId", "ELECTRONIC_TEXT", "dataTemplateTypeId", "FORM_COMBINED", "userLogin", userLogin));
- dispatcher.runSync("createElectronicTextForm", UtilMisc.toMap("dataResourceId", dataResourceId, "textData", reportForm, "userLogin", userLogin));
- dispatcher.runSync("createContent", UtilMisc.toMap("contentId", contentId, "contentTypeId", "FLEXIBLE_REPORT", "dataResourceId", dataResourceId, "statusId", "CTNT_IN_PROGRESS", "contentName", reportName, "description", description, "userLogin", userLogin));
+ Map<String, Object> result = null;
+ result = dispatcher.runSync("createDataResource", UtilMisc.toMap("dataResourceId", dataResourceId, "dataResourceTypeId", "ELECTRONIC_TEXT", "dataTemplateTypeId", "FORM_COMBINED", "userLogin", userLogin));
+ if (ServiceUtil.isError(result)) {
+ throw new GeneralException(ServiceUtil.getErrorMessage(result));
+ }
+ result = dispatcher.runSync("createElectronicTextForm", UtilMisc.toMap("dataResourceId", dataResourceId, "textData", reportForm, "userLogin", userLogin));
+ if (ServiceUtil.isError(result)) {
+ throw new GeneralException(ServiceUtil.getErrorMessage(result));
+ }
+ result = dispatcher.runSync("createContent", UtilMisc.toMap("contentId", contentId, "contentTypeId", "FLEXIBLE_REPORT", "dataResourceId", dataResourceId, "statusId", "CTNT_IN_PROGRESS", "contentName", reportName, "description", description, "userLogin", userLogin));
+ if (ServiceUtil.isError(result)) {
+ throw new GeneralException(ServiceUtil.getErrorMessage(result));
+ }
String dataResourceIdRpt = delegator.getNextSeqId("DataResource");
String contentIdRpt = delegator.getNextSeqId("Content");
String rptDesignName = BirtUtil.encodeReportName(reportName);
if (!rptDesignName.endsWith(".rptdesign")) {
rptDesignName = rptDesignName.concat(".rptdesign");
}
- dispatcher.runSync("createDataResource", UtilMisc.toMap("dataResourceId", dataResourceIdRpt, "dataResourceTypeId", "LOCAL_FILE", "mimeTypeId", "text/rptdesign", "dataResourceName", rptDesignName, "objectInfo", templateFileLocation, "userLogin", userLogin));
- dispatcher.runSync("createContent", UtilMisc.toMap("contentId", contentIdRpt, "contentTypeId", "RPTDESIGN", "dataResourceId", dataResourceIdRpt, "statusId", "CTNT_PUBLISHED", "contentName", reportName, "description", description + " (.rptDesign file)", "userLogin", userLogin));
- dispatcher.runSync("createContentAssoc", UtilMisc.toMap("contentId", masterContentId, "contentIdTo", contentId, "contentAssocTypeId", "SUB_CONTENT", "userLogin", userLogin));
- dispatcher.runSync("createContentAssoc", UtilMisc.toMap("contentId", contentId, "contentIdTo", contentIdRpt, "contentAssocTypeId", "SUB_CONTENT", "userLogin", userLogin));
- dispatcher.runSync("createContentAttribute", UtilMisc.toMap("contentId", contentId, "attrName", workflowType, "attrValue", modelElementName, "userLogin", userLogin));
+ result = dispatcher.runSync("createDataResource", UtilMisc.toMap("dataResourceId", dataResourceIdRpt, "dataResourceTypeId", "LOCAL_FILE", "mimeTypeId", "text/rptdesign", "dataResourceName", rptDesignName, "objectInfo", templateFileLocation, "userLogin", userLogin));
+ if (ServiceUtil.isError(result)) {
+ throw new GeneralException(ServiceUtil.getErrorMessage(result));
+ }
+ result = dispatcher.runSync("createContent", UtilMisc.toMap("contentId", contentIdRpt, "contentTypeId", "RPTDESIGN", "dataResourceId", dataResourceIdRpt, "statusId", "CTNT_PUBLISHED", "contentName", reportName, "description", description + " (.rptDesign file)", "userLogin", userLogin));
+ if (ServiceUtil.isError(result)) {
+ throw new GeneralException(ServiceUtil.getErrorMessage(result));
+ }
+ result = dispatcher.runSync("createContentAssoc", UtilMisc.toMap("contentId", masterContentId, "contentIdTo", contentId, "contentAssocTypeId", "SUB_CONTENT", "userLogin", userLogin));
+ if (ServiceUtil.isError(result)) {
+ throw new GeneralException(ServiceUtil.getErrorMessage(result));
+ }
+ result = dispatcher.runSync("createContentAssoc", UtilMisc.toMap("contentId", contentId, "contentIdTo", contentIdRpt, "contentAssocTypeId", "SUB_CONTENT", "userLogin", userLogin));
+ if (ServiceUtil.isError(result)) {
+ throw new GeneralException(ServiceUtil.getErrorMessage(result));
+ }
+ result = dispatcher.runSync("createContentAttribute", UtilMisc.toMap("contentId", contentId, "attrName", workflowType, "attrValue", modelElementName, "userLogin", userLogin));
+ if (ServiceUtil.isError(result)) {
+ throw new GeneralException(ServiceUtil.getErrorMessage(result));
+ }
return contentId;
}
Modified: ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/email/BirtEmailServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/email/BirtEmailServices.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/email/BirtEmailServices.java (original)
+++ ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/email/BirtEmailServices.java Sun Dec 31 12:30:48 2017
@@ -257,9 +257,15 @@ public class BirtEmailServices {
Map<String, Object> result = ServiceUtil.returnSuccess();
try {
if (isMultiPart) {
- dispatcher.runSync("sendMailMultiPart", serviceContext);
+ Map<String, Object> resultMap = dispatcher.runSync("sendMailMultiPart", serviceContext);
+ if (ServiceUtil.isError(resultMap)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultMap));
+ }
} else {
- dispatcher.runSync("sendMail", serviceContext);
+ Map<String, Object> resultMap = dispatcher.runSync("sendMail", serviceContext);
+ if (ServiceUtil.isError(resultMap)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultMap));
+ }
}
} catch (GenericServiceException e) {
String errMsg = UtilProperties.getMessage(resource, "BirtErrorInSendingEmail", UtilMisc.toMap("errorString", e.toString()), locale);
Modified: ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java (original)
+++ ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java Sun Dec 31 12:30:48 2017
@@ -136,6 +136,10 @@ public class BirtServices {
String birtType = null;
try {
Map<String, Object> convertRes = dispatcher.runSync("convertFieldTypeToBirtType", UtilMisc.toMap("fieldType", fieldType, "userLogin", userLogin));
+ if (ServiceUtil.isError(convertRes)) {
+ String errMsg = UtilProperties.getMessage(resource_error, "BirtErrorConversionFieldToBirtFailed", locale);
+ return ServiceUtil.returnError(errMsg + ServiceUtil.getErrorMessage(convertRes));
+ }
birtType = (String) convertRes.get("birtType");
if (UtilValidate.isEmpty(birtType)) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorConversionFieldToBirtFailed", locale));
@@ -278,6 +282,9 @@ public class BirtServices {
Map<String, Object> resultFormDisplay;
try {
resultFormDisplay = dispatcher.runSync("prepareFlexibleReportSearchFormToEdit", UtilMisc.toMap("reportContentId", reportContentId, "userLogin", userLogin, "locale", locale));
+ if (ServiceUtil.isError(resultFormDisplay)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultFormDisplay));
+ }
textForm = (String) resultFormDisplay.get("textForm");
} catch (GenericServiceException e) {
Debug.logError(e, module);
@@ -315,8 +322,11 @@ public class BirtServices {
newForm.append(overrideFilters);
newForm.append("</forms>");
Document xmlForm = UtilXml.readXmlDocument(newForm.toString());
- dispatcher.runSync("updateElectronicTextForm", UtilMisc.toMap("dataResourceId", dataResourceId, "textData", UtilXml.writeXmlDocument(xmlForm),
+ Map<String, Object> result = dispatcher.runSync("updateElectronicTextForm", UtilMisc.toMap("dataResourceId", dataResourceId, "textData", UtilXml.writeXmlDocument(xmlForm),
"userLogin", userLogin, "locale", locale));
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
} catch (GeneralException | SAXException | ParserConfigurationException | IOException e) {
Debug.logError(e, module);
return ServiceUtil.returnError("Error in overrideReportForm service."); //TODO labelise
@@ -425,11 +435,14 @@ public class BirtServices {
}
contentId = BirtWorker.recordReportContent(delegator, dispatcher, context);
String rptDesignFileName = BirtUtil.resolveRptDesignFilePathFromContent(delegator, contentId);
- Map<String, Object> resultService = dispatcher.runSync(serviceName, UtilMisc.toMap("locale", locale, "userLogin", userLogin));
- Map<String, String> dataMap = UtilGenerics.checkMap(resultService.get("dataMap"));
- Map<String, String> filterMap = UtilGenerics.checkMap(resultService.get("filterMap"));
- Map<String, String> fieldDisplayLabels = UtilGenerics.checkMap(resultService.get("fieldDisplayLabels"));
- Map<String, String> filterDisplayLabels = UtilGenerics.checkMap(resultService.get("filterDisplayLabels"));
+ Map<String, Object> serviceResult = dispatcher.runSync(serviceName, UtilMisc.toMap("locale", locale, "userLogin", userLogin));
+ if (ServiceUtil.isError(serviceResult)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
+ }
+ Map<String, String> dataMap = UtilGenerics.checkMap(serviceResult.get("dataMap"));
+ Map<String, String> filterMap = UtilGenerics.checkMap(serviceResult.get("filterMap"));
+ Map<String, String> fieldDisplayLabels = UtilGenerics.checkMap(serviceResult.get("fieldDisplayLabels"));
+ Map<String, String> filterDisplayLabels = UtilGenerics.checkMap(serviceResult.get("filterDisplayLabels"));
Map<String, Object> resultGeneration = dispatcher.runSync("createFlexibleReport", UtilMisc.toMap(
"locale", locale,
"dataMap", dataMap,
@@ -577,7 +590,9 @@ public class BirtServices {
try {
for (String contentId : listContentId) {
Map<String, Object> returnMap = dispatcher.runSync("deleteFlexibleReport", UtilMisc.toMap("contentId", contentId, "userLogin", userLogin, "locale", locale));
- ServiceUtil.isError(returnMap);
+ if (ServiceUtil.isError(returnMap)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(returnMap));
+ }
}
} catch (GenericServiceException e) {
Debug.logError(e, module);
@@ -630,8 +645,14 @@ public class BirtServices {
}
try {
delegator.removeByAnd("ContentAttribute", UtilMisc.toMap("contentId", contentId));
- dispatcher.runSync("removeContentAndRelated", UtilMisc.toMap("contentId", contentId, "userLogin", userLogin, "locale", locale));
- dispatcher.runSync("removeContentAndRelated", UtilMisc.toMap("contentId", contentIdRpt, "userLogin", userLogin, "locale", locale));
+ Map<String, Object> result = dispatcher.runSync("removeContentAndRelated", UtilMisc.toMap("contentId", contentId, "userLogin", userLogin, "locale", locale));
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
+ result = dispatcher.runSync("removeContentAndRelated", UtilMisc.toMap("contentId", contentIdRpt, "userLogin", userLogin, "locale", locale));
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
} catch (GenericServiceException | GenericEntityException e) {
Debug.logError(e, module);
return ServiceUtil.returnError("Error in deleteFlexibleReport service."); //TODO labelise
Modified: ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayHelper.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayHelper.java (original)
+++ ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayHelper.java Sun Dec 31 12:30:48 2017
@@ -253,6 +253,9 @@ public class EbayHelper {
Map<String, Object> results = dispatcher.runSync("createPaymentFromPreference", UtilMisc.toMap("userLogin", userLogin,
"orderPaymentPreferenceId", paymentPreference.get("orderPaymentPreferenceId"), "paymentFromId",
partyIdFrom, "paymentRefNum", externalId, "comments", "Payment receive via eBay"));
+ if (ServiceUtil.isError(results)) {
+ Debug.logError(ServiceUtil.getErrorMessage(results) + " - " + results, module);
+ }
if ((results == null) || (results.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_ERROR))) {
Debug.logError((String) results.get(ModelService.ERROR_MESSAGE), module);
@@ -315,6 +318,10 @@ public class EbayHelper {
Map<String, Object> summaryResult = dispatcher.runSync("createPerson", UtilMisc.<String, Object> toMap("description",
name, "firstName", firstName, "lastName", lastName, "userLogin", userLogin, "comments",
"Created via eBay"));
+ if (ServiceUtil.isError(summaryResult)) {
+ Debug.logError(ServiceUtil.getErrorMessage(summaryResult) + " - " + summaryResult, module);
+ return null;
+ }
partyId = (String) summaryResult.get("partyId");
if (Debug.verboseOn()) Debug.logVerbose("Created Customer Party: " + partyId, module);
}
@@ -346,6 +353,10 @@ public class EbayHelper {
correctCityStateCountry(dispatcher, context, city, state, country);
Map<String, Object> summaryResult = dispatcher.runSync("createPartyPostalAddress", context);
+ if (ServiceUtil.isError(summaryResult)) {
+ Debug.logError(ServiceUtil.getErrorMessage(summaryResult) + " - " + summaryResult, module);
+ return null;
+ }
contactMechId = (String) summaryResult.get("contactMechId");
// Set also as a billing address
context = new HashMap<String, Object>();
@@ -353,7 +364,11 @@ public class EbayHelper {
context.put("contactMechId", contactMechId);
context.put("contactMechPurposeTypeId", "BILLING_LOCATION");
context.put("userLogin", userLogin);
- dispatcher.runSync("createPartyContactMechPurpose", context);
+ summaryResult = dispatcher.runSync("createPartyContactMechPurpose", context);
+ if (ServiceUtil.isError(summaryResult)) {
+ Debug.logError(ServiceUtil.getErrorMessage(summaryResult) + " - " + summaryResult, module);
+ return null;
+ }
} catch (GenericServiceException e) {
Debug.logError(e, "Failed to createAddress", module);
}
@@ -409,6 +424,10 @@ public class EbayHelper {
context.put("userLogin", userLogin);
context.put("contactMechPurposeTypeId", "PHONE_SHIPPING");
summaryResult = dispatcher.runSync("createPartyTelecomNumber", context);
+ if (ServiceUtil.isError(summaryResult)) {
+ Debug.logError(ServiceUtil.getErrorMessage(summaryResult) + " - " + summaryResult, module);
+ return null;
+ }
phoneContactMechId = (String) summaryResult.get("contactMechId");
} catch (GenericServiceException e) {
Debug.logError(e, "Failed to createPartyPhone", module);
@@ -428,6 +447,9 @@ public class EbayHelper {
context.put("userLogin", userLogin);
context.put("contactMechTypeId", "EMAIL_ADDRESS");
summaryResult = dispatcher.runSync("createEmailAddress", context);
+ if (ServiceUtil.isError(summaryResult)) {
+ Debug.logError(ServiceUtil.getErrorMessage(summaryResult) + " - " + summaryResult, module);
+ }
emailContactMechId = (String) summaryResult.get("contactMechId");
context.clear();
@@ -436,6 +458,9 @@ public class EbayHelper {
context.put("contactMechPurposeTypeId", "OTHER_EMAIL");
context.put("userLogin", userLogin);
summaryResult = dispatcher.runSync("createPartyContactMech", context);
+ if (ServiceUtil.isError(summaryResult)) {
+ Debug.logError(ServiceUtil.getErrorMessage(summaryResult) + " - " + summaryResult, module);
+ }
}
} catch (GenericServiceException e) {
Debug.logError(e, "Failed to createPartyEmail", module);
@@ -454,6 +479,9 @@ public class EbayHelper {
context.put("attrValue", eias);
context.put("userLogin", userLogin);
summaryResult = dispatcher.runSync("createPartyAttribute", context);
+ if (ServiceUtil.isError(summaryResult)) {
+ Debug.logError(ServiceUtil.getErrorMessage(summaryResult) + " - " + summaryResult, module);
+ }
} catch (GenericServiceException e) {
Debug.logError(e, "Failed to create eBay EIAS party attribute");
}
@@ -467,6 +495,9 @@ public class EbayHelper {
context.put("attrValue", ebayUserIdBuyer);
context.put("userLogin", userLogin);
summaryResult = dispatcher.runSync("createPartyAttribute", context);
+ if (ServiceUtil.isError(summaryResult)) {
+ Debug.logError(ServiceUtil.getErrorMessage(summaryResult) + " - " + summaryResult, module);
+ }
} catch (GenericServiceException e) {
Debug.logError(e, "Failed to create eBay userId party attribute");
}
Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java (original)
+++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java Sun Dec 31 12:30:48 2017
@@ -101,80 +101,119 @@ public class EbayBestOfferAutoPref {
ebayCondition1.put("prefCondId", prefCondId1);
ebayCondition1.put("parentPrefCondId", parentPrefCondId);
ebayCondition1.put("description", "Kind of Price Field");
- dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition1);
+ result = dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition1);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
String prefCondId2 = delegator.getNextSeqId("EbayProductStorePrefCond");
ebayCondition2.put("prefCondId", prefCondId2);
ebayCondition2.put("parentPrefCondId", parentPrefCondId);
ebayCondition2.put("description", "acceptBestOfferValue Field");
- dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition2);
+ result = dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition2);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
String prefCondId3 = delegator.getNextSeqId("EbayProductStorePrefCond");
ebayCondition3.put("prefCondId", prefCondId3);
ebayCondition3.put("parentPrefCondId", parentPrefCondId);
ebayCondition3.put("description", "rejectOffer Field");
- dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition3);
+ result = dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition3);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
String prefCondId4 = delegator.getNextSeqId("EbayProductStorePrefCond");
ebayCondition4.put("prefCondId", prefCondId4);
ebayCondition4.put("parentPrefCondId", parentPrefCondId);
ebayCondition4.put("description", "ignoreOfferMessage Field");
- dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition4);
+ result = dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition4);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
String prefCondId5 = delegator.getNextSeqId("EbayProductStorePrefCond");
ebayCondition5.put("prefCondId", prefCondId5);
ebayCondition5.put("parentPrefCondId", parentPrefCondId);
ebayCondition5.put("description", "rejectGreaterEnable Field");
- dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition5);
+ result = dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition5);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
String prefCondId6 = delegator.getNextSeqId("EbayProductStorePrefCond");
ebayCondition6.put("prefCondId", prefCondId6);
ebayCondition6.put("parentPrefCondId", parentPrefCondId);
ebayCondition6.put("description", "greaterValue Field");
- dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition6);
+ result = dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition6);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
String prefCondId7 = delegator.getNextSeqId("EbayProductStorePrefCond");
ebayCondition7.put("prefCondId", prefCondId7);
ebayCondition7.put("parentPrefCondId", parentPrefCondId);
ebayCondition7.put("description", "lessValue Field");
- dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition7);
+ result = dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition7);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
String prefCondId8 = delegator.getNextSeqId("EbayProductStorePrefCond");
ebayCondition8.put("prefCondId", prefCondId8);
ebayCondition8.put("parentPrefCondId", parentPrefCondId);
ebayCondition8.put("description", "rejectGreaterMsg Field");
- dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition8);
+ result = dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition8);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
String prefCondId9 = delegator.getNextSeqId("EbayProductStorePrefCond");
ebayCondition9.put("prefCondId", prefCondId9);
ebayCondition9.put("parentPrefCondId", parentPrefCondId);
ebayCondition9.put("description", "rejectLessEnable Field");
- dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition9);
+ result = dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition9);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
String prefCondId10 = delegator.getNextSeqId("EbayProductStorePrefCond");
ebayCondition10.put("prefCondId", prefCondId10);
ebayCondition10.put("parentPrefCondId", parentPrefCondId);
ebayCondition10.put("description", "lessThanValue Field");
- dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition10);
+ result = dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition10);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
String prefCondId11 = delegator.getNextSeqId("EbayProductStorePrefCond");
ebayCondition11.put("prefCondId", prefCondId11);
ebayCondition11.put("parentPrefCondId", parentPrefCondId);
ebayCondition11.put("description", "rejectLessMsg Field");
- dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition11);
+ result = dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition11);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
Map<String, Object> ebayPref = UtilMisc.<String, Object>toMap("userLogin", userLogin, "serviceName", "autoBestOffer");
ebayPref.put("parentPrefCondId",parentPrefCondId);
ebayPref.put("enabled", enabled);
ebayPref.put("autoPrefEnumId", "EBAY_AUTO_BEST_OFFER");
ebayPref.put("productStoreId",productStoreId);
- dispatcher.runSync("createEbayProductStorePref",ebayPref);
+ result = dispatcher.runSync("createEbayProductStorePref",ebayPref);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
} else {
Map<String, Object> ebayPref = UtilMisc.<String, Object>toMap("userLogin", userLogin, "serviceName", "autoBestOffer");
ebayPref.put("enabled", enabled);
ebayPref.put("autoPrefEnumId", "EBAY_AUTO_BEST_OFFER");
ebayPref.put("productStoreId",productStoreId);
- dispatcher.runSync("updateEbayProductStorePref",ebayPref);
+ result = dispatcher.runSync("updateEbayProductStorePref",ebayPref);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
String parentPrefCondId = productStorePref.getString("parentPrefCondId");
List<GenericValue> productPref = EntityQuery.use(delegator).from("EbayProductStorePrefCond").where("parentPrefCondId",parentPrefCondId).queryList();
@@ -184,7 +223,10 @@ public class EbayBestOfferAutoPref {
for (int i = 0; i < productPref.size(); i++) {
ebayPrefCond.put("prefCondId",productPref.get(i).getString("prefCondId"));
ebayPrefCond.put("acceptanceCondition",condition[i]);
- dispatcher.runSync("updateEbayProductStorePrefCond",ebayPrefCond);
+ result = dispatcher.runSync("updateEbayProductStorePrefCond",ebayPrefCond);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
}
}
Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java (original)
+++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java Sun Dec 31 12:30:48 2017
@@ -133,7 +133,13 @@ public class EbayEvents {
leavefeedback.put("AqItemAsDescribedId", AqItemAsDescribedId);
// Call service
try {
- dispatcher.runSync("leaveFeedback", leavefeedback);
+ Map<String, Object> resultMap = dispatcher.runSync("leaveFeedback", leavefeedback);
+ if (ServiceUtil.isError(resultMap)) {
+ String errorMessage = ServiceUtil.getErrorMessage(resultMap);
+ request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+ Debug.logError(errorMessage, module);
+ return "error";
+ }
} catch (GenericServiceException e) {
Debug.logError(e, module);
request.setAttribute("_ERROR_MESSAGE_","Exception: ".concat(e.getMessage()));
@@ -880,7 +886,13 @@ public class EbayEvents {
inMap.put("availableToPromiseListing", new BigDecimal(newAtp));
inMap.put("userLogin", userLogin);
try {
- dispatcher.runSync("updateEbayProductStoreInventory", inMap);
+ Map<String, Object> resultMap = dispatcher.runSync("updateEbayProductStoreInventory", inMap);
+ if (ServiceUtil.isError(resultMap)) {
+ String errorMessage = ServiceUtil.getErrorMessage(resultMap);
+ request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+ Debug.logError(errorMessage, module);
+ return "error";
+ }
} catch (GenericServiceException ex) {
Debug.logError(ex.getMessage(), module);
request.setAttribute("_ERROR_MESSAGE_","Exception: ".concat(ex.getMessage()));
@@ -921,6 +933,12 @@ public class EbayEvents {
try {
prodMap.put("statusId", "ITEM_CREATED");
Map<String, Object> result = dispatcher.runSync("createEbayProductListing", prodMap);
+ if (ServiceUtil.isError(result)) {
+ String errorMessage = ServiceUtil.getErrorMessage(result);
+ request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+ Debug.logError(errorMessage, module);
+ return "error";
+ }
productListingId = result.get("productListingId").toString();
itemObj.put("productListingId", productListingId);
itemObj.put("isSaved", "Y");
@@ -933,7 +951,13 @@ public class EbayEvents {
productListingId = itemObj.get("productListingId").toString();
prodMap.put("productListingId", productListingId);
try {
- dispatcher.runSync("updateEbayProductListing", prodMap);
+ Map<String, Object> result = dispatcher.runSync("updateEbayProductListing", prodMap);
+ if (ServiceUtil.isError(result)) {
+ String errorMessage = ServiceUtil.getErrorMessage(result);
+ request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+ Debug.logError(errorMessage, module);
+ return "error";
+ }
} catch (GenericServiceException ex) {
Debug.logError(ex.getMessage(), module);
request.setAttribute("_ERROR_MESSAGE_","Exception: ".concat(ex.getMessage()));
@@ -949,7 +973,13 @@ public class EbayEvents {
ebayProdAttrMap.put("userLogin", userLogin);
ebayProdAttrMap.put("attributeMapList", attributeMapList);
try {
- dispatcher.runSync("setEbayProductListingAttribute", ebayProdAttrMap);
+ Map<String, Object> result = dispatcher.runSync("setEbayProductListingAttribute", ebayProdAttrMap);
+ if (ServiceUtil.isError(result)) {
+ String errorMessage = ServiceUtil.getErrorMessage(result);
+ request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+ Debug.logError(errorMessage, module);
+ return "error";
+ }
} catch (GenericServiceException ex) {
Debug.logError(ex.getMessage(), module);
request.setAttribute("_ERROR_MESSAGE_","Exception: ".concat(ex.getMessage()));
@@ -1091,7 +1121,13 @@ public class EbayEvents {
}
for (Map<String,Object> itemObj : listAddItem) {
updateQuantityInventoryProduct(itemObj, productStoreId, locale, delegator, dispatcher, userLogin);
- dispatcher.runSync("exportProductEachItem", UtilMisc.toMap("itemObject", itemObj));
+ Map<String, Object> result = dispatcher.runSync("exportProductEachItem", UtilMisc.toMap("itemObject", itemObj));
+ if (ServiceUtil.isError(result)) {
+ String errorMessage = ServiceUtil.getErrorMessage(result);
+ request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+ Debug.logError(errorMessage, module);
+ return "error";
+ }
}
} catch (GenericServiceException gse) {
Debug.logError(e.getMessage(), module);
Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java (original)
+++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java Sun Dec 31 12:30:48 2017
@@ -68,6 +68,9 @@ public class EbayFeedback {
inMap.put("productStoreId", productStoreId);
inMap.put("userLogin", userLogin);
Map<String, Object> resultUser = dispatcher.runSync("getEbayStoreUser", inMap);
+ if (ServiceUtil.isError(resultUser)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultUser));
+ }
String userID = (String)resultUser.get("userLoginId");
GetFeedbackCall feedbackCall = new GetFeedbackCall();
feedbackCall.setApiContext(apiContext);
Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java (original)
+++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java Sun Dec 31 12:30:48 2017
@@ -859,7 +859,10 @@ public class EbayStore {
inMap.put("subtitle", returnStoreType.getDescription());
inMap.put("title", returnStoreType.getName());
inMap.put("userLogin", context.get("userLogin"));
- dispatcher.runSync("updateProductStore", inMap);
+ Map<String, Object> result = dispatcher.runSync("updateProductStore", inMap);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
}
} catch (GenericServiceException e) {
Debug.logError("error message"+e, module);
@@ -1314,6 +1317,9 @@ public class EbayStore {
}
LocalDispatcher dispatcher = dctx.getDispatcher();
Map<String,Object> results = dispatcher.runSync("getEbayStoreOutput",UtilMisc.toMap("productStoreId",(String) context.get("productStoreId"),"userLogin",context.get("userLogin")));
+ if (ServiceUtil.isError(results)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(results));
+ }
if (results != null) {
result.put("ebayStore", results.get("ebayStore"));
}
@@ -1633,7 +1639,10 @@ public class EbayStore {
inMap.put("productId", context.get("productId"));
inMap.put("availableToPromiseListing", new BigDecimal(newAtp));
inMap.put("userLogin", context.get("userLogin"));
- dispatcher.runSync("updateEbayProductStoreInventory", inMap);
+ Map<String, Object> result = dispatcher.runSync("updateEbayProductStoreInventory", inMap);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
}
result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
result.put(ModelService.SUCCESS_MESSAGE, "Export products listing success..");
Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPrefEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPrefEvents.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPrefEvents.java (original)
+++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPrefEvents.java Sun Dec 31 12:30:48 2017
@@ -1,5 +1,4 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
+/* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
@@ -101,7 +100,12 @@ public class EbayStoreAutoPrefEvents{
bestOfferCondition.put("condition10", condition10);
bestOfferCondition.put("condition11", condition11);
try {
- dispatcher.runSync("ebayBestOfferPrefCond", bestOfferCondition);
+ Map<String, Object> result = dispatcher.runSync("ebayBestOfferPrefCond", bestOfferCondition);
+ if (ServiceUtil.isError(result)) {
+ request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(result));
+ Debug.log( ServiceUtil.getErrorMessage(result),module);
+ return "error";
+ }
} catch (GenericServiceException e) {
Debug.logError(e, module);
return "error";
Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java (original)
+++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java Sun Dec 31 12:30:48 2017
@@ -241,6 +241,7 @@ public class EbayStoreAutoPreferences {
ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator);
try {
+ Map<String, Object> resultMap = new HashMap<String, Object>();
GenericValue ebayProductStorePref = null;
String comments = null;
String autoPrefJobId = null;
@@ -281,9 +282,21 @@ public class EbayStoreAutoPreferences {
context.put("condition2", comments);
context.put("condition3", null);
if (UtilValidate.isEmpty(ebayProductStorePref)) {
- dispatcher.runSync("createEbayProductStorePref", context);
+ resultMap = dispatcher.runSync("createEbayProductStorePref", context);
+ if (ServiceUtil.isError(resultMap)) {
+ String errorMessage = ServiceUtil.getErrorMessage(resultMap);
+ request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+ Debug.logError(errorMessage, module);
+ return "error";
+ }
} else {
- dispatcher.runSync("updateEbayProductStorePref", context);
+ resultMap = dispatcher.runSync("updateEbayProductStorePref", context);
+ if (ServiceUtil.isError(resultMap)) {
+ String errorMessage = ServiceUtil.getErrorMessage(resultMap);
+ request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+ Debug.logError(errorMessage, module);
+ return "error";
+ }
}
request.setAttribute("_EVENT_MESSAGE_", "Setting Automated Positive Feedback for Buyers Success with site " + apiContext.getSite().value());
@@ -411,12 +424,18 @@ public class EbayStoreAutoPreferences {
if (nowTime.after(fromDate) && nowTime.before(thruDate)) {
serviceMap.put("productStoreId", productStoreId);
Map<String, Object> eBayUserLogin = dispatcher.runSync("getEbayStoreUser", serviceMap);
+ if (ServiceUtil.isError(eBayUserLogin)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(eBayUserLogin));
+ }
String eBayUserLoginId = (String) eBayUserLogin.get("userLoginId");
GenericValue party = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", eBayUserLoginId).queryOne();
String partyId = party.getString("partyId");
//save sold items to OFbBiz product entity
- Map<String, Object> resultService = dispatcher.runSync("getEbaySoldItems", serviceMap);
- List<Map<String, Object>> soldItems = UtilGenerics.checkList(resultService.get("soldItems"));
+ Map<String, Object> serviceResult = dispatcher.runSync("getEbaySoldItems", serviceMap);
+ if (ServiceUtil.isError(resultService)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultService));
+ }
+ List<Map<String, Object>> soldItems = UtilGenerics.checkList(serviceResult.get("soldItems"));
if (soldItems.size() != 0) {
for (int itemCount = 0; itemCount < soldItems.size(); itemCount++) {
Map<String, Object> soldItemMap = soldItems.get(itemCount);
@@ -428,7 +447,10 @@ public class EbayStoreAutoPreferences {
inMap.put("productTypeId", "EBAY_ITEM");
inMap.put("internalName", "eBay Item " + soldItemMap.get("title"));
inMap.put("userLogin", userLogin);
- dispatcher.runSync("createProduct", inMap);
+ Map<String, Object> result = dispatcher.runSync("createProduct", inMap);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
// ProductRole (VENDOR)
List<GenericValue> productRole = EntityQuery.use(delegator).from("ProductRole").where("partyId", partyId, "productId", soldItemMap.get("itemId"), "roleTypeId", "VENDOR").queryList();
if (productRole.size() == 0) {
@@ -438,7 +460,10 @@ public class EbayStoreAutoPreferences {
addRole.put("partyId", partyId);
addRole.put("fromDate", UtilDateTime.nowTimestamp());
addRole.put("userLogin", userLogin);
- dispatcher.runSync("addPartyToProduct", addRole);
+ Map<String, Object> result = dispatcher.runSync("addPartyToProduct", addRole);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
}
}
}
@@ -448,8 +473,11 @@ public class EbayStoreAutoPreferences {
serviceMap = new HashMap<String, Object>();
serviceMap.put("userLogin", userLogin);
serviceMap.put("productStoreId", productStoreId);
- resultService = dispatcher.runSync("getEbayActiveItems", serviceMap);
- List<Map<String, Object>> activeItems = UtilGenerics.checkList(resultService.get("activeItems"));
+ serviceResult = dispatcher.runSync("getEbayActiveItems", serviceMap);
+ if (ServiceUtil.isError(resultService)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultService));
+ }
+ List<Map<String, Object>> activeItems = UtilGenerics.checkList(serviceResult.get("activeItems"));
List<String> activeItemMaps = new LinkedList<String>();
if (activeItems.size() != 0) {
for (int itemCount = 0; itemCount < activeItems.size(); itemCount++) {
@@ -535,8 +563,11 @@ public class EbayStoreAutoPreferences {
Map<String, Object> serviceMap = new HashMap<String, Object>();
serviceMap.put("productStoreId", productStoreId);
serviceMap.put("userLogin", userLogin);
- Map<String, Object> resultService = dispatcher.runSync("getEbaySoldItems", serviceMap);
- List<Map<String, Object>> soldItems = UtilGenerics.checkList(resultService.get("soldItems"));
+ Map<String, Object> serviceResult = dispatcher.runSync("getEbaySoldItems", serviceMap);
+ if (ServiceUtil.isError(resultService)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultService));
+ }
+ List<Map<String, Object>> soldItems = UtilGenerics.checkList(serviceResult.get("soldItems"));
// check items to dispute
List<Map<String, Object>> itemsToDispute = new LinkedList<Map<String,Object>>();
for (int itemCount = 0; itemCount < soldItems.size(); itemCount++) {
@@ -608,8 +639,11 @@ public class EbayStoreAutoPreferences {
Map<String, Object> serviceMap = new HashMap<String, Object>();
serviceMap.put("productStoreId", productStoreId);
serviceMap.put("userLogin", userLogin);
- Map<String, Object> resultService = dispatcher.runSync("getEbaySoldItems", serviceMap);
- List<Map<String, Object>> soldItems = UtilGenerics.checkList(resultService.get("soldItems"));
+ Map<String, Object> serviceResult = dispatcher.runSync("getEbaySoldItems", serviceMap);
+ if (ServiceUtil.isError(resultService)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultService));
+ }
+ List<Map<String, Object>> soldItems = UtilGenerics.checkList(serviceResult.get("soldItems"));
// check items to dispute
List<Map<String, Object>> itemsToDispute = new LinkedList<Map<String,Object>>();
for (int itemCount = 0; itemCount < soldItems.size(); itemCount++) {
@@ -925,6 +959,9 @@ public class EbayStoreAutoPreferences {
try {
GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne();
Map<String, Object> resultSold = dispatcher.runSync("getEbaySoldItems", UtilMisc.toMap("productStoreId", productStoreId, "userLogin", userLogin));
+ if (ServiceUtil.isError(resultSold)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultSold));
+ }
List<Map<String, Object>> soldItems = UtilGenerics.checkList(resultSold.get("soldItems"));
if (soldItems.size() != 0) {
for (int i = 0; i < soldItems.size(); i++) {
@@ -940,6 +977,9 @@ public class EbayStoreAutoPreferences {
serviceMap.put("productStoreId", productStoreId);
serviceMap.put("itemId", item.get("itemId").toString());
Map<String, Object> resultBid = dispatcher.runSync("getEbayAllBidders", serviceMap);
+ if (ServiceUtil.isError(resultBid)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultBid));
+ }
List<Map<String, Object>> allBidders = UtilGenerics.checkList(resultBid.get("allBidders"));
if (allBidders.size() != 0) {
@@ -996,6 +1036,9 @@ public class EbayStoreAutoPreferences {
GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne();
context.put("userLogin", userLogin);
Map<String, Object> resultSold = dispatcher.runSync("getEbaySoldItems", context);
+ if (ServiceUtil.isError(resultSold)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultSold));
+ }
List<Map<String, Object>> soldItems = UtilGenerics.checkList(resultSold.get("soldItems"));
if (soldItems.size() != 0) {
for (int i = 0; i < soldItems.size(); i++) {
@@ -1132,7 +1175,10 @@ public class EbayStoreAutoPreferences {
itemObject.put("productListingId", ebayProductListing.getString("productListingId"));
inMap.put("itemObject", itemObject);
inMap.put("userLogin", userLogin);
- Map<String, Object>result = dispatcher.runSync("exportProductEachItem", inMap);
+ Map<String, Object> result = dispatcher.runSync("exportProductEachItem", inMap);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
String success = (String) result.get("responseMessage");
if ("success".equals(success)) {
String duration = item.getListingDuration();
Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java (original)
+++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java Sun Dec 31 12:30:48 2017
@@ -279,7 +279,10 @@ public class EbayStoreHelper {
Map<String, Object>inMap = new HashMap<String, Object>();
inMap.put("jobId", jobId);
inMap.put("userLogin", userLogin);
- dispatcher.runSync("resetScheduledJob", inMap);
+ result = dispatcher.runSync("resetScheduledJob", inMap);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
}
}
if (UtilValidate.isEmpty(ebayProductPref.getString("autoPrefJobId"))) {
@@ -361,7 +364,10 @@ public class EbayStoreHelper {
inMap.put("userLogin", userLogin);
for (int index = 0; index < jobs.size(); index++) {
inMap.put("jobId", jobs.get(index).getString("jobId"));
- dispatcher.runSync("cancelScheduledJob", inMap);
+ result = dispatcher.runSync("cancelScheduledJob", inMap);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
}
} catch (GenericEntityException e) {
return ServiceUtil.returnError(e.getMessage());
@@ -450,7 +456,10 @@ public class EbayStoreHelper {
updateItemMap.put("statusId", "ITEM_APPROVED");
updateItemMap.put("userLogin", userLogin);
try {
- dispatcher.runSync("updateEbayProductListing", updateItemMap);
+ result = dispatcher.runSync("updateEbayProductListing", updateItemMap);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
} catch (GenericServiceException ex) {
Debug.logError(ex.getMessage(), module);
return ServiceUtil.returnError(ex.getMessage());
@@ -481,13 +490,16 @@ public class EbayStoreHelper {
}
}
for (Map.Entry<String,Object> entry : attributeMapList.entrySet()) {
- if (UtilValidate.isNotEmpty(entry.getKey())) {
- ebayProductListingAttributeMap.put("productListingId", productListingId);
- ebayProductListingAttributeMap.put("attrName", entry.getKey().toString());
- ebayProductListingAttributeMap.put("attrValue", entry.getValue().toString());
- ebayProductListingAttributeMap.put("userLogin", userLogin);
- dispatcher.runSync("createEbayProductListingAttribute", ebayProductListingAttributeMap);
- }
+ if (UtilValidate.isNotEmpty(entry.getKey())) {
+ ebayProductListingAttributeMap.put("productListingId", productListingId);
+ ebayProductListingAttributeMap.put("attrName", entry.getKey().toString());
+ ebayProductListingAttributeMap.put("attrValue", entry.getValue().toString());
+ ebayProductListingAttributeMap.put("userLogin", userLogin);
+ Map<String, Object> result = dispatcher.runSync("createEbayProductListingAttribute", ebayProductListingAttributeMap);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
+ }
}
} catch (GenericEntityException e) {
return ServiceUtil.returnError(e.getMessage());
@@ -714,7 +726,10 @@ public class EbayStoreHelper {
newMap.put("logMessage", errorMessage);
newMap.put("createDatetime", UtilDateTime.nowTimestamp());
newMap.put("userLogin", userLogin);
- dispatcher.runSync("insertErrorMessagesFromEbay", newMap);
+ Map<String, Object> result = dispatcher.runSync("insertErrorMessagesFromEbay", newMap);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
} catch (Exception ex) {
Debug.logError("Error from create error log messages : "+ex.getMessage(), module);
}
Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreInventoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreInventoryServices.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreInventoryServices.java (original)
+++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreInventoryServices.java Sun Dec 31 12:30:48 2017
@@ -391,7 +391,10 @@ public class EbayStoreInventoryServices
ebayProductStoreInventoryList = EntityQuery.use(delegator).from("EbayProductStoreInventory").where("facilityId",(String)context.get("facilityId"),"productStoreId",(String)context.get("productStoreId")).queryList();
for (GenericValue ebayProductStoreInventory : ebayProductStoreInventoryList) {
if (ebayProductStoreInventory.get("ebayProductId") != null) {
- dispatcher.runSync("updateEbayInventoryStatusByProductId", UtilMisc.toMap("productStoreId", (String)context.get("productStoreId"), "facilityId", (String)context.get("facilityId"), "folderId", ebayProductStoreInventory.get("folderId"), "productId", ebayProductStoreInventory.get("productId"), "ebayProductId", ebayProductStoreInventory.get("ebayProductId"), "userLogin", context.get("userLogin")));
+ Map<String, Object> result = dispatcher.runSync("updateEbayInventoryStatusByProductId", UtilMisc.toMap("productStoreId", (String)context.get("productStoreId"), "facilityId", (String)context.get("facilityId"), "folderId", ebayProductStoreInventory.get("folderId"), "productId", ebayProductStoreInventory.get("productId"), "ebayProductId", ebayProductStoreInventory.get("ebayProductId"), "userLogin", context.get("userLogin")));
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
}
}
}
Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java (original)
+++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java Sun Dec 31 12:30:48 2017
@@ -65,6 +65,9 @@ public class EbayStoreOrder {
context.put("shippingAddressStreet1", context.get("shippingAddressStreet").toString());
}
result = dispatcher.runSync("EbayStoreCreateTransactionShoppingCart", context);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
}
} catch (GenericServiceException e) {
result = ServiceUtil.returnFailure(e.getMessage());
@@ -79,6 +82,9 @@ public class EbayStoreOrder {
if (UtilValidate.isEmpty(context.get("orderId"))) {
try {
result = dispatcher.runSync("EbayStoreCreateOrderShoppingCart", context);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
} catch (GenericServiceException e) {
result = ServiceUtil.returnFailure(e.getMessage());
}
Modified: ofbiz/ofbiz-plugins/trunk/ldap/src/main/java/org/apache/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ldap/src/main/java/org/apache/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/ldap/src/main/java/org/apache/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java (original)
+++ ofbiz/ofbiz-plugins/trunk/ldap/src/main/java/org/apache/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java Sun Dec 31 12:30:48 2017
@@ -47,6 +47,9 @@ import org.apache.ofbiz.service.LocalDis
import org.apache.ofbiz.service.ModelService;
import org.apache.ofbiz.webapp.stats.VisitHandler;
import org.w3c.dom.Element;
+import org.apache.ofbiz.service.ServiceUtil;
+import org.apache.ofbiz.base.util.Debug;
+
/**
* The abstract Authentication Handler.
@@ -129,6 +132,9 @@ public abstract class AbstractOFBizAuthe
try {
loginResult = dispatcher.runSync("userLogin", UtilMisc.toMap("login.username", username, "login.password", password, "visitId", visitId, "locale", UtilHttp.getLocale(request)));
+ if (ServiceUtil.isError(loginResult)) {
+ throw new Exception(ServiceUtil.getErrorMessage(loginResult));
+ }
} catch (GenericServiceException e) {
throw new GenericServiceException(e.getLocalizedMessage());
}
Modified: ofbiz/ofbiz-plugins/trunk/lucene/src/main/java/org/apache/ofbiz/content/search/SearchEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/lucene/src/main/java/org/apache/ofbiz/content/search/SearchEvents.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/lucene/src/main/java/org/apache/ofbiz/content/search/SearchEvents.java (original)
+++ ofbiz/ofbiz-plugins/trunk/lucene/src/main/java/org/apache/ofbiz/content/search/SearchEvents.java Sun Dec 31 12:30:48 2017
@@ -54,6 +54,12 @@ public class SearchEvents {
serviceInMap.put("contentId", siteId);
try {
result = dispatcher.runSync("indexContentTree", serviceInMap);
+ if (ServiceUtil.isError(result)) {
+ String errorMessage = ServiceUtil.getErrorMessage(result);
+ request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+ Debug.logError(errorMessage, module);
+ return "error";
+ }
} catch (GenericServiceException e) {
String errorMsg = "Error calling the indexContentTree service." + e.toString();
Debug.logError(e, errorMsg, module);
Modified: ofbiz/ofbiz-plugins/trunk/lucene/src/main/java/org/apache/ofbiz/content/search/SearchServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/lucene/src/main/java/org/apache/ofbiz/content/search/SearchServices.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/lucene/src/main/java/org/apache/ofbiz/content/search/SearchServices.java (original)
+++ ofbiz/ofbiz-plugins/trunk/lucene/src/main/java/org/apache/ofbiz/content/search/SearchServices.java Sun Dec 31 12:30:48 2017
@@ -36,6 +36,7 @@ import org.apache.ofbiz.service.Dispatch
import org.apache.ofbiz.service.GenericServiceException;
import org.apache.ofbiz.service.ServiceUtil;
import org.apache.ofbiz.service.LocalDispatcher;
+import java.util.HashMap;
/**
* SearchServices Class
@@ -77,7 +78,10 @@ public class SearchServices {
for (GenericValue productFeatureAppl : productFeatureAppls) {
try {
- dispatcher.runSync("indexProduct", UtilMisc.toMap("productId", productFeatureAppl.get("productId")));
+ Map<String, Object> result = dispatcher.runSync("indexProduct", UtilMisc.toMap("productId", productFeatureAppl.get("productId")));
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, module);
}
@@ -91,9 +95,16 @@ public class SearchServices {
public static Map<String, Object> indexProductsFromProductAssoc(DispatchContext dctx, Map<String, ? extends Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
+ Map<String, Object> result = new HashMap<String, Object>();
try {
- dispatcher.runSync("indexProduct", UtilMisc.toMap("productId", context.get("productId")));
- dispatcher.runSync("indexProduct", UtilMisc.toMap("productId", context.get("productIdTo")));
+ result = dispatcher.runSync("indexProduct", UtilMisc.toMap("productId", context.get("productId")));
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
+ result = dispatcher.runSync("indexProduct", UtilMisc.toMap("productId", context.get("productIdTo")));
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, module);
}
@@ -103,13 +114,17 @@ public class SearchServices {
public static Map<String, Object> indexProductsFromDataResource(DispatchContext dctx, Map<String, ? extends Object> context) {
Delegator delegator = dctx.getDelegator();
LocalDispatcher dispatcher = dctx.getDispatcher();
+ Map<String, Object> result = new HashMap<String, Object>();
try {
List<GenericValue> contents = EntityQuery.use(delegator).from("Content").where("dataResourceId", context.get("dataResourceId")).queryList();
for (GenericValue content : contents) {
- dispatcher.runSync("indexProductsFromContent",
+ result = dispatcher.runSync("indexProductsFromContent",
UtilMisc.toMap(
"userLogin", context.get("userLogin"),
"contentId", content.get("contentId")));
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
}
} catch (GenericEntityException e) {
Debug.logError(e, module);
@@ -125,7 +140,10 @@ public class SearchServices {
List<GenericValue> productContents = EntityQuery.use(delegator).from("ProductContent").where("contentId", context.get("contentId")).queryList();
for (GenericValue productContent : productContents) {
try {
- dispatcher.runSync("indexProduct", UtilMisc.toMap("productId", productContent.get("productId")));
+ Map<String, Object> result = dispatcher.runSync("indexProduct", UtilMisc.toMap("productId", productContent.get("productId")));
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, module);
}
@@ -162,9 +180,13 @@ public class SearchServices {
private static void indexProductCategoryMembers(String productCategoryId, Delegator delegator, LocalDispatcher dispatcher) throws GenericEntityException {
List<GenericValue> productCategoryMembers = EntityQuery.use(delegator).from("ProductCategoryMember").where("productCategoryId", productCategoryId).queryList();
+ Map<String, Object> result;
for (GenericValue productCategoryMember : productCategoryMembers) {
try {
- dispatcher.runSync("indexProduct", UtilMisc.toMap("productId", productCategoryMember.get("productId")));
+ result = dispatcher.runSync("indexProduct", UtilMisc.toMap("productId", productCategoryMember.get("productId")));
+ if (ServiceUtil.isError(result)) {
+ throw new GenericEntityException(ServiceUtil.getErrorMessage(result));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, module);
}
Modified: ofbiz/ofbiz-plugins/trunk/lucene/src/main/java/org/apache/ofbiz/content/test/LuceneTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/lucene/src/main/java/org/apache/ofbiz/content/test/LuceneTests.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/lucene/src/main/java/org/apache/ofbiz/content/test/LuceneTests.java (original)
+++ ofbiz/ofbiz-plugins/trunk/lucene/src/main/java/org/apache/ofbiz/content/test/LuceneTests.java Sun Dec 31 12:30:48 2017
@@ -66,6 +66,10 @@ public class LuceneTests extends OFBizTe
ctx.put("contentId", "LuceneCONTENT");
ctx.put("userLogin", userLogin);
Map<String, Object> resp = dispatcher.runSync("indexContentTree", ctx);
+ if (ServiceUtil.isError(resp)) {
+ String errorMessage = ServiceUtil.getErrorMessage(resp);
+ throw new Exception(errorMessage);
+ }
assertTrue("Could not init search index", ServiceUtil.isSuccess(resp));
try {
Modified: ofbiz/ofbiz-plugins/trunk/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumServices.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumServices.java (original)
+++ ofbiz/ofbiz-plugins/trunk/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumServices.java Sun Dec 31 12:30:48 2017
@@ -84,7 +84,10 @@ public class ScrumServices {
GenericValue userLogin = (GenericValue) context.get("userLogin");
// also close the incoming communication event
if (UtilValidate.isNotEmpty(productRoleMap)) {
- dispatcher.runSync("setCommunicationEventStatus", UtilMisc.<String, Object>toMap("communicationEventId", communicationEvent.getString("communicationEventId"), "statusId", "COM_COMPLETE", "userLogin", userLogin));
+ Map<String, Object> result = dispatcher.runSync("setCommunicationEventStatus", UtilMisc.<String, Object>toMap("communicationEventId", communicationEvent.getString("communicationEventId"), "statusId", "COM_COMPLETE", "userLogin", userLogin));
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
}
} catch (GenericServiceException e1) {
Debug.logError(e1, "Error calling updating commevent status", module);
@@ -227,7 +230,10 @@ public class ScrumServices {
inputMap.put("revisionDescription", taskInfo);
inputMap.put("userLogin", userLogin);
Debug.logInfo("inputMap ============== >>>>>>>>>>> "+ inputMap, module);
- dispatcher.runSync("updateScrumRevision", inputMap);
+ result = dispatcher.runSync("updateScrumRevision", inputMap);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
}
}
}
Modified: ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/ProductUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/ProductUtil.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/ProductUtil.java (original)
+++ ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/ProductUtil.java Sun Dec 31 12:30:48 2017
@@ -38,6 +38,8 @@ import org.apache.ofbiz.product.product.
import org.apache.ofbiz.product.product.ProductWorker;
import org.apache.ofbiz.service.DispatchContext;
import org.apache.ofbiz.service.LocalDispatcher;
+import org.apache.ofbiz.service.ServiceUtil;
+
/**
* Product utility class for solr.
@@ -129,11 +131,17 @@ public final class ProductUtil {
// if(product.get("popularity") != null) dispatchContext.put("popularity", "");
Map<String, Object> featureSet = dispatcher.runSync("getProductFeatureSet", UtilMisc.toMap("productId", productId));
+ if (ServiceUtil.isError(featureSet)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(featureSet));
+ }
if (featureSet != null) {
dispatchContext.put("features", (Set<?>) featureSet.get("featureSet"));
}
Map<String, Object> productInventoryAvailable = dispatcher.runSync("getProductInventoryAvailable", UtilMisc.toMap("productId", productId));
+ if (ServiceUtil.isError(productInventoryAvailable)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(productInventoryAvailable));
+ }
String inStock = null;
BigDecimal availableToPromiseTotal = (BigDecimal) productInventoryAvailable.get("availableToPromiseTotal");
if (availableToPromiseTotal != null) {
@@ -208,6 +216,9 @@ public final class ProductUtil {
} else {
Map<String, GenericValue> priceContext = UtilMisc.toMap("product", product);
Map<String, Object> priceMap = dispatcher.runSync("calculateProductPrice", priceContext);
+ if (ServiceUtil.isError(priceMap)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(priceMap));
+ }
if (priceMap.get("listPrice") != null) {
String listPrice = ((BigDecimal) priceMap.get("listPrice")).setScale(2, BigDecimal.ROUND_HALF_DOWN).toString();
dispatchContext.put("listPrice", listPrice);
Modified: ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/SolrProductSearch.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/SolrProductSearch.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/SolrProductSearch.java (original)
+++ ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/SolrProductSearch.java Sun Dec 31 12:30:48 2017
@@ -408,6 +408,9 @@ public abstract class SolrProductSearch
dispatchMap.put("indexName", solrIndexName);
Map<String, Object> searchResult = dispatcher.runSync("runSolrQuery", dispatchMap);
+ if (ServiceUtil.isError(searchResult)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(searchResult));
+ }
QueryResponse queryResult = (QueryResponse) searchResult.get("queryResult");
@@ -455,6 +458,9 @@ public abstract class SolrProductSearch
dispatchMap.put("indexName", solrIndexName);
Map<String, Object> searchResult = dispatcher.runSync("runSolrQuery", dispatchMap);
+ if (ServiceUtil.isError(searchResult)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(searchResult));
+ }
QueryResponse queryResult = (QueryResponse) searchResult.get("queryResult");
List<List<String>> suggestions = new ArrayList<List<String>>();
@@ -682,7 +688,9 @@ public abstract class SolrProductSearch
// THis adds all products to the Index (instantly)
Map<String, Object> runResult = dispatcher.runSync("addListToSolrIndex", UtilMisc.toMap("fieldList", solrDocs, "userLogin", userLogin, "locale", locale, "indexName",
solrIndexName, "treatConnectErrorNonFatal", treatConnectErrorNonFatal));
-
+ if (ServiceUtil.isError(runResult)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(runResult));
+ }
String runMsg = ServiceUtil.getErrorMessage(runResult);
if (UtilValidate.isEmpty(runMsg)) {
runMsg = null;
Modified: ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/test/SolrTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/test/SolrTests.java?rev=1819735&r1=1819734&r2=1819735&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/test/SolrTests.java (original)
+++ ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/test/SolrTests.java Sun Dec 31 12:30:48 2017
@@ -68,12 +68,20 @@ public class SolrTests extends OFBizTest
ctx.put("instance", product);
Map<String, Object> resp = dispatcher.runSync("addToSolr", ctx);
+ if (ServiceUtil.isError(resp)) {
+ String errorMessage = ServiceUtil.getErrorMessage(resp);
+ throw new Exception(errorMessage);
+ }
assertTrue("Could not init search index", ServiceUtil.isSuccess(resp));
Map<String, Object> sctx = new HashMap<String, Object>();
sctx.put("productCategoryId", "102");
Map<String, Object> sresp = dispatcher.runSync("solrProductsSearch", sctx);
+ if (ServiceUtil.isError(sresp)) {
+ String errorMessage = ServiceUtil.getErrorMessage(sresp);
+ throw new Exception(errorMessage);
+ }
assertTrue("Could not query search index", ServiceUtil.isSuccess(sresp));
@@ -83,6 +91,10 @@ public class SolrTests extends OFBizTest
context = new HashMap<>();
context.put("productId", validTestProductId);
response = dispatcher.runSync("addToSolrIndex", context);
+ if (ServiceUtil.isError(response)) {
+ String errorMessage = ServiceUtil.getErrorMessage(response);
+ throw new Exception(errorMessage);
+ }
assertTrue("Could not add Product to Index", ServiceUtil.isSuccess(
response));
}
@@ -91,6 +103,10 @@ public class SolrTests extends OFBizTest
context = new HashMap<>();
context.put("productId", invalidTestProductId);
response = dispatcher.runSync("addToSolrIndex", context);
+ if (ServiceUtil.isError(response)) {
+ String errorMessage = ServiceUtil.getErrorMessage(response);
+ throw new Exception(errorMessage);
+ }
assertTrue("Could not test the addition of an invalid product to the Solr index", ServiceUtil.isSuccess(
response));
}
@@ -111,6 +127,10 @@ public class SolrTests extends OFBizTest
context.put("fieldList", products);
response = dispatcher.runSync("addListToSolrIndex", context);
+ if (ServiceUtil.isError(response)) {
+ String errorMessage = ServiceUtil.getErrorMessage(response);
+ throw new Exception(errorMessage);
+ }
assertTrue("Could not add products to index", ServiceUtil.isSuccess(response));
}
@@ -134,6 +154,10 @@ public class SolrTests extends OFBizTest
context.put("fieldList", products);
response = dispatcher.runSync("addListToSolrIndex", context);
+ if (ServiceUtil.isError(response)) {
+ String errorMessage = ServiceUtil.getErrorMessage(response);
+ throw new Exception(errorMessage);
+ }
assertTrue("Could not test adding invalid products to index", ServiceUtil.isSuccess(response));
}