Application Rules

The Application or API Rule is the interface between the process engine and the application, including any parameters to be passed.

Based on their usage these are categorized into three types.

·       Execution Rule: These are Business Logic executed as Task by an Activity.

·       Decision Rule: This rule returns Boolean value “True/False”, used in decision making during split/branching of transition.

·       Selection Rule: This rule fetches some value, useful to get value dynamically from a table or other source.

For example, select v_created_by from fct_expenses where id=101

Following are the available Application Rules:

·       SQL Application Rule

·       Stored Procedure Application Rule

·       Function Application Rule

·       Java Application Rule

·       Java External API Application Rule

·       Outcome Rules Application Rule

·       Expression Application Rule

·       Rest Service Application Rule

·       Attribute Expression Application Rule

·       Advanced Attribute Application Rule

·       JSON Path Expression Rule

·       JSON Read From DB Application Rule

·       JSON Write To DB Application Rule

SQL Application Rule:

This Application Rule is used to execute any SQL queries in the Process Flow.

 

 

Field Name

Description

Name

Enter a unique name for the SQL Application Rule.

Rule Type

Select the Rule Type from the drop-down list. The SQL Application Rule can be used as Decision Rule, Execution Rule or Selection Rule based on your requirement.

Execution Type

Displays the Application Execution Type as SQL.

Implementation Detail

·       Decision Rule- For Decision Rule the SQL Statement should return ‘PASS’ for success condition.

For example, select ‘PASS’ from dual where {EXPENSES} <= {THRESHOLD}

Note: {EXPENSES}, {THRESHOLD} are user defined Data Fields.

·       Execution Rule- For Execution Rule the SQL Statement can be any DML statement.

For example, update fct_expenses set expenses={EXPENSES} where id = {WF_ENTITYID}

·       Selection Rule- For Selection Rule the SQL Statement should be a Select statement which returns a list of values.

For example, select v_created_by from fct_expenses id = {WF_ENTITYID}

Return Parameter

Select the Data Field which will receive the return parameter of the SQL Rule, from the drop-down list.

·       For ExecutionRule type, the business logic is implemented in the method and the parameter value returned from the SQL Rule is saved in the mapped Data Field.

·       In case of SelectionRule type, the Java method should be a String value.

·       In case of DecisionRule type, the Java method should return Boolean values “True/False”.

Scope

Select the Scope as Process to use the Application Rule only in the current process or Package to use the Application Rule across all the processes in the package.

 

Stored Procedure Application Rule:

This Application Rule is used to call a Stored Procedure in your Process Flow.

 

Field Name

Description

Name

Enter a unique name for the SQL Application Rule.

Rule Type

Select the Rule Type from the drop-down list. The Stored Procedure Application Rule can be used as Decision Rule, Execution Rule or Selection Rule based on your requirement.

Execution Type

Displays the Application Execution Type as Stored Procedure.

Procedure Name

Enter the Stored Procedure Name.

Input Parameters

Select the list of Data Fields which will be passed as input parameters, from the drop-down list.

Parameter Mode

Enter the Parameter Mode in JSON format. For example, suppose you have given 3 parameters as input parameters, enter parameter mode as [“IN”,”IN”,”OUT”].During Execution of Stored Procedure,

·       In case of Decision Rule type, the first return parameter should return value ‘PASS’ for success evaluation.

·       In case of Selection Rule type, the first return parameter value is taken as Selection data.

·       In case of Execution Rule, the procedure return OUT parameter value overwrites the current value of respective mapped Data Field.

Scope

Select the Scope as Process to use the Application Rule only in the current process or Package to use the Application Rule across all the processes in the package.

 

 

Function Application Rule:

This Application Rule is used to call Database functions in your Process Flow.

Field Name

Description

Name

Enter a unique name for the Application Rule.

Rule Type

Select the rule type from the drop-down list. The available rule types are Decision Rule, Execution Rule and Selection Rule.

Execution Type

Displays the Application Execution Type as Function.

Function Name

Enter the Function Name.

Input Parameters

Select the list of Data Fields which will be passed as input parameters, from the drop-down list.

Parameter Mode

Enter the Parameter Mode in JSON format. For example, suppose you have given 3 parameters as input parameters, enter parameter mode as [“IN”,”IN”,”OUT”].

During Execution of Function,

·       In case of Decision Rule type, the first return parameter should return value ‘PASS’ for success evaluation.

·       In case of Selection Rule type, the first return parameter value is taken as Selection data.

·       In case of Execution Rule, the procedure return OUT parameter value overwrites the current value of respective mapped Data Field.

Return Parameter

Select the Data Field which will receive the return parameter of the Java function, from the drop-down list.

·       For ExecutionRule type, the business logic is implemented in the method and the parameter value returned from the Java method is saved in the mapped Data Field.

·       In case of SelectionRule type, the Java method should be a String value.

·       In case of DecisionRule type, the Java method should return Boolean values “True/False”.

Scope

Select the Scope as Process to use the Application Rule only in the current process or Package to use the Application Rule across all the processes in the package.

 

For Java Application Rule:

This Application Rule is used to call Java functions in your Process flow.

 

Field Name

Description

Name

Enter a unique name for the Application Rule.

Rule Type

This Rule Execution type supports only ExecutionRule type.

Execution Type

Displays the Application Execution Type as JAVA.

Implementation Detail

Enter the complete java class name which implements the Interface :

 com.ofs.aai.service.wf.external.base.Activity.

The implementation class has to override the method with the Business Logic.

executeTask(List<Data Field> Data Fields)

The Data Fields are passed by reference, so changes can be made in Data Fields value directly by the implementation class, which will be recognized by the WorkflowEngine.

Return Parameter

Select the Data Field which will receive the return parameter of the Java function, from the drop-down list.

·       For ExecutionRule type, the business logic is implemented in the method and the parameter value returned from the Java method is saved in the mapped Data Field.

·       In case of SelectionRule type, the Java method should be a String value.

·       In case of DecisionRule type, the Java method should return Boolean values “True/False”.

Scope

Select the Scope as Process to use the Application Rule only in the current process or Package to use the Application Rule across all the processes in the package.

 

The class and its dependent file (or jar) needs to be available in webcontainer class path.
For example, <TOMCAT_HOME>/webapps/<context>/WEB-INF/lib/<forecast.jar>

For Java External API Application Rule:

This Application Rule is used to call Java External API in your process flow. You need to specify the Class Name and the method of the API.

 

Field Name

Description

Name

Enter a unique name for the Application Rule.

Rule Type

Select the Rule Type from the drop-down list. The Java External API Application Rule can be used as Decision Rule, Execution Rule or Selection Rule based on your requirement.

Execution Type

Displays the Application Execution Type as JAVA External API.

Class Name

Enter the complete java class name which implements the Business Logic.

Method

Enter the method which you want to execute.

Input Parameters

You can pass Input Parameters for the method using Data Fields. Select the required Data Fields from the drop-down list.

Return Parameters

Select the Data Field which will store the Return Parameter of the method, from the drop-down list.

Scope

Select the Scope as Process to use the Application Rule only in the current process or Package to use the Application Rule across all the processes in the package.

 

NOTE

1.      The class and its dependent file (or jar) needs to be available in webcontainer class path.
For example, <TOMCAT_HOME>/webapps/<context>/WEB-INF/lib/<forecast.jar>

2.     For details on the supported API's for using as Java External APIs, see Appendix B.

For Outcome Rules Application Rule

 

Field Name

Description

Name

Enter a unique name for the Application Rule.

Rule Type

Displays the rule type as DecisionRule. This Rule Execution type supports only DecisionRule type.

Execution Type

Displays the Application Execution Type as Outcome.

Outcomes

Select the outcome for which you want to add the rule.

Scope

Select the Scope as Process to use the Application Rule only in the current process or Package to use the Application Rule across all the processes in the package.

 

Expression Application Rule

This is same as SQL execution type. You need to specify only the where clause in the Expression field. It can be any SQL expressions including ‘AND’/ ‘OR’.

 

Field Name

Description

Name

Enter a unique name for the Application Rule.

Rule Type

Select the Rule Type from the drop-down list. The Expression Application Rule can be used as Decision Rule, Execution Rule or Selection Rule based on your requirement.

Execution Type

Displays the Application Execution Type as Expression.

Expression Type

Select Expression Type as SQL to use SQL expressions or JSON to use JSON expressions.

Expression

Enter the expression in SQL format or JSON format.

Return Parameter

Select the Data Field which will receive the return parameter of the Expression, from the drop-down list.

·       For ExecutionRule type, the business logic is implemented in the method and the parameter value returned from the Application Rule is saved in the mapped Data Field.

·       In case of SelectionRule type, the Application Rule should be a String value.

·       In case of DecisionRule type, the Application Rule should return Boolean values “True/False”.

Scope

Select the Scope as Process to use the Application Rule only in the current process or Package to use the Application Rule across all the processes in the package.

 

Rest Service Application Rule

This Application Rule is used to call any Rest services (internal or external) components in your Process flow.

 

Field Name

Description

Name

Enter a unique name for the Application Rule.

Rule Type

Select the Rule Type from the drop-down list.

This Application Rule can be used as Decision Rule, Execution Rule or Selection Rule based on your requirement.

Execution Type

Displays the Application Execution Type as Rest service.

Method Type

Select the method type from the drop-down list. The options are GET and POST.

URL

Enter the REST URL that needs to be called.

For example, <IP Address/hostname of the Web Server >:<servlet port>/<context name>/restPMF/PMFService/startWorkflowProcess (A rest URL to start the workflow).

Authorization Type

Select the authorization type from the drop-down list. The options are:

·       No Auth- Select this option for rest services that does not need authorization header.

·       Basic Auth- Select this option if you want to authenticate the invocation of Rest service.

Authorization

This field is displayed only if you have selected Basic Auth as Authorization Type.

·       In case of OFSAA local user, enter the User ID only.

·       In case of an external user, enter the base 64 encoded string. For more information, see Authentication of Rest Service section.

·       In case this field is left blank, logged in user credentials will be taken as authorization header.

Note: If Authorization is given in the Header explicitly, then it will take preference than the value given in the Authorization field.

 

Query Param

Enter the Query Parameters that needs to be passed to the rest API.

For example, http://example.com/foo?bar

Headers

Enter any headers that needs to be passed to the rest API.

For example, "content-type": "application/json"

To pass the header values dynamically, use the following format:

{Content-Type:~~TYPE~~,Authorization:~~CREDENTIAL~~}

Where TYPE and CREDENTIAL are data fields.

Data

Enter if any actual data that needs to be passed to the rest API. Data can be of type RAW, JSON, Form Data and so on.

For example, "{\n \"objectid\":\"912\",\n \"objecttype\":\"1000\",\n \"infodom\":\"OFSCAPADQINFO\",\n \"segment\":\"OFSCAPADQINFO\",\n \"userid\":\"ORMUSER\",\n \"locale\":\"en_US\",\n \"securityMap\" :{},\n \"applicationParams\" :{\n \"testparam\":\"value1\",\n \"testparam2\":\"value2\"\n }\n \n}

Return Parameter

Select the Data Field which will receive the return parameter of the Expression, from the drop-down list.

·       For ExecutionRule type, the business logic is implemented in the method and the parameter value returned from the Application Rule is saved in the mapped Data Field.

·       In case of SelectionRule type, the Application Rule should be a String value.

·       In case of DecisionRule type, the Application Rule should return Boolean values “True/False”.

Scope

Select the Scope as Process to use the Application Rule only in the current process or Package to use the Application Rule across all the processes in the package.

Is Proxy required

Select Yes if proxy is required for the Rest Service. That is, if the Rest API is outside OFSAA. For information on how to enable proxy, see Enabling Proxy for REST Service Application Rule section.

 

Enabling Proxy for REST Service Application Rule

This section explains how to configure the Proxy details if it is required for the Rest Service Application Rule.

Add the following entries in the AAI_WF_GLOBAL_SETTINGS table:

 

V_PARAM_NAME

V_PARAM_VALUE

Description

PROXY_SERVER_IP

For example, www.proxy.myserver.com

Provide the IP address of the Proxy server.

PROXY_SERVER_PORT

For example, 80

Provide the port number of the Proxy server.

Authentication of Rest Service

Basic auth is supported for authentication of the rest service. You have to encode your username and password using the Online encoder (https://www.base64encode.org/) and add the encoded value in the Authorization field in the Rule Details window.  The format of user name and password to be entered in the online encoder should be username:password. For example, if we give DAVID_MLRO:oracle1, it will be converted to REFWSURfTUxSTzpvcmFjbGUx.

You can also add this as a parameter V_PARAM_1 in AAI_WF_APPLICATION_API_B table. This needs to be entered in AAI_WF_APPLICATION_API_B table as given in the following figure:

For Attribute Expression Application Rule

 

Field Name

Description

Name

Enter a unique name for the Application Rule.

Rule Type

Displays the rule type as DecisionRule. This Rule Execution type supports only DecisionRule type.

Execution Type

Displays the Application Execution Type as Attribute Expression.

Attribute

Select the attribute for which you want to define the application rule, from the drop-down list. The list displays the attributes configured for the selected application and component. For more information, see Configuring Application Object Model (AOM) section.

Click Add to add values to the selected attributes. A row is added in the Attribute Values pane. Click the Value column to select the values for the attribute from the drop-down. You can select one or more values.

You can delete a row by clicking  button.

You can select multiple attributes and click Add to assign values to those attributes.

 

For Advanced Attribute Expression Application Rule

This is an advanced version of Attribute Expression Application Rule with additional logical conditions and assignment operators. The expression can be dynamically built and will return True or False value after evaluation. This is used as a DecisionRule in transitions.

You can define this application rule with multiple conditions and nested groups.

 

 

Field Name

Description

Rule Name

Enter a unique name for the Application Rule.

AND/ OR

Select the logical operator to be used for the conditions in a group.

Add Condition

When you click Add Condition, a new row gets added. To define a condition, select the attribute, the operator and the value from the drop-down lists. Multiple values can be selected for each attribute.

·       Attribute- The drop-down list displays the attributes configured for the selected application and component. For more information, see Configuring Application Object Model (AOM) section.

·       Operator- Available options are in,=,<>,<,<=,>,>=.

·       Value- Displays the values configured for the selected attributes. Select the required value.

Click Remove Condition to delete already added condition.

Add Group

Click Add Group if you want to have nested conditions. For each group, select the required logical operator as AND or OR.

Click Remove Group to delete a group of conditions.

 

For JSON Path Expression Application Rule

This Application rule is used to extract data from the JSON Path Expression, which gets returned from a Rest API or Web Service call, and you can store it into a Data Field for further processing.

Field Name

Description

Name

Enter a unique name for the Application Rule.

Rule Type

Select the rule type from the drop-down list. The available rule types are Decision Rule and Execution Rule.

For Decision Rule, output of JSON Path Expression will be compared with RHS expression and rule will return either true or false accordingly.

For execution rule, JSON Path Expression is evaluated and the output is returned to the DataField selected as Output DataField.

Execution Type

Displays the Application Execution Type as JSON Path Expression.

JSON Input

Select the Data Field in which the output of Web Service is stored from the drop-down list. You should select a DataField which has JSON as its value.

JSON Path Expression

Enter the JSON path expression. For more information, see JsonPath Expressions section.

Operator

This field is displayed only if Rule Type is selected as Decision Rule.

Select the required operator for comparison from the drop-down list. The options are =,<,>,>= and <=.

RHS Expression

This field is displayed only if Rule Type is selected as Decision Rule.

Enter the expression to which you want to compare the JSON path expression.

Output DataField

This field is displayed only if Rule Type is selected as Execution Rule.

Select the DataField to which you want to return the value of JSON Path Expression, from the drop-down list.

Scope

Select the scope of the Application Rule from the drop-down list. The options are:

·       Process- Select Process if you want to use the Application Rule only in the current process.

·       Package- Select Package if you want to use the Application Rule across all the processes in the Application package.

Convert To Type

Select JSON ARRAY to store the output in Array format or select String to store as a string, from the drop-down list.

 

JSON Read From DB Application Rule

This Application Rule is used to read data from the database in JSON format.

 

Field Name

Description

Name

Enter a unique name for the Application Rule.

Rule Type

Only Execution Rule type is supported.

Execution Type

Displays the Execution Type as JSON Read From DB.

Table Name

Enter the table name from which you want to read the data.

Column List

Enter the column names of the selected table.

Where Condition

Enter the filter condition (where clause) of the SQL query.

Return JSON Type

Select the JSON type of the returned value as JSON Object or JSON Array based on your requirement.

·       JSON Object- Select this option if the returned value is a single row.

·       JSON Array- Select this option if the returned data has multiple rows.

Output DataField

Select the DataField to which you want to return the value of the SQL query, from the drop-down list.

Scope

Select the scope of the Application Rule from the drop-down list. The options are:

·       Process- Select Process if you want to use the Application Rule only in the current process.

·       Package- Select Package if you want to use the Application Rule across all the processes in the Application package.

 

JSON Write To DB Application Rule

This Application Rule is used to write the data in JSON format into the database.

 

Field Name

Description

Name

Enter a unique name for the Application Rule.

Rule Type

Only Execution Rule type is supported.

Execution Type

Displays the Execution Type as JSON Write To DB.

Table Name

Enter the table name to which you want to write the data in JSON format.

Source JSON

Enter the data in the JSON format that you want to write to the database.

Output DataField

This field is not applicable.

Scope

Select the scope of the Application Rule from the drop-down list. The options are:

·       Process- Select Process if you want to use the Application Rule only in the current process.

·       Package- Select Package if you want to use the Application Rule across all the processes in the Application package.