We had this discussion too many times. Big mass-changes that are unfocused are a bad idea. We've witnessed many issues in the past and the info is available in other threads.
I wish if Jacques would stop these massive lets-go-after-a-pattern-everywhere kind of commits. I leave it for the rest of the community to decide. I am beginning to really get tired from these unending and repeating discussions. On Jan 1, 2018 3:13 PM, "Michael Brohl" <[email protected]> wrote: > Inline... > > > Am 01.01.18 um 12:45 schrieb Jacques Le Roux: > >> Le 01/01/2018 à 11:42, Michael Brohl a écrit : >> >>> For me, reviewing is much easier if I can apply a patch to the codebase >>> and use the IDE tools to examine the diff with the code contexts. >>> >> This is something I'll take into account in the future. I'll ask for >> reviews before committing such large patches. >> > That would be a good idea... > >> >> This is not possible for me now the code is already committed. I won't >>> review this in the my email client. >>> >> Actually if you really want to review there is a possibility. >> You copy you current trunk working copy under another name. >> You svn update just before the commit (here at r1819694). >> You modify the name in .project with the copied name. >> You import in the IDE, you patch, it's ready for a review. >> This can be done in minutes, the longer part being the copy. >> > This is unnecessary complicated compared to just applying a patch and I > won't do it also in this case. > >> >> >>> This is a big commit and most of the patches were submitted just before >>> Christmas. I cannot see the urge to commit the work so fast without letting >>> more people review. >>> >> 2 reasons: >> >> 1. Large patches reviews (and not only large ones) tend to be postponed >> (we are humans), then are deprecated and can't be applied so get forgotten. >> I'm sure I can find several examples in Jira. >> 2. When in trunk they can be "hand" and "automatically" (thanks to >> spiders) tested, in demo. Also by people running them on their machine. >> They are >> not supposed to be used in production of course. >> > > My standpoint in these cases is to do a review and dicussion before the > commit. If there is a chance and others do not take it, you can commit > later. That does not postpone the issue too much. > > We should also take into account that people might use the trunk as base > of their work. Even if trunk is not considered stable and we have releases, > we should still try to be as stable as possible in trunk. > > I won't insist on this further. There seems to be a substantial difference >>> in perception how we should handle these issues and I'm tired to discuss >>> this again and again. Hope you will take care about the fixes resulting >>> from the commit if they are necessary. >>> >> Yes as I said I'll review again. I hope the contributors (Suraj and >> Anushi ) and others will help me do so, it's indeed a large task >> > I would expect that the testing was done before providing the patches. You > cannot rely on the tests in all cases because different return results > might not affect the single event/service but the integration logic/flow. I > am not sure if we have enough tests for this. > > Anyway, I made my point clear (now and in the past) and I don't like the > process. It's up to you to take responsibility if things are broken. > I'm finished with this discussion. > > Michael > >> >> Jacques >> >> >>> Michael >>> >>> >>> Am 01.01.18 um 08:53 schrieb Jacques Le Roux: >>> >>>> Michael, >>>> >>>> I'll review again but will not revert. It will take time, but will be >>>> done before we create the next release branch. This will allow usage, on >>>> demo at least, to help finding possible issues. >>>> >>>> My basic idea is simple: we should handle error in services like >>>> exceptions in Java: no swallowing at all. >>>> >>>> Handling a service returning an error only with a debug log error >>>> should be only done when strictly necessary, ie when we don't want to >>>> derail the flow. There are some cases in the commits (plugins is another >>>> one). >>>> >>>> To answer you Taher, no I did not test all services manually. Of course >>>> I'd appreciate any help in reviewing... >>>> >>>> Jacques >>>> >>>> >>>> Le 31/12/2017 à 23:49, Jacques Le Roux a écrit : >>>> >>>>> It's far better than before. I reviewed all carefully and tests pass. >>>>> If you see something specific which hurts you please fix it >>>>> >>>>> Thanks >>>>> >>>>> Jacques >>>>> >>>>> >>>>> Le 31/12/2017 à 15:41, Michael Brohl a écrit : >>>>> >>>>>> I have not the time to look at this further now but some changes seem >>>>>> to change the business logic, e.g. by returning an "error" result in >>>>>> events >>>>>> where they did not before, same in services. It makes a difference in >>>>>> both >>>>>> the controller logic as well as in the service engine logic. >>>>>> >>>>>> This seems not to be a simple refactoring and we should have some >>>>>> thorough testing before this goes into the codebase. >>>>>> >>>>>> Regards, >>>>>> >>>>>> Michael >>>>>> >>>>>> >>>>>> Am 31.12.17 um 15:11 schrieb Taher Alkhateeb: >>>>>> >>>>>>> I don't know what the rest of the team thinks, but I am really >>>>>>> worried >>>>>>> from this commit. It is one of those mass updates which I constantly >>>>>>> warn against. >>>>>>> >>>>>>> Can you please clarify what kind of testing was done against all the >>>>>>> services that were updated and the context of each service? >>>>>>> >>>>>>> On Sun, Dec 31, 2017 at 2:11 PM, <[email protected]> wrote: >>>>>>> >>>>>>>> Author: jleroux >>>>>>>> Date: Sun Dec 31 11:11:46 2017 >>>>>>>> New Revision: 1819730 >>>>>>>> >>>>>>>> URL: http://svn.apache.org/viewvc?rev=1819730&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 applications part with some slight changes >>>>>>>> >>>>>>>> Thanks: Suraj Khurana >>>>>>>> >>>>>>>> Modified: >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/ContentManagementEvents.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/ContentManagementServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/ConvertTree.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/compdoc/CompDocEvents.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/content/ContentPermissionServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/content/ContentServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/content/ContentWorker.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/content/UploadContentAndImage.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/data/DataEvents.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/data/DataResourceWorker.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/layout/LayoutEvents.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/survey/PdfSurveyServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/ >>>>>>>> main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/ >>>>>>>> main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/ >>>>>>>> main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/ >>>>>>>> main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRun.java >>>>>>>> >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/ >>>>>>>> main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java >>>>>>>> >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/ >>>>>>>> main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java >>>>>>>> >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/ >>>>>>>> main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/ >>>>>>>> main/java/org/apache/ofbiz/manufacturing/mrp/ProposedOrder.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/marketing/src/main/ >>>>>>>> java/org/apache/ofbiz/sfa/vcard/VCard.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/OrderManagerEvents.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/order/OrderChangeHelper.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/order/OrderEvents.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/order/OrderLookupServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/order/OrderReturnServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/order/OrderServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/quote/QuoteServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/requirement/RequirementServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/shoppingcart/ShoppingCart.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java >>>>>>>> >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/task/TaskEvents.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/test/OrderTestServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/test/PurchaseOrderTest.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/test/SalesOrderTest.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >>>>>>>> /org/apache/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java >>>>>>>> >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/party/src/main/java >>>>>>>> /org/apache/ofbiz/party/communication/CommunicationEventServices.java >>>>>>>> >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/party/src/main/java >>>>>>>> /org/apache/ofbiz/party/contact/ContactMechServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/party/src/main/java >>>>>>>> /org/apache/ofbiz/party/party/PartyRelationshipServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/party/src/main/java >>>>>>>> /org/apache/ofbiz/party/party/PartyServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/product/config/ProductConfigWrapper.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/product/imagemanagement/CropImage.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/product/imagemanagement/FrameImage.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java >>>>>>>> >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/product/imagemanagement/ReplaceImage.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/product/imagemanagement/RotateImage.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/product/product/ProductServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/shipment/packing/PackingSession.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/shipment/shipment/ShipmentEvents.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/shipment/shipment/ShipmentServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/shipment/shipment/ShipmentWorker.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/shipment/thirdparty/usps/UspsServicesTests.java >>>>>>>> >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/shipment/verify/VerifyPickSession.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/product/src/main/ja >>>>>>>> va/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java >>>>>>>> >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/securityext/src/mai >>>>>>>> n/java/org/apache/ofbiz/securityext/login/LoginEvents.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main >>>>>>>> /java/org/apache/ofbiz/workeffort/workeffort/ICalConverter.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main >>>>>>>> /java/org/apache/ofbiz/workeffort/workeffort/ICalWorker.java >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main >>>>>>>> /java/org/apache/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java >>>>>>>> >>>>>>>> ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main >>>>>>>> /java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java >>>>>>>> >>>>>>>> >>>>>>>> Modified: ofbiz/ofbiz-framework/trunk/ap >>>>>>>> plications/content/src/main/java/org/apache/ofbiz/content/Co >>>>>>>> ntentManagementEvents.java >>>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/app >>>>>>>> lications/content/src/main/java/org/apache/ofbiz/content/Con >>>>>>>> tentManagementEvents.java?rev=1819730&r1=1819729&r2=1819730& >>>>>>>> view=diff >>>>>>>> ============================================================================== >>>>>>>> >>>>>>>> --- ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/ContentManagementEvents.java (original) >>>>>>>> +++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/ContentManagementEvents.java Sun Dec >>>>>>>> 31 11:11:46 2017 >>>>>>>> @@ -43,11 +43,9 @@ import org.apache.ofbiz.entity.util.Enti >>>>>>>> import org.apache.ofbiz.security.Security; >>>>>>>> import org.apache.ofbiz.service.GenericServiceException; >>>>>>>> import org.apache.ofbiz.service.LocalDispatcher; >>>>>>>> -import org.apache.ofbiz.service.ModelService; >>>>>>>> +import org.apache.ofbiz.service.ServiceUtil; >>>>>>>> import org.apache.ofbiz.webapp.website.WebSiteWorker; >>>>>>>> >>>>>>>> - >>>>>>>> - >>>>>>>> /** >>>>>>>> * ContentManagementEvents Class >>>>>>>> */ >>>>>>>> @@ -63,6 +61,7 @@ public class ContentManagementEvents { >>>>>>>> Delegator delegator = (Delegator)request.getAttribut >>>>>>>> e("delegator"); >>>>>>>> LocalDispatcher dispatcher = >>>>>>>> (LocalDispatcher)request.getAttribute("dispatcher"); >>>>>>>> Map<String, Object> paramMap = >>>>>>>> UtilHttp.getParameterMap(request); >>>>>>>> + Map<String, Object> result = new HashMap<>(); >>>>>>>> String parentPlaceholderId = (String)paramMap.get("ph"); >>>>>>>> if (UtilValidate.isEmpty(parentPlaceholderId)) { >>>>>>>> request.setAttribute("_ERROR_MESSAGE_", >>>>>>>> "ParentPlaceholder is empty."); >>>>>>>> @@ -99,12 +98,24 @@ public class ContentManagementEvents { >>>>>>>> if (!paramValue.equals(pubValue)) { >>>>>>>> if ("Y".equalsIgnoreCase(paramValue)) >>>>>>>> { >>>>>>>> serviceIn.put("fromDate", UtilDateTime.nowTimestamp()); >>>>>>>> - dispatcher.runSync("createContentAssoc", serviceIn); >>>>>>>> + result = >>>>>>>> dispatcher.runSync("createContentAssoc", serviceIn); >>>>>>>> + if (ServiceUtil.isError(result)) { >>>>>>>> + String errorMessage = >>>>>>>> ServiceUtil.getErrorMessage(result); >>>>>>>> + request.setAttribute("_ERROR_MESSAGE_", errorMessage); >>>>>>>> + Debug.logError(errorMessage, module); >>>>>>>> + return "error"; >>>>>>>> + } >>>>>>>> } else if >>>>>>>> ("N".equalsIgnoreCase(paramValue) && "Y".equalsIgnoreCase(pubValue)) >>>>>>>> { >>>>>>>> serviceIn.put("thruDate", UtilDateTime.nowTimestamp()); >>>>>>>> Timestamp fromDate = >>>>>>>> (Timestamp)map.get(pubContentId + "FromDate"); >>>>>>>> serviceIn.put("fromDate", fromDate); >>>>>>>> - dispatcher.runSync("updateContentAssoc", serviceIn); >>>>>>>> + result = >>>>>>>> dispatcher.runSync("updateContentAssoc", serviceIn); >>>>>>>> + if (ServiceUtil.isError(result)) { >>>>>>>> + String errorMessage = >>>>>>>> ServiceUtil.getErrorMessage(result); >>>>>>>> + request.setAttribute("_ERROR_MESSAGE_", errorMessage); >>>>>>>> + Debug.logError(errorMessage, module); >>>>>>>> + return "error"; >>>>>>>> + } >>>>>>>> } >>>>>>>> } >>>>>>>> } else if (UtilValidate.isNotEmpty(pubValue)) >>>>>>>> { >>>>>>>> @@ -112,7 +123,13 @@ public class ContentManagementEvents { >>>>>>>> serviceIn.put("thruDate", UtilDateTime.nowTimestamp()); >>>>>>>> Timestamp fromDate = >>>>>>>> (Timestamp)map.get(pubContentId + "FromDate"); >>>>>>>> serviceIn.put("fromDate", fromDate); >>>>>>>> - dispatcher.runSync("updateContentAssoc", serviceIn); >>>>>>>> + result = >>>>>>>> dispatcher.runSync("updateContentAssoc", serviceIn); >>>>>>>> + if (ServiceUtil.isError(result)) { >>>>>>>> + String errorMessage = >>>>>>>> ServiceUtil.getErrorMessage(result); >>>>>>>> + request.setAttribute("_ERROR_MESSAGE_", errorMessage); >>>>>>>> + Debug.logError(errorMessage, module); >>>>>>>> + return "error"; >>>>>>>> + } >>>>>>>> } >>>>>>>> } >>>>>>>> } catch (GenericServiceException e) { >>>>>>>> @@ -196,10 +213,8 @@ public class ContentManagementEvents { >>>>>>>> >>>>>>>> // Loop thru all the possible subsites >>>>>>>> Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); >>>>>>>> - String responseMessage = null; >>>>>>>> - String errorMessage = null; >>>>>>>> boolean statusIdUpdated = false; >>>>>>>> - Map<String, Object> results = null; >>>>>>>> + Map<String, Object> result = new HashMap<>(); >>>>>>>> for (Object [] arr : origPublishedLinkList) { >>>>>>>> String contentId = (String)arr[0]; // main (2nd >>>>>>>> level) site id >>>>>>>> String origSubContentId = null; >>>>>>>> @@ -243,13 +258,11 @@ public class ContentManagementEvents { >>>>>>>> serviceIn.put("targetOperationList", targetOperationList); >>>>>>>> // TODO check if this should be removed >>>>>>>> (see above) >>>>>>>> serviceIn.put("contentPurposeList", contentPurposeList); >>>>>>>> - results = >>>>>>>> dispatcher.runSync("createContentAssoc", >>>>>>>> serviceIn); >>>>>>>> - responseMessage = >>>>>>>> (String)results.get(ModelService.RESPONSE_MESSAGE); >>>>>>>> - if (UtilValidate.isNotEmpty(responseMessage)) >>>>>>>> { >>>>>>>> - errorMessage = >>>>>>>> (String)results.get(ModelService.ERROR_MESSAGE); >>>>>>>> - Debug.logError("in updatePublishLinks, >>>>>>>> serviceIn:" + serviceIn , module); >>>>>>>> - Debug.logError(errorMessage, module); >>>>>>>> + result = >>>>>>>> dispatcher.runSync("createContentAssoc", >>>>>>>> serviceIn); >>>>>>>> + if (ServiceUtil.isError(result)) { >>>>>>>> + String errorMessage = >>>>>>>> ServiceUtil.getErrorMessage(result); >>>>>>>> request.setAttribute("_ERROR_MESSAGE_", errorMessage); >>>>>>>> + Debug.logError(errorMessage, module); >>>>>>>> return "error"; >>>>>>>> } >>>>>>>> >>>>>>>> @@ -263,7 +276,13 @@ public class ContentManagementEvents { >>>>>>>> serviceIn.put("targetOperationList", targetOperationList); >>>>>>>> // TODO check if this should be removed >>>>>>>> (see above) >>>>>>>> serviceIn.put("contentPurposeList", contentPurposeList); >>>>>>>> - results = >>>>>>>> dispatcher.runSync("createContentAssoc", >>>>>>>> serviceIn); >>>>>>>> + result = >>>>>>>> dispatcher.runSync("createContentAssoc", >>>>>>>> serviceIn); >>>>>>>> + if (ServiceUtil.isError(result)) { >>>>>>>> + String errorMessage = >>>>>>>> ServiceUtil.getErrorMessage(result); >>>>>>>> + request.setAttribute("_ERROR_MESSAGE_", errorMessage); >>>>>>>> + Debug.logError(errorMessage, module); >>>>>>>> + return "error"; >>>>>>>> + } >>>>>>>> if (!statusIdUpdated) { >>>>>>>> try { >>>>>>>> GenericValue targContent = >>>>>>>> EntityQuery.use(delegator).from("Content").where("contentId", >>>>>>>> targContentId).queryOne(); >>>>>>>> >>>>>>>> Modified: ofbiz/ofbiz-framework/trunk/ap >>>>>>>> plications/content/src/main/java/org/apache/ofbiz/content/Co >>>>>>>> ntentManagementServices.java >>>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/app >>>>>>>> lications/content/src/main/java/org/apache/ofbiz/content/Con >>>>>>>> tentManagementServices.java?rev=1819730&r1=1819729&r2= >>>>>>>> 1819730&view=diff >>>>>>>> ============================================================================== >>>>>>>> >>>>>>>> --- ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/ContentManagementServices.java >>>>>>>> (original) >>>>>>>> +++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/ContentManagementServices.java Sun Dec >>>>>>>> 31 11:11:46 2017 >>>>>>>> @@ -359,9 +359,8 @@ public class ContentManagementServices { >>>>>>>> Map<String, Object> ctx = >>>>>>>> contentAssocModel.makeValid(contentAssoc, ModelService.IN_PARAM); >>>>>>>> contentAssocContext.putAll(ctx); >>>>>>>> thisResult = >>>>>>>> dispatcher.runSync("createContentAssoc", >>>>>>>> contentAssocContext); >>>>>>>> - String errMsg = ServiceUtil.getErrorMessage(th >>>>>>>> isResult); >>>>>>>> - if (ServiceUtil.isError(thisResult) || >>>>>>>> ServiceUtil.isFailure(thisResult) || UtilValidate.isNotEmpty(errMsg)) >>>>>>>> { >>>>>>>> - return ServiceUtil.returnError(errMsg); >>>>>>>> + if (ServiceUtil.isError(thisResult) || >>>>>>>> ServiceUtil.isFailure(thisResult)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(thisResult)); >>>>>>>> } >>>>>>>> >>>>>>>> results.put("caContentIdTo", >>>>>>>> thisResult.get("contentIdTo")); >>>>>>>> @@ -379,9 +378,8 @@ public class ContentManagementServices { >>>>>>>> Map<String, Object> ctx = >>>>>>>> contentAssocModel.makeValid(contentAssocExisting, >>>>>>>> ModelService.IN_PARAM); >>>>>>>> contentAssocContext.putAll(ctx); >>>>>>>> thisResult = >>>>>>>> dispatcher.runSync("updateContentAssoc", >>>>>>>> contentAssocContext); >>>>>>>> - String errMsg = ServiceUtil.getErrorMessage(th >>>>>>>> isResult); >>>>>>>> - if (ServiceUtil.isError(thisResult) || >>>>>>>> ServiceUtil.isFailure(thisResult) || UtilValidate.isNotEmpty(errMsg)) >>>>>>>> { >>>>>>>> - return ServiceUtil.returnError(errMsg); >>>>>>>> + if (ServiceUtil.isError(thisResult) || >>>>>>>> ServiceUtil.isFailure(thisResult)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(thisResult)); >>>>>>>> } >>>>>>>> } >>>>>>>> } catch (GenericEntityException e) { >>>>>>>> @@ -455,12 +453,14 @@ public class ContentManagementServices { >>>>>>>> newContext.put("roleTypeId", >>>>>>>> serviceContext.get("roleTypeId")); >>>>>>>> newContext.put("userLogin", userLogin); >>>>>>>> Map<String, Object> permResults = >>>>>>>> dispatcher.runSync("deactivateAllContentRoles", newContext); >>>>>>>> + if (ServiceUtil.isError(permResults)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(permResults)); >>>>>>>> + } >>>>>>>> serviceContext.put("fromDate", >>>>>>>> UtilDateTime.nowTimestamp()); >>>>>>>> if (Debug.infoOn()) >>>>>>>> Debug.logInfo("updateSiteRoles, serviceContext(1):" + >>>>>>>> serviceContext, module); >>>>>>>> permResults = >>>>>>>> dispatcher.runSync("createContentRole", >>>>>>>> serviceContext); >>>>>>>> - String errMsg = >>>>>>>> ServiceUtil.getErrorMessage(permResults); >>>>>>>> - if (UtilValidate.isNotEmpty(errMsg)) { >>>>>>>> - return ServiceUtil.returnError(errMsg); >>>>>>>> + if (ServiceUtil.isError(permResults)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(permResults)); >>>>>>>> } >>>>>>>> } catch (GenericServiceException e) { >>>>>>>> Debug.logError(e, e.toString(), module); >>>>>>>> @@ -481,9 +481,9 @@ public class ContentManagementServices { >>>>>>>> newContext.put("roleTypeId", >>>>>>>> serviceContext.get("roleTypeId")); >>>>>>>> newContext.put("userLogin", userLogin); >>>>>>>> Map<String, Object> permResults = >>>>>>>> dispatcher.runSync("deactivateAllContentRoles", newContext); >>>>>>>> - String errMsg = >>>>>>>> ServiceUtil.getErrorMessage(permResults); >>>>>>>> - if (UtilValidate.isNotEmpty(errMsg)) >>>>>>>> - return ServiceUtil.returnError(errMsg); >>>>>>>> + if (ServiceUtil.isError(permResults)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(permResults)); >>>>>>>> + } >>>>>>>> } catch (GenericServiceException e) { >>>>>>>> Debug.logError(e, e.toString(), module); >>>>>>>> return ServiceUtil.returnError(e.toSt >>>>>>>> ring()); >>>>>>>> @@ -505,6 +505,9 @@ public class ContentManagementServices { >>>>>>>> ModelService checkPermModel = >>>>>>>> dispatcher.getDispatchContext().getModelService("checkConten >>>>>>>> tPermission"); >>>>>>>> Map<String, Object> ctx = checkPermModel.makeValid(context, >>>>>>>> ModelService.IN_PARAM); >>>>>>>> Map<String, Object> thisResult = >>>>>>>> dispatcher.runSync("checkContentPermission", ctx); >>>>>>>> + if (ServiceUtil.isError(thisResult)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(thisResult)); >>>>>>>> + } >>>>>>>> String permissionStatus = (String)thisResult.get("permis >>>>>>>> sionStatus"); >>>>>>>> if (UtilValidate.isNotEmpty(permissionStatus) && >>>>>>>> "granted".equalsIgnoreCase(permissionStatus)) { >>>>>>>> result = persistDataResourceAndDataMethod(dctx, >>>>>>>> context); >>>>>>>> @@ -585,9 +588,8 @@ public class ContentManagementServices { >>>>>>>> >>>>>>>> if (!dataResourceExists) { // Create >>>>>>>> Map<String, Object> thisResult = >>>>>>>> dispatcher.runSync("createDataResource", newDrContext); >>>>>>>> - String errorMsg = ServiceUtil.getErrorMessage(th >>>>>>>> isResult); >>>>>>>> - if (UtilValidate.isNotEmpty(errorMsg)) { >>>>>>>> - throw(new Exception(errorMsg)); >>>>>>>> + if (ServiceUtil.isError(thisResult)) { >>>>>>>> + throw(new Exception(ServiceUtil.getError >>>>>>>> Message(thisResult))); >>>>>>>> } >>>>>>>> dataResourceId = (String)thisResult.get("dataRe >>>>>>>> sourceId"); >>>>>>>> if (Debug.infoOn()) { >>>>>>>> @@ -601,9 +603,8 @@ public class ContentManagementServices { >>>>>>>> fileContext.put("dataResourceId", >>>>>>>> dataResourceId); >>>>>>>> fileContext.put("imageData", imageDataBytes); >>>>>>>> thisResult = dispatcher.runSync("createImage", >>>>>>>> fileContext); >>>>>>>> - errorMsg = ServiceUtil.getErrorMessage(th >>>>>>>> isResult); >>>>>>>> - if (UtilValidate.isNotEmpty(errorMsg)) { >>>>>>>> - return ServiceUtil.returnError(errorMsg); >>>>>>>> + if (ServiceUtil.isError(thisResult)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(thisResult)); >>>>>>>> } >>>>>>>> } >>>>>>>> } else if ("SHORT_TEXT".equals(dataResourceTypeId)) { >>>>>>>> @@ -617,24 +618,25 @@ public class ContentManagementServices { >>>>>>>> uploadImage.put("uploadedFile", imageDataBytes); >>>>>>>> uploadImage.put("_uploadedFile_fileName", (String) >>>>>>>> context.get("_imageData_fileName")); >>>>>>>> uploadImage.put("_uploadedFile_contentType", (String) >>>>>>>> context.get("_imageData_contentType")); >>>>>>>> - dispatcher.runSync("attachUploadToDataResource", uploadImage); >>>>>>>> + thisResult = >>>>>>>> dispatcher.runSync("attachUploadToDataResource", >>>>>>>> uploadImage); >>>>>>>> + if (ServiceUtil.isError(thisResult)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(thisResult)); >>>>>>>> + } >>>>>>>> } else { >>>>>>>> // assume ELECTRONIC_TEXT >>>>>>>> if (UtilValidate.isNotEmpty(textData)) { >>>>>>>> fileContext.put("dataResourceId", >>>>>>>> dataResourceId); >>>>>>>> fileContext.put("textData", textData); >>>>>>>> thisResult = >>>>>>>> dispatcher.runSync("createElectronicText", >>>>>>>> fileContext); >>>>>>>> - errorMsg = ServiceUtil.getErrorMessage(th >>>>>>>> isResult); >>>>>>>> - if (UtilValidate.isNotEmpty(errorMsg)) { >>>>>>>> - return ServiceUtil.returnError(errorMsg); >>>>>>>> + if (ServiceUtil.isError(thisResult)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(thisResult)); >>>>>>>> } >>>>>>>> } >>>>>>>> } >>>>>>>> } else { // Update >>>>>>>> Map<String, Object> thisResult = >>>>>>>> dispatcher.runSync("updateDataResource", newDrContext); >>>>>>>> - String errorMsg = ServiceUtil.getErrorMessage(th >>>>>>>> isResult); >>>>>>>> - if (UtilValidate.isNotEmpty(errorMsg)) { >>>>>>>> - return ServiceUtil.returnError(errorMsg); >>>>>>>> + if (ServiceUtil.isError(thisResult)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(thisResult)); >>>>>>>> } >>>>>>>> Map<String, Object> fileContext = new HashMap<String, >>>>>>>> Object>(); >>>>>>>> fileContext.put("userLogin", userLogin); >>>>>>>> @@ -644,9 +646,8 @@ public class ContentManagementServices { >>>>>>>> fileContext.put("dataResourceId", >>>>>>>> dataResourceId); >>>>>>>> fileContext.put("imageData", imageDataBytes); >>>>>>>> thisResult = dispatcher.runSync("updateImage", >>>>>>>> fileContext); >>>>>>>> - errorMsg = ServiceUtil.getErrorMessage(th >>>>>>>> isResult); >>>>>>>> - if (UtilValidate.isNotEmpty(errorMsg)) { >>>>>>>> - return ServiceUtil.returnError(errorMsg); >>>>>>>> + if (ServiceUtil.isError(thisResult)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(thisResult)); >>>>>>>> } >>>>>>>> } >>>>>>>> } else if ("SHORT_TEXT".equals(dataResourceTypeId)) { >>>>>>>> @@ -660,15 +661,17 @@ public class ContentManagementServices { >>>>>>>> uploadImage.put("uploadedFile", imageDataBytes); >>>>>>>> uploadImage.put("_uploadedFile_fileName", (String) >>>>>>>> context.get("_imageData_fileName")); >>>>>>>> uploadImage.put("_uploadedFile_contentType", (String) >>>>>>>> context.get("_imageData_contentType")); >>>>>>>> - dispatcher.runSync("attachUploadToDataResource", uploadImage); >>>>>>>> + thisResult = >>>>>>>> dispatcher.runSync("attachUploadToDataResource", >>>>>>>> uploadImage); >>>>>>>> + if (ServiceUtil.isError(thisResult)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(thisResult)); >>>>>>>> + } >>>>>>>> } else { >>>>>>>> if (UtilValidate.isNotEmpty(textData) || >>>>>>>> "true".equalsIgnoreCase(forceElectronicText)) { >>>>>>>> fileContext.put("dataResourceId", >>>>>>>> dataResourceId); >>>>>>>> fileContext.put("textData", textData); >>>>>>>> thisResult = >>>>>>>> dispatcher.runSync("updateElectronicText", >>>>>>>> fileContext); >>>>>>>> - errorMsg = ServiceUtil.getErrorMessage(th >>>>>>>> isResult); >>>>>>>> - if (UtilValidate.isNotEmpty(errorMsg)) { >>>>>>>> - return ServiceUtil.returnError(errorMsg); >>>>>>>> + if (ServiceUtil.isError(thisResult)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(thisResult)); >>>>>>>> } >>>>>>>> } >>>>>>>> } >>>>>>>> @@ -680,11 +683,15 @@ public class ContentManagementServices { >>>>>>>> } >>>>>>>> >>>>>>>> public static void addRoleToUser(Delegator delegator, >>>>>>>> LocalDispatcher dispatcher, Map<String, Object> serviceContext) throws >>>>>>>> GenericServiceException, GenericEntityException { >>>>>>>> + Map<String, Object> result = new HashMap<>(); >>>>>>>> List<GenericValue> userLoginList = >>>>>>>> EntityQuery.use(delegator).from("UserLogin").where("partyId", >>>>>>>> serviceContext.get("partyId")).queryList(); >>>>>>>> for (GenericValue partyUserLogin : userLoginList) { >>>>>>>> String partyUserLoginId = >>>>>>>> partyUserLogin.getString("userLoginId"); >>>>>>>> serviceContext.put("contentId", partyUserLoginId); >>>>>>>> // author contentId >>>>>>>> - dispatcher.runSync("createContentRole", >>>>>>>> serviceContext); >>>>>>>> + result = dispatcher.runSync("createContentRole", >>>>>>>> serviceContext); >>>>>>>> + if (ServiceUtil.isError(result)) { >>>>>>>> + Debug.logError(ServiceUtil.getErrorMessage(result), module); >>>>>>>> + } >>>>>>>> } >>>>>>>> } >>>>>>>> >>>>>>>> @@ -692,6 +699,7 @@ public class ContentManagementServices { >>>>>>>> LocalDispatcher dispatcher = dctx.getDispatcher(); >>>>>>>> Delegator delegator = dctx.getDelegator(); >>>>>>>> Map<String, Object> results = new HashMap<String, >>>>>>>> Object>(); >>>>>>>> + Map<String, Object> thisResult = new HashMap<String, >>>>>>>> Object>(); >>>>>>>> Map<String, Object> serviceContext = new HashMap<String, >>>>>>>> Object>(); >>>>>>>> // siteContentId will equal "ADMIN_MASTER", >>>>>>>> "AGINC_MASTER", etc. >>>>>>>> // Remember that this service is called in the "multi" >>>>>>>> mode, >>>>>>>> @@ -725,7 +733,10 @@ public class ContentManagementServices { >>>>>>>> Debug.logInfo("updateSiteRoles, serviceContext(1):" + >>>>>>>> serviceContext, module); >>>>>>>> } >>>>>>>> addRoleToUser(delegator, dispatcher, >>>>>>>> serviceContext); >>>>>>>> - dispatcher.runSync("createContentRole", serviceContext); >>>>>>>> + thisResult = >>>>>>>> dispatcher.runSync("createContentRole", >>>>>>>> serviceContext); >>>>>>>> + if (ServiceUtil.isError(thisResult)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(thisResult)); >>>>>>>> + } >>>>>>>> } catch (GenericServiceException e) { >>>>>>>> Debug.logError(e, e.toString(), module); >>>>>>>> } catch (Exception e2) { >>>>>>>> @@ -742,7 +753,10 @@ public class ContentManagementServices { >>>>>>>> newContext.put("contentId", >>>>>>>> serviceContext.get("contentId")); >>>>>>>> newContext.put("partyId", >>>>>>>> serviceContext.get("partyId")); >>>>>>>> newContext.put("roleTypeId", >>>>>>>> serviceContext.get("roleTypeId")); >>>>>>>> - dispatcher.runSync("deactivateAllContentRoles", newContext); >>>>>>>> + thisResult = >>>>>>>> dispatcher.runSync("deactivateAllContentRoles", >>>>>>>> newContext); >>>>>>>> + if (ServiceUtil.isError(thisResult)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(thisResult)); >>>>>>>> + } >>>>>>>> } catch (GenericServiceException e) { >>>>>>>> Debug.logError(e, e.toString(), module); >>>>>>>> } catch (Exception e2) { >>>>>>>> @@ -892,6 +906,7 @@ public class ContentManagementServices { >>>>>>>> Map<String, Object> result = new HashMap<String, >>>>>>>> Object>(); >>>>>>>> Delegator delegator = dctx.getDelegator(); >>>>>>>> LocalDispatcher dispatcher = dctx.getDispatcher(); >>>>>>>> + Map<String, Object> thisResult = new HashMap<String, >>>>>>>> Object>(); >>>>>>>> String contentId = (String)context.get("contentId"); >>>>>>>> GenericValue userLogin = (GenericValue)context.get("use >>>>>>>> rLogin"); >>>>>>>> String userLoginId = userLogin.getString("userLoginId"); >>>>>>>> @@ -926,7 +941,10 @@ public class ContentManagementServices { >>>>>>>> serviceIn.put("contentAssocTypeId", >>>>>>>> "SUB_CONTENT"); >>>>>>>> serviceIn.put("sequenceNum", Long.valueOf(50)); >>>>>>>> try { >>>>>>>> - dispatcher.runSync("persistContentAndAssoc", serviceIn); >>>>>>>> + thisResult = >>>>>>>> dispatcher.runSync("persistContentAndAssoc", >>>>>>>> serviceIn); >>>>>>>> + if (ServiceUtil.isError(thisResult)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(thisResult)); >>>>>>>> + } >>>>>>>> } catch (ServiceAuthException e) { >>>>>>>> return ServiceUtil.returnError(e.toString()); >>>>>>>> } >>>>>>>> @@ -1281,7 +1299,7 @@ public class ContentManagementServices { >>>>>>>> Delegator delegator = dctx.getDelegator(); >>>>>>>> LocalDispatcher dispatcher = dctx.getDispatcher(); >>>>>>>> Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); >>>>>>>> - >>>>>>>> + Map<String, Object> thisResult = new HashMap<String, >>>>>>>> Object>(); >>>>>>>> String partyId = (String) context.get("partyId"); >>>>>>>> String webPubPt = (String) context.get("contentId"); >>>>>>>> String roleTypeId = (String) context.get("useRoleTypeId"); >>>>>>>> @@ -1347,7 +1365,10 @@ public class ContentManagementServices { >>>>>>>> map.put("partyId", partyId); >>>>>>>> map.put("roleTypeId", roleTypeId); >>>>>>>> map.put("userLogin", userLogin); >>>>>>>> - dispatcher.runSync("ensurePartyRole", map); >>>>>>>> + thisResult = dispatcher.runSync("ensurePartyRole", >>>>>>>> map); >>>>>>>> + if (ServiceUtil.isError(thisResult)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(thisResult)); >>>>>>>> + } >>>>>>>> contentRole.create(); >>>>>>>> } >>>>>>>> } catch (GenericEntityException e) { >>>>>>>> @@ -1402,6 +1423,9 @@ public class ContentManagementServices { >>>>>>>> ModelService subscriptionModel = >>>>>>>> dispatcher.getDispatchContext().getModelService("updateConte >>>>>>>> ntSubscription"); >>>>>>>> Map<String, Object> ctx = >>>>>>>> subscriptionModel.makeValid(context, >>>>>>>> ModelService.IN_PARAM); >>>>>>>> result = dispatcher.runSync("updateContentSubscription", >>>>>>>> ctx); >>>>>>>> + if (ServiceUtil.isError(result)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(result)); >>>>>>>> + } >>>>>>>> return result; >>>>>>>> } >>>>>>>> >>>>>>>> @@ -1447,7 +1471,10 @@ public class ContentManagementServices { >>>>>>>> context.put("productId", productId); >>>>>>>> context.put("quantity", >>>>>>>> Integer.valueOf(qty.intValue())); >>>>>>>> Map<String, Object> ctx = >>>>>>>> subscriptionModel.makeValid(context, ModelService.IN_PARAM); >>>>>>>> - dispatcher.runSync("updateContentSubscriptionByProduct", ctx); >>>>>>>> + result = >>>>>>>> dispatcher.runSync("updateContentSubscriptionByProduct", >>>>>>>> ctx); >>>>>>>> + if (ServiceUtil.isError(result)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(result)); >>>>>>>> + } >>>>>>>> } >>>>>>>> } >>>>>>>> } catch (GenericEntityException e) { >>>>>>>> @@ -1510,6 +1537,9 @@ public class ContentManagementServices { >>>>>>>> >>>>>>>> GenericValue userLogin = (GenericValue)context.get("use >>>>>>>> rLogin"); >>>>>>>> result = dispatcher.runSync(serviceName, >>>>>>>> UtilMisc.toMap("content", content, "userLogin", userLogin)); >>>>>>>> + if (ServiceUtil.isError(result)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(result)); >>>>>>>> + } >>>>>>>> >>>>>>>> List<GenericValue> kids = >>>>>>>> ContentWorker.getAssociatedContent(content, >>>>>>>> "from", contentAssocTypeIdList, null, null, null); >>>>>>>> for (GenericValue kidContent : kids) { >>>>>>>> @@ -1545,9 +1575,8 @@ public class ContentManagementServices { >>>>>>>> ctx.remove("drDataResourceId"); >>>>>>>> } >>>>>>>> result = dispatcher.runSync("persistContentAndAssoc", >>>>>>>> ctx); >>>>>>>> - String errorMsg = ServiceUtil.getErrorMessage(result); >>>>>>>> - if (UtilValidate.isNotEmpty(errorMsg)) { >>>>>>>> - return ServiceUtil.returnError(errorMsg); >>>>>>>> + if (ServiceUtil.isError(result)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(result)); >>>>>>>> } >>>>>>>> String contentId = (String)result.get("contentId"); >>>>>>>> List<String> parentList = new LinkedList<String>(); >>>>>>>> @@ -1557,6 +1586,9 @@ public class ContentManagementServices { >>>>>>>> traversMap.put("direction", "To"); >>>>>>>> traversMap.put("contentAssocTypeId", >>>>>>>> "COMPDOC_PART"); >>>>>>>> Map<String, Object> traversResult = >>>>>>>> dispatcher.runSync("traverseContent", traversMap); >>>>>>>> + if (ServiceUtil.isError(traversResult)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(traversResult)); >>>>>>>> + } >>>>>>>> parentList = UtilGenerics.checkList(travers >>>>>>>> Result.get("parentList")); >>>>>>>> } else { >>>>>>>> parentList.add(masterRevisionContentId); >>>>>>>> @@ -1572,9 +1604,8 @@ public class ContentManagementServices { >>>>>>>> String thisContentId = parentList.get(i); >>>>>>>> contentRevisionMap.put("contentId", thisContentId); >>>>>>>> result = >>>>>>>> dispatcher.runSync("persistContentRevisionAndItem", >>>>>>>> contentRevisionMap); >>>>>>>> - errorMsg = ServiceUtil.getErrorMessage(result); >>>>>>>> - if (UtilValidate.isNotEmpty(errorMsg)) { >>>>>>>> - return ServiceUtil.returnError(errorMsg); >>>>>>>> + if (ServiceUtil.isError(result)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(result)); >>>>>>>> } >>>>>>>> } >>>>>>>> } catch (GenericServiceException e) { >>>>>>>> >>>>>>>> Modified: ofbiz/ofbiz-framework/trunk/ap >>>>>>>> plications/content/src/main/java/org/apache/ofbiz/content/Co >>>>>>>> nvertTree.java >>>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/app >>>>>>>> lications/content/src/main/java/org/apache/ofbiz/content/Con >>>>>>>> vertTree.java?rev=1819730&r1=1819729&r2=1819730&view=diff >>>>>>>> ============================================================================== >>>>>>>> >>>>>>>> --- ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/ConvertTree.java (original) >>>>>>>> +++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/ConvertTree.java Sun Dec 31 11:11:46 >>>>>>>> 2017 >>>>>>>> @@ -70,6 +70,7 @@ In order to make this service active add >>>>>>>> Locale locale = (Locale) context.get("locale"); >>>>>>>> GenericValue userLogin = (GenericValue) >>>>>>>> context.get("userLogin"); >>>>>>>> String file = (String) context.get("file"); >>>>>>>> + Map<String, Object> result = new HashMap<String, Object>(); >>>>>>>> String errMsg = "", sucMsg= ""; >>>>>>>> GenericValue Entity = null; >>>>>>>> if (UtilValidate.isNotEmpty(file)) { >>>>>>>> @@ -77,8 +78,6 @@ In order to make this service active add >>>>>>>> String line = null; >>>>>>>> int size = 0; >>>>>>>> int counterLine = 0; >>>>>>>> - //Home Document >>>>>>>> - Entity = null; >>>>>>>> Entity = delegator.makeValue("Content"); >>>>>>>> Entity.set("contentId", "ROOT"); >>>>>>>> Entity.set("contentName", "ROOT"); >>>>>>>> @@ -92,7 +91,6 @@ In order to make this service active add >>>>>>>> Entity.set("createdTxStamp", >>>>>>>> UtilDateTime.nowTimestamp()); >>>>>>>> delegator.create(Entity); >>>>>>>> >>>>>>>> - Entity = null; >>>>>>>> Entity = delegator.makeValue("Content"); >>>>>>>> Entity.set("contentId", "HOME_DOCUMENT"); >>>>>>>> Entity.set("contentName", "Home"); >>>>>>>> @@ -111,7 +109,10 @@ In order to make this service active add >>>>>>>> contentAssoc.put("contentAssocTypeId", "TREE_CHILD"); >>>>>>>> contentAssoc.put("contentIdTo", "ROOT"); >>>>>>>> contentAssoc.put("userLogin", userLogin); >>>>>>>> - dispatcher.runSync("createContentAssoc", contentAssoc); >>>>>>>> + result = dispatcher.runSync("createContentAssoc", >>>>>>>> contentAssoc); >>>>>>>> + if (ServiceUtil.isError(result)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(result)); >>>>>>>> + } >>>>>>>> while ((line = input.readLine()) != null) >>>>>>>> {//start line >>>>>>>> boolean hasFolder = true; >>>>>>>> String rootContent = null, contentId = null; >>>>>>>> counterLine++; >>>>>>>> @@ -162,7 +163,6 @@ In order to make this service active add >>>>>>>> } >>>>>>>> >>>>>>>> if (contentAssocSize == 0 && >>>>>>>> contentNameMatch == false) {//New Root Content >>>>>>>> - Entity = null; >>>>>>>> contentId = >>>>>>>> delegator.getNextSeqId("Content"); >>>>>>>> Entity = >>>>>>>> delegator.makeValue("Content"); >>>>>>>> Entity.set("contentId", contentId); >>>>>>>> @@ -192,7 +192,10 @@ In order to make this service active add >>>>>>>> contentAssoc.put("contentAssocTypeId", "TREE_CHILD"); >>>>>>>> contentAssoc.put("contentIdTo", rootContent); >>>>>>>> contentAssoc.put("userLogin", userLogin); >>>>>>>> - dispatcher.runSync("createContentAssoc", contentAssoc); >>>>>>>> + result = >>>>>>>> dispatcher.runSync("createContentAssoc", contentAssoc); >>>>>>>> + if >>>>>>>> (ServiceUtil.isError(result)) { >>>>>>>> + return >>>>>>>> ServiceUtil.returnError(ServiceUtil.getErrorMessage(result)); >>>>>>>> + } >>>>>>>> rootContent = contentId; >>>>>>>> } else { >>>>>>>> //Debug.logInfo("ContentAssoc [contentId= " + contentId + ", >>>>>>>> contentIdTo=" + rootContent + "] already exist.");//ShoW log file >>>>>>>> @@ -230,6 +233,7 @@ In order to make this service active add >>>>>>>> Delegator delegator = dctx.getDelegator(); >>>>>>>> LocalDispatcher dispatcher = dctx.getDispatcher(); >>>>>>>> GenericValue userLogin = (GenericValue) >>>>>>>> context.get("userLogin"); >>>>>>>> + Map<String, Object> result = new HashMap<String, Object>(); >>>>>>>> String subContents = null, check = ",", oldChar = "\"", >>>>>>>> newChar = "", contentNameInprogress = "", contentName = "", contentId = >>>>>>>> null; >>>>>>>> GenericValue Entity = null; >>>>>>>> String errMsg = "", sucMsg= ""; >>>>>>>> @@ -259,16 +263,17 @@ In order to make this service active add >>>>>>>> } >>>>>>>> } >>>>>>>> } >>>>>>>> - contentId = null; >>>>>>>> if (contentNameMatch == false) { >>>>>>>> //create DataResource >>>>>>>> Map<String,Object> data = new >>>>>>>> HashMap<String, Object>(); >>>>>>>> data.put("userLogin", userLogin); >>>>>>>> - String dataResourceId = >>>>>>>> dispatcher.runSync("createDataResource", >>>>>>>> data).get("dataResourceId").toString(); >>>>>>>> - >>>>>>>> + result = >>>>>>>> dispatcher.runSync("createDataResource", >>>>>>>> data); >>>>>>>> + if (ServiceUtil.isError(result)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(result)); >>>>>>>> + } >>>>>>>> + String dataResourceId = (String) >>>>>>>> result.get("dataResourceId"); >>>>>>>> //create Content >>>>>>>> contentId = delegator.getNextSeqId("Conten >>>>>>>> t"); >>>>>>>> - Entity = null; >>>>>>>> Entity = delegator.makeValue("Content"); >>>>>>>> Entity.set("contentId", contentId); >>>>>>>> Entity.set("contentName", contentName); >>>>>>>> @@ -289,7 +294,10 @@ In order to make this service active add >>>>>>>> contentAssoc.put("contentAssocTypeId", "SUB_CONTENT"); >>>>>>>> contentAssoc.put("contentIdTo", rootContent); >>>>>>>> contentAssoc.put("userLogin", userLogin); >>>>>>>> - dispatcher.runSync("createContentAssoc", contentAssoc); >>>>>>>> + result = >>>>>>>> dispatcher.runSync("createContentAssoc", >>>>>>>> contentAssoc); >>>>>>>> + if (ServiceUtil.isError(result)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(result)); >>>>>>>> + } >>>>>>>> } >>>>>>>> contentName =""; >>>>>>>> contentNameInprogress=""; >>>>>>>> @@ -320,16 +328,17 @@ In order to make this service active add >>>>>>>> } >>>>>>>> } >>>>>>>> } >>>>>>>> - contentId = null; >>>>>>>> if (contentNameMatch == false) { >>>>>>>> //create DataResource >>>>>>>> Map<String,Object> data = new >>>>>>>> HashMap<String, Object>(); >>>>>>>> data.put("userLogin", userLogin); >>>>>>>> - String dataResourceId = >>>>>>>> dispatcher.runSync("createDataResource",data).get(" >>>>>>>> dataResourceId").toString(); >>>>>>>> - >>>>>>>> + result = >>>>>>>> dispatcher.runSync("createDataResource", >>>>>>>> data); >>>>>>>> + if (ServiceUtil.isError(result)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(result)); >>>>>>>> + } >>>>>>>> + String dataResourceId = (String) >>>>>>>> result.get("dataResourceId"); >>>>>>>> //create Content >>>>>>>> contentId = delegator.getNextSeqId("Conten >>>>>>>> t"); >>>>>>>> - Entity = null; >>>>>>>> Entity = delegator.makeValue("Content"); >>>>>>>> Entity.set("contentId", contentId); >>>>>>>> Entity.set("contentName", contentName); >>>>>>>> @@ -350,7 +359,10 @@ In order to make this service active add >>>>>>>> contentAssoc.put("contentAssocTypeId", "SUB_CONTENT"); >>>>>>>> contentAssoc.put("contentIdTo", rootContent); >>>>>>>> contentAssoc.put("userLogin", userLogin); >>>>>>>> - dispatcher.runSync("createContentAssoc", contentAssoc); >>>>>>>> + result = >>>>>>>> dispatcher.runSync("createContentAssoc", >>>>>>>> contentAssoc); >>>>>>>> + if (ServiceUtil.isError(result)) { >>>>>>>> + return ServiceUtil.returnError(Servic >>>>>>>> eUtil.getErrorMessage(result)); >>>>>>>> + } >>>>>>>> } >>>>>>>> } >>>>>>>> } >>>>>>>> >>>>>>>> Modified: ofbiz/ofbiz-framework/trunk/ap >>>>>>>> plications/content/src/main/java/org/apache/ofbiz/content/co >>>>>>>> mpdoc/CompDocEvents.java >>>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/app >>>>>>>> lications/content/src/main/java/org/apache/ofbiz/content/com >>>>>>>> pdoc/CompDocEvents.java?rev=1819730&r1=1819729&r2=1819730&view=diff >>>>>>>> ============================================================================== >>>>>>>> >>>>>>>> --- ofbiz/ofbiz-framework/trunk/applications/content/src/main/ja >>>>>>>> va/org/apache/ofbiz/content/compdo >>>>>>> >>>>>>> ...
