⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atm.bpel

📁 ejb3 java session bean
💻 BPEL
📖 第 1 页 / 共 2 页
字号:
                  <otherwise>                    <!-- deny customer access -->                    <sequence name="AccessDeniedSeq">                      <!-- populate access fault -->                      <assign name="PrepareAccessDenial">                        <copy>                          <from variable="logOnReq" part="customerName" />                          <to variable="unauthorizedAccess" part="detail"                            query="/atm:unauthorizedAccess/customerName" />                        </copy>                      </assign>                      <!-- send fault back to ATM -->                      <reply name="DenyAccess" operation="logOn" partnerLink="atm"                        portType="atm:FrontEnd" variable="unauthorizedAccess"                        faultName="atm:unauthorizedAccess" />                    </sequence>                  </otherwise>                </switch>                <!-- accept account requests, one at a time -->                <while name="AccountLoop" condition="bpel:getVariableData('logged')">                  <pick name="AccountMenu">                    <onMessage operation="logOff" partnerLink="atm" portType="atm:FrontEnd"                      variable="customerMsg">                      <correlations>                        <correlation set="customerInteraction" />                      </correlations>                      <!-- turn off logged flag -->                      <assign name="SetLoggedOff">                        <copy>                          <from expression="false()" />                          <to variable="logged" />                        </copy>                      </assign>                    </onMessage>                    <onMessage operation="getBalance" partnerLink="atm" portType="atm:FrontEnd"                      variable="customerMsg">                      <correlations>                        <correlation set="customerInteraction" />                      </correlations>                      <sequence name="BalanceSeq">                        <!-- get current account balance -->                        <invoke name="QueryBalance" operation="queryBalance" partnerLink="account"                          portType="acc:AccountSystem" inputVariable="customerMsg"                          outputVariable="balanceMsg">                          <correlations>                            <correlation set="customerInteraction" pattern="out" />                          </correlations>                        </invoke>                        <!-- return balance to ATM -->                        <reply name="TellBalance" operation="getBalance" partnerLink="atm"                          portType="atm:FrontEnd" variable="balanceMsg" />                      </sequence>                    </onMessage>                    <onMessage operation="deposit" partnerLink="atm" portType="atm:FrontEnd"                      variable="balanceChange">                      <correlations>                        <correlation set="customerInteraction" />                      </correlations>                      <sequence name="DepositSeq">                        <!-- populate balance update request -->                        <assign name="PrepareDeposit">                          <copy>                            <from variable="balanceChange" part="customerName" />                            <to variable="accountOperation" part="body" query="/body/customerName" />                          </copy>                          <copy>                            <from variable="balanceChange" part="amount" />                            <to variable="accountOperation" part="body" query="/body/amount" />                          </copy>                        </assign>                        <!-- post positive balance update -->                        <invoke name="UpdateBalance" operation="updateBalance" partnerLink="account"                          portType="acc:AccountSystem" inputVariable="accountOperation"                          outputVariable="balanceMsg">                          <correlations>                            <correlation set="customerInteraction" pattern="out" />                          </correlations>                        </invoke>                        <!-- make new balance available to ATM -->                        <reply name="TellNewBalance" operation="deposit" partnerLink="atm"                          portType="atm:FrontEnd" variable="balanceMsg" />                      </sequence>                    </onMessage>                    <onMessage operation="withdraw" partnerLink="atm" portType="atm:FrontEnd"                      variable="balanceChange">                      <correlations>                        <correlation set="customerInteraction" />                      </correlations>                      <sequence name="WithdrawSeq">                        <!-- populate balance query request -->                        <assign name="PrepareBalanceQuery">                          <copy>                            <from variable="balanceChange" part="customerName" />                            <to variable="customerMsg" part="customerName" />                          </copy>                        </assign>                        <!-- get current account balance -->                        <invoke name="QueryBalance" operation="queryBalance" partnerLink="account"                          portType="acc:AccountSystem" inputVariable="customerMsg"                          outputVariable="balanceMsg">                          <correlations>                            <correlation set="customerInteraction" pattern="out" />                          </correlations>                        </invoke>                        <!-- evaluate amount that would remain in account -->                        <assign name="EvaluateNewBalance">                          <copy>                            <from                              expression="bpel:getVariableData('balanceMsg', 'balance') -                                bpel:getVariableData('balanceChange', 'amount')" />                            <to variable="newBalance" />                          </copy>                        </assign>                        <!-- decide outcome of withdraw request -->                        <switch name="BalanceDecision">                          <case condition="bpel:getVariableData('newBalance') &gt;= 0.0">                            <!-- accept withdrawal -->                            <sequence name="PositiveBalanceSeq">                              <!-- populate balance update request -->                              <assign name="PrepareWithdraw">                                <copy>                                  <from variable="balanceChange" part="customerName" />                                  <to variable="accountOperation" part="body"                                    query="/body/customerName" />                                </copy>                                <copy>                                  <from                                    expression="-bpel:getVariableData('balanceChange', 'amount')" />                                  <to variable="accountOperation" part="body" query="/body/amount" />                                </copy>                              </assign>                              <!-- post negative balance update -->                              <invoke name="UpdateBalance" operation="updateBalance"                                partnerLink="account" portType="acc:AccountSystem"                                inputVariable="accountOperation" outputVariable="balanceMsg">                                <correlations>                                  <correlation set="customerInteraction" pattern="out" />                                </correlations>                              </invoke>                              <!-- return new balance to ATM -->                              <reply name="TellNewBalance" operation="withdraw" partnerLink="atm"                                portType="atm:FrontEnd" variable="balanceMsg" />                            </sequence>                          </case>                          <otherwise>                            <!-- reject withdrawal -->                            <sequence name="NegativeBalanceSeq">                              <!-- populate withdraw fault -->                              <assign name="PrepareRejection">                                <copy>                                  <from variable="balanceChange" part="customerName" />                                  <to variable="insufficientFunds" part="detail"                                    query="/atm:insufficientFunds/customerName" />                                </copy>                                <copy>                                  <from variable="balanceMsg" part="balance" />                                  <to variable="insufficientFunds" part="detail"                                    query="/atm:insufficientFunds/amount" />                                </copy>                              </assign>                              <!-- return fault to ATM -->                              <reply name="RejectWithdraw" operation="withdraw" partnerLink="atm"                                portType="atm:FrontEnd" variable="insufficientFunds"                                faultName="atm:insufficientFunds" />                            </sequence>                          </otherwise>                        </switch>                      </sequence>                    </onMessage>                    <onAlarm for="'PT2M'">                      <!-- turn off logged flag after a period of inactivity -->                      <assign name="SetLoggedOff">                        <copy>                          <from expression="false()" />                          <to variable="logged" />                        </copy>                      </assign>                    </onAlarm>                  </pick>                </while>              </sequence>            </scope>          </onMessage>        </pick>      </while>    </scope>  </sequence></process>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -