diff --git a/applications/content/servicedef/services.xml b/applications/content/servicedef/services.xml index 2b534167041..c89cf2be695 100644 --- a/applications/content/servicedef/services.xml +++ b/applications/content/servicedef/services.xml @@ -248,24 +248,6 @@ - - Follow a content and return descendants - - - - - - - - - - - - - - - Get Content of passed contentId @@ -364,23 +346,6 @@ - - - - - - - - - - - - - - - Supply thruDate to all ContentAssoc that come "before" current one diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java index bd7c0949903..3f133ed0498 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java @@ -123,107 +123,6 @@ public static Map findRelatedContent(DispatchContext dctx, Map findContentParents(DispatchContext dctx, Map context) { - Map results = new HashMap<>(); - List parentList = new LinkedList<>(); - results.put("parentList", parentList); - LocalDispatcher dispatcher = dctx.getDispatcher(); - String contentId = (String) context.get("contentId"); - String contentAssocTypeId = (String) context.get("contentAssocTypeId"); - String direction = (String) context.get("direction"); - if (UtilValidate.isEmpty(direction)) { - direction = "To"; - } - Map traversMap = new HashMap<>(); - traversMap.put("contentId", contentId); - traversMap.put("direction", direction); - traversMap.put("contentAssocTypeId", contentAssocTypeId); - try { - Map thisResults = dispatcher.runSync("traverseContent", traversMap); - if (ServiceUtil.isError(thisResults)) { - return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResults)); - } - Map nodeMap = UtilGenerics.cast(thisResults.get("nodeMap")); - walkParentTree(nodeMap, parentList); - } catch (GenericServiceException e) { - return ServiceUtil.returnFailure(e.getMessage()); - } - return results; - } - - private static void walkParentTree(Map nodeMap, List parentList) { - List> kids = UtilGenerics.cast(nodeMap.get("kids")); - if (UtilValidate.isEmpty(kids)) { - parentList.add(nodeMap.get("contentId")); - } else { - for (Map node : kids) { - walkParentTree(node, parentList); - } - } - } - /** - * This is a generic service for traversing a Content tree, typical of a blog response tree. It calls the ContentWorker.traverse method. - */ - public static Map traverseContent(DispatchContext dctx, Map context) { - Delegator delegator = dctx.getDelegator(); - Map results = new HashMap<>(); - Locale locale = (Locale) context.get("locale"); - - String contentId = (String) context.get("contentId"); - String direction = (String) context.get("direction"); - if (direction != null && "From".equalsIgnoreCase(direction)) { - direction = "From"; - } else { - direction = "To"; - } - - if (contentId == null) { - contentId = "PUBLISH_ROOT"; - } - - GenericValue content = null; - try { - content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne(); - } catch (GenericEntityException e) { - Debug.logError(e, "Entity Error:" + e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", - UtilMisc.toMap("contentId", contentId), locale)); - } - - String fromDateStr = (String) context.get("fromDateStr"); - String thruDateStr = (String) context.get("thruDateStr"); - Timestamp fromDate = null; - if (UtilValidate.isNotEmpty(fromDateStr)) { - fromDate = UtilDateTime.toTimestamp(fromDateStr); - } - - Timestamp thruDate = null; - if (UtilValidate.isNotEmpty(thruDateStr)) { - thruDate = UtilDateTime.toTimestamp(thruDateStr); - } - - Map whenMap = new HashMap<>(); - whenMap.put("followWhen", context.get("followWhen")); - whenMap.put("pickWhen", context.get("pickWhen")); - whenMap.put("returnBeforePickWhen", context.get("returnBeforePickWhen")); - whenMap.put("returnAfterPickWhen", context.get("returnAfterPickWhen")); - - String startContentAssocTypeId = (String) context.get("contentAssocTypeId"); - if (startContentAssocTypeId != null) { - startContentAssocTypeId = "PUBLISH"; - } - - Map nodeMap = new HashMap<>(); - List pickList = new LinkedList<>(); - ContentWorker.traverse(delegator, content, fromDate, thruDate, whenMap, 0, nodeMap, startContentAssocTypeId, pickList, direction); - - results.put("nodeMap", nodeMap); - results.put("pickList", pickList); - return results; - } /** * Update a ContentAssoc service. The work is done in a separate method so that complex services that need this