Listing 1 BPEL "Flat" Code Snippet

001 <process>
002  <variables>
003   <variable name="state" type="ns2:string"/>
004   <variable name="capturingState" type="ns2:string"/>
005   <variable name="investigatingState" type="xsd:string"/>
006   <variable name="chargingBackState" type="xsd:string"/>
007   <variable name="loopContinue" type="ns2:boolean"/>
008   AND OTHERS
009  </variables>
010  <sequence>
011   <receive partnerLink="client" operations="submitted" />
012   <assign name="initVars">
013    <copy>
014     <from expression="string('Capturing')"/> <to variable="state"/>
015    </copy>
016    <copy>
017     <from expression="string('InitiallyCaptured')"/>
018     <to variable="capturingState"/>
019    </copy>
020    <copy>
021     <from expression="string('FullyCaptured')"/>
022     <to variable="investigatingState"/>
023    </copy>
024    <copy>
025     <from expression="string('ChargedBack')"/> <to variable="chargingBackState"/>
026    </copy>
027    <copy>
028     <from expression="true()"/><to variable="loopContinue"/>
029    </copy>
030   </assign>
031   <while condition="bpws:getVariableData('loopContinue')=true()">
032    <switch name="topStateSwitch">
033     <case condition="bpws:getVariableData('state')='Rejected'  or
034                      bpws:getVariableData('state')='WrittenOff' or
035                      bpws:getVariableData('state')='Won' or
036                      bpws:getVariableData('state')='Lost'">
037      <sequence>
038       <invoke partnerLink="client" operation="completed" />
039       <assign name="setDone">
040        <copy>
041         <from expression="false()"/><to variable="loopContinue"/>
042        </copy>
043       </assign>
044      </sequence>
045     </case>
046     <case condition="bpws:getVariableData('state')='Capturing'">
047      OMITTED
048     </case>
049     <case condition="bpws:getVariableData('state')='Investigating'">
050      <switch>
051       <case condition=
052        "bpws:getVariableData('investigatingState')='FullyCaptured'">
053        <sequence>
054         <invoke partnerLink="ops" operation="pickup"/>
055         <pick>
056          <onMessage operation="rejected" partnerLink="ops">
057           <assign name="setState">
058            <copy>
059             <from expression="string('Rejected')"/>
060             <to variable="state"/>
061            </copy>
062           </assign>
063          </onMessage>
064          <onMessage operation="writtenOff" partnerLink="ops">
065           <assign name="setState">
066            <copy>
067             <from expression="string('WrittenOff')"/>
068             <to variable="state"/>
069            </copy>
070           </assign>
071          </onMessage>
072          <onMessage operation="chargedBack" partnerLink="ops">
073           <assign name="setState">
074            <copy>
075             <from expression="string('ChargingBack')"/>
076             <to variable="state"/>
077            </copy>
078           </assign>
079          </onMessage>
080          <onMessage operation="requestedDocs" partnerLink="ops">
081           <assign name="setState">
082            <copy>
083             <from expression="string('AwaitingDraft')"/>
084             <to variable="investigatingState"/>
085            </copy>
086           </assign>
087          </onMessage>
088         </pick>
089        </sequence>
090       </case>
091       <case condition=
092        "bpws:getVariableData('investigatingState')='AwaitingDraft'">
093        <sequence>
094         <invoke partnerLink="net" operation="requestDraft"/>
095         <pick>
096          <onMessage operation="draft" partnerLink="net">
097           <assign name="setState">
098            <copy>
099             <from expression="string('ExaminingDraft')"/>
100             <to variable="investigatingState"/>
101            </copy>
102           </assign>
103          </onMessage>
104          <onAlarm ...>
105           <assign name="setState">
106            <copy>
107             <from expression="string('ChargingBack')"/>
108             <to variable="state"/>
109            </copy>
110           </assign>
111          </onAlarm>
112         </pick>
113        </sequence>
114       </case>
115       <case condition=
116        "bpws:getVariableData('investigatingState')='ExaminingDraft'">
117        OMITTED
118       </case>
119       <case condition=
120        "bpws:getVariableData('investigatingState')='AwaitingCustOnDraft'">
121        OMITTED
122       </case>
123       <case condition=
124        "bpws:getVariableData('investigatingState')='ExaminingCustOnDraft'">
125        OMITTED
126       </case>
127       <otherwise>
128        <throw name="throwUp" faultName="bpws:selectionFailure"/>
129       </otherwise>
130      </switch>
131     </case>
132     <case condition="bpws:getVariableData('state')='ChargingBack'">
133      OMITTED
134     </case>
135     <case condition="bpws:getVariableData('state')='Cancelled'">
136      OMITTED
137     </case>
138     <otherwise>
139      <throw name="throwUp" faultName="bpws:selectionFailure"/>
140     </otherwise>
141    </switch>
142   </while>
143  </sequence>
144 </process>