To be able to add objects to an application based on search rules, an application has to exist beforehand. The following HowTo Guide shows how to create an application:
Using the script API_REDADM.ADD_APP_DISCOVER_RULE adds database objects based on search rules. These search rules can be defined using regular expressions without “$” and “^”. The search rules can be defined to include and exclude patterns from schemas and tables. While the inclusion patterns are mandatory, the exclusion patterns are optional. The definition of an app name and the name of the business domain are mandatory as well while a comment for a rule is optional.
EXECUTE SCRIPT API_REDADM.ADD_APP_DISCOVER_RULE(
'test_app' -- p_app_name
,'.*_TEST_.*' -- p_schema_incl_pattern
,'.*_RAW' -- p_schema_excl_pattern
,'TEST_TAB' -- p_table_incl_pattern
,NULL -- p_table_excl_pattern
,'TEST' -- p_bdomain
,'Adding objects to the Test-Application' -- p_rule_comment
);
After the discover rule has been added, it can be found in REDADM.RED_APP_DISCOVER_RULES.
Rule_id | app_name | schema_ incl_ pattern | schema_ excl_ pattern | table_ incl_ pattern | table_ excl_ pattern | bdomain | rule_ comment |
---|---|---|---|---|---|---|---|
3 | test_app | .*_TEST_.* | .*_RAW | TEST_TAB | (null) | TEST | Adding objects to the Test-Application |
To modify which objects should be added to an application the script API_REDADM.MODIFY_APP_DISCOVER_RULE can be used. To be able to modify a rule, the script needs the rule id which can be found in the table REDADM.RED_APP_DISCOVER_RULES. As the rule is identified by the rule id, the name of the rule is not necessary for the modification of it. To change the rule, one only has to provide the new value for those parameters that should be changed and a 'null' for those which should not. By providing a 'null' for any parameter the current value will be kept. In the example below only the schema exclusion pattern and the rule comment are being changed.
EXECUTE SCRIPT API_REDADM.MODIFY_APP_DISCOVER_RULE(
3 -- p_rule_id
,null -- p_schema_incl_pattern
,'.*_(RAW|BA)' -- p_schema_excl_pattern
,null -- p_table_incl_pattern
,null -- p_table_excl_pattern
,'modifying discover rule' -- p_rule_comment
);
After issuing the command above the rule entry in table REDADM.RED_APP_DISCOVER_RULES will have changed and look as follows:
Rule_id | app_name | schema_ incl_ pattern | schema_ excl_ pattern | table_ incl_ pattern | table_ excl_ pattern | bdomain | rule_ comment |
---|---|---|---|---|---|---|---|
3 | test_app | .*_TEST_.* | .*_(RAW|BA) | TEST_TAB | (null) | TEST | modifying discover rule |
An object discover rule can be removed from an application, and therefore all objects which have been added through this rule, by providing the rule id, of the rule that should be removed, to the script API_REDADM_REMOVE_APP_DISCOVER_RULE. The rule id can be found in the table REDADM.RED_APP_DISCOVER_RULES.
EXECUTE SCRIPT API_REDADM.REMOVE_APP_DISCOVER_RULE(
3 -- p_rule_id
);
The entry in the table REDADM.RED_APP_DISCOVER_RULES for the 'test_app' rule will be removed, after the script above is being issued.