Skip to main content

BPL Business Process Example

This page provides examples of BPL business processes.

Example with <switch>

Within a <switch> activity, each possible path is automatically labeled with the corresponding <switch> value. All of the possible paths from a <switch> activity converge at a Join shape before a single arrow connects from the Join shape to the next activity in the BPL diagram.

BPL switch shape connected to multiple call shapes, which converge at a join shape

Example 1 with <if>

BPL diagram with if shape selected and inverted triangle that represents a join highlighted

Example 2 with <if>

BPL diagram of a loop that includes nested if shapes

Example with <call>

In this example, three different banks can be consulted for prime rate and credit approval information.

BPL diagram with three sequential call shapes

The XML representation of this process is as follows:

/// 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