Jarvis Pizzeria: The various Decisions of a Decision Model

In one of our next posts we will implement the Decision Model in the Order Process. Before we do that we first explain the various type of decisions that are available for a Decision Model.

The Decision Model editor in PCS (Process Cloud Service) or the later OIC (Oracle Integration Cloud) supports the DMN (Decision Modeling Notation) standard version 1.1, and uses FEEL (Friendly Enough Expression Language) to make decision modeling easier and more intuitive.

In DMN all decision logic is represented as ‘boxed expressions’. A ‘boxed expression’ is a graphical notation for decision logic. Within OIC we recognize the following boxed expressions:

The expressions in the boxes are FEEL expressions. A Decision Model is a tree of simple decisions notated as FEEL expressions. In the remainder of this blog we will give an example of the various boxed expressions.

The first example is a boolean expression with the name ‘SmallPizza’. The expression is true when the size of the pizza is ‘Small’. Otherwise it’s false.

In the second example we have the named (crustArea) expression to calculate the pizza crust area.

Next we have the if-then-else construction. Actually, this is no more than a combination of 3 expressions. The first determines which of the following 2 is returned as a result.

This construction could also be defined with the following single expression

Decision Table

The Decision Table is by far the most complex and ridge boxed expression. In this post we limit ourselves to a single example and an explanation of the available hit policies.

The following table returns the required baking time for each type of pizza. The baking time is independent of the size, except for the Quattro Stagioni, the Small pizza requires a minute less than the other sizes. To get the correct outcome from the Decision Table we have to set the hit policy. By default it is set to U(nique). But that will not work for this. There are 2 rules that a small Quarttro Stagioni meets. We want the first rule to be met. We do this by setting the hit policy to F(irst) in the upper left corner.

The following list shows the available Hit Policies. Here we are not going to treat them in detail.

The Unique hit policy is used when at most 1 rule can match the input
The Any hit policy is used when multiple rules can match the input, but the output value is the same for all matching rules
The First hit policy is used when multiple rules can match the input. The first hit by rule order is returned.
The Priority hit policy is used when multiple rules can match the input.The matching rule with the highest output priority is returned.The priority is defined by the order of output values in the decision table output column header
The Collect hit policy is used when multiple rules can match the input, and a list of output values for all the matching rules is desired
The Collect with sum hit policy is used when multiple rules can match the input, and the sum of the output values for all the matching rules is desired
The Collect with min hit policy is used when multiple rules can match the input, and the smallest output value for all matching rules is desired
The Collect with max hit policy is used when multiple rules can match the input, and the largest output value for all matching rules is desired
The Collect with count hit policy is used when multiple rules can match the input, and the count of the matching rules is desired

Next we come to the context box. A context is a list of key-value pairs.
In this example a list of 'constants'. The key must be unique, when duplicated, only the last one survives. In the example we used expressions, but it is possible to use any type that suits your needs, for example decision tables. In a context it is possible to reference entries that are defined higher in the context (like the fullname, that is using size and name).

A context is a list of key-value pairs and a list is a list of values without the key. It’s pretty straight forward.

Next is a relation. A relation is a shorthand for multiple contexts (a list of contexts).

Let’s convert this relation into a flat FEEL expression. We will do this in two steps. The first step is to present the relation as a list.

The next / second step is to transform this list into one single expression.

The last one is the function. Functions are used to get a reusable piece of code. You can feed them with parameters. A function can contain any of the other boxed types in its body. But that is not that special. Without explicitly mentioning it we already did it before. In the context we used nested expressions.

The following function checks whether the pizza size is 'Small', 'Medium' or 'Large'. If that is the case, the cooking time is calculated. For a 'Small' pizza that is 2, a 'Medium' 3 and for a 'Large' it is 4 minutes.

The ‘index of’ function returns all occurrences of the size in the list. For our solution this could only be one occurrence. We get this single occurrence as an entry in a list. That’s why the first entry is selected and convert to a string and thereafter into a number.
In this function we used a few of the available build-in functions. We won’t get into details about all of them in this blog. In a later blog we will pay special attention to these build-in functions.

Jarvis Pizzeria: Activating activities and attaining milestones

In our previous blogs we have given a brief overview of the look-and-feel of the dynamic process possibilities within PCS. In this blog we take a dive into the activation of activities, how milestones can be attained and how rules are configured to make sure that the correct actions are triggered when conditions are met.

Let's take a look at our dynamic Jarvis overview first. In the picture below we came up with three stages: ordering, preparation and delivery.

Obviously we start the preparation phase after the ordering stage has completed. This configuration is shown below:

In here we have selected the “Preparation”-stage and clicked the edit-pencil. In the “Conditions”-tab one can choose to add Activation conditions and Termination conditions. Because we want to start preparing the pizza after the order stage completes, our activation condition is configured as in the picture below:

There is no need for us to specify termination conditions. When all activities in the preparation phase are completed and when the Prepared milestone has occurred then the stage will auto-complete. A possible use-case for termination can be that an event comes in that the order has been cancelled. Let’s see how that would look like. We create a global activity “Order Cancellation” (for the example it doesn’t really matter what type of activity this is)

Now we can configure the termination condition for the preparation phase:

One might notice that our stage has two icons added to it showing the presence :

Another way of adding a condition is by means of data, hence the “Data driven” name. To do this we have to add a Data Object that tells us whether the order has been cancelled.

The orderCancelled boolean can be set by an activity to flag that the order has been cancelled. In the Termination settings we can then specify which value “orderCancelled” must have in order to meet the condition:

Which will lead to the following result:

We have configured the activation and termination conditions of the Preparation stage. The same holds for the configuration of activities.
For milestones however, we can configure when a milestone completes. In our example, the Prepared-milestone is completed when the “Prepare Pizza” activity is completed.

Note that revoking milestones is not possible. The stage of a milestone is either “Created” or “Occur”, as is depicted below:

This wraps up the blog about activation and termination. The ones familiar with Oracle ACM might notice the look-and-feel which has improved drastically. The readability of the case as a whole has become very easy. PCS dynamic processes supports the user by provisioning the drop-down boxes with all the names of the processes and activities, making the life of the developers very easy. The only noticeable difference we encountered was the lack of the possibility to revoke a milestone. However, this might end up having dynamic process that is less complicated!

Jarvis Pizzeria: The logic underneath the Dynamic Process

In our previous blog we have made the first set up of our dynamic process. We created several stages and had the first processes, human tasks and milestones in there. Now that we have the first draft of the dynamic process, it is time to actually call some processes and human tasks from our dynamic process.
In this blog we will explain how that is done. We already had imported the Preparation Process Application. But the delivery and payment are not part of this application. They are part of the overall Jarvis Pizzeria application. So before this blog, we also imported the Jarvis 1.0 application and the DeliveryDM to the new integration cloud.

When we click the edit pencil of the ‘Prepare Pizza’ step, on the right hand side, we get to see the properties of this step. Under the Process section, we select the ‘PizzaPreparationProcess’ and the ‘start’ as start event.

We repeat these steps for all the processes we want to call, for example to do the delivery we call the existing start event from the DeliveryProcess.

For human tasks, we have to set some more options than just the process to call. Here we fill in the information concerning the task. Like, to what role it will be assigned, we choose the presentation view and set a title. Basically the same properties you also fill in when calling a human task from a structured process.

Now that all the steps have been filled and are correct, we can deploy our application and check how this looks run time. Within the OIC deploying now has been renamed to activate. So lets activate our application. Clicking the blue activate button will bring us to the familiar screen formerly known as the deploy screen.

Once deployed we can start working on the instance, by going to the workspace. Within the OIC the workspace changed a bit as well, but the url is mostly the same, it can be found at: ic/process/workspace. The menu now looks like this:

Here we find a lot of familiar things. The My Tasks option will bring us to the tasklist. The Processes menu option is the one formerly known as instances. Here you find the instances of the structured processes.
The Dynamic Processes is the new runtime representation of the dynamic process, more on that later.
My Apps is the new place where you can start the different applications that you have deployed within OIC.
The Dashboard will take you to a graphical representation and gives you an insight about what is going on. More about this when we will blog about analytics within OIC.
Last but not least, the administration for changing settings concerning roles, credentials, certificates, purging, etc.

For now we will take a dive into the new Dynamic Processes option and explore an already started instance of our Dynamic Jarvis case.

The runtime environment looks different than what we are used. We get an overview of the progress of the case. We see the activities that we can start on the left and the form in the center. 
When toggling the the top component we can also get an overview of the stages and in the audit tab we can learn more about what happened to our dynamic process. 

From the left, we can start working on our process. Lets see what happens when we open the Register Order human task. 

We see that the form get started and this looks like the form that we know from the structured processes. Which makes sense, since it is the same task being reused. 

Now we can perform an action on task and see what happens to the instance. When closing the task, we get a confirmation that the action has been performed on the task. We also notice that it is gone from the activities and is no longer available to start. 

With the setting icon, we can change the filter of the activities, it is possible to look at the completed activities and they will show up with a green check that they have been completed. 

As you can see we get a good out of the box representation of the dynamic process. We can work on the process within the OIC and have an overview of what happened with the process. We see the progression and stages on top. Activities on the left and can drill in the audit trail. 
Now that we have had a look at the runtime, we can start modifying the flow. Now all the activities are becoming available at once and we can work on everything together. In the next blog we will show how to handle the stages. Work with milestones and use condition when activities can be started or are enabled.