blob: d4f3f6d4dc100e9de0c3b6c283aed6c7f3ffdd2b [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
<!-- base content CRUD services -->
<simple-method method-name="createContent" short-description="Create a Content Record">
<make-value value-name="content" entity-name="Content"/>
<set-nonpk-fields value-name="content" map-name="parameters"/>
<set-pk-fields value-name="content" map-name="parameters"/>
<if-empty field="content.contentId">
<sequenced-id-to-env sequence-name="Content" env-name="contentId"/>
<set field="content.contentId" from-field="contentId"/>
</if-empty>
<if-empty field="content.statusId">
<!-- get the first status item -->
<entity-and entity-name="StatusItem" list-name="contentStatus">
<field-map field-name="statusTypeId" value="CONTENT_STATUS"/>
<order-by field-name="sequenceId"/>
</entity-and>
<first-from-list entry-name="statusItem" list-name="contentStatus"/>
<set field="content.statusId" from-field="statusItem.statusId"/>
</if-empty>
<now-timestamp-to-env env-name="nowTimestamp"/>
<set field="content.lastModifiedByUserLogin" from-field="userLogin.userLoginId"/>
<set field="content.createdByUserLogin" from-field="userLogin.userLoginId"/>
<set field="content.lastModifiedDate" from-field="nowTimestamp"/>
<set field="content.createdDate" from-field="nowTimestamp"/>
<create-value value-name="content"/>
<field-to-result field-name="content.contentId" result-name="contentId"/>
</simple-method>
<simple-method method-name="updateContent" short-description="Update a Content Record">
<entity-one entity-name="Content" value-name="content" auto-field-map="true"/>
<set-nonpk-fields value-name="content" map-name="parameters"/>
<now-timestamp-to-env env-name="nowTimestamp"/>
<set field="content.lastModifiedByUserLogin" from-field="userLogin.userLoginId"/>
<set field="content.lastModifiedDate" from-field="nowTimestamp"/>
<store-value value-name="content"/>
<field-to-result field-name="content.contentId" result-name="contentId"/>
</simple-method>
<simple-method method-name="removeContent" short-description="Remove a Content Record">
<make-value entity-name="Content" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="Content" map-name="lookupKeyValue" value-name="content"/>
<remove-value value-name="content"/>
</simple-method>
<!-- content assoc services -->
<simple-method method-name="createContentAssoc" short-description="Create a ContntAssoc Record">
<make-value value-name="assoc" entity-name="ContentAssoc"/>
<set-nonpk-fields value-name="assoc" map-name="parameters"/>
<set-pk-fields value-name="assoc" map-name="parameters"/>
<set field="assoc.contentId" from-field="parameters.contentIdFrom" default-value="${parameters.contentId}" />
<now-timestamp-to-env env-name="nowTimestamp"/>
<if-empty field="assoc.fromDate">
<set field="assoc.fromDate" from-field="nowTimestamp"/>
</if-empty>
<set field="assoc.lastModifiedByUserLogin" from-field="userLogin.userLoginId"/>
<set field="assoc.createdByUserLogin" from-field="userLogin.userLoginId"/>
<set field="assoc.lastModifiedDate" from-field="nowTimestamp"/>
<set field="assoc.createdDate" from-field="nowTimestamp"/>
<create-value value-name="assoc"/>
<log level="info" message="assoc: ${assoc}"/>
<field-to-result field-name="assoc.fromDate" result-name="fromDate"/>
</simple-method>
<simple-method method-name="updateContentAssoc" short-description="Update a ContentAssoc Record">
<set field="contentId" from-field="parameters.contentIdFrom" default-value="${parameters.contentId}" />
<entity-one entity-name="ContentAssoc" value-name="assoc" auto-field-map="true"/>
<set-nonpk-fields value-name="assoc" map-name="parameters"/>
<now-timestamp-to-env env-name="nowTimestamp"/>
<set field="content.lastModifiedByUserLogin" from-field="userLogin.userLoginId"/>
<set field="content.lastModifiedDate" from-field="nowTimestamp"/>
<store-value value-name="assoc"/>
</simple-method>
<simple-method method-name="removeContentAssoc" short-description="Remove a Content Assoc Record">
<make-value entity-name="ContentAssoc" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentAssoc" map-name="lookupKeyValue" value-name="assoc"/>
<remove-value value-name="assoc"/>
</simple-method>
<!-- update content; just status -->
<simple-method method-name="setContentStatus" short-description="Set The Content Status">
<entity-one entity-name="Content" value-name="content"/>
<field-to-result field-name="content.statusId" result-name="oldStatusId"/>
<if-compare-field field="content.statusId" to-field="parameters.statusId" operator="not-equals">
<entity-one entity-name="StatusValidChange" value-name="statusChange" auto-field-map="false">
<field-map field-name="statusId" env-name="content.statusId"/>
<field-map field-name="statusIdTo" env-name="parameters.statusId"/>
</entity-one>
<if-empty field="statusChange">
<add-error><fail-message message="Cannot change from ${content.statusId} to ${parameters.statusId}"/></add-error>
<log level="error" message="Cannot change from ${content.statusId} to ${parameters.statusId}"/>
<check-errors/>
<else>
<set from-field="parameters.statusId" field="content.statusId"/>
<store-value value-name="content"/>
</else>
</if-empty>
</if-compare-field>
</simple-method>
<simple-method method-name="copyContentAndElectronicTextandAssoc" short-description="copy a content, electronic text and assocs and set status in progress">
<set-service-fields service-name="getContent" map-name="parameters" to-map-name="getC"/>
<call-service service-name="getContent" in-map-name="getC">
<result-to-field result-name="view" field-name="content"/>
</call-service>
<if-not-empty field="content.dataResourceId">
<set-service-fields service-name="getElectronicText" map-name="content" to-map-name="getEt"/>
<call-service service-name="getElectronicText" in-map-name="getEt">
<result-to-field result-name="textData" field-name="et.textData"/>
</call-service>
<set field="dataResource.dataResourceTypeId" value="ELECTRONIC_TEXT"/>
<call-service service-name="createDataResource" in-map-name="dataResource">
<result-to-field result-name="dataResourceId" field-name="et.dataResourceId"/>
</call-service>
<call-service service-name="createElectronicText" in-map-name="et"/>
<set field="content.dataResourceId" from-field="et.dataResourceId"/>
</if-not-empty>
<clear-field field-name="content.contentId"/><!-- force new value -->
<clear-field field-name="content.statusId"/><!-- force new value -->
<set-service-fields service-name="createContent" map-name="content" to-map-name="createContent"/>
<call-service service-name="createContent" in-map-name="createContent">
<result-to-field result-name="contentId" field-name="newContentId"/>
</call-service>
<entity-and entity-name="ContentAssoc" list-name="assocs">
<field-map field-name="contentId" env-name="parameters.contentId"/>
</entity-and>
<iterate entry-name="assoc" list-name="assocs">
<set field="assoc.contentId" from-field="newContentId"/>
<set-service-fields service-name="createContentAssoc" map-name="assoc" to-map-name="assocS"/>
<call-service service-name="createContentAssoc" in-map-name="assocS"/>
</iterate>
<entity-and entity-name="ContentAssoc" list-name="assocsTo">
<field-map field-name="contentIdTo" env-name="parameters.contentId"/>
</entity-and>
<iterate entry-name="assocTo" list-name="assocsTo">
<set field="assocTo.contentIdTo" from-field="newContentId"/>
<set-service-fields service-name="createContentAssoc" map-name="assocTo" to-map-name="assocTos"/>
<call-service service-name="createContentAssoc" in-map-name="assocTos"/>
</iterate>
<field-to-result field-name="newContentId" result-name="contentId"/>
</simple-method>
<!-- Methods for ContentAssoc -->
<simple-method login-required="true" method-name="assocContent" short-description="Associate Content" >
<log level="always" message="assocContent, parameters:${parameters}"/>
<log level="always" message="assocContent, context:${context}"/>
<call-service in-map-name="parameters" service-name="checkAssocPermission">
<result-to-field field-name="permissionStatus" result-name="permissionStatus"/>
<result-to-field field-name="rolesOut" result-name="rolesOut"/>
</call-service>
<log level="always" message="permissionStatus:${permissionStatus}"/>
<set from-field="parameters.contentIdTo" field="pk.contentId"/>
<set from-field="currentContent" field="context.currentContent"/>
<set from-field="parameters.contentIdFrom" field="pk.contentId"/>
<set from-field="parameters.userLogin" field="context.userLogin"/>
<find-by-primary-key value-name="currentContent" entity-name="Content" map-name="pk" />
<find-by-primary-key value-name="fromContent" entity-name="Content" map-name="pk" />
<if-compare field="permissionStatus" operator="equals" type="String" value="granted">
<make-value entity-name="ContentAssoc" value-name="newContentAssoc"/>
<set from-field="parameters.contentIdTo" field="newContentAssoc.contentIdTo"/>
<set from-field="parameters.contentIdFrom" field="newContentAssoc.contentId"/>
<set from-field="parameters.contentAssocTypeId" field="newContentAssoc.contentAssocTypeId"/>
<set from-field="newUserLogin.userLoginId" field="newContentAssoc.createdByUserLogin"/>
<set from-field="newUserLogin.userLoginId" field="newContentAssoc.lastModifiedByUserLogin"/>
<now-timestamp-to-env env-name="newContentAssoc.createdDate"/>
<now-timestamp-to-env env-name="newContentAssoc.lastModifiedDate"/>
<if-empty field="parameters.fromDate">
<now-timestamp-to-env env-name="parameters.fromDate"/>
<to-string map-name="parameters" field-name="fromDate" />
</if-empty>
<set from-field="parameters.fromDate" field="newContentAssoc.fromDate"/>
<if-not-empty field="parameters.thruDate">
<set from-field="parameters.thruDate" field="newContentAssoc.thruDate"/>
</if-not-empty>
<create-value value-name="newContentAssoc" />
</if-compare>
<check-errors/>
</simple-method>
<!-- Methods for ContentMetaData -->
<simple-method method-name="createContentMetaData" short-description="Create Content Meta Data">
<make-value entity-name="ContentMetaData" value-name="newEntity"/>
<set-nonpk-fields map-name="parameters" value-name="newEntity"/>
<set-pk-fields map-name="parameters" value-name="newEntity"/>
<create-value value-name="newEntity"/>
</simple-method>
<simple-method method-name="updateContentMetaData" short-description="Update Content Meta Data">
<make-value entity-name="ContentMetaData" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentMetaData" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
<store-value value-name="lookedUpValue"/>
</simple-method>
<simple-method method-name="removeContentMetaData" short-description="Remove Content Meta Data">
<make-value entity-name="ContentMetaData" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentMetaData" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<remove-value value-name="lookedUpValue"/>
</simple-method>
<!-- Methods for ContentRole -->
<simple-method method-name="createContentRole" short-description="Create Content Role">
<if-empty field="parameters.fromDate">
<now-timestamp-to-env env-name="parameters.fromDate"/>
</if-empty>
<make-value value-name="partyRolePK" entity-name="PartyRole"/>
<set-pk-fields value-name="partyRolePK" map-name="parameters"/>
<find-by-primary-key entity-name="PartyRole" map-name="partyRolePK" value-name="partyRole"/>
<if-empty field="partyRole">
<make-value entity-name="PartyRole" map-name="partyRolePK" value-name="partyRole"/>
<create-value value-name="partyRole"/>
</if-empty>
<check-errors/>
<make-value entity-name="ContentRole" value-name="newEntity"/>
<set-pk-fields map-name="parameters" value-name="newEntity"/>
<find-by-primary-key entity-name="ContentRole" map-name="newEntity" value-name="contentRole"/>
<if-empty field="contentRole">
<set-nonpk-fields map-name="parameters" value-name="newEntity"/>
<create-value value-name="newEntity"/>
</if-empty>
<check-errors/>
</simple-method>
<simple-method method-name="updateContentRole" short-description="Update Content Role">
<make-value entity-name="ContentRole" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentRole" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
<store-value value-name="lookedUpValue"/>
</simple-method>
<simple-method method-name="deactivateAllContentRoles" short-description="Update Content Role">
<make-value entity-name="ContentRole" value-name="lookupKeyValue"/>
<set from-field="parameters.contentId" field="lookupKeyValue.contentId"/>
<set from-field="parameters.partyId" field="lookupKeyValue.partyId"/>
<set from-field="parameters.roleTypeId" field="lookupKeyValue.roleTypeId"/>
<find-by-and entity-name="ContentRole" map-name="lookupKeyValue" list-name="roleList"/>
<iterate entry-name="contentRoleMap" list-name="roleList">
<make-value entity-name="ContentRole" value-name="role" map-name="contentRoleMap"/>
<now-timestamp-to-env env-name="role.thruDate"/>
<store-value value-name="role"/>
</iterate>
</simple-method>
<simple-method method-name="removeContentRole" short-description="Remove Content Role">
<make-value entity-name="ContentRole" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentRole" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<remove-value value-name="lookedUpValue"/>
</simple-method>
<!-- Methods for ContentType -->
<simple-method method-name="createContentType" short-description="Create Content Type">
<make-value entity-name="ContentType" value-name="newEntity"/>
<set-nonpk-fields map-name="parameters" value-name="newEntity"/>
<set-pk-fields map-name="parameters" value-name="newEntity"/>
<create-value value-name="newEntity"/>
<field-to-result map-name="newEntity" field-name="contentTypeId" />
</simple-method>
<simple-method method-name="updateContentType" short-description="Update Content Type">
<make-value entity-name="ContentType" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentType" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
<store-value value-name="lookedUpValue"/>
</simple-method>
<simple-method method-name="removeContentType" short-description="Remove Content Type">
<make-value entity-name="ContentType" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentType" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<remove-value value-name="lookedUpValue"/>
</simple-method>
<!-- Methods for ContentTypeAttr -->
<simple-method method-name="createContentTypeAttr" short-description="Create Content TypeAttr">
<make-value entity-name="ContentTypeAttr" value-name="newEntity"/>
<set-nonpk-fields map-name="parameters" value-name="newEntity"/>
<set-pk-fields map-name="parameters" value-name="newEntity"/>
<create-value value-name="newEntity"/>
</simple-method>
<simple-method method-name="removeContentTypeAttr" short-description="Remove Content TypeAttr">
<make-value entity-name="ContentTypeAttr" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentTypeAttr" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<remove-value value-name="lookedUpValue"/>
</simple-method>
<!-- Methods for ContentAssocType -->
<simple-method method-name="createContentAssocType" short-description="Create Content AssocType">
<make-value entity-name="ContentAssocType" value-name="newEntity"/>
<set-nonpk-fields map-name="parameters" value-name="newEntity"/>
<set-pk-fields map-name="parameters" value-name="newEntity"/>
<create-value value-name="newEntity"/>
<field-to-result map-name="newEntity" field-name="contentAssocTypeId" />
</simple-method>
<simple-method method-name="updateContentAssocType" short-description="Update Content AssocType">
<make-value entity-name="ContentAssocType" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentAssocType" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
<store-value value-name="lookedUpValue"/>
</simple-method>
<simple-method method-name="removeContentAssocType" short-description="Remove Content AssocType">
<make-value entity-name="ContentAssocType" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentAssocType" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<remove-value value-name="lookedUpValue"/>
</simple-method>
<!-- Methods for ContentPurposeType -->
<simple-method method-name="createContentPurposeType" short-description="Create Content PurposeType">
<make-value entity-name="ContentPurposeType" value-name="newEntity"/>
<set-nonpk-fields map-name="parameters" value-name="newEntity"/>
<set-pk-fields map-name="parameters" value-name="newEntity"/>
<if-empty field="newEntity.contentPurposeTypeId">
<make-next-seq-id seq-field-name="contentPurposeTypeId" value-name="newEntity"/>
</if-empty>
<create-value value-name="newEntity"/>
<field-to-result map-name="newEntity" field-name="contentPurposeTypeId" />
</simple-method>
<simple-method method-name="updateContentPurposeType" short-description="Update Content PurposeType">
<make-value entity-name="ContentPurposeType" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentPurposeType" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
<store-value value-name="lookedUpValue"/>
</simple-method>
<simple-method method-name="removeContentPurposeType" short-description="Remove Content PurposeType">
<make-value entity-name="ContentPurposeType" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentPurposeType" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<remove-value value-name="lookedUpValue"/>
</simple-method>
<!-- Methods for ContentAssocPredicate -->
<simple-method method-name="createContentAssocPredicate" short-description="Create Content AssocPredicate">
<make-value entity-name="ContentAssocPredicate" value-name="newEntity"/>
<set-nonpk-fields map-name="parameters" value-name="newEntity"/>
<set-pk-fields map-name="parameters" value-name="newEntity"/>
<create-value value-name="newEntity"/>
<field-to-result map-name="newEntity" field-name="contentAssocPredicateId" />
</simple-method>
<simple-method method-name="updateContentAssocPredicate" short-description="Update Content AssocPredicate">
<make-value entity-name="ContentAssocPredicate" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentAssocPredicate" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
<store-value value-name="lookedUpValue"/>
</simple-method>
<simple-method method-name="removeContentAssocPredicate" short-description="Remove Content AssocPredicate">
<make-value entity-name="ContentAssocPredicate" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentAssocPredicate" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<remove-value value-name="lookedUpValue"/>
</simple-method>
<!-- Methods for ContentPurposeOperation -->
<simple-method method-name="createContentPurposeOperation" short-description="Create Content PurposeOperation">
<make-value entity-name="ContentPurposeOperation" value-name="newEntity"/>
<set-nonpk-fields map-name="parameters" value-name="newEntity"/>
<set-pk-fields map-name="parameters" value-name="newEntity"/>
<create-value value-name="newEntity"/>
</simple-method>
<simple-method method-name="updateContentPurposeOperation" short-description="Update Content PurposeOperation">
<make-value entity-name="ContentPurposeOperation" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentPurposeOperation" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
<store-value value-name="lookedUpValue"/>
</simple-method>
<simple-method method-name="removeContentPurposeOperation" short-description="Remove Content PurposeOperation">
<make-value entity-name="ContentPurposeOperation" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentPurposeOperation" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<remove-value value-name="lookedUpValue"/>
</simple-method>
<!-- Methods for ContentPurpose -->
<simple-method method-name="createContentPurpose" short-description="Create Content Purpose">
<make-value entity-name="ContentPurpose" value-name="newEntity"/>
<set-nonpk-fields map-name="parameters" value-name="newEntity"/>
<set-pk-fields map-name="parameters" value-name="newEntity"/>
<create-value value-name="newEntity"/>
</simple-method>
<simple-method method-name="updateContentPurpose" short-description="Update Content Purpose">
<make-value entity-name="ContentPurpose" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentPurpose" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
<store-value value-name="lookedUpValue"/>
</simple-method>
<simple-method method-name="removeContentPurpose" short-description="Remove Content Purpose">
<make-value entity-name="ContentPurpose" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentPurpose" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<remove-value value-name="lookedUpValue"/>
</simple-method>
<simple-method method-name="updateSingleContentPurpose" short-description="Updates the purpose making sure there is only one">
<set field="toRemove.contentId" from-field="parameters.contentId"/>
<remove-by-and entity-name="ContentPurpose" map-name="toRemove"/>
<call-simple-method method-name="createContentPurpose"/>
</simple-method>
<!-- Methods for ContentOperation -->
<simple-method method-name="createContentOperation" short-description="Create Content Operation">
<make-value entity-name="ContentOperation" value-name="newEntity"/>
<set-nonpk-fields map-name="parameters" value-name="newEntity"/>
<set-pk-fields map-name="parameters" value-name="newEntity"/>
<create-value value-name="newEntity"/>
</simple-method>
<simple-method method-name="updateContentOperation" short-description="Update Content Operation">
<make-value entity-name="ContentOperation" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentOperation" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
<store-value value-name="lookedUpValue"/>
</simple-method>
<simple-method method-name="removeContentOperation" short-description="Remove Content Operation">
<make-value entity-name="ContentOperation" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentOperation" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<remove-value value-name="lookedUpValue"/>
</simple-method>
<!-- Methods for ContentPurposeOperation -->
<simple-method method-name="createContentPurposeOperation" short-description="Create Content PurposeOperation">
<make-value entity-name="ContentPurposeOperation" value-name="newEntity"/>
<set-nonpk-fields map-name="parameters" value-name="newEntity"/>
<set-pk-fields map-name="parameters" value-name="newEntity"/>
<create-value value-name="newEntity"/>
</simple-method>
<simple-method method-name="updateContentPurposeOperation" short-description="Update Content PurposeOperation">
<make-value entity-name="ContentPurposeOperation" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentPurposeOperation" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
<store-value value-name="lookedUpValue"/>
</simple-method>
<simple-method method-name="removeContentPurposeOperation" short-description="Remove Content PurposeOperation">
<make-value entity-name="ContentPurposeOperation" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentPurposeOperation" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<remove-value value-name="lookedUpValue"/>
</simple-method>
<!-- Methods for ContentAttribute -->
<simple-method method-name="createContentAttribute" short-description="Create Content Attribute">
<make-value entity-name="ContentAttribute" value-name="newEntity"/>
<set-nonpk-fields map-name="parameters" value-name="newEntity"/>
<set-pk-fields map-name="parameters" value-name="newEntity"/>
<create-value value-name="newEntity"/>
</simple-method>
<simple-method method-name="updateContentAttribute" short-description="Update Content Attribute">
<make-value entity-name="ContentAttribute" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentAttribute" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
<store-value value-name="lookedUpValue"/>
</simple-method>
<simple-method method-name="removeContentAttribute" short-description="Remove Content Attribute">
<make-value entity-name="ContentAttribute" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentAttribute" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<remove-value value-name="lookedUpValue"/>
</simple-method>
<!-- Methods for ContentMetaData -->
<simple-method method-name="createContentMetaData" short-description="Create Content MetaData">
<make-value entity-name="ContentMetaData" value-name="newEntity"/>
<set-nonpk-fields map-name="parameters" value-name="newEntity"/>
<set-pk-fields map-name="parameters" value-name="newEntity"/>
<create-value value-name="newEntity"/>
</simple-method>
<simple-method method-name="updateContentMetaData" short-description="Update Content MetaData">
<make-value entity-name="ContentMetaData" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentMetaData" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
<store-value value-name="lookedUpValue"/>
</simple-method>
<simple-method method-name="removeContentMetaData" short-description="Remove Content MetaData">
<check-errors/>
<make-value entity-name="ContentMetaData" value-name="lookupKeyValue"/>
<set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
<find-by-primary-key entity-name="ContentMetaData" map-name="lookupKeyValue" value-name="lookedUpValue"/>
<remove-value value-name="lookedUpValue"/>
</simple-method>
<!-- combined text + uploaded file service -->
<simple-method method-name="createTextAndUploadedContent" short-description="Creates Text and Optionally Uploaded (sub) Content records">
<set-service-fields service-name="createTextContent" map-name="parameters" to-map-name="textContext"/>
<call-service service-name="createTextContent" in-map-name="textContext">
<result-to-field result-name="contentId" field-name="parentContentId" map-name="parameters"/>
</call-service>
<log level="always" message="${parameters}"/>
<if-not-empty field="parameters.uploadedFile">
<log level="always" message="Uploaded file found; processing sub-content"/>
<set-service-fields service-name="createContentFromUploadedFile" map-name="parameters" to-map-name="uploadContext"/>
<set field="uploadContext.ownerContentId" from-field="parameters.parentContentId"/>
<set field="uploadContext.contentIdFrom" from-field="parameters.parentContentId"/>
<set field="uploadContext.contentAssocTypeId" value="SUB_CONTENT"/>
<set field="uploadContext.contentPurposeTypeId" value="SECTION"/>
<call-service service-name="createContentFromUploadedFile" in-map-name="uploadContext"/>
</if-not-empty>
<field-to-result field-name="parentContentId" map-name="parameters" result-name="contentId"/>
</simple-method>
<!-- Util -->
<simple-method method-name="findAssocContent" short-description="Find associated content">
<set from-field="parameters.contentId" field="queryMap.contentId"/>
<set field="mapKeys" from-field="parameters.mapKeys" />
<field-to-list field-name="mapKey" list-name="mapKeys"/>
<iterate entry-name="mapKey" list-name="mapKeys">
<set from-field="mapKey" field="queryMap.mapKey"/>
<find-by-and list-name="resultMap" entity-name="ContentAssoc" map-name="queryMap"/>
<filter-list-by-date list-name="resultMap" to-list-name="validContent"/>
<iterate entry-name="contentAssoc" list-name="validContent">
<field-to-list field-name="contentAssoc" list-name="result"/>
</iterate>
</iterate>
<if>
<condition>
<if-empty field="parameters.mapKey"/>
</condition>
<then>
<field-to-result field-name="result" result-name="contentAssocs"/>
</then>
<else>
<field-to-result field-name="result" result-name="contentAssoc"/>
</else>
</if>
</simple-method>
<!-- Generic content services -->
<simple-method method-name="createEmailContent" short-description="Create Email as Content">
<check-permission permission="CONTENTMGR" action="_CREATE">
<fail-message message="Security Error: to run createContentEmail you must have the CONTENTMGR_CREATE or CONTENTMGR_ADMIN permission"/>
</check-permission>
<check-errors/>
<!-- Create subject -->
<set-service-fields service-name="createContent" map-name="parameters" to-map-name="createSubjectContent"/>
<set from-field="parameters.subject" field="createSubjectEtext.textData"/>
<call-service service-name="createElectronicText" in-map-name="createSubjectEtext">
<result-to-field result-name="dataResourceId" map-name="createSubjectContent"/>
</call-service>
<call-service service-name="createContent" in-map-name="createSubjectContent">
<result-to-field result-name="contentId" map-name="createBodyAssoc"/>
</call-service>
<!-- Create plain body -->
<set from-field="parameters.plainBody" field="createPlainBodyEtext.textData"/>
<call-service service-name="createElectronicText" in-map-name="createPlainBodyEtext">
<result-to-field result-name="dataResourceId" map-name="createPlainBodyContent"/>
</call-service>
<call-service service-name="createContent" in-map-name="createPlainBodyContent">
<result-to-field result-name="contentId" map-name="createBodyAssoc" field-name="contentIdTo"/>
</call-service>
<!-- Create content assoc between subject and plain body -->
<set value="TREE_CHILD" field="createBodyAssoc.contentAssocTypeId"/>
<set value="plainBody" field="createBodyAssoc.mapKey"/>
<call-service service-name="createContentAssoc" in-map-name="createBodyAssoc"/>
<!-- Create HTML body -->
<set from-field="parameters.htmlBody" field="createHtmlBodyEtext.textData"/>
<call-service service-name="createElectronicText" in-map-name="createHtmlBodyEtext">
<result-to-field result-name="dataResourceId" map-name="createHtmlBodyContent"/>
</call-service>
<call-service service-name="createContent" in-map-name="createHtmlBodyContent">
<result-to-field result-name="contentId" map-name="createBodyAssoc" field-name="contentIdTo"/>
</call-service>
<!-- Create content assoc between subject and html body -->
<set value="htmlBody" field="createBodyAssoc.mapKey"/>
<call-service service-name="createContentAssoc" in-map-name="createBodyAssoc"/>
<field-to-result field-name="contentId" map-name="createBodyAssoc" result-name="contentId"/>
</simple-method>
<simple-method method-name="updateEmailContent" short-description="Update Email Content">
<check-permission permission="CONTENTMGR" action="_UPDATE">
<fail-message message="Security Error: to run updateContentEmail you must have the CONTENTMGR_UPDATE or CONTENTMGR_ADMIN permission"/>
</check-permission>
<check-errors/>
<if-not-empty field="parameters.subjectDataResourceId">
<set from-field="parameters.subjectDataResourceId" field="updateSubjectEt.dataResourceId"/>
<set from-field="parameters.subject" field="updateSubjectEt.textData"/>
<call-service service-name="updateElectronicText" in-map-name="updateSubjectEt"/>
</if-not-empty>
<if-not-empty field="parameters.plainBodyDataResourceId">
<set from-field="parameters.plainBodyDataResourceId" field="updatePlainBodyEt.dataResourceId"/>
<set from-field="parameters.plainBody" field="updatePlainBodyEt.textData"/>
<call-service service-name="updateElectronicText" in-map-name="updatePlainBodyEt"/>
</if-not-empty>
<if-not-empty field="parameters.htmlBodyDataResourceId">
<set from-field="parameters.htmlBodyDataResourceId" field="updateHtmlBodyEt.dataResourceId"/>
<set from-field="parameters.htmlBody" field="updateHtmlBodyEt.textData"/>
<call-service service-name="updateElectronicText" in-map-name="updateHtmlBodyEt"/>
</if-not-empty>
</simple-method>
<simple-method method-name="createDownloadContent" short-description="Create Download as Content">
<check-permission permission="CONTENTMGR" action="_CREATE">
<fail-message message="Security Error: to run createContentEmail you must have the CONTENTMGR_CREATE or CONTENTMGR_ADMIN permission"/>
</check-permission>
<check-errors/>
<set-service-fields service-name="createContent" map-name="parameters" to-map-name="createDownloadContent"/>
<set from-field="parameters.file" field="createDownload.dataResourceContent"/>
<call-service service-name="createOtherDataResource" in-map-name="createDownload">
<result-to-field result-name="dataResourceId" map-name="createDownloadContent"/>
</call-service>
<call-service service-name="createContent" in-map-name="createDownloadContent">
<result-to-result result-name="contentId"/>
</call-service>
</simple-method>
<simple-method method-name="updateDownloadContent" short-description="Update Download Content">
<check-permission permission="CONTENTMGR" action="_UPDATE">
<fail-message message="Security Error: to run updateContentEmail you must have the CONTENTMGR_UPDATE or CONTENTMGR_ADMIN permission"/>
</check-permission>
<check-errors/>
<if-not-empty field="parameters.fileDataResourceId">
<set from-field="parameters.fileDataResourceId" field="updateFile.dataResourceId"/>
<set from-field="parameters.file" field="updateFile.dataResourceContent"/>
<call-service service-name="updateOtherDataResource" in-map-name="updateFile"/>
</if-not-empty>
</simple-method>
<simple-method method-name="createSimpleTextContent" short-description="Create Simple Text Content">
<check-permission permission="CONTENTMGR" action="_CREATE">
<fail-message message="Security Error: to run createSimpleTextContent you must have the CONTENTMGR_CREATE or CONTENTMGR_ADMIN permission"/>
</check-permission>
<check-errors/>
<set-service-fields service-name="createContent" map-name="parameters" to-map-name="createSimpleTextContent"/>
<set value="DOCUMENT" field="createSimpleTextContent.contentTypeId"/>
<set from-field="parameters.text" field="createSimpleText.textData"/>
<set-service-fields service-name="createDataResource" map-name="parameters" to-map-name="createSimpleTextDataResource"/>
<set value="ELECTRONIC_TEXT" field="createSimpleTextDataResource.dataResourceTypeId"/>
<set value="FTL" field="createSimpleTextDataResource.dataTemplateTypeId"/>
<call-service service-name="createDataResource" in-map-name="createSimpleTextDataResource">
<result-to-field result-name="dataResourceId" map-name="createSimpleText"/>
<result-to-field result-name="dataResourceId" map-name="createSimpleTextContent"/>
</call-service>
<call-service service-name="createElectronicText" in-map-name="createSimpleText"/>
<call-service service-name="createContent" in-map-name="createSimpleTextContent">
<result-to-result result-name="contentId"/>
</call-service>
</simple-method>
<simple-method method-name="updateSimpleTextContent" short-description="Update Simple Text Content">
<check-permission permission="CONTENTMGR" action="_UPDATE">
<fail-message message="Security Error: to run updateSimpleTextContent you must have the CONTENTMGR_UPDATE or CONTENTMGR_ADMIN permission"/>
</check-permission>
<check-errors/>
<if-not-empty field="parameters.textDataResourceId">
<set from-field="parameters.textDataResourceId" field="updateSimpleText.dataResourceId"/>
<set from-field="parameters.text" field="updateSimpleText.textData"/>
<call-service service-name="updateElectronicText" in-map-name="updateSimpleText"/>
</if-not-empty>
</simple-method>
<simple-method method-name="createTopic" short-description="Create TOPIC type Content">
<make-value value-name="content" entity-name="Content" />
<set from-field="parameters.newTopicId" field="content.contentId" />
<set from-field="parameters.newTopicId" field="content.contentName" />
<set from-field="parameters.newTopicDescription" field="content.description" />
<set value="TOPIC" field="content.contentTypeId" />
<now-timestamp-to-env env-name="content.lastModifiedDate"/>
<now-timestamp-to-env env-name="content.createdDate"/>
<set from-field="parameters.userLogin.userLoginId" field="content.lastModifiedByUserLogin"/>
<set from-field="parameters.userLogin.userLoginId" field="content.createdByUserLogin"/>
<create-value value-name="content"/>
</simple-method>
<!-- This method will create a skeleton content record from a data resource -->
<simple-method method-name="createContentFromDataResource" short-description="Create Content from DataResource Object">
<entity-one entity-name="DataResource" value-name="dataResource">
<field-map field-name="dataResourceId" env-name="parameters.dataResourceId"/>
</entity-one>
<if-empty field="dataResource">
<add-error><fail-message message="No data resource found for ID: [$parameters.dataResourceId}]"/></add-error>
</if-empty>
<check-errors/>
<set-service-fields service-name="createContent" map-name="parameters" to-map-name="createContentMap"/>
<if-empty field="createContentMap.contentName">
<set field="createContentMap.contentName" from-field="dataResource.dataResourceName"/>
</if-empty>
<if-empty field="createContentMap.contentTypeId">
<set field="createContentMap.contentTypeId" value="DOCUMENT"/>
</if-empty>
<if-empty field="createContentMap.statusId">
<set field="createContentMap.statusId" value="CTNT_INITIAL_DRAFT"/>
</if-empty>
<if-empty field="createContentMap.mimeTypeId">
<set from-field="dataResource.mimeTypeId" field="createContentMap.mimeTypeId"/>
</if-empty>
<call-service service-name="createContent" in-map-name="createContentMap" break-on-error="false">
<result-to-field result-name="contentId" field-name="contentId"/>
</call-service>
<field-to-result field-name="contentId" />
</simple-method>
<!-- This method first creates Content, DataResource and ElectronicText, ImageDataResource, etc. entities (if needed)
by calling persistContentAndAssoc.
It then takes the contentId coming out of that service, the passed in communicationEventId
and calls the "createCommEventContentAssoc" service to tie the CommunicationEvent and Content entities together.
-->
<simple-method method-name="createCommContentDataResource" short-description="Create CommunicationEvent and Content">
<!--
<check-permission permission="CONTENTMGR" action="_DELETE"><fail-message message="Security Error: to run updateContent you must have the CONTENTMGR_DELETE or CONTENTMGR_ADMIN permission"/></check-permission>
<check-errors/>
-->
<now-timestamp-to-env env-name="nowTimestamp"/>
<set-service-fields to-map-name="persistIn" service-name="persistContentAndAssoc" map-name="parameters"/>
<!-- let's take a guess at what the dataResourceTypeId should be if it is empty -->
<if-empty field="persistIn.dataResourceTypeId">
<log level="info" message="persistIn.drMimeTypeId: ${persistIn.drMimeTypeId}" />
<if-regexp expr="text.*" field-name="persistIn.drMimeTypeId">
<set field="persistIn.dataResourceTypeId" value="ELECTRONIC_TEXT"/>
<else>
<set field="persistIn.dataResourceTypeId" value="IMAGE_OBJECT"/>
</else>
</if-regexp>
</if-empty>
<log level="info" message="persistIn.dataResourceTypeId: ${persistIn.dataResourceTypeId}" />
<call-service service-name="persistContentAndAssoc" in-map-name="persistIn">
<results-to-map map-name="persistOut"/>
</call-service>
<iterate-map key-name="key" value-name="val" map-name="persistOut">
<field-to-result field-name="val" result-name="${key}"/>
</iterate-map>
<set field="mapIn.contentId" from-field="persistOut.contentId"/>
<!-- <set field="mapIn.fromDate" from-field="nowTimestamp"/> -->
<set field="mapIn.communicationEventId" from-field="parameters.communicationEventId"/>
<set field="mapIn.sequenceNum" from-field="parameters.sequenceNum"/>
<call-service service-name="createCommEventContentAssoc" in-map-name="mapIn">
<result-to-result result-name="fromDate"/>
</call-service>
</simple-method>
<!-- This method first updates Content, DataResource and ElectronicText, ImageDataResource, etc. entities (if needed)
by calling persistContentAndAssoc. It then takes the passed in contentId, communicationEventId and fromDate primary keys
and calls the "updateCommEventContentAssoc" service to tie the CommunicationEvent and Content entities together.
-->
<simple-method method-name="updateCommContentDataResource" short-description="Update CommunicationEvent and Content">
<!--
<check-permission permission="CONTENTMGR" action="_DELETE"><fail-message message="Security Error: to run updateContent you must have the CONTENTMGR_DELETE or CONTENTMGR_ADMIN permission"/></check-permission>
<check-errors/>
-->
<set-service-fields to-map-name="persistIn" service-name="persistContentAndAssoc" map-name="parameters"/>
<call-service service-name="persistContentAndAssoc" in-map-name="persistIn">
<results-to-map map-name="persistOut"/>
</call-service>
<set field="mapIn.contentId" from-field="persistOut.contentId"/>
<set field="mapIn.fromDate" from-field="parameters.fromDate"/>
<set field="mapIn.communicationEventId" from-field="parameters.communicationEventId"/>
<set field="mapIn.sequenceNum" from-field="parameters.sequenceNum"/>
<call-service service-name="updateCommEventContentAssoc" in-map-name="mapIn">
</call-service>
<iterate-map key-name="key" value-name="val" map-name="persistOut">
<field-to-result field-name="val" result-name="${key}"/>
</iterate-map>
</simple-method>
<!-- This service ties CommunicationEvent and Content entities together along with the standard from/thruDate fields.
-->
<simple-method method-name="createCommEventContentAssoc" short-description="Create CommEventContentAssoc">
<make-value entity-name="CommEventContentAssoc" value-name="commEventContentAssoc" />
<set-pk-fields value-name="commEventContentAssoc" map-name="parameters"/>
<set-nonpk-fields value-name="commEventContentAssoc" map-name="parameters"/>
<if-empty field="commEventContentAssoc.fromDate">
<now-timestamp-to-env env-name="commEventContentAssoc.fromDate"/>
</if-empty>
<create-value value-name="commEventContentAssoc" />
<field-to-result field-name="commEventContentAssoc.fromDate" result-name="fromDate"/>
</simple-method>
<!-- This service would primarily be used to update the thruDate field.
-->
<simple-method method-name="updateCommEventContentAssoc" short-description="Create CommEventContentAssoc">
<make-value entity-name="CommEventContentAssoc" value-name="pkCommEventContentAssoc" />
<set-pk-fields value-name="pkCommEventContentAssoc" map-name="parameters"/>
<find-by-primary-key value-name="commEventContentAssoc" map-name="pkCommEventContentAssoc" entity-name="CommEventContentAssoc"/>
<if-empty field="commEventContentAssoc">
<add-error>
<fail-message message="CommEventContentAssoc entity not found for update, communicationEventId: ${parameters.communicationEventId} and contentId: ${parameters.contentId}"/>
</add-error>
</if-empty>
<set-nonpk-fields value-name="commEventContentAssoc" map-name="parameters"/>
<store-value value-name="commEventContentAssoc" />
</simple-method>
<simple-method method-name="removeCommEventContentAssoc" short-description="Delete CommEventContentAssoc">
<make-value entity-name="CommEventContentAssoc" value-name="pkCommEventContentAssoc" />
<set-pk-fields value-name="pkCommEventContentAssoc" map-name="parameters"/>
<find-by-primary-key value-name="commEventContentAssoc" map-name="pkCommEventContentAssoc" entity-name="CommEventContentAssoc"/>
<if-empty field="commEventContentAssoc">
<add-error>
<fail-message message="CommEventContentAssoc entity not found for removal, communicationEventId: ${parameters.communicationEventId} and contentId: ${parameters.contentId}"/>
</add-error>
</if-empty>
<remove-value value-name="commEventContentAssoc" />
</simple-method>
<simple-method method-name="createContentAndAssoc" short-description="Create content and associate with other content">
<set-service-fields service-name="createContent" map-name="parameters" to-map-name="contentData"/>
<call-service service-name="createContent" in-map-name="contentData">
<result-to-field result-name="contentId" field-name="newContentId"/>
</call-service>
<if-not-empty field="newContentId">
<set-service-fields service-name="createContentAssoc" map-name="parameters" to-map-name="assocData"/>
<set field="assocData.contentId" from-field="newContentId"/>
<call-service service-name="createContentAssoc" in-map-name="assocData">
<result-to-result result-name="contentId" service-result-name="contentIdFrom"/>
<result-to-result result-name="contentIdTo" service-result-name="contentIdTo"/>
</call-service>
<field-to-result field-name="newContentId" result-name="contentId"/>
</if-not-empty>
</simple-method>
<!-- retrieve Data resource information -->
<simple-method method-name="getDataResource" short-description="get the content and relasted resource information" login-required="false">
<entity-one entity-name="DataResource" value-name="resultData.dataResource">
<field-map field-name="dataResourceId" env-name="parameters.dataResourceId"/>
</entity-one>
<if-not-empty field="resultData.dataResource">
<if-compare field="resultData.dataResource.dataResourceTypeId" value="ELECTRONIC_TEXT" operator="equals">
<get-related-one value-name="resultData.dataResource" relation-name="ElectronicText"
to-value-name="resultData.electronicText"/>
</if-compare>
<if-compare field="resultData.dataResource.dataResourceTypeId" value="IMAGE_OBJECT" operator="equals">
<get-related-one value-name="resultData.dataResource" relation-name="ImageDataResource"
to-value-name="resultData.imageDataResource"/>
</if-compare>
</if-not-empty>
<field-to-result field-name="resultData" result-name="resultData"/>
</simple-method>
<simple-method method-name="getContentAndDataResource" short-description="get the content and related resource information" login-required="false">
<entity-one entity-name="Content" value-name="resultDataContent.content">
<field-map field-name="contentId" env-name="parameters.contentId"/>
</entity-one>
<if-not-empty field="resultDataContent.content">
<if-not-empty field="resultDataContent.content.dataResourceId">
<set field="parameters.dataResourceId" from-field="resultDataContent.content.dataResourceId"/>
<call-simple-method method-name="getDataResource"/>
<set field="resultDataContent.dataResource" from-field="resultData.dataResource"/>
<set field="resultDataContent.electronicText" from-field="resultData.electronicText"/>
<set field="resultDataContent.imageDataResource" from-field="resultData.imageDataResource"/>
</if-not-empty>
<field-to-result field-name="resultDataContent" result-name="resultData"/>
</if-not-empty>
</simple-method>
<simple-method method-name="getPublicForumMessage" short-description="get the content and related resource information without security" login-required="false">
<set field="publicForumMessage" value="true"/>
<call-simple-method method-name="getContentAndDataResource"/>
</simple-method>
<!-- eca helper services -->
<simple-method method-name="checkContentAssocIds" short-description="Checks and prepares contentIdTo and contentId for ContentAssoc service">
<if>
<condition>
<and>
<not>
<if-empty field="parameters.contentIdFrom"/>
</not>
<not>
<if-empty field="parameters.contentId"/>
</not>
<if-empty field="parameters.contentIdTo"/>
</and>
</condition>
<then>
<field-to-result field-name="contentIdFrom" map-name="parameters" result-name="contentId"/>
<field-to-result field-name="contentId" map-name="parameters" result-name="contentIdTo"/>
<log level="info" message="Converted 'contentId' to 'contentIdTo' and 'contentIdFrom' to 'contentId'"/>
</then>
<else-if>
<condition>
<not>
<if-empty field="parameters.contentIdTo"/>
</not>
</condition>
<then>
<field-to-result field-name="contentIdTo" map-name="parameters" result-name="contentIdTo"/>
<field-to-result field-name="contentId" map-name="parameters" result-name="contentId"/>
<log level="info" message="Returned 'contentId' as 'contentId' and 'contentIdTo' as 'contentIdTo'"/>
</then>
</else-if>
<else>
<log level="warning" message="Illegal values passed; should be either contentIdTo/contentId or contentIdFrom/contentId :: ${parameters}"/>
</else>
</if>
</simple-method>
<simple-method method-name="createArticleContent" short-description="Post a new Content article Entry">
<set field="contentAssocTypeId" from-field="parameters.contentAssocTypeId"/>
<set field="origContentAssocTypeId" from-field="parameters.contentAssocTypeId"/>
<set field="ownerContentId" from-field="parameters.threadContentId"/>
<if-compare operator="equals" field="origContentAssocTypeId" value="PUBLISH_LINK">
<set field="ownerContentId" from-field="parameters.pubPtContentId"/>
</if-compare>
<set field="contentIdFrom" from-field="parameters.contentIdFrom"/>
<set field="pubPtContentId" from-field="parameters.pubPtContentId"/>
<call-object-method method-name="length" obj-field-name="parameters.textData" ret-field-name="textDataLen"/>
<log level="info" message="textDataLen:${textDataLen}"/>
<property-to-field resource="forum" property="descriptLen" field-name="descriptLen" />
<log level="info" message="descriptLen:${descriptLen}"/>
<call-class-method method-name="min" class-name="java.lang.Math" ret-field-name="subStringLen">
<field field-name="textDataLen" type="int"/>
<field field-name="descriptLen" type="int"/>
</call-class-method>
<log level="info" message="subStringLen:${subStringLen}"/>
<set field="zeroValue" value="0" type="Integer"/>
<call-object-method method-name="substring" obj-field-name="parameters.textData" ret-field-name="subDescript">
<field field-name="zeroValue" type="int"/>
<field field-name="subStringLen" type="int"/>
</call-object-method>
<log level="info" message="subDescript:${subDescript}"/>
<if-compare operator="equals" field="contentAssocTypeId" value="PUBLISH_LINK">
<set field="ownerContentId" from-field="pubPtContentId"/>
</if-compare>
<!-- determine of we need to create complex template structure or simple content structure -->
<if>
<condition>
<and>
<not>
<if-empty field="parameters.uploadedFile"/>
</not>
<not>
<if-empty field="parameters.textData"/>
</not>
</and>
</condition>
<then>
<!-- complex template structure (image & text) -->
<set field="createMain.dataResourceId" from-field="parameters.dataResourceId"/>
<set field="createMain.contentAssocTypeId" from-field="contentAssocTypeId"/>
<set field="createMain.contentName" from-field="parameters.contentName"/>
<set field="createMain.description" from-field="subDescript"/>
<set field="createMain.statusId" from-field="parameters.statusId"/>
<set field="createMain.contentIdFrom" from-field="contentIdFrom"/>
<set field="createMain.partyId" from-field="userLogin.partyId"/>
<set field="createMain.ownerContentId" from-field="ownerContentId"/>
<set field="createMain.dataTemplateTypeId" value="SCREEN_COMBINED"/>
<set field="createMain.mapKey" value="MAIN"/>
<call-service service-name="createContent" in-map-name="createMain">
<result-to-field result-name="contentId" field-name="contentId"/>
</call-service>
<!-- reset contentIdFrom to new contentId -->
<set field="contentAssocTypeId" value="SUB_CONTENT"/>
<set field="contentIdFrom" from-field="contentId"/>
</then>
</if>
<if>
<condition>
<not>
<if-empty field="parameters.uploadedFile"/>
</not>
</condition>
<then>
<!-- create image data -->
<set field="createImage.dataResourceTypeId" value="LOCAL_FILE"/>
<set field="createImage.dataTemplateTypeId" value="NONE"/>
<set field="createImage.mapKey" value="IMAGE"/>
<set field="createMain.ownerContentId" from-field="ownerContentId"/>
<set field="createImage.contentName" from-field="parameters.contentName"/>
<set field="createImage.description" from-field="subDescript"/>
<set field="createImage.statusId" from-field="parameters.statusId"/>
<set field="createImage.contentAssocTypeId" from-field="contentAssocTypeId"/>
<set field="createImage.contentIdFrom" from-field="contentIdFrom"/>
<set field="createImage.partyId" from-field="userLogin.partyId"/>
<set field="createImage.uploadedFile" from-field="parameters.uploadedFile"/>
<set field="createImage._uploadedFile_fileName" from-field="parameters._uploadedFile_fileName"/>
<set field="createImage._uploadedFile_contentType" from-field="parameters._uploadedFile_contentType"/>
<call-service service-name="createContentFromUploadedFile" in-map-name="createImage">
<result-to-field result-name="contentId" field-name="imageContentId"/>
</call-service>
<if-empty field="contentId">
<set field="contentIdFrom" from-field="imageContentId"/>
<set field="contentId" from-field="imageContentId"/>
<set field="contentAssocTypeId" value="SUB_CONTENT"/>
</if-empty>
</then>
</if>
<if>
<condition>
<not>
<if-empty field="parameters.textData"/>
</not>
</condition>
<then>
<!-- create text data -->
<set field="createText.dataResourceTypeId" value="ELECTRONIC_TEXT"/>
<set field="createText.dataTemplateTypeId" value="NONE"/>
<set field="createText.mapKey" value="MAIN"/>
<set field="createText.ownerContentId" from-field="ownerContentId"/>
<set field="createText.contentName" from-field="parameters.contentName"/>
<set field="createText.description" from-field="subDescript"/>
<set field="createText.statusId" from-field="parameters.statusId"/>
<set field="createText.contentAssocTypeId" from-field="contentAssocTypeId"/>
<set field="createText.textData" from-field="parameters.textData"/>
<set field="createText.contentIdFrom" from-field="contentIdFrom"/>
<set field="createText.partyId" from-field="userLogin.partyId"/>
<log level="always" message="calling createTextContent with map: ${createText}"/>
<call-service service-name="createTextContent" in-map-name="createText">
<result-to-field result-name="contentId" field-name="textContentId"/>
</call-service>
<if-empty field="contentId">
<set field="contentIdFrom" from-field="textContentId"/>
<set field="contentId" from-field="textContentId"/>
<set field="contentAssocTypeId" value="SUB_CONTENT"/>
</if-empty>
</then>
</if>
<!-- we should have a primary (at least) contentId -->
<if>
<condition>
<and>
<not>
<if-empty field="contentId"/>
</not>
<not>
<if-empty field="parameters.summaryData"/>
</not>
</and>
</condition>
<then>
<!-- create the summary data -->
<set field="createSummary.dataResourceTypeId" value="ELECTRONIC_TEXT"/>
<set field="createSummary.dataTemplateTypeId" value="NONE"/>
<set field="createSummary.mapKey" value="SUMMARY"/>
<set field="createSummary.ownerContentId" from-field="ownerContentId"/>
<set field="createSummary.contentName" from-field="parameters.contentName"/>
<set field="createSummary.description" from-field="parameters.description"/>
<set field="createSummary.statusId" from-field="parameters.statusId"/>
<set field="createSummary.contentAssocTypeId" from-field="contentAssocTypeId"/>
<set field="createSummary.textData" from-field="parameters.summaryData"/>
<set field="createSummary.contentIdFrom" from-field="contentIdFrom"/>
<set field="createSummary.partyId" from-field="userLogin.partyId"/>
<call-service service-name="createTextContent" in-map-name="createSummary"/>
</then>
</if>
<!-- If a response, still link it to the publish point -->
<if-compare operator="equals" field="origContentAssocTypeId" value="RESPONSE">
<set field="contentAssocMap.contentId" from-field="pubPtContentId"/>
<set field="contentAssocMap.contentIdTo" from-field="contentId"/>
<set field="contentAssocMap.contentAssocTypeId" value="RESPONSE"/>
<log level="info" message="contentAssocMap:${contentAssocMap.contentId}"/>
<call-service service-name="createContentAssoc" in-map-name="contentAssocMap"/>
</if-compare>
<field-to-result field-name="contentId"/>
</simple-method>
<simple-method method-name="getSubContentWithPermCheck" short-description="Get sub content and perform permission check on each record">
<set field="filterByDate" from-field="parameters.filterByDate" default-value="true" type="Boolean" />
<set field="useCache" from-field="parameters.useCache" default-value="true" type="Boolean" />
<entity-condition list-name="viewList" entity-name="ContentAssocViewTo" filter-by-date="${filterByDate}" use-cache="${useCache}">
<condition-list combine="and">
<condition-expr field-name="contentIdStart" env-name="parameters.contentId"/>
<condition-expr field-name="caContentAssocTypeId" env-name="parameters.contentAssocTypeId" ignore-if-empty="true"/>
<condition-expr field-name="caMapKey" env-name="parameters.mapKey" ignore-if-empty="true"/>
</condition-list>
</entity-condition>
<iterate entry-name="view" list-name="viewList">
<set field="hasPermission" value="true" type="Boolean"/>
<if>
<condition>
<and>
<not>
<if-empty field="parameters.mainAction"/>
</not>
<not>
<if-empty field="parameters.userLogin"/>
</not>
</and>
</condition>
<then>
<set field="inMap.contentId" from-field="parameters.contentId"/>
<set field="inMap.mainAction" from-field="parameters.mainAction"/>
<set field="inMap.userLogin" from-field="parameters.userLogin"/>
<set field="inMap.contentOperationId" from-field="parameters.contentOperationId" default-value="CONTENT_CREATE"/>
<call-service service-name="genericContentPermission" in-map-name="inMap" include-user-login="true">
<result-to-field result-name="hasPermission"/>
</call-service>
</then>
</if>
<if-compare operator="equals" field="hasPermission" value="true" type="Boolean">
<set field="contentViewList[]" from-field="view"/>
</if-compare>
</iterate>
<field-to-result field-name="contentViewList" result-name="subContentList"/>
</simple-method>
<simple-method method-name="getSubSubContentWithPermCheck" short-description="Get sub content and perform permission check on each record">
<set-service-fields service-name="getSubContentWithPermCheck" map-name="parameters" to-map-name="inMap"/>
<call-service service-name="getSubContentWithPermCheck" in-map-name="inMap">
<result-to-field result-name="subContentList"/>
</call-service>
<iterate entry-name="view" list-name="subContentList">
<entity-condition list-name="viewList" entity-name="ContentAssocViewTo" filter-by-date="true" use-cache="${useCache}">
<condition-list combine="and">
<condition-expr field-name="contentIdStart" env-name="view.caContentIdTo"/>
<condition-expr field-name="caContentAssocTypeId" env-name="parameters.subContentAssocTypeId" ignore-if-empty="true"/>
<condition-expr field-name="caMapKey" env-name="parameters.subMapKey" ignore-if-empty="true"/>
</condition-list>
</entity-condition>
<clear-field field-name="view2"/>
<first-from-list entry-name="view2" list-name="viewList"/>
<clear-field field-name="map"/>
<set field="map.contentIdFrom" from-field="view.contentId"/>
<set field="map.dataResourceIdFrom" from-field="view.dataResourceId"/>
<set field="map.contentId" from-field="view2.contentId"/>
<set field="map.contentName" from-field="view2.contentName"/>
<set field="map.description" from-field="view2.description"/>
<entity-one entity-name="ElectronicText" value-name="electronicText">
<field-map field-name="dataResourceId" env-name="view2.dataResourceId"/>
</entity-one>
<set field="map.textData" from-field="electronicText.textData"/>
<set field="contentViewList[]" from-field="map"/>
</iterate>
<field-to-result field-name="subContentList" result-name="subContentList"/>
<field-to-result field-name="contentViewList" result-name="subSubContentList"/>
</simple-method>
</simple-methods>