Skip to content

10. Vacation Days - Use case and project creation

In this lab you'll try out the combination of DMN decision tables with literal expressions. You will also explore a number of different FEEL constructs and expressions like, for example, ranges. Finally, you'll learn how to deploy the solution as a sample to OpenShift.

10.1 Goal

  • Implement a DMN model using the IBM Business Automation Manager Canvas DMN editor
  • Deploy the existing DMN project to OpenShift
  • Consume the DMN project using the REST API

10.2 Problem Statement

In this lab we will create a decision service that determines the number of vacation days assigned to a given employee. The number of vacation days depends on age and years of service.

  • Every employee receives at least 22 days.

  • Additional days are provided according to the following criteria which will be broken into separate decision nodes:

    1. Only employees younger than 18 or at least 60 years, will receive 5 days of vacation or employees with at least 30 years of service will receive an 7 extra days;

    2. Employees with at least 30 years of service get 4 more days and also employees of age 60 or more, receive 3 extra days, on top of possible additional days already given;

    3. If an employee has at least 15 but less than 30 years of service, 3 extra days are given. Two days are also provided for employees of age 45 or more. These extra days can not be combined with the 5 extra days.

When using IBM Business Automation Manager Canvas you can start from the decision model creation and work top-down to deliver your decision model. This is a feature that will enable you to create the decision model and publish a sample project to your Git provider. From here the project can be deployed in your traditional means or you can also utilize a sample service that IBM Business Automation Manager Canvas can create if you desire for testing purposes. To do this, you need to make sure your connection to GitHub is active with the token and from there you can jump right in!

In this section we will link your GitHub account to the IBM Business Automation Manager Canvas so we can easily synchronize changes in DMN with GitHub and our tooling, in this case IBM Business Automation Manager Canvas.

  1. First click the User icon to connect your public GitHub account to the IBM Business Automation Manager Canvas.

    Github setup

  2. Click the Connect to an account button to add a new Git provider

    Canvas connect a new account

  3. Select the card for GitHub

    Select GitHub to connect your GitHub account Token

  4. Click Generate new token to create a new token that will be used by IBM Business Automation Manager Canvas

    Token Generate

  5. You can use similar properties to the token created below in the screenshot, but the main 2 to have right now are repo and gist - the others can be beneficial if you reuse this token for other purposes too, but are not required nor needed. You can change the date to never expiring or be as short as you want. Once the token is generated though, that is the only time you will see the actual token value.

    • Name: Name your token a unique name from any previously created
    • Expiration: This can either be a set time period, up to 1 year or never expiring
    • The checkboxes you need are repo and gist to get the full benefit of IBM Business Automation Manager Canvas

    Token Properties

  6. Use the copy button that's created with the Token to use in IBM Business Automation Manager Canvas.

    Copy token

  7. Return to IBM Business Automation Manager Canvas and insert the Token into the wizard.

    Insert token

  8. When your token is pasted, the IBM Business Automation Manager Canvas will return a similar screen to below towards your GitHub account signifying you've connected, your GitHub user ID and some extra details.

    Successfully linked Git


10.3.2 Create a DMN Model and Create a Project in IBM Business Automation Manager Canvas

Now that our account is linked, let's go ahead and create a new DMN model and then later produce a project for it that will reside in our GitHub repositories. IBM Business Automation Manager Canvas provides an excellent way to both push and pull from your GitHub repositories. This methodology provides a true canvas over your process and decision models that sits on top of your artifact repositories as a means of seeing/creating/editing some of your most important assets for process and decision services. From IBM Business Automation Manager Canvas, you can create and edit various types of open-standards models in BPMN, DMN and PMML using the editors here. The editors are based on the standards, so if your model follows the standards, it will make a best effort representation of them to be able to edit. In theory a different DMN model written for another DMN platform would be editable if it follows the specification. In this lab you will see how we can use these editors to produce a model and a project that's ready to be deployable in OpenShift.

  1. Navigate to http://localhost:9090/# and we will start creating a DMN model for a Vacation Days Decision. This will provide some of the basics of a DMN decision and start getting you acquainted to IBM Business Automation Manager Canvas and DMN in general. This can either be done from the bookmark from Chrome on the desktop or by navigating to https://localhost:9090/ on the provided image.

    Chrome Bookmark

  2. From the IBM Business Automation Manager Canvas landing page, you can create and edit various types of open-standards models in BPMN, DMN and PMML using the editors here. We will be creating a DMN model for this lab, so to do this, you can click New Decision to create a new DMN model.

    IBM Business Automation Manager Canvas Welcome Screen

  3. You will now have an empty canvas and can start working on your DMN model for designing the number of vacation days decision. Change the name at the top of the model from Untitled to vacation-days or whatever you want to call it.

    Change the name of the model

  4. In the next section we will start to create the decision.


Last update: 2023-12-21