Red Hat Training

A Red Hat training course is available for Red Hat Process Automation Manager

Chapter 5. Creating the MortgageApprovalProcess business process

A business process is a graph that describes the order in which a series of steps must be executed using a flow chart. A business process consists of a collection of nodes that are linked to each other using connections. Each of the nodes represents one step in the overall process while the connections specify how to transition from one node to the other.

The Mortgage Process sample project contains a predefined MortgageApprovalProcess business process. For this tutorial, you will delete the existing MortgageApprovalProcess business process and recreate it to gain a better understanding of creating a business process.

5.1. Delete the existing business process

Procedure

You must delete the sample business process before you can create your own.

Procedure

  1. Log in to Business Central and click MenuDesignProjects, then click Mortgage Process.
  2. Input MortgageApprovalProcess.bpmn in to the project’s asset search box and click on the MortgageApprovalProcess business process.
  3. Click Delete in the upper-right corner, then click Proceed in the Usages notification window.
  4. Click Delete to confirm that you want to delete this asset.

5.1.1. Validating the mortgage

The mortgage validation business process determines whether or not the new application contains the required data before proceeding. If all of the specified data requirements are met, the application will move on to the mortgage calculation business process.

Procedure

  1. Log in to Business Central and click MenuDesignProjects, then click Mortgage Process.
  2. Click Add AssetBusiness Process.
  3. Enter the following values:

    • Business Process: MortgageApprovalProcess
    • Package: Select com.myspace.mortgage_app
  4. Click Ok. The diagram editor opens.
  5. In the upper-right corner, click the Diagram properties diagram properties icon.
  6. Scroll down and expand Process Data and click btn plus in the Process Variables section.
  7. Enter the following values:

    • Name: application.
    • Data Type: Application [com.myspace.mortgage_app]
  8. Click Save, then Save, to confirm your changes.

5.1.2. Creating outgoing connections

This section describes how to create an outgoing connection from the start event to an exclusive gateway and then from the exclusive gateway to the business rule task. Exclusive gateways are used to make decisions and react to events based on the available data. A business rule task represents a set of rules that must be evaluated.

Red Hat Process Automation Manager contains a predefined selection of node types to simplify business process creation. The predefined node panel is located on the left side of the diagram editor. Click on the various node icons to reveal the available options as shown here.

node panel

Procedure

  1. Click on the start event and create an outgoing connection from the start event to an exclusive gateway.

    exclusive gateway
  2. Create an outgoing connection from the exclusive gateway to a business rule task.

    create task
    bus rule task
  3. Click on the task and enter Validation in the Name field of the Diagram properties panel.
  4. Expand Implementation/Execution, select validation in the Rule Flow Group field.
  5. Scroll down and expand the Data Assignments section and click btn assign next to Assignments.
  6. In the Validation Data I/O window, click Add to create the following assignments:

    • Data Inputs and Assignments:

      • Name: Application
      • Data Type: Application [com.myspace.mortgage_app]
      • Source: Application
    • Data Outputs and Assignments:

      • Name: Application
      • Data Type: Application [com.myspace.mortgage_app]
      • Target: Application

        val data io
  7. Click Save.
  8. In the diagram editor, click Save, then Save, to confirm your changes.

5.1.3. Defining the validation data

This section describes how to define the data that will determine whether the application data is correct or if there is an error or any missing information.

Procedure

  1. Click on the Validation task and create an outgoing connection to an exclusive gateway.

    exclusive gateway
  2. Create an outgoing connection from the exclusive gateway to a new Business Rule Task.

    new br task
  3. Click the created connection.

    created connection
  4. In the Diagram Properties panel, input Invalid in the Name field.
  5. Expand Implementation/Execution, select and enter:

    • Condition Expression: ValidationErrorDO()
    • Condition Expression Language: drools
  6. Click on the Business Rule Task and enter retractValidation in the Name field of the Diagram properties panel.
  7. Expand Implementation/Execution, select New and enter error in the Rule Flow Group field.
  8. Click the Business Rule Task you created and define:

    • Name: retractValidation
    • Rule Flow Group: error
  9. Create an outgoing connection from the retractValidation task to a user task.

    user task
  10. Click the user task and in the Diagram Properties panel, input Correct Data in the Name field.
  11. Expand Implementation/Execution and enter:

    • Task Name: CorrectData
    • Groups: broker
  12. Click btn assign next to Assignments. In the Correct Data Data I/O window, click Add to create the following assignments:

    • Input assignment:

      • Name: application
      • Data Type: Application [com.myspace.mortgage_app]
      • Source: application
    • Output assignment:

      • Name: application
      • Data Type: Application [com.myspace.mortgage_app]
      • Target: application
  13. Click Save.
  14. In the diagram editor, click Save, then Save, to confirm your changes.
  15. Connect the Correct Data back to the first exclusive gateway. Your workflow should look similar to the following diagram:

    workflow1

5.1.4. Calculating the mortgage

The mortgage calculation business process determines the applicant’s mortgage borrowing limit.

Procedure

  1. Return to the second exclusive gateway. Create an outgoing connection to a Business Rule Task.

    second gateway
  2. Click the created connection.

    drools valid
  3. Click the user task and in the Diagram Properties panel, input Valid in the Name field.
  4. Expand Implementation/Execution, select and enter:

    • Condition Expression: not ValidationErrorDO()
    • Condition Expression Language: drools
  5. Expand Implementation/Execution, select and enter mortgagecalculation in the Rule Flow Group field.
  6. Click btn assign next to Assignments. In the Mortgage Calculation Data I/O window, click Add to create the following assignments:

    • Input assignment:

      • Name: application
      • Data Type: Application [com.myspace.mortgage_app]
      • Source: application
    • Output assignment:

      • Name: application
      • Data Type: Application [com.myspace.mortgage_app]
      • Target: application
  7. Click Save.
  8. Click the created Business Rule Task and in the Diagram Properties panel, input Mortgage Calculation in the Name field.
  9. Click on an empty space on the canvas, scroll down, expand Process Data, and click btn plus next to Process Variables. Enter the following values:

    new proc var
    • Name: inlimit
    • Date Type: Boolean
  10. Create an outgoing connection from the Mortgage Calculation task to a user task.

    qualify task
  11. Click on the user task and enter Qualify in the Name field.
  12. Expand Implementation/Execution and enter:

    • Task Name: Qualify
    • Groups: approver
    • Click btn assign next to Assignments. In the Qualify Data I/O window, click Add to create the following assignments:

      • Input assignments:

        • Name: application
        • Data Type: Application [com.myspace.mortgage_app]
        • Source: application
        • Name: inlimit
        • Data Type: Boolean
        • Source: inlimit
      • Output assignments:

        • Name: application
        • Data Type: Application [com.myspace.mortgage_app]
        • Target: application
        • Name: inlimit
        • Data Type: Boolean
        • Source: inlimit
  13. Click Save. Above the canvas, click Save, then Save, to confirm your changes.
  14. Create an outgoing connection from the Qualify task to an exclusive gateway.

    1. Click on the GATEWAYS icon in the node panel.
    2. Click on Exclusive and drag it to the right of the Qualify task.
  15. Create an outgoing connection from the exclusive gateway and connect it to a user task.
  16. Click the connection, name it in Limit and define the following Java Condition expression:

    return inlimit;
    inlimit true
  17. Click the user task and define:

    • Name: Final Approval
    • Task Name: finalapproval
    • Groups: manager
  18. Click btn assign next to Assignments. In the Final Approval Data I/O window, click Add to create the following assignments:

    • Input assignments:

      • Name: Application
      • Data Type: Application [com.myspace.mortgage_app]
      • Source: Application
      • Name: inlimit
      • Data Type: Boolean
      • Source: inlimit
    • Output assignment:

      • Name: Application
      • Data Type: Application [com.myspace.mortgage_app]
      • Target: Application
  19. Click Save. Above the canvas, click Save, then Save, to confirm your changes.

5.1.5. Increasing the down payment

The increasing the down payment business process checks to see if the applicant qualifies for the loan by increasing their down payment. The final result will be either the final loan approval, or loan denial based on the applicant’s inability to increase the down payment.

Procedure

  1. Create an outgoing connection from the Final Approval user task and connect it to an end event.

    create end
    end event
  2. Return to the exclusive gateway that connects with the Final Approval user task. Create a second outgoing connection and connect it to a new user task.

    new task
  3. Click the connection, name it Not in Limit and define the following Java expression:

    return !inlimit;
    not inlimit
  4. Click on an empty space on the canvas, scroll down, expand Process Data, and click btn plus next to Process Variables. Enter the following values:

    • Name: incdownpayment
    • Data Type: Boolean

      proc var new
  5. Click the created user task and define:

    • Name: Increase Down Payment
    • Task Name: incdown
    • Groups: broker
    • Click btn assign next to Assignments. In the Increase Down Payment Data I/O window, click Add to create the following assignments:

      • Input assignments:

        • Name: Application
        • Data Type: Application [com.myspace.mortgage_app]
        • Source: Application
      • Output assignment:

        • Name: Application
        • Data Type: Application [com.myspace.mortgage_app]
        • Target: Application
        • Name: incdownpayment
        • Data Type: Boolean
        • Target: incdownpayment
  6. Click Save. Above the canvas, click Save, then Save, to confirm your changes.
  7. Create an outgoing connection from the Increase Down Payment task to an exclusive gateway.

    1. Click on the GATEWAYS icon in the node panel.
    2. Click on Exclusive and drag it to the right of the Increase Down Payment task.
  8. Click on the Create Sequence Flow icon to create a connection to the exclusive gateway.

    connection icon2
  9. Create an outgoing connection from the exclusive gateway and connect it to an end event. Then, click the connection, name it Down payment not increased, and create the following Java expression:

    return !incdownpayment;
  10. Create an outgoing connection from the exclusive gateway and connect it to the first exclusive gateway. Then, click the connection, name it Down payment increased, and create the following Java expression:

    return incdownpayment;
  11. Above the canvas, click Save, then Save, to confirm your changes.

The final version of the business process:

finalBP