svn commit: r1765035 - in /ofbiz/trunk/framework/service: config/ServiceUiLabels.xml src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1765035 - in /ofbiz/trunk/framework/service: config/ServiceUiLabels.xml src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java

Mridul Pathak-5
Author: mridulpathak
Date: Sat Oct 15 11:28:59 2016
New Revision: 1765035

URL: http://svn.apache.org/viewvc?rev=1765035&view=rev
Log:
Improved: Entity auto services doesn't returns success message.
(OFBIZ-7597)

Thanks: Suraj Khurana for the contribution.

Added:
    ofbiz/trunk/framework/service/config/ServiceUiLabels.xml
Modified:
    ofbiz/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java

Added: ofbiz/trunk/framework/service/config/ServiceUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/config/ServiceUiLabels.xml?rev=1765035&view=auto
==============================================================================
--- ofbiz/trunk/framework/service/config/ServiceUiLabels.xml (added)
+++ ofbiz/trunk/framework/service/config/ServiceUiLabels.xml Sat Oct 15 11:28:59 2016
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
+    <property key="EntityCreatedSuccessfully">
+        <value xml:lang="en">${entityName} created successfully</value>
+    </property>
+    <property key="EntityUpdatedSuccessfully">
+        <value xml:lang="en">${entityName} updated successfully</value>
+    </property>
+    <property key="EntityDeletedSuccessfully">
+        <value xml:lang="en">${entityName} deleted successfully</value>
+    </property>
+    <property key="EntityExpiredSuccessfully">
+        <value xml:lang="en">${entityName} expired successfully</value>
+    </property>
+</resource>
\ No newline at end of file

Modified: ofbiz/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java?rev=1765035&r1=1765034&r2=1765035&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java (original)
+++ ofbiz/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java Sat Oct 15 11:28:59 2016
@@ -112,18 +112,22 @@ public final class EntityAutoEngine exte
             switch (modelService.invoke) {
             case "create":
                 result = invokeCreate(dctx, parameters, modelService, modelEntity, allPksInOnly, pkFieldNameOutOnly);
+                result.put("successMessage", UtilProperties.getMessage("ServiceUiLabels", "EntityCreatedSuccessfully", UtilMisc.toMap("entityName", modelEntity.getEntityName()), locale));
                 break;
             case "update":
                 result = invokeUpdate(dctx, parameters, modelService, modelEntity, allPksInOnly);
+                result.put("successMessage", UtilProperties.getMessage("ServiceUiLabels", "EntityUpdatedSuccessfully", UtilMisc.toMap("entityName", modelEntity.getEntityName()), locale));
                 break;
             case "delete":
                 result = invokeDelete(dctx, parameters, modelService, modelEntity, allPksInOnly);
+                result.put("successMessage", UtilProperties.getMessage("ServiceUiLabels", "EntityDeletedSuccessfully", UtilMisc.toMap("entityName", modelEntity.getEntityName()), locale));
                 break;
             case "expire":
                 result = invokeExpire(dctx, parameters, modelService, modelEntity, allPksInOnly);
                 if (ServiceUtil.isSuccess(result)) {
                     result = invokeUpdate(dctx, parameters, modelService, modelEntity, allPksInOnly);
                 }
+                result.put("successMessage", UtilProperties.getMessage("ServiceUiLabels", "EntityExpiredSuccessfully", UtilMisc.toMap("entityName", modelEntity.getEntityName()), locale));
                 break;
             default:
                 break;
@@ -137,7 +141,7 @@ public final class EntityAutoEngine exte
             Debug.logError(e, "Error doing entity-auto operation for entity [" + modelEntity.getEntityName() + "] in service [" + modelService.name + "]: " + e.toString(), module);
             return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ServiceEntityAutoOperation", UtilMisc.toMap("entityName", modelEntity.getEntityName(), "serviceName", modelService.name,"errorString", e.toString()), locale));
         }
-
+        result.put(ModelService.SUCCESS_MESSAGE, result.get("successMessage"));
         return result;
     }