Re: svn commit: r1807908 - /ofbiz/ofbiz-framework/trunk/framework/service/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
|

Re: svn commit: r1807908 - /ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java

Rishi Solanki
I have reverted the changes due to buildbot failure report. I ran the test
integration failed at my local. I'll review it further but it looks like
some test expecting success always and failing due to this commit.


Rishi Solanki
Sr Manager, Enterprise Software Development
HotWax Systems Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxsystems.com
www.hotwax.co

On Sat, Sep 9, 2017 at 7:41 PM, <[hidden email]> wrote:

> Author: rishi
> Date: Sat Sep  9 14:11:51 2017
> New Revision: 1807908
>
> URL: http://svn.apache.org/viewvc?rev=1807908&view=rev
> Log:
> Fixed: Can enter empty content for product facility (OFBIZ-8323). A
> Generic Issue with EntityAutoEngine in which success message is appended to
> result after invoking create, update, delete, expire methods. Now engine
> would return success or error from invoking method and won't prepare the
> message its own.
> Thanks to Lalit Dashora for your contribution.
>
> Modified:
>     ofbiz/ofbiz-framework/trunk/framework/service/src/main/
> java/org/apache/ofbiz/service/engine/EntityAutoEngine.java
>
> Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/
> java/org/apache/ofbiz/service/engine/EntityAutoEngine.java
> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/
> framework/service/src/main/java/org/apache/ofbiz/service/
> engine/EntityAutoEngine.java?rev=1807908&r1=1807907&r2=1807908&view=diff
> ============================================================
> ==================
> --- ofbiz/ofbiz-framework/trunk/framework/service/src/main/
> java/org/apache/ofbiz/service/engine/EntityAutoEngine.java (original)
> +++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/
> java/org/apache/ofbiz/service/engine/EntityAutoEngine.java Sat Sep  9
> 14:11:51 2017
> @@ -112,22 +112,18 @@ public final class EntityAutoEngine exte
>              switch (modelService.invoke) {
>              case "create":
>                  result = invokeCreate(dctx, parameters, modelService,
> modelEntity, allPksInOnly, pkFieldNameOutOnly);
> -                result.put(ModelService.SUCCESS_MESSAGE,
> UtilProperties.getMessage("ServiceUiLabels", "EntityCreatedSuccessfully",
> UtilMisc.toMap("entityName", modelEntity.getEntityName()), locale));
>                  break;
>              case "update":
>                  result = invokeUpdate(dctx, parameters, modelService,
> modelEntity, allPksInOnly);
> -                result.put(ModelService.SUCCESS_MESSAGE,
> UtilProperties.getMessage("ServiceUiLabels", "EntityUpdatedSuccessfully",
> UtilMisc.toMap("entityName", modelEntity.getEntityName()), locale));
>                  break;
>              case "delete":
>                  result = invokeDelete(dctx, parameters, modelService,
> modelEntity, allPksInOnly);
> -                result.put(ModelService.SUCCESS_MESSAGE,
> 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(ModelService.SUCCESS_MESSAGE,
> UtilProperties.getMessage("ServiceUiLabels", "EntityExpiredSuccessfully",
> UtilMisc.toMap("entityName", modelEntity.getEntityName()), locale));
>                  break;
>              default:
>                  break;
> @@ -148,7 +144,6 @@ public final class EntityAutoEngine exte
>      private static Map<String, Object> invokeCreate(DispatchContext dctx,
> Map<String, Object> parameters, ModelService modelService, ModelEntity
> modelEntity, boolean allPksInOnly, List<String> pkFieldNameOutOnly)
>              throws GeneralException {
>          Locale locale = (Locale) parameters.get("locale");
> -        Map<String, Object> result = ServiceUtil.returnSuccess();
>
>          GenericValue newEntity = dctx.getDelegator().makeValue(
> modelEntity.getEntityName());
>
> @@ -360,6 +355,7 @@ public final class EntityAutoEngine exte
>              }
>          }
>          newEntity.create();
> +        Map<String, Object> result = ServiceUtil.returnSuccess(
> UtilProperties.getMessage("ServiceUiLabels", "EntityCreatedSuccessfully",
> UtilMisc.toMap("entityName", modelEntity.getEntityName()), locale));
>          result.put("crudValue", newEntity);
>          return result;
>      }
> @@ -472,6 +468,7 @@ public final class EntityAutoEngine exte
>
>          lookedUpValue.store();
>          result.put("crudValue", lookedUpValue);
> +        result.put(ModelService.SUCCESS_MESSAGE,ServiceUtil.
> returnSuccess(UtilProperties.getMessage("ServiceUiLabels",
> "EntityUpdatedSuccessfully", UtilMisc.toMap("entityName",
> modelEntity.getEntityName()), locale)));
>          return result;
>      }
>
> @@ -502,7 +499,8 @@ public final class EntityAutoEngine exte
>              return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> "ServiceValueNotFoundForRemove", locale));
>          }
>          lookedUpValue.remove();
> -        return ServiceUtil.returnSuccess();
> +        Map<String, Object> result = ServiceUtil.returnSuccess(
> UtilProperties.getMessage("ServiceUiLabels", "EntityDeletedSuccessfully",
> UtilMisc.toMap("entityName", modelEntity.getEntityName()), locale));
> +        return result;
>      }
>
>      /**
> @@ -566,6 +564,7 @@ public final class EntityAutoEngine exte
>          }
>          if (Debug.infoOn())
>              Debug.logInfo(" parameters OUT  : " + parameters, module);
> -        return ServiceUtil.returnSuccess();
> +        Map<String, Object> result = ServiceUtil.returnSuccess(
> UtilProperties.getMessage("ServiceUiLabels", "EntityExpiredSuccessfully",
> UtilMisc.toMap("entityName", modelEntity.getEntityName()), locale));
> +        return result;
>      }
>  }
>
>
>