blob: e1b969b45a1742fc0c4357270ed685e9f5353ef1 [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-v2.xsd">
<simple-method method-name="updateAVSOverride" short-description="Create/Update The AVS Override String">
<make-value value-field="lookupPKMap" entity-name="PartyIcsAvsOverride"/>
<set-pk-fields map="parameters" value-field="lookupPKMap"/>
<find-by-primary-key entity-name="PartyIcsAvsOverride" map="lookupPKMap" value-field="lookedUpValue"/>
<if-not-empty field="lookedUpValue.partyId">
<set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
<store-value value-field="lookedUpValue"/>
</if-not-empty>
<if-empty field="lookedUpValue.partyId">
<set-nonpk-fields map="parameters" value-field="lookupPKMap"/>
<create-value value-field="lookupPKMap"/>
</if-empty>
</simple-method>
<simple-method method-name="deleteAVSOverride" short-description="Delete The AVS Override String">
<make-value value-field="lookupPKMap" entity-name="PartyIcsAvsOverride"/>
<set-pk-fields map="parameters" value-field="lookupPKMap"/>
<find-by-primary-key entity-name="PartyIcsAvsOverride" map="lookupPKMap" value-field="lookedUpValue"/>
<if-not-empty field="lookedUpValue.partyId">
<remove-value value-field="lookedUpValue"/>
</if-not-empty>
</simple-method>
<simple-method method-name="ensureNaPartyRole" short-description="Ensure Party is in _NA_ or the specified Role" login-required="false">
<!-- must have a partyId, partyIdFrom, or partyIdTo in the parameters map, should be called through different service defs for each one -->
<if-not-empty field="parameters.partyId">
<set field="lookupPKMap.partyId" from-field="parameters.partyId"/>
<else>
<if-not-empty field="parameters.partyIdFrom">
<set field="lookupPKMap.partyId" from-field="parameters.partyIdFrom"/>
<else>
<if-not-empty field="parameters.partyIdTo">
<set field="lookupPKMap.partyId" from-field="parameters.partyIdTo"/>
</if-not-empty>
</else>
</if-not-empty>
</else>
</if-not-empty>
<!-- resolve the roleTypeId on this order roleTypeIdFrom, roleTypeIdTo, roleTypeId and if not find use _NA_-->
<if-not-empty field="parameters.roleTypeIdFrom">
<set field="lookupPKMap.roleTypeId" from-field="parameters.roleTypeIdFrom"/>
<else>
<if-not-empty field="parameters.roleTypeIdTo">
<set field="lookupPKMap.roleTypeId" from-field="parameters.roleTypeIdTo"/>
<else>
<if-not-empty field="parameters.roleTypeId">
<set from-field="parameters.roleTypeId" field="lookupPKMap.roleTypeId"/>
<else>
<set field="lookupPKMap.roleTypeId" value="_NA_"/>
</else>
</if-not-empty>
</else>
</if-not-empty>
</else>
</if-not-empty>
<if-not-empty field="lookupPKMap.partyId">
<find-by-primary-key entity-name="PartyRole" map="lookupPKMap" value-field="lookedUpValue" use-cache="true"/>
<if-empty field="lookedUpValue">
<make-value value-field="partyRole" entity-name="PartyRole" map="lookupPKMap"/>
<create-value value-field="partyRole"/>
</if-empty>
</if-not-empty>
</simple-method>
<simple-method method-name="createPersonAndUserLogin" short-description="Creates a person and userlogin" login-required="false">
<set-service-fields service-name="createUserLogin" map="parameters" to-map="createUlInMap"/>
<set-service-fields service-name="createPerson" map="parameters" to-map="createPersonCtx"/>
<call-service service-name="createPerson" in-map-name="createPersonCtx">
<result-to-field result-name="partyId" field="createUlInMap.partyId"/>
</call-service>
<!-- call the service with the system account to get around security constraints for this special create -->
<entity-one entity-name="UserLogin" value-field="createUlInMap.userLogin" auto-field-map="false">
<field-map field-name="userLoginId" value="system"/>
</entity-one>
<call-service service-name="createUserLogin" in-map-name="createUlInMap"/>
<entity-one entity-name="UserLogin" value-field="newUserLogin"/>
<field-to-result field="newUserLogin"/>
<field-to-result field="createUlInMap.partyId" result-name="partyId"/>
</simple-method>
<!-- Simple method to create a person, its role and basic contact mechs -->
<simple-method method-name="createPersonRoleAndContactMechs" short-description="Creates a person, role and contactMechs">
<call-map-processor processor-name="person" in-map-name="parameters" out-map-name="personContext"
xml-resource="component://party/script/org/ofbiz/party/party/PartyMapProcs.xml"/>
<if-not-empty field="parameters.address1">
<call-map-processor processor-name="postalAddress" in-map-name="parameters" out-map-name="postalAddressContext"
xml-resource="component://party/script/org/ofbiz/party/contact/PartyContactMechMapProcs.xml"/>
</if-not-empty>
<if-not-empty field="parameters.contactNumber">
<call-map-processor processor-name="telecomNumber" in-map-name="parameters" out-map-name="telecomNumberContext"
xml-resource="component://party/script/org/ofbiz/party/contact/PartyContactMechMapProcs.xml"/>
</if-not-empty>
<if-not-empty field="parameters.emailAddress">
<call-map-processor in-map-name="parameters" out-map-name="emailAddressContext">
<simple-map-processor name="emailAddress">
<process field="emailAddress">
<copy/>
<validate-method method="isEmail"><fail-property resource="PartyUiLabels" property="PartyEmailAddressNotFormattedCorrectly"/></validate-method>
</process>
</simple-map-processor>
</call-map-processor>
</if-not-empty>
<check-errors/>
<call-service service-name="createPerson" in-map-name="personContext">
<result-to-field result-name="partyId" field="partyId"/>
</call-service>
<if-not-empty field="parameters.roleTypeId">
<set field="createPartyRoleCtx.partyId" from-field="partyId"/>
<set field="createPartyRoleCtx.roleTypeId" from-field="parameters.roleTypeId"/>
<call-service service-name="createPartyRole" in-map-name="createPartyRoleCtx"/>
</if-not-empty>
<set field="postalAddContactMechPurpTypeId" from-field="parameters.postalAddContactMechPurpTypeId"/>
<set field="contactNumber" from-field="parameters.contactNumber"/>
<set field="phoneContactMechPurpTypeId" from-field="parameters.phoneContactMechPurpTypeId"/>
<set field="emailAddress" from-field="parameters.emailAddress"/>
<set field="emailContactMechPurpTypeId" from-field="parameters.emailContactMechPurpTypeId"/>
<call-simple-method method-name="createPartyContactMechs"/>
</simple-method>
<!-- Simple method to create a party group, its role and basic contact mechs -->
<simple-method method-name="createPartyGroupRoleAndContactMechs" short-description="Creates a party group, role and contactMechs">
<call-map-processor processor-name="partyGroup" in-map-name="parameters" out-map-name="partyGroupContext"
xml-resource="component://party/script/org/ofbiz/party/party/PartyMapProcs.xml"/>
<if-not-empty field="parameters.address1">
<call-map-processor processor-name="postalAddress" in-map-name="parameters" out-map-name="postalAddressContext"
xml-resource="component://party/script/org/ofbiz/party/contact/PartyContactMechMapProcs.xml"/>
</if-not-empty>
<if-not-empty field="parameters.contactNumber">
<call-map-processor processor-name="telecomNumber" in-map-name="parameters" out-map-name="telecomNumberContext"
xml-resource="component://party/script/org/ofbiz/party/contact/PartyContactMechMapProcs.xml"/>
</if-not-empty>
<if-not-empty field="parameters.emailAddress">
<call-map-processor in-map-name="parameters" out-map-name="emailAddressContext">
<simple-map-processor name="emailAddress">
<process field="emailAddress">
<copy/>
<validate-method method="isEmail"><fail-property resource="PartyUiLabels" property="PartyEmailAddressNotFormattedCorrectly"/></validate-method>
</process>
</simple-map-processor>
</call-map-processor>
</if-not-empty>
<check-errors/>
<set field="partyGroupContext.partyTypeId" value="PARTY_GROUP"/>
<call-service service-name="createPartyGroup" in-map-name="partyGroupContext">
<result-to-field result-name="partyId" field="partyId"/>
</call-service>
<check-errors/>
<if-not-empty field="parameters.roleTypeId">
<set field="createPartyRoleCtx.partyId" from-field="partyId"/>
<set field="createPartyRoleCtx.roleTypeId" from-field="parameters.roleTypeId"/>
<call-service service-name="createPartyRole" in-map-name="createPartyRoleCtx"/>
</if-not-empty>
<check-errors/>
<set field="postalAddContactMechPurpTypeId" from-field="parameters.postalAddContactMechPurpTypeId"/>
<set field="contactNumber" from-field="parameters.contactNumber"/>
<set field="phoneContactMechPurpTypeId" from-field="parameters.phoneContactMechPurpTypeId"/>
<set field="emailAddress" from-field="parameters.emailAddress"/>
<set field="emailContactMechPurpTypeId" from-field="parameters.emailContactMechPurpTypeId"/>
<call-simple-method method-name="createPartyContactMechs"/>
</simple-method>
<!-- Simple method to create Party Postal Address, Telecom Number and Email Address, to be used by
createPersonRoleAndContactMechs and createPartyGroupRoleAndContactMechs simple methods -->
<simple-method method-name="createPartyContactMechs" short-description="Create Contact Mechs">
<!-- postal address -->
<if-not-empty field="postalAddressContext">
<set field="postalAddressContext.partyId" from-field="partyId"/>
<set field="postalAddressContext.contactMechPurposeTypeId" value="GENERAL_LOCATION"/>
<call-service service-name="createPartyPostalAddress" in-map-name="postalAddressContext">
<result-to-field result-name="contactMechId" field="postalAddressContext.contactMechId"/>
</call-service>
</if-not-empty>
<if-not-empty field="postalAddContactMechPurpTypeId">
<set-service-fields service-name="createPartyContactMechPurpose" map="postalAddressContext" to-map="serviceCtx"/>
<set field="serviceCtx.contactMechPurposeTypeId" from-field="postalAddContactMechPurpTypeId"/>
<call-service service-name="createPartyContactMechPurpose" in-map-name="serviceCtx"/>
</if-not-empty>
<!-- phone number -->
<if-not-empty field="telecomNumberContext">
<set field="telecomNumberContext.partyId" from-field="partyId"/>
<set field="telecomNumberContext.contactMechPurposeTypeId" value="PRIMARY_PHONE"/>
<if-not-empty field="phoneContactMechPurpTypeId"> <!-- override with purpose present in parameters, if any (This field is not used now, just here for future implementations) -->
<set field="telecomNumberContext.contactMechPurposeTypeId" from-field="phoneContactMechPurpTypeId"/>
</if-not-empty>
<call-service service-name="createPartyTelecomNumber" in-map-name="telecomNumberContext"/>
</if-not-empty>
<!-- email address -->
<if-not-empty field="emailAddressContext">
<set field="emailAddressContext.partyId" from-field="partyId"/>
<set field="emailAddressContext.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
<if-not-empty field="emailContactMechPurpTypeId"> <!-- override with purpose present in parameters, if any (This field is not used now, just here for future implementations) -->
<set field="emailAddressContext.contactMechPurposeTypeId" from-field="emailContactMechPurpTypeId"/>
</if-not-empty>
<call-service service-name="createPartyEmailAddress" in-map-name="emailAddressContext"/>
</if-not-empty>
</simple-method>
<simple-method method-name="deleteBillingAccount" short-description="delete billing account">
<now-timestamp field="nowTimestamp"/>
<set field="parameters.thruDate" from-field="nowTimestamp"/>
<set-service-fields service-name="updateBillingAccount" to-map="deleteBillingAccountCtx" map="parameters"/>
<call-service service-name="updateBillingAccount" in-map-name="deleteBillingAccountCtx"/>
</simple-method>
</simple-methods>