Skip to main content

BPL ビジネス・プロセスの例

このページでは、BPL ビジネス・プロセスの例を示します。

<switch> の使用例

<switch> アクティビティ内では、実行可能な各パスに、対応する <switch> 値のラベルが自動的に付けられます。<switch> アクティビティから分岐した実行可能なパスはすべて、1 つの矢印が結合シェイプから BPL ダイアログ内の次のアクティビティに接続される手前で、結合シェイプに収束されます。

BPL switch シェイプが複数の call シェイプに接続され、これらの call シェイプが結合シェイプに収束されます

<if> の使用例 1

if のシェイプが選択され、結合を表す逆三角形が強調表示されている、BPL ダイアグラム

<if> の使用例 2

入れ子になった if シェイプを含むループの BPL ダイアグラム

<call> の使用例

この例では、3 つの異なる銀行にプライム・レートと信用承認情報を問い合わせることができます。

3 つの連続した call シェイプを含む BPL ダイアグラム

このプロセスの XML 表現は以下のとおりです。

/// Loan Approval Business Process for Bank Soprano.
/// Bank Soprano simulates a bank with great service but
/// somewhat high interest rates.
Class Demo.Loan.BankSoprano Extends Ens.BusinessProcessBPL
{

XData BPL
{
<process request="Demo.Loan.Msg.Application"
         response="Demo.Loan.Msg.Approval">

  <context>
    <property name="CreditRating" type="%Integer"/>
    <property name="PrimeRate" type="%Numeric"/>
  </context>

  <sequence>

  <trace value='"received application for "_request.Name'/>

  <assign name='Init Response'
          property="response.BankName"
          value='"BankSoprano"'>
    <annotation>
      <![CDATA[Initialize the response object.]]>
    </annotation>
  </assign>

  <call name="PrimeRate"
        target="Demo.Loan.WebOperations"
        async="1">
    <annotation>
      <![CDATA[Send an asynchronous request for the Prime Rate.]]>
    </annotation>
    <request type="Demo.Loan.Msg.PrimeRateRequest"/>
    <response type="Demo.Loan.Msg.PrimeRateResponse">
      <assign property="context.PrimeRate"
              value="callresponse.PrimeRate"/>
    </response>
  </call>

  <call name="CreditRating"
        target="Demo.Loan.WebOperations"
        async="1">
    <annotation>
      <![CDATA[Send an asynchronous request for the Credit Rating.]]>
    </annotation>
    <request type="Demo.Loan.Msg.CreditRatingRequest">
      <assign property="callrequest.TaxID" value='request.TaxID'/>
    </request>
    <response type="Demo.Loan.Msg.CreditRatingResponse">
      <assign property="context.CreditRating"
              value="callresponse.CreditRating"/>
    </response>
  </call>

  <sync name='Wait'
        calls="PrimeRate,CreditRating"
        type="all"
        timeout="10">
    <annotation>
      <![CDATA[Wait for the response from the async requests.
               Wait for up to 10 seconds.]]>
    </annotation>
  </sync>

  <switch name='Approved?'>

    <case name='No PrimeRate'
          condition='context.PrimeRate=""'>
      <assign name='Not Approved'
              property="response.IsApproved"
              value="0"/>
    </case>

    <case name='No Credit'
          condition='context.CreditRating=""'>
      <assign name='Not Approved'
              property="response.IsApproved"
              value="0"/>
    </case>

    <default name='Approved' >
      <assign name='Approved'
              property="response.IsApproved"
              value="1"/>
      <assign name='InterestRate'
          property="response.InterestRate"
          value="context.PrimeRate+10+(99*(1-(context.CreditRating/100)))">
        <annotation>
          <![CDATA[Copy InterestRate into response object.]]>
        </annotation>
      </assign>
    </default>

  </switch>

  <delay
    name='Delay'
    duration="2+($zcrc(request.Name,4)#5)">
    <annotation>
      <![CDATA[Wait for a random duration.]]>
    </annotation>
  </delay>

  <trace value='"application is "
         _$s(response.IsApproved:"approved for "_response.InterestRate_"%",
         1:"denied")'/>

  </sequence>
</process>
}

}
FeedbackOpens in a new tab