Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions applications/content/minilang/content/ContentEvents.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ under the License.
<log level="info" message="currentContent: ${currentContent}"/>

<set field="context.contentPurposeTypeId" from-field="parameters.contentPurposeTypeId"/>
<string-to-list list="targetOperationList" string="CONTENT_CREATE"/>
<set field="context.targetOperationList" from-field="targetOperationList"/>
<session-to-field field="context.userLogin" session-name="userLogin"/>

<call-service in-map-name="context" service-name="createContent">
Expand Down
9 changes: 0 additions & 9 deletions applications/content/servicedef/services_content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@
<attribute name="contentAssocTypeId" type="String" mode="INOUT" optional="true"/>
<attribute name="contentIdFrom" type="String" mode="INOUT" optional="true"/>
<attribute name="contentIdTo" type="String" mode="INOUT" optional="true"/>
<!-- TODO: the following fields are deprecated; but will not be removed until all services and callers are updated -->
<attribute mode="IN" name="targetOperationList" optional="true" type="List"/>
<attribute mode="IN" name="targetOperationString" optional="true" type="String"/>
<attribute mode="IN" name="contentPurposeList" optional="true" type="List"/>
<attribute mode="IN" name="contentPurposeString" optional="true" type="String"/>
<attribute mode="IN" name="skipPermissionCheck" optional="true" type="String"/>
<attribute mode="IN" name="displayFailCond" optional="true" type="Boolean"/>
<attribute mode="INOUT" name="roleTypeList" optional="true" type="List"/>
<!-- end of deprecated fields -->
<override name="contentTypeId" default-value="DOCUMENT"/>
<override name="statusId" default-value="CTNT_IN_PROGRESS"/>
<override name="contentName" allow-html="safe"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,6 @@ public static String updatePublishLinks(HttpServletRequest request, HttpServletR
serviceIn.put("contentAssocTypeId", "PUBLISH_LINK");
serviceIn.put("fromDate", nowTimestamp);
serviceIn.put("contentIdTo", currentSubContentId);
serviceIn.put("roleTypeList", roleTypeList);
serviceIn.put("targetOperationList", targetOperationList);
// TODO check if this should be removed (see above)
serviceIn.put("contentPurposeList", contentPurposeList);
result = dispatcher.runSync("createContentAssoc", serviceIn);
if (ServiceUtil.isError(result)) {
String errorMessage = ServiceUtil.getErrorMessage(result);
Expand All @@ -270,10 +266,6 @@ public static String updatePublishLinks(HttpServletRequest request, HttpServletR
serviceIn.put("contentAssocTypeId", "PUBLISH_LINK");
serviceIn.put("fromDate", nowTimestamp);
serviceIn.put("contentIdTo", contentId);
serviceIn.put("roleTypeList", roleTypeList);
serviceIn.put("targetOperationList", targetOperationList);
// TODO check if this should be removed (see above)
serviceIn.put("contentPurposeList", contentPurposeList);
result = dispatcher.runSync("createContentAssoc", serviceIn);
if (ServiceUtil.isError(result)) {
String errorMessage = ServiceUtil.getErrorMessage(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,6 @@ public static Map<String, Object> persistContentAndAssoc(DispatchContext dctx, M
ModelService contentModel = dispatcher.getDispatchContext().getModelService("createContent");
contentContext.putAll(contentModel.makeValid(content, ModelService.IN_PARAM));
contentContext.put("userLogin", userLogin);
contentContext.put("displayFailCond", bDisplayFailCond);
contentContext.put("skipPermissionCheck", context.get("skipPermissionCheck"));
Debug.logInfo("In persistContentAndAssoc calling createContent with content: " + contentContext, MODULE);
Map<String, Object> thisResult = dispatcher.runSync("createContent", contentContext);
if (ServiceUtil.isError(thisResult) || ServiceUtil.isFailure(thisResult)) {
Expand Down Expand Up @@ -377,8 +375,6 @@ public static Map<String, Object> persistContentAndAssoc(DispatchContext dctx, M
}
Map<String, Object> contentAssocContext = new HashMap<>();
contentAssocContext.put("userLogin", userLogin);
contentAssocContext.put("displayFailCond", bDisplayFailCond);
contentAssocContext.put("skipPermissionCheck", context.get("skipPermissionCheck"));
Map<String, Object> thisResult = null;
try {
GenericValue contentAssocExisting = EntityQuery.use(delegator).from("ContentAssoc").where(contentAssoc.getPrimaryKey()).queryOne();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,43 @@ class ContentTests implements JupiterTestHelper {
assert serviceResult.view
}

@Test
@Order(9)
void testCreateContent() {
Map serviceCtx = [:]
serviceCtx.contentName = 'Test Content'
serviceCtx.contentTypeId = 'DOCUMENT'
serviceCtx.statusId = 'CTNT_IN_PROGRESS'
serviceCtx.userLogin = userLogin
Map serviceResult = dispatcher.runSync('createContent', serviceCtx)
assert ServiceUtil.isSuccess(serviceResult)
assert serviceResult.contentId

GenericValue content = from('Content')
.where('contentId', serviceResult.contentId)
.queryOne()
assert content
assert content.contentName == 'Test Content'
assert content.contentTypeId == 'DOCUMENT'
}

@Test
@Order(10)
void testPersistContentAndAssoc() {
Map serviceCtx = [:]
serviceCtx.contentName = 'Test Content Persist'
serviceCtx.contentTypeId = 'DOCUMENT'
serviceCtx.statusId = 'CTNT_IN_PROGRESS'
serviceCtx.userLogin = userLogin
Map serviceResult = dispatcher.runSync('persistContentAndAssoc', serviceCtx)
assert ServiceUtil.isSuccess(serviceResult)
assert serviceResult.contentId

GenericValue content = from('Content')
.where('contentId', serviceResult.contentId)
.queryOne()
assert content
assert content.contentName == 'Test Content Persist'
}

}
Loading