blob: a4cd7e26b7c0fca08e3222d96bccedc9a4aba67e [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"
xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
<!-- Facility Location Services -->
<simple-method method-name="createFacilityLocation" short-description="Create a Facility Location">
<make-value value-field="newEntity" entity-name="FacilityLocation"/>
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<set field="newEntity.facilityId" from-field="parameters.facilityId"/>
<set field="locationSeqId" value="${parameters.areaId}${parameters.aisleId}${parameters.sectionId}${parameters.levelId}${parameters.positionId}"/>
<!-- check to see if it exists already, if so try a simple suffix, then give up and use a sequenced id -->
<if-not-empty field="locationSeqId">
<set field="checkLocationSeqIdMap.locationSeqId" from-field="locationSeqId"/>
<set field="checkLocationSeqIdMap.facilityId" from-field="parameters.facilityId"/>
<find-by-primary-key entity-name="FacilityLocation" map="checkLocationSeqIdMap" value-field="checkLocationSeqIdValue"/>
<if-not-empty field="checkLocationSeqIdValue">
<set field="locationSeqId" value="${locationSeqId}_2"/>
<set field="checkLocationSeqIdMap.locationSeqId" from-field="locationSeqId"/>
<set field="checkLocationSeqIdMap.facilityId" from-field="parameters.facilityId"/>
<find-by-primary-key entity-name="FacilityLocation" map="checkLocationSeqIdMap" value-field="checkLocationSeqIdValue"/>
<if-not-empty field="checkLocationSeqIdValue">
<set field="locationSeqId" value=""/>
</if-not-empty>
</if-not-empty>
</if-not-empty>
<if-empty field="locationSeqId">
<sequenced-id sequence-name="FacilityLocation" field="locationSeqId"/>
<to-string field="locationSeqId"/>
</if-empty>
<set field="newEntity.locationSeqId" from-field="locationSeqId"/>
<field-to-result field="locationSeqId" result-name="locationSeqId"/>
<create-value value-field="newEntity"/>
</simple-method>
<!-- Facility Role Services -->
<simple-method method-name="removePartyFromFacility" short-description="Remove Party From Facility">
<entity-one entity-name="FacilityParty" value-field="lookedUpValue"/>
<now-timestamp field="thruDate"/>
<set field="lookedUpValue.thruDate" from-field="thruDate"/>
<store-value value-field="lookedUpValue"/>
</simple-method>
<simple-method method-name="removePartyFromFacilityGroup" short-description="Remove Party From FacilityGroup">
<make-value value-field="lookupPKMap" entity-name="FacilityGroupRole"/>
<set-pk-fields map="parameters" value-field="lookupPKMap"/>
<find-by-primary-key entity-name="FacilityGroupRole" map="lookupPKMap" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
</simple-method>
<simple-method method-name="deleteFacilityContent" short-description="Delete Content From Facility">
<make-value value-field="lookupPKMap" entity-name="FacilityContent"/>
<set-pk-fields map="parameters" value-field="lookupPKMap"/>
<find-by-primary-key entity-name="FacilityContent" map="lookupPKMap" value-field="lookedUpValue"/>
<now-timestamp field="lookedUpValue.thruDate"/>
<store-value value-field="lookedUpValue"/>
</simple-method>
</simple-methods>