JAVA

Tuesday 14 April 2020

Dynamic Domains

Dynamic Domains:

      
               IBM operational decision manager supports rule development using dynamic domains, which defined values from an Excel file or other data source.
  

Note: Simply say: If a variable consists of set of fixed values and to avoid unnecessary errors in rule  authoring we go for domains.

 

 What are dynamic domains?

        A domain places a restriction on type elements in the Business Object Model (BOM). ODM supports static, dynamic, enumerated, and complex domains. For example, enumerated domains can be used in rule editing to present valid choices to the rule author. A dynamic domain is an enumerated domain that makes use of values in an Excel file or other data source. The domain is dynamically populated from the data source. This provides the flexibility to make on-the-fly changes and then synchronize the domain and the data source.

 

Why use dynamic domains?
 

Dynamic domains offer a number of advantages to both rule developers and business users:

1)By constraining a business user's selection to a predefined set of values, rule developers can
help prevent errors.
 
2)Dynamic domains can be easily extended or modified by business users, whereas static
enumerations require IT support for changes.
 
3)Adding a value to a dynamic domain does not require a change to a rule service contract.

Creating Domains using Excel follow below steps:.

(step1:) Creating Domain Excel file:

a)    Create Domain Excel file with pre-defined and required structure by Excel domain provider.

b)    Each worksheet in the Excel file corresponds to a domain and each row in the sheet defines a domain value. Note that you cannot merge cells.

c)    Mandatory columns for each worksheet (domain) are :

1.    Value Column: Defines values of the domain provider. It creates class attributes and thus all the restrictions for java class attributes applies.
2.    Label Column: Defines the verbalization for the domain value.
3.    BOM to XOM Column: Defines the exact value to be used in rules for the domain value.
4.    Optional Columns: There are couple of optional columns which can be created in domain excel. Kindly refer to IBM Knowledge Center for more information.

Consider the below image

 
  5.place the Excel file in the resource folder of your Rule Project. Make sure your refresh the project otherwise you won’t see file in the next step.
 

step2:) Creating dynamic Domains from Excel file


1.    It is always recommended to have a separate BOM Entry for domains. Create a new BOM Entry without XOM and give a significant name to it.



2.      Open BOM editor  and add a new Class to the BOM. For each Domain, we would need to create a BOM Class in the BOM Entry.
   
                                  
3.  In BOM to XOM Mapping section of BOM Class editor, select String or relevant data-type class of domain values as Execution Class Name. 

4. Navigate to BOM Class tab and click Create a domain and select Dynamic Domains > Excel. Select Excel file, Domain sheet, Value, B2X and Label columns in the sheet.
5.When you click finish, you would be able to see all the domain values from domain sheet are now available in BOM Class as class attributes or members.
6.    Any time you make a change in your Domain sheet, you just need to synchronize at BOM Class level or at BOM Entry level by selecting option “Update the dynamic domains of this BOM entry.”
 

(c) Creating Virtual Attribute to use Domains effectively

               The Dynamic Domains are now available to be used. We can assign them directly to BOM elements Method arguments and return types etc. We should not assign Domains directly to original attributes. If we do so, we will receive “Fully qualified type name modified.” difference and the action will add a new member in BOM Class creating duplicate members. For this reason, we would be creating virtual attributes as described below.

1.     Open the BOM Class in BOM editor which has members to be assign the domains.
 
     2.    Create a new attribute for the member which needs domains to be assigned. Type of the virtual attribute should be Domain Class name.


3.Edit the newly added attribute and mark as Ignore for DVS. In BOM to XOM Mapping section of member editor, return original attribute and in setter set the value to original attribute as depicted below.
4.The final step is to remove verbalization from original attribute and verbalize the virtual attribute.

 

No comments:

Post a Comment