Skip to content

Commit ef7c0ee

Browse files
committed
Fixed: Remove unused content services traverseContent and findContentParents
(cherry picked from commit 1853a30)
1 parent e3a8b06 commit ef7c0ee

2 files changed

Lines changed: 0 additions & 136 deletions

File tree

applications/content/servicedef/services.xml

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -248,24 +248,6 @@
248248
<attribute mode="OUT" name="entityList" optional="true" type="List"/>
249249
</service>
250250

251-
<service name="traverseContent" auth="false" engine="java" invoke="traverseContent"
252-
location="org.apache.ofbiz.content.content.ContentServices">
253-
<description>Follow a content and return descendants</description>
254-
<attribute mode="IN" name="contentId" optional="false" type="String">
255-
<type-validate>
256-
<fail-property resource="ContentErrorUiLabels" property="ContentRequiredFieldMissingContentId"/>
257-
</type-validate>
258-
</attribute>
259-
<attribute mode="IN" name="fromDateStr" optional="true" type="String"/>
260-
<attribute mode="IN" name="thruDateStr" optional="true" type="String"/>
261-
<attribute mode="IN" name="followWhen" optional="true" type="String"/>
262-
<attribute mode="IN" name="pickWhen" optional="true" type="String"/>
263-
<attribute mode="IN" name="returnBeforePickWhen" optional="true" type="String"/>
264-
<attribute mode="IN" name="returnAfterPickWhen" optional="true" type="String"/>
265-
<attribute mode="IN" name="direction" optional="true" type="String"/>
266-
<attribute mode="OUT" name="pickList" optional="true" type="List"/>
267-
<attribute mode="OUT" name="nodeMap" optional="true" type="Map"/>
268-
</service>
269251
<service name="getContent" engine="java"
270252
location="org.apache.ofbiz.content.ContentManagementServices" invoke="getContent" auth="false">
271253
<description>Get Content of passed contentId</description>
@@ -364,23 +346,6 @@
364346
<override name="textData" allow-html="any"/>
365347
</service>
366348

367-
<service name="findContentParents" engine="java"
368-
transaction-timeout="7200"
369-
location="org.apache.ofbiz.content.content.ContentServices" invoke="findContentParents" auth="true">
370-
<attribute mode="IN" name="contentId" optional="false" type="String">
371-
<type-validate>
372-
<fail-property resource="ContentErrorUiLabels" property="ContentRequiredFieldMissingContentId"/>
373-
</type-validate>
374-
</attribute>
375-
<attribute mode="IN" name="contentAssocTypeId" optional="false" type="String">
376-
<type-validate>
377-
<fail-property resource="ContentErrorUiLabels" property="ContentRequiredFieldMissingContentAssocTypeId"/>
378-
</type-validate>
379-
</attribute>
380-
<attribute mode="IN" name="direction" optional="true" type="String"/>
381-
<attribute mode="OUT" name="parentList" optional="true" type="List"/>
382-
</service>
383-
384349
<service name="deactivateAssocs" engine="java"
385350
location="org.apache.ofbiz.content.content.ContentServices" invoke="deactivateAssocs" auth="true">
386351
<description>Supply thruDate to all ContentAssoc that come "before" current one</description>

applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -123,107 +123,6 @@ public static Map<String, Object> findRelatedContent(DispatchContext dctx, Map<S
123123
results.put("contentList", permittedList);
124124
return results;
125125
}
126-
/**
127-
* This is a generic service for traversing a Content tree, typical of a blog response tree. It calls the ContentWorker.traverse method.
128-
*/
129-
public static Map<String, Object> findContentParents(DispatchContext dctx, Map<String, ? extends Object> context) {
130-
Map<String, Object> results = new HashMap<>();
131-
List<Object> parentList = new LinkedList<>();
132-
results.put("parentList", parentList);
133-
LocalDispatcher dispatcher = dctx.getDispatcher();
134-
String contentId = (String) context.get("contentId");
135-
String contentAssocTypeId = (String) context.get("contentAssocTypeId");
136-
String direction = (String) context.get("direction");
137-
if (UtilValidate.isEmpty(direction)) {
138-
direction = "To";
139-
}
140-
Map<String, Object> traversMap = new HashMap<>();
141-
traversMap.put("contentId", contentId);
142-
traversMap.put("direction", direction);
143-
traversMap.put("contentAssocTypeId", contentAssocTypeId);
144-
try {
145-
Map<String, Object> thisResults = dispatcher.runSync("traverseContent", traversMap);
146-
if (ServiceUtil.isError(thisResults)) {
147-
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResults));
148-
}
149-
Map<String, Object> nodeMap = UtilGenerics.cast(thisResults.get("nodeMap"));
150-
walkParentTree(nodeMap, parentList);
151-
} catch (GenericServiceException e) {
152-
return ServiceUtil.returnFailure(e.getMessage());
153-
}
154-
return results;
155-
}
156-
157-
private static void walkParentTree(Map<String, Object> nodeMap, List<Object> parentList) {
158-
List<Map<String, Object>> kids = UtilGenerics.cast(nodeMap.get("kids"));
159-
if (UtilValidate.isEmpty(kids)) {
160-
parentList.add(nodeMap.get("contentId"));
161-
} else {
162-
for (Map<String, Object> node : kids) {
163-
walkParentTree(node, parentList);
164-
}
165-
}
166-
}
167-
/**
168-
* This is a generic service for traversing a Content tree, typical of a blog response tree. It calls the ContentWorker.traverse method.
169-
*/
170-
public static Map<String, Object> traverseContent(DispatchContext dctx, Map<String, ? extends Object> context) {
171-
Delegator delegator = dctx.getDelegator();
172-
Map<String, Object> results = new HashMap<>();
173-
Locale locale = (Locale) context.get("locale");
174-
175-
String contentId = (String) context.get("contentId");
176-
String direction = (String) context.get("direction");
177-
if (direction != null && "From".equalsIgnoreCase(direction)) {
178-
direction = "From";
179-
} else {
180-
direction = "To";
181-
}
182-
183-
if (contentId == null) {
184-
contentId = "PUBLISH_ROOT";
185-
}
186-
187-
GenericValue content = null;
188-
try {
189-
content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne();
190-
} catch (GenericEntityException e) {
191-
Debug.logError(e, "Entity Error:" + e.getMessage(), MODULE);
192-
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound",
193-
UtilMisc.toMap("contentId", contentId), locale));
194-
}
195-
196-
String fromDateStr = (String) context.get("fromDateStr");
197-
String thruDateStr = (String) context.get("thruDateStr");
198-
Timestamp fromDate = null;
199-
if (UtilValidate.isNotEmpty(fromDateStr)) {
200-
fromDate = UtilDateTime.toTimestamp(fromDateStr);
201-
}
202-
203-
Timestamp thruDate = null;
204-
if (UtilValidate.isNotEmpty(thruDateStr)) {
205-
thruDate = UtilDateTime.toTimestamp(thruDateStr);
206-
}
207-
208-
Map<String, Object> whenMap = new HashMap<>();
209-
whenMap.put("followWhen", context.get("followWhen"));
210-
whenMap.put("pickWhen", context.get("pickWhen"));
211-
whenMap.put("returnBeforePickWhen", context.get("returnBeforePickWhen"));
212-
whenMap.put("returnAfterPickWhen", context.get("returnAfterPickWhen"));
213-
214-
String startContentAssocTypeId = (String) context.get("contentAssocTypeId");
215-
if (startContentAssocTypeId != null) {
216-
startContentAssocTypeId = "PUBLISH";
217-
}
218-
219-
Map<String, Object> nodeMap = new HashMap<>();
220-
List<GenericValue> pickList = new LinkedList<>();
221-
ContentWorker.traverse(delegator, content, fromDate, thruDate, whenMap, 0, nodeMap, startContentAssocTypeId, pickList, direction);
222-
223-
results.put("nodeMap", nodeMap);
224-
results.put("pickList", pickList);
225-
return results;
226-
}
227126

228127
/**
229128
* Update a ContentAssoc service. The work is done in a separate method so that complex services that need this

0 commit comments

Comments
 (0)