This is an automated email from the ASF dual-hosted git repository.
jacopoc pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release24.09 by this push:
new ef7c0eed2b Fixed: Remove unused content services traverseContent and
findContentParents
ef7c0eed2b is described below
commit ef7c0eed2b49d41b7318ac406f53b5a06e8bf23d
Author: Jacopo Cappellato <[email protected]>
AuthorDate: Fri May 15 07:36:42 2026 +0200
Fixed: Remove unused content services traverseContent and findContentParents
(cherry picked from commit 1853a306adb2d4ca25da54eec3fd3461a2c72bf2)
---
applications/content/servicedef/services.xml | 35 -------
.../ofbiz/content/content/ContentServices.java | 101 ---------------------
2 files changed, 136 deletions(-)
diff --git a/applications/content/servicedef/services.xml
b/applications/content/servicedef/services.xml
index 2b53416704..c89cf2be69 100644
--- a/applications/content/servicedef/services.xml
+++ b/applications/content/servicedef/services.xml
@@ -248,24 +248,6 @@
<attribute mode="OUT" name="entityList" optional="true" type="List"/>
</service>
- <service name="traverseContent" auth="false" engine="java"
invoke="traverseContent"
- location="org.apache.ofbiz.content.content.ContentServices">
- <description>Follow a content and return descendants</description>
- <attribute mode="IN" name="contentId" optional="false" type="String">
- <type-validate>
- <fail-property resource="ContentErrorUiLabels"
property="ContentRequiredFieldMissingContentId"/>
- </type-validate>
- </attribute>
- <attribute mode="IN" name="fromDateStr" optional="true" type="String"/>
- <attribute mode="IN" name="thruDateStr" optional="true" type="String"/>
- <attribute mode="IN" name="followWhen" optional="true" type="String"/>
- <attribute mode="IN" name="pickWhen" optional="true" type="String"/>
- <attribute mode="IN" name="returnBeforePickWhen" optional="true"
type="String"/>
- <attribute mode="IN" name="returnAfterPickWhen" optional="true"
type="String"/>
- <attribute mode="IN" name="direction" optional="true" type="String"/>
- <attribute mode="OUT" name="pickList" optional="true" type="List"/>
- <attribute mode="OUT" name="nodeMap" optional="true" type="Map"/>
- </service>
<service name="getContent" engine="java"
location="org.apache.ofbiz.content.ContentManagementServices"
invoke="getContent" auth="false">
<description>Get Content of passed contentId</description>
@@ -364,23 +346,6 @@
<override name="textData" allow-html="any"/>
</service>
- <service name="findContentParents" engine="java"
- transaction-timeout="7200"
- location="org.apache.ofbiz.content.content.ContentServices"
invoke="findContentParents" auth="true">
- <attribute mode="IN" name="contentId" optional="false" type="String">
- <type-validate>
- <fail-property resource="ContentErrorUiLabels"
property="ContentRequiredFieldMissingContentId"/>
- </type-validate>
- </attribute>
- <attribute mode="IN" name="contentAssocTypeId" optional="false"
type="String">
- <type-validate>
- <fail-property resource="ContentErrorUiLabels"
property="ContentRequiredFieldMissingContentAssocTypeId"/>
- </type-validate>
- </attribute>
- <attribute mode="IN" name="direction" optional="true" type="String"/>
- <attribute mode="OUT" name="parentList" optional="true" type="List"/>
- </service>
-
<service name="deactivateAssocs" engine="java"
location="org.apache.ofbiz.content.content.ContentServices"
invoke="deactivateAssocs" auth="true">
<description>Supply thruDate to all ContentAssoc that come "before"
current one</description>
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 bd7c094990..3f133ed049 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 class ContentServices {
results.put("contentList", permittedList);
return results;
}
- /**
- * 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<String, Object> findContentParents(DispatchContext dctx,
Map<String, ? extends Object> context) {
- Map<String, Object> results = new HashMap<>();
- List<Object> 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<String, Object> traversMap = new HashMap<>();
- traversMap.put("contentId", contentId);
- traversMap.put("direction", direction);
- traversMap.put("contentAssocTypeId", contentAssocTypeId);
- try {
- Map<String, Object> thisResults =
dispatcher.runSync("traverseContent", traversMap);
- if (ServiceUtil.isError(thisResults)) {
- return
ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResults));
- }
- Map<String, Object> nodeMap =
UtilGenerics.cast(thisResults.get("nodeMap"));
- walkParentTree(nodeMap, parentList);
- } catch (GenericServiceException e) {
- return ServiceUtil.returnFailure(e.getMessage());
- }
- return results;
- }
-
- private static void walkParentTree(Map<String, Object> nodeMap,
List<Object> parentList) {
- List<Map<String, Object>> kids =
UtilGenerics.cast(nodeMap.get("kids"));
- if (UtilValidate.isEmpty(kids)) {
- parentList.add(nodeMap.get("contentId"));
- } else {
- for (Map<String, Object> 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<String, Object> traverseContent(DispatchContext dctx,
Map<String, ? extends Object> context) {
- Delegator delegator = dctx.getDelegator();
- Map<String, Object> 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<String, Object> 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<String, Object> nodeMap = new HashMap<>();
- List<GenericValue> 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