<?xml version="1.0" encoding="UTF-8"?>
<process xmlns:bean="http://bean.boe.com/" xmlns:bpel="http://bpel.boe.com/" targetNamespace="http://bpel.boe.com/bpelj/" name="PDAFGChangePalletLocation.bpel">
    <partnerLinks>
        <partnerLink name="bpelj" partnerLinkType="bpel:bpelj" />
        <partnerLink name="TransactionUtil" partnerLinkType="bean:TransactionUtil" />
        <partnerLink name="EventInfoUtil" partnerLinkType="bean:EventInfoUtil" />
        <partnerLink name="PackingGroupServiceUtil" partnerLinkType="bean:PackingGroupServiceUtil" />
        <partnerLink name="StorageServiceImpl" partnerLinkType="bean:StorageServiceImpl" />
        <partnerLink name="StorageServiceUtil" partnerLinkType="bean:StorageServiceUtil" />
        <partnerLink name="DurableServiceImpl" partnerLinkType="bean:DurableServiceImpl" />
        <partnerLink name="PackingGroupServiceImpl" partnerLinkType="bean:PackingGroupServiceImpl" />
        <partnerLink name="ESBService" partnerLinkType="bean:ESBService" />
    </partnerLinks>
    <variables>
        <variable name="customException" messageType="com.cim.idm.fgwmsextend.generic.errorHandler.CustomException"></variable>
        <variable name="eventComment" messageType="java.lang.String" expression="getXmlData('message','/Message/Header/EVENTCOMMENT')" />
        <variable name="eventInfo" messageType="com.cim.idm.framework.data.EventInfo"></variable>
        <variable name="eventName" messageType="java.lang.String" expression="getXmlData('message','/Message/Header/MESSAGENAME')" />
        <variable name="eventUser" messageType="java.lang.String" expression="getXmlData('message','/Message/Header/EVENTUSER')" />
        <variable name="holdReasonCode" messageType="java.lang.String"></variable>
        <variable name="locationEventInfo" messageType="com.cim.idm.framework.data.EventInfo"></variable>
        <variable name="locationInfo" messageType="com.cim.idm.wmspackage.storage.management.data.Storage"></variable>
        <variable name="message" messageType="org.jdom.Document"></variable>
        <variable name="movePalletElement" messageType="org.jdom.Element"></variable>
        <variable name="movePalletElementList" messageType="java.util.List"></variable>
        <variable name="OICSender" messageType="java.lang.String"></variable>
        <variable name="oldLocationName" messageType="java.lang.String"></variable>
        <variable name="palletInfo" messageType="com.cim.idm.wmspackage.productpacking.management.data.ProductPacking"></variable>
        <variable name="palletName" messageType="java.lang.String" expression="getXmlData('message','/Message/Body/PALLETNAME')" />
        <variable name="replySubjectName" messageType="java.lang.String" expression="getXmlData('message', '/Message/Header/ORIGINALSOURCESUBJECTNAME')" />
        <variable name="SiteName" messageType="java.lang.String" expression="getXmlData('message','/Message/Body/SITENAME')" />
        <variable name="storageSpec" messageType="com.cim.idm.wmspackage.storage.management.data.StorageSpec"></variable>
        <variable name="toLocationName" messageType="java.lang.String" expression="getXmlData('message','/Message/Body/LOCATION')" />
        <variable name="trayName" messageType="java.lang.String"></variable>
    </variables>
    <sequence>
        <receive name="PDAFGChangePalletLocation" bounds="167,30,140,75">
            <input variable="message" type="org.jdom.Document" />
        </receive>
        <invoke name="TransactionUtil beginTransaction" type="invokebean" description="public void beginTransaction()" bounds="167,135,140,102" partnerLink="TransactionUtil" partnerLinkType="TransactionUtil" operation="beginTransaction" operationDesc="public void beginTransaction()" ignoreThrow="false" fork="false">
            <source idx="0" terminal="5,A" />
        </invoke>
        <invoke name="EventInfoUtil makeEventInfo" type="invokebean" description="public static com.cim.idm.framework.data.EventInfo makeEventInfo(java.lang.String eventName, java.lang.String eventUser, java.lang.String eventComment, java.lang.String reasonCodeType, java.lang.String reasonCode)" bounds="123,267,228,102" partnerLink="EventInfoUtil" partnerLinkType="EventInfoUtil" operation="makeEventInfo" operationDesc="public static com.cim.idm.framework.data.EventInfo makeEventInfo(java.lang.String eventName, java.lang.String eventUser, java.lang.String eventComment, java.lang.String reasonCodeType, java.lang.String reasonCode)" ignoreThrow="false" fork="false">
            <source idx="0" terminal="5,A" />
            <input variable="eventName" type="java.lang.String" />
            <input variable="eventUser" type="java.lang.String" />
            <input variable="eventComment" type="java.lang.String" />
            <input constant="" type="java.lang.String" />
            <input constant="" type="java.lang.String" />
            <output variable="eventInfo" />
        </invoke>
        <invoke name="PackingGroupServiceUtil getPackingGroupData" type="invokebean" description="public com.cim.idm.wmspackage.productpacking.management.data.ProductPacking getPackingGroupData(java.lang.String originalPalletName, java.lang.String siteName)" bounds="167,741,140,102" partnerLink="PackingGroupServiceUtil" partnerLinkType="PackingGroupServiceUtil" operation="getPackingGroupData" operationDesc="public com.cim.idm.wmspackage.productpacking.management.data.ProductPacking getPackingGroupData(java.lang.String originalPalletName, java.lang.String siteName)" ignoreThrow="false" fork="false">
            <source idx="0" terminal="5,A" />
            <input variable="palletName" type="java.lang.String" />
            <input variable="SiteName" type="java.lang.String" />
            <output variable="palletInfo" />
        </invoke>
        <switch name="switch" bounds="221,873,33,33" type="switch">
            <source idx="0" terminal="5,A" />
            <switchstart name="switchstart" type="switchstart" bounds="182,952,110,49">
                <source idx="0" terminal="5,A" />
            </switchstart>
            <case name="case" type="case" condition="getField('palletInfo','holdState') = 'Y'&#xA; or getField('palletInfo','oqaRtFlag') = 'Y'" bounds="124,1031,32,49">
                <source idx="0" terminal="5,A" />
                <expression name="expression" type="expression" bounds="70,1110,141,65">
                    <source idx="0" terminal="5,A" />
                    <function value="setVariable('holdReasonCode',getField('palletInfo', 'reasonCode'))" />
                    <function value="setField('eventInfo','reasonCode',getVariable('holdReasonCode'))" />
                </expression>
            </case>
            <otherwise name="otherwise" type="otherwise" bounds="304,1031,61,49">
                <source idx="0" terminal="5,A" />
            </otherwise>
            <switchend name="switchend" type="switchend" bounds="347,1195,110,49">
                <source idx="0" terminal="5,A" />
                <source idx="1" terminal="5,A" />
            </switchend>
        </switch>
        <expression name="expression" type="expression" bounds="332,1274,140,62">
            <source idx="0" terminal="5,A" />
            <function value="setVariable('oldLocationName',getField('palletInfo','locationName'))" />
        </expression>
        <switch name="switch" bounds="386,1366,33,33" type="switch">
            <source idx="0" terminal="5,A" />
            <switchstart name="switchstart" type="switchstart" bounds="347,1445,110,49">
                <source idx="0" terminal="5,A" />
            </switchstart>
            <case name="case" type="case" condition="isNull('oldLocationName') = 'true'&#xA; or getVariable('oldLocationName') = ''" bounds="221,1524,32,49">
                <source idx="0" terminal="5,A" />
                <empty name="empty" bounds="167,1603,140,62">
                    <source idx="0" terminal="5,A" />
                </empty>
            </case>
            <otherwise name="otherwise" type="otherwise" bounds="538,1524,61,49">
                <source idx="0" terminal="5,A" />
                <invoke name="EventInfoUtil makeEventInfo" type="invokebean" description="public static com.cim.idm.framework.data.EventInfo makeEventInfo(java.lang.String eventName, java.lang.String eventUser, java.lang.String eventComment, java.lang.String reasonCodeType, java.lang.String reasonCode)" bounds="498,1603,141,105" partnerLink="EventInfoUtil" partnerLinkType="EventInfoUtil" operation="makeEventInfo" operationDesc="public static com.cim.idm.framework.data.EventInfo makeEventInfo(java.lang.String eventName, java.lang.String eventUser, java.lang.String eventComment, java.lang.String reasonCodeType, java.lang.String reasonCode)" ignoreThrow="false" fork="false">
                    <source idx="0" terminal="5,A" />
                    <input variable="eventName" type="java.lang.String" />
                    <input variable="eventUser" type="java.lang.String" />
                    <input variable="eventComment" type="java.lang.String" />
                    <input constant="" type="java.lang.String" />
                    <input constant="" type="java.lang.String" />
                    <output variable="locationEventInfo" />
                </invoke>
                <invoke name="StorageServiceImpl modifyLocation" type="invokebean" description="public void modifyLocation(java.lang.String siteName, java.lang.String storageName, java.lang.String resourceState, java.lang.String useState, com.cim.idm.framework.data.EventInfo eventInfo)" bounds="435,1738,266,102" partnerLink="StorageServiceImpl" partnerLinkType="StorageServiceImpl" operation="modifyLocation" operationDesc="public void modifyLocation(java.lang.String siteName, java.lang.String storageName, java.lang.String resourceState, java.lang.String useState, com.cim.idm.framework.data.EventInfo eventInfo)" ignoreThrow="false" fork="false">
                    <source idx="0" terminal="5,A" />
                    <input variable="SiteName" type="java.lang.String" />
                    <input variable="oldLocationName" type="java.lang.String" />
                    <input constant="InService" type="java.lang.String" />
                    <input constant="Empty" type="java.lang.String" />
                    <input variable="locationEventInfo" type="com.cim.idm.framework.data.EventInfo" />
                </invoke>
            </otherwise>
            <switchend name="switchend" type="switchend" bounds="640,1860,110,49">
                <source idx="0" terminal="5,A" />
                <source idx="1" terminal="5,A" />
            </switchend>
        </switch>
        <invoke name="StorageServiceUtil checkLocationExist" type="invokebean" description="public com.cim.idm.wmspackage.storage.management.data.Storage checkLocationExist(java.lang.String SiteName, java.lang.String locationName)" bounds="625,1939,140,102" partnerLink="StorageServiceUtil" partnerLinkType="StorageServiceUtil" operation="checkLocationExist" operationDesc="public com.cim.idm.wmspackage.storage.management.data.Storage checkLocationExist(java.lang.String SiteName, java.lang.String locationName)" ignoreThrow="false" fork="false">
            <source idx="0" terminal="5,A" />
            <input variable="SiteName" type="java.lang.String" />
            <input variable="toLocationName" type="java.lang.String" />
            <output variable="locationInfo" />
        </invoke>
        <switch name="switch" bounds="679,2071,33,33" type="switch">
            <source idx="0" terminal="5,A" />
            <switchstart name="switchstart" type="switchstart" bounds="640,2150,110,49">
                <source idx="0" terminal="5,A" />
            </switchstart>
            <case name="case" type="case" condition="getField('locationInfo','useState') = 'Empty'&#xA; and getField('locationInfo','resourceState')  = 'InService'" bounds="423,2229,32,49">
                <source idx="0" terminal="5,A" />
                <expression name="expression" type="expression" bounds="369,2308,141,65">
                    <source idx="0" terminal="5,A" />
                    <function value="setVariable('trayName',getField('palletInfo','durableName'))" />
                </expression>
                <switch name="switch" bounds="423,2403,33,33" type="switch">
                    <source idx="0" terminal="5,A" />
                    <switchstart name="switchstart" type="switchstart" bounds="384,2482,110,49">
                        <source idx="0" terminal="5,A" />
                    </switchstart>
                    <case name="case" type="case" condition="getVariable('trayName') = ''&#xA; or isNull('trayName') ='true'" bounds="372,2561,60,19">
                        <source idx="0" terminal="5,A" />
                    </case>
                    <otherwise name="otherwise" type="otherwise" bounds="584,2561,88,19">
                        <source idx="0" terminal="5,A" />
                        <invoke name="StorageServiceUtil getStorageSpecData" type="invokebean" description="public com.cim.idm.wmspackage.storage.management.data.StorageSpec getStorageSpecData(java.lang.String siteName, java.lang.String storageName)" bounds="558,2610,141,105" partnerLink="StorageServiceUtil" partnerLinkType="StorageServiceUtil" operation="getStorageSpecData" operationDesc="public com.cim.idm.wmspackage.storage.management.data.StorageSpec getStorageSpecData(java.lang.String siteName, java.lang.String storageName)" ignoreThrow="false" fork="false">
                            <source idx="0" terminal="5,A" />
                            <input variable="SiteName" type="java.lang.String" />
                            <input variable="toLocationName" type="java.lang.String" />
                            <output variable="storageSpec" />
                        </invoke>
                        <switch name="switch" bounds="612,2745,33,33" type="switch">
                            <source idx="0" terminal="5,A" />
                            <switchstart name="switchstart" type="switchstart" bounds="573,2824,110,49">
                                <source idx="0" terminal="5,A" />
                            </switchstart>
                            <case name="case" type="case" condition="getField('storageSpec','storageOperationType') = 'Auto'" bounds="460,2903,32,49">
                                <source idx="0" terminal="5,A" />
                                <invoke name="DurableServiceImpl changeTrayLocation" type="invokebean" description="public void changeTrayLocation(java.lang.String trayName, java.lang.String locationName, java.lang.String eventComment, com.cim.idm.framework.data.EventInfo eventInfo, java.lang.String siteName)" bounds="406,2982,141,105" partnerLink="DurableServiceImpl" partnerLinkType="DurableServiceImpl" operation="changeTrayLocation" operationDesc="public void changeTrayLocation(java.lang.String trayName, java.lang.String locationName, java.lang.String eventComment, com.cim.idm.framework.data.EventInfo eventInfo, java.lang.String siteName)" ignoreThrow="false" fork="false">
                                    <source idx="0" terminal="5,A" />
                                    <input variable="trayName" type="java.lang.String" />
                                    <input variable="toLocationName" type="java.lang.String" />
                                    <input variable="eventComment" type="java.lang.String" />
                                    <input variable="eventInfo" type="com.cim.idm.framework.data.EventInfo" />
                                    <input variable="SiteName" type="java.lang.String" />
                                </invoke>
                            </case>
                            <otherwise name="otherwise" type="otherwise" bounds="751,2903,61,49">
                                <source idx="0" terminal="5,A" />
                            </otherwise>
                            <switchend name="switchend" type="switchend" bounds="573,3107,110,49">
                                <source idx="0" terminal="5,A" />
                                <source idx="1" terminal="5,A" />
                            </switchend>
                        </switch>
                    </otherwise>
                    <switchend name="switchend" type="switchend" bounds="384,3176,110,49">
                        <source idx="0" terminal="5,A" />
                        <source idx="1" terminal="5,A" />
                    </switchend>
                </switch>
                <invoke name="PackingGroupServiceImpl assignLocation" type="invokebean" description="public void assignLocation(java.lang.String palletName, java.lang.String locationName, com.cim.idm.framework.data.EventInfo eventInfo, java.lang.String siteName)" bounds="329,3255,220,102" partnerLink="PackingGroupServiceImpl" partnerLinkType="PackingGroupServiceImpl" operation="assignLocation" operationDesc="public void assignLocation(java.lang.String palletName, java.lang.String locationName, com.cim.idm.framework.data.EventInfo eventInfo, java.lang.String siteName)" ignoreThrow="false" fork="false">
                    <source idx="0" terminal="5,A" />
                    <input variable="palletName" type="java.lang.String" />
                    <input variable="toLocationName" type="java.lang.String" />
                    <input variable="eventInfo" type="com.cim.idm.framework.data.EventInfo" />
                    <input variable="SiteName" type="java.lang.String" />
                </invoke>
            </case>
            <otherwise name="otherwise" type="otherwise" bounds="922,2229,61,49">
                <source idx="0" terminal="5,A" />
                <throw name="throw" bounds="882,2308,140,62" faultName="CatchAll" variable="customException">
                    <source idx="0" terminal="5,A" />
                    <input constant="STORAGE-009" type="java.lang.String" />
                    <input variable="oldLocationName" type="java.lang.Object" />
                </throw>
            </otherwise>
            <switchend name="switchend" type="switchend" bounds="384,3377,110,49">
                <source idx="0" terminal="5,A" />
                <source idx="1" terminal="5,A" />
            </switchend>
        </switch>
        <invoke name="TransactionUtil commitTransaction" type="invokebean" description="public void commitTransaction()" bounds="371,3495,141,105" partnerLink="TransactionUtil" partnerLinkType="TransactionUtil" operation="commitTransaction" operationDesc="public void commitTransaction()" ignoreThrow="false" fork="false">
            <source idx="0" terminal="5,A" />
        </invoke>
        <invoke name="ESBService sendReplyBySender" type="invokebean" description="public void sendReplyBySender(java.lang.String replySubject, org.jdom.Document doc, java.lang.String senderName)" bounds="373,3655,141,105" partnerLink="ESBService" partnerLinkType="ESBService" operation="sendReplyBySender" operationDesc="public void sendReplyBySender(java.lang.String replySubject, org.jdom.Document doc, java.lang.String senderName)" ignoreThrow="false" fork="false">
            <source idx="0" terminal="5,A" />
            <input variable="replySubjectName" type="java.lang.String" />
            <input variable="message" type="org.jdom.Document" />
            <input constant="PDASender" type="java.lang.String" />
        </invoke>
    </sequence>
</process>

