The amazing world of IBM ODM and more

The amazing world of IBM ODM blog - Angello Manrique Vigil
  • HOME
  • ABOUT ME
  • CONTACT ME

Working with Lists in the XOM / BOM

Wednesday, 24 May 2017 by Angello Manrique Vigil

The XOM (Execution Object Model) and BOM (Business Object Model) are key artifacts of our Rule project. The execution object model (XOM) is the model against which you run rules, it references the application objects and data, and is the base implementation of the business object model (BOM). For more information about XOM/BOM visit the IBM Knowledge Center here.

We can generate our BOM entries from a XOM (Java or XSD) and get the objects we will verbalize for our rules. A very common requirement in a project is to work with Lists and return a populated List with values from a Rule Action or Decision Table. You will notice that after you create your BOM entry from an XOM with Lists (maxOccurs=”unbounded”) you will get an object of type java.util.Vector but with no direct relationship between the elements. Please review the following problem example and a workaround on how to fix it and implement Lists correctly.


Problem:

Let’s say you have an XSD with an element like this:

<complexType name=”RecruitsList”>
         <sequence>
                  <element name=”recruits” type=”tns:Recruit” maxOccurs=”unbounded” minOccurs=”0″></element>
         </sequence>
</complexType>

List XSD Samples XOM

After you create the BOM entry, you will get an object like this:

BOM Lists ODM sample

With no proper verbalization and without a way to use it in a Rule Action, Decision Table or Decision Tree correctly. In this example we want to add objects of type Recruit to our RecruitsList and display this list in the output of our Decision Service. Follow the steps below to implement a workaround and accomplish our goal.


Steps:

  1. Creating a new Method member
    • Let’s remove this verbalization and navigate to the Class tab.
    • We are going to create a new method to add our Objects. Click “New…” in the Members section.
    • Select “Method”, give a proper Name and “void” for Type.
    • Now add Arguments according to the Object you are going to add to your list, in our example the Recruit’s attributes. At the end you should have something like this:BOM new method member sample
    • Tip: Remember that the types have to match, if you are using a virtual value assign the corresponding type like the example. For more information about dynamic domains and virtual values read my previous post here.
    • Now we need to create a proper verbalization for our new method and implement the BOM to XOM Mapping logic.
    • Navigate to the Member Verbalization section and click “Create”. Modify the Action phrase according to your Object. In this sample:BOM method verbalization sample
    • The last and most important step is to define our BOM to XOM Mapping logic. We need to map our method arguments with the attributes of our Object, in this sample with the Recruit’s age, country, name and sex:BOM to XOM mapping logic sampleTip: Don’t forget to initialize the response list variable in your ruleflow or variableSet.

Results:

Now we are ready to use our method in any Rule and return a list structure schema in our Decision Service response!

Decision Table demonstration sample:

Decision Table method sample

After we test our rules we will see this list structure in the response (Testing with SoapUI):

BOM XOM Rule Test List SoapUI

Please feel free to comment or contact me with any doubts or feedback. Thank you!

BOMBOM2XOMJavaListsRuleDesignerSoapUIXOM
Read more
  • Published in Java, Rule Authoring, Rule Designer, Rule Execution Server (RES)
No Comments

Creating Dynamic Domains from an Excel file

Sunday, 14 May 2017 by Angello Manrique Vigil

A very common requirement in a Rule development project is to manage some data objects with dynamic domains. But wait, what are domains? A Domain places a restriction for your BOM members, this includes attributes, method arguments and classes. For more information about domains click here.

There are many ways to use Domains, the easiest way is to use Static References to define the possible values. But what if we want to have an external source to manage and update our values frecuently? Well, that’s when Dynamic Domains come in handy. In this tutorial we will focus on creating dynamic domains from an excel file.
The IBM knowledge center provides an article about this topic but without some key details that can make you spend more time than neccesary.


Steps:

    1. Creating the Domains Values Excel File
        • The Excel file must have the structure defined by the Excel Domain Provider:
          • Value column
          • Label column
          • BOM to XOM column
          • Documentation and additonal labels/documentation for other locales (Optional)
        • You can have multiple sheets, each one representing a Domain. Example: Countries, Cities, Streets, etc.
        • Each row represents a value for that particular Domain, you cannot have merged cells.
        • Here is an example of how your excel file should look like:Domains - Excel Sample
        • Tip: If you want to have the option to send a blank value use “None” or “NA” in the Values and Label columns and return “”; in the BOM to XOM column. Check the example above.
        • Save the Excel file in the resources folder or your BOM rule project.

       

    2. Creating the Dynamic Domains from the Domains Excel File
        • It is recommended to have the Domain values in a separate BOM model, or at least in a separate package from your original objects. Here is a simple example:Domains BOM structure
        • Create a class in your new BOM model for each Domain you have. In this example “CountryValues”.
        • Open the new class and expand the BOM to XOM Mapping section. In the Execution name field you need to specify the type for your Domain values, for example java.lang.String:BOM to XOM mapping section sample
        • Now you are ready to create your dynamic domains, locate the Domain section and click Create.
        • Select the Excel option under Dynamic Domains, click Next and then select your excel file.
        • Select the correct sheet for the Domain you are working on and check the “Table with Header” option to see the column header values. Now map the columns to the appropiate field, here is how your final mapping should look like:Domains configuration sample
        • The values should appear in the Domain section:Domain values list samples
        • You can update the values by modifying the Excel file and clicking “Synchronize” or at the BOM Entry level, clicking “Update”:BOM Entry sample

       

    3. Creating the virtual attribute
        • Our first intention would be to change the type our attribute to our new virtual class but this would create a duplicate of the original member and a BOM to XOM conflict error. That is why we need to create a virtual member for each attribute that is going to use Domains.
        • Create a new member in your Class editor and in the type field select the virtual class with the Domains. In this example we are going to create “countryVirtualName”:New BOM member sample
        • Verbalize the member accordingly. You will need to change Edit the subject to elaborate correct sentences for Action and Navigation fields. Remember to delete the original member verbalization.
        • Check the “Ignore for DVS” option to avoid having the virtual value being added when testing with DVS Excel testsuites.
        • And the last but most important step is to finish the BOM to XOM mapping. In Getter return the original member and in Setter assign the value to the original member. Example:BOM to XOM mapping sample

Results:

Now you are ready to use Dinamyc Domains for your BOM members like in the Decision Table sample below:

Dynamic Domains results sample

Please feel free to contact me with any queries or feedback about this article. Thank you!

BOMBOM2XOMDomainsDynamicDomainsRuleDesigner
Read more
  • Published in Domains, Rule Authoring, Rule Designer
No Comments

Recent Posts

  • RPA – UiPath: Working with Excel

    In this blog post we will talk about working wi...
  • ODM on Docker!

    If you are a DevOps enthusiast like me you prob...
  • RPA: UiPath and ODM integration

    In this technical tutorial we will have a look ...
  • Populating Decision Tables with external data sources

    One of the most used artifacts in IBM ODM is th...
  • Decision Composer, integration with Rule Designer

    In this post I will show a new way to start you...
  • Connecting to external Database with ODM API

    The IBM ODM Decision Center and the Rule Execut...
  • Custom log file with ODM API

    Given the positive feedback from previous post ...
  • Working with the Decision Center API

    In many IBM ODM rules implementation projects w...
  • Automating deployments with Ant tasks

    To deploy RuleApps to Rule Execution Server, au...
  • Editing business rules in Microsoft Office

    IBM ODM Decision Center Business Console provid...

Categories

  • Ant Tasks
  • Bluemix
  • Cloud
  • Database
  • Debug
  • Decision Center
  • Decision Operation
  • Decision Table
  • Decision Warehouse
  • Docker
  • Domains
  • Java
  • ODM API
  • RPA
  • Rule Authoring
  • Rule Designer
  • Rule Execution Server (RES)
  • Rule Solutions for Office
  • Ruleflow
  • UiPath

Recent Posts

  • RPA – UiPath: Working with Excel

    In this blog post we will talk about working wi...
  • ODM on Docker!

    If you are a DevOps enthusiast like me you prob...
  • RPA: UiPath and ODM integration

    In this technical tutorial we will have a look ...
  • Populating Decision Tables with external data sources

    One of the most used artifacts in IBM ODM is th...
  • Decision Composer, integration with Rule Designer

    In this post I will show a new way to start you...

Recent Comments

  • Mastan on Debugging a simple Ruleflow in Rule Designer
  • Angello Manrique Vigil on ODM on Docker!
  • brian on ODM on Docker!
  • Angello Manrique Vigil on Populating Decision Tables with external data sources
  • Pramod on Populating Decision Tables with external data sources

Subscribe

  • Register
  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

All rights reserved. Made by Angello Manrique Vigil.

TOP