ilscipio/scipio-erp

View on GitHub
specialpurpose/assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintServices.xml

Summary

Maintainability
Test Coverage
<?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="createFixedAssetMaintUpdateWorkEffort" login-required="true"
        short-description="Create FixedAssetMaint and Update Schedule information in WorkEffort">
        <set-service-fields map="parameters" service-name="createFixedAssetMaint" to-map="createFixedAssetMaintCtx"/>
        <call-service service-name="createFixedAssetMaint" in-map-name="createFixedAssetMaintCtx">
            <result-to-field result-name="maintHistSeqId" field="findAssetMaintLookup.maintHistSeqId"/>
            <result-to-result result-name="maintHistSeqId"/>
        </call-service>
        <check-errors/>
        <set from-field="parameters.fixedAssetId" field="findAssetMaintLookup.fixedAssetId"/>
        <find-by-primary-key entity-name="FixedAssetMaint" map="findAssetMaintLookup" value-field="findAssetMaint"/>
        <set from-field="findAssetMaint.scheduleWorkEffortId" field="updateWorkEffortCtx.workEffortId"/>
        <set-service-fields map="parameters" service-name="updateWorkEffort" to-map="updateWorkEffortCtx"/>
        <!-- Maintenance WorkEffort entity -->
        <call-service service-name="updateWorkEffort" in-map-name="updateWorkEffortCtx"/>
    </simple-method>

    <simple-method method-name="updateFixedAssetMaintAndWorkEffort" login-required="true"
        short-description="Update FixedAssetMaint and Schedule information in WorkEffort">
        <set-service-fields map="parameters" service-name="updateFixedAssetMaint" to-map="updateFixedAssetMaintCtx"/>
        <call-service service-name="updateFixedAssetMaint" in-map-name="updateFixedAssetMaintCtx"/>
        <check-errors/>
        <if-compare field="parameters.statusId" operator="equals" value="FAM_CANCELLED">
            <set field="updateWorkEffortCtx.currentStatusId" value="CAL_CANCELLED"/>
        </if-compare>
        <set-service-fields map="parameters" service-name="updateWorkEffort" to-map="updateWorkEffortCtx"/>
        <set from-field="parameters.scheduleWorkEffortId" field="updateWorkEffortCtx.workEffortId"/>
        <set from-field="parameters.scheduleWorkEffortId" field="workEffortId"/>
        <entity-one entity-name="WorkEffort" value-field="workEffort"/>
        <set field="updateWorkEffortCtx.actualCompletionDate" from-field="parameters.actualCompletionDate" default-value="${workEffort.actualCompletionDate}"/>
        <call-service service-name="updateWorkEffort" in-map-name="updateWorkEffortCtx"/>
    </simple-method>

    <simple-method method-name="createWorkEffortAndAssocWithParent" login-required="true"
        short-description="Create WorkEffort and Associate it with Parent (identified by workEffortFromId)">
        <set from-field="parameters.workEffortIdTo" field="parameters.workEffortId"/>
        <set-service-fields map="parameters" service-name="createWorkEffortAndAssoc" to-map="createWorkEffortAndAssocCtx"/>
        <call-service service-name="createWorkEffortAndAssoc" in-map-name="createWorkEffortAndAssocCtx"/>
        <check-errors/>
    </simple-method>

    <!-- ==============Permission Checking Service============= -->
    <simple-method method-name="assetMaintPermissionCheck" short-description="Asset Maintenance permission logic">
        <set field="primaryPermission" value="ASSETMAINT"/>
        <call-simple-method method-name="genericBasePermissionCheck" xml-resource="component://common/script/org/ofbiz/common/permission/CommonPermissionServices.xml"/>
    </simple-method>

</simple-methods>