svn commit: r1831450 - /ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java

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

svn commit: r1831450 - /ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java

Deepak Dixit-5
Author: deepak
Date: Sat May 12 06:43:47 2018
New Revision: 1831450

URL: http://svn.apache.org/viewvc?rev=1831450&view=rev
Log:
Improved: Remove createContent Java service implementation
(OFBIZ-10393)

The createContent service has been replaced by a minilang implementation since 2007
Thanks Mathieu Lirzin for your contribution

Modified:
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java?rev=1831450&r1=1831449&r2=1831450&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java Sat May 12 06:43:47 2018
@@ -225,89 +225,6 @@ public class ContentServices {
     }
 
     /**
-     * Create a Content service. The work is done in a separate method so that complex services that need this functionality do not need to incur the
-     * reflection performance penalty.
-     */
-    public static Map<String, Object> createContent(DispatchContext dctx, Map<String, ? extends Object> context) {
-        Map<String, Object> result = createContentMethod(dctx, context);
-        return result;
-    }
-
-    /**
-     * Create a Content method. The work is done in this separate method so that complex services that need this functionality do not need to incur the
-     * reflection performance penalty.
-     */
-    public static Map<String, Object> createContentMethod(DispatchContext dctx, Map<String, ? extends Object> rcontext) {
-        Map<String, Object> context = UtilMisc.makeMapWritable(rcontext);
-        context.put("entityOperation", "_CREATE");
-        List<String> targetOperationList = ContentWorker.prepTargetOperationList(context, "_CREATE");
-        if (Debug.infoOn()) Debug.logInfo("in createContentMethod, targetOperationList: " + targetOperationList, null);
-
-        List<String> contentPurposeList = ContentWorker.prepContentPurposeList(context);
-        context.put("targetOperationList", targetOperationList);
-        context.put("contentPurposeList", contentPurposeList);
-
-        Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
-        Map<String, Object> result = new HashMap<String, Object>();
-        Delegator delegator = dctx.getDelegator();
-        LocalDispatcher dispatcher = dctx.getDispatcher();
-        String contentId = (String) context.get("contentId");
-
-        if (UtilValidate.isEmpty(contentId)) {
-            contentId = delegator.getNextSeqId("Content");
-        }
-
-        GenericValue content = delegator.makeValue("Content", UtilMisc.toMap("contentId", contentId));
-        content.setNonPKFields(context);
-
-        GenericValue userLogin = (GenericValue) context.get("userLogin");
-        String userLoginId = (String) userLogin.get("userLoginId");
-
-        // get first statusId  for content out of the statusItem table if not provided
-        if (UtilValidate.isEmpty(context.get("statusId"))) {
-            try {
-                GenericValue statusItem = EntityQuery.use(delegator).from("StatusItem")
-                        .where("statusTypeId", "CONTENT_STATUS")
-                        .orderBy("sequenceId").queryFirst();
-                if (statusItem != null) {
-                    content.put("statusId",  statusItem.get("statusId"));
-                }
-            } catch (GenericEntityException e) {
-                return ServiceUtil.returnError(e.getMessage());
-            }
-        }
-
-        content.put("createdByUserLogin", userLoginId);
-        content.put("lastModifiedByUserLogin", userLoginId);
-        content.put("createdDate", nowTimestamp);
-        content.put("lastModifiedDate", nowTimestamp);
-
-        context.put("currentContent", content);
-        if (Debug.infoOn()) Debug.logInfo("in createContentMethod, context: " + context, null);
-
-        Map<String, Object> permResults = ContentWorker.callContentPermissionCheckResult(delegator, dispatcher, context);
-        String permissionStatus = (String) permResults.get("permissionStatus");
-        if (permissionStatus != null && "granted".equalsIgnoreCase(permissionStatus)) {
-            try {
-                content.create();
-            } catch (GenericEntityException e) {
-                return ServiceUtil.returnError(e.getMessage());
-            } catch (Exception e2) {
-                return ServiceUtil.returnError(e2.getMessage());
-            }
-
-            result.put("contentId", contentId);
-        } else {
-            String errorMsg = (String) permResults.get(ModelService.ERROR_MESSAGE);
-            result.put(ModelService.ERROR_MESSAGE, errorMsg);
-            return ServiceUtil.returnFailure(errorMsg);
-        }
-
-        context.remove("currentContent");
-        return result;
-    }
-
-    /**
      * Create a ContentAssoc service. The work is done in a separate method so that complex services that need this functionality do not need to incur the
      * reflection performance penalty.
      */