TIBCO EBX®
Rules Portfolio Add-on Documentation > User Guide
Navigation modeRules Portfolio Add-on Documentation > User Guide

Use case

Overview of use cases

This section contains use cases that demonstrate how the EBX® Rules Portfolio Add-on can meet the following business requirements:

The examples in this section do not show the Java code used for rule implementation. However, it does include add-on specific scripting language examples where applicable. See the add-on's Java API documentation, if you would like more information on coding your own Java implementation classes.

The diagram below outlines the rule creation process. A 'Rule execution' declares information about the rule such as the event on which the rule executes, a validity date range or any other context required for rule execution. A 'Rules set' allows you to declare multiple rules and attach them to a definition.

/1000000000000259000001B185842380.jpg

Use case: Preventing record deletion when relationships exist

This use case uses the 'Article' data model (shown below) and demonstrates how you can prevent users from deleting a record when:

/Preventing_Record_Deletion_When_Relatioships_Exist.png

In this case, the rule's business logic relates to the 'Articles' and 'Strategies' tables.

/Preventing_Record_Deletion_When_Relatioship_Exist_2.png

Configuring the data model

Complete the following steps to prepare the data model for rule execution:

Class

Description

com.orchestranetworks.addon.rpfl.DefaultTableTrigger

Enables use of validation and automated rules.

com.orchestranetworks.addon.rpfl.DefaultConstraintOnTable

Enables manual validation rules.

com.orchestranetworks.addon.rpfl.DefaultSchemaExtension

Enables access permission rules.

com.orchestranetworks.addon.rpfl.DefaultRulesSchemaServicePermission

Enables action permission rules if the service is declared in the schema. If the service is declared in the module.xml file, create a class to extend DefaultRulesServicePermission and add is to the module.xml services declaration.

/Configuring_The_DataModel.png

/Configuring_The_Data_Model_2.png

/Configuring_The_Data_Model_3.png

The next section describes how to create D.E.C.'s (Data Element Concepts) in the add-on.

Creating the D.E.C.s

A D.E.C. associates a specific business concept, such as a table, or a field with a rule. You can add each D.E.C. manually, or use the 'D.E.C. creation' service to automatically create them. However, manual creation can easily lead to duplication and is not a recommended practice.

The following demonstrates using the service to auto-generate the D.E.C.s:

/Creating_The_DECs.png

/Creating_The_DECs_2.png

Implementing the rule using Java

The requirements for this use case stem from the following two scenarios:

Each of the above scenarios requires its own validation type business rule, relies on a Java implementation and applies to the same data model table ('Articles' in this case). Each Java implementation contains two classes. One class defines the rule and the other defines how the rule executes. The following table outlines these two classes:

Class

Description

The rule definition class

This class has to implement the 'BusinessRuleDefinition' interface and defines the following rule information:

  • Label

  • Input

  • Output

  • Properties

  • Rule type

  • Implementation class

The rule implementation class

This class must implement the 'Rule' interface and it contains the logic to execute the rule.

Note that the following steps only demonstrate creating one of the two rules. Just repeat the same set of steps to add the second rule.

To create the business rules:

/Implement_The_Rule_Using_Java.png

After saving the record, the 'Java implementation' tab displays.

/Implement_The_Rule_Using_Java_2.png

Repeat steps one through five to create the second business rule and rule execution. Once both rules are complete, you can publish the rules portfolio and test the rules.

The following images show the error messages that display when we attempt to delete an 'Article' that is a substitute 'Article' and an 'Article' with a related 'Strategies', respectively.

/Implementing_The_Rule_Using_Java_3.jpg

/Implementing_The_Rule_Using_Java_4.jpg

Implementing the rule using a script

This section demonstrates using a script to meet the following requirements for this use case:

The following steps provide script examples for both rules, but only demonstrate creating one of the two rules. Just repeat the same set of steps to add the second rule.

To create the business rules:

/Implement_The_Rule_Using_A_Script.png

After ensuring the above properties are correct, save the record and the 'Script' tab displays.

/Implementing_The_Rule_Using_A_Script_2.png

/Implementing_The_Rule_Using_A_Script_3.png

Steps one through four are repeated to create the second business rule and rule execution. Once both rules are complete, you can publish the rules portfolio and test the rules.

The following images show the error messages that display when we attempt to delete a 'Article' with a child 'Article' and an 'Article' with a related 'Strategies', respectively.

/Implementing_The_Rule_Using_Java_3.jpg

/Implementing_The_Rule_Using_Java_4.jpg

Use case: Preventing a field from exceeding a value and auto-correcting

This use case uses the previously shown 'Article' data model and applies sample rules to the 'Product managers' table. Data model configuration for add-on compatibility and creation of the D.E.C.s followed the same processes as the previous use case. For more information about these processes, see the above sections 'Configuring the data model' and 'Creating the D.E.C.s'.

/Preventing_A_Field_From_Exceeding_A_Value.png

The next two topics show how to define a rule using Java and the built-in scripting language. Part of the rule definition includes a condition for rule execution, or 'Execution context', which defines rule requirements. When creating your own rules, not all situations require an 'Execution context'. In these cases you can simply remove the 'Execution context'. This rule enforces the following business requirement:

Configuring a Java-based rule and execution conditions

When relying on Java implementation, you select from a list of available rules previously registered with the add-on. These rules already contain programming logic required to analyze data conditions and pass a result to the add-on. Subsequently, an end-user responsible for 'Rule' and 'Rule execution' configuration does not need Java-specific programming knowledge to complete his task. If you are required to create the rules in Java and register them with the add-on, refer to the API documentation for more information.

The following steps demonstrate 'Rule' and 'Rule execution' configuration based on use case requirements:

/Configuring_A_Java_Based_Rule_And_Execution_Conditions.png

After entering the required information, click 'Save' and the 'Java implementation' tab displays.

/Configuring_A_Java_Based_Rule_And_Execution_Conditions_2.png

/Configuring_A_JavaBased_Rule_And_Execution_Condition_2.jpg

Configuring a script-based rule and execution conditions

When you use a script to define rule and execution logic, it requires the end-user to have some background programming knowledge. However, such a user can rapidly develop and implement rules by leveraging the add-on's scripting feature. This section observes the same use case conditions as the previous section, except it uses a script (examples included) to meet the requirements.

To create a rule that checks the 'Login' field value and add prefix automatically if the value does not have prefix:

/10000000000001C60000009EFDB4E605.jpg

After entering the required information, click 'Save' and the 'Script' tab displays.

/1000000000000201000000ACF1BD400C.jpg

/Configuring_A_JavaBased_Rule_And_Execution_Condition_2.jpg

Use case: Check empty field with predefined assertion rules and the execution condition

Certain situations can lend themselves to using pre-built assertion rules to create new rules. These pre-built rules are script-based and alleviate the need to hand-code Java. The following lists the available pre-built assertion rules (business rule):

For example, to check if field (F) in a table (T) is empty, configure the following rule execution:

/Check_Empty_Field_With_Predefined_Assertion_Rules.png

During execution, when the condition of execution is validated (the table field is empty), the rule executes and returns a value of 'False' which logs an error in the validation report. If the field is not empty, then the rule is not executed and no error is logged.

You can extend this type of configuration using a script to implement any execution context.

Use case: Set table permisison for a specific user using predefined assertion rules and execution conditions

The predefined assertion rules also allow you to set permisison on a data set, table, field and record. The available pre-built assertion rules (permission rules):

For example, to set table (T) hidden only for a specific user:

/Set_Table_Permission_For_A_Specific_User.png

During execution, when the condition of execution is validated (the user profile is correct), the rule executes and set hidden permission of table (T). If the user profile is not correct, then the rule is not executed and the user still has read-writer permission on table (T).

Use case: Finding an existing Java implementation

When you have many Java implementations - whether execution contexts, or rules - it can be difficult to remember their names. Without the exact name, you may not be able to locate the implementation of interest. To locate an existing implementation you can search for it by defining criteria in the search dialog.

/Finding_An_Existing_Java_Implementation.png

/Finding_An_Existing_Java_Implementation_2.png

Use case: Using the wizard to configure a rule

The rule configuration wizard offers an alternative way for you to configure rules. This option is especially helpful for new users as it eliminates some of the complexity and manual configuration steps. If you have any questions about a particular option, just open the tooltip for additional information.

The following outlines the general flow of the wizard:

/Using_The_Wizard_To_Configure_A_Rule.png

/Using_The_Wizard_To_Configure_A_Rule_2.png

/Using_The_Wizard_To_Configure_A_Rule_3.png

/Using_The_Wizard_To_Configure_A_Rule.png