Library Entity Business Rule ============================ .. code-block:: http /api/repositories/{repository}/library/entities/{libraryID}/businessrules/{ruleID} .. csv-table:: :header: Parameter, Type, Purpose :widths: 20, 20, 60 :stub-columns: 1 repository, string, The name of the :doc:`repository` libraryID, int, The ID of the library entity ruleID, int, The ID of the rule .. _lebr_show: Get/Post ~~~~~~~~ .. http:get:: /api/repositories/(string:repository)/library/entities/(int:libraryID)/businessrules/(int:ruleID) :synopsis: Get details for a library business rule Get details of a business rule for a :doc:`libraryentity`. The GET request supports page and pageSize parameters on the URL. If you require a subset of this data (filtering, sorting, or columns), POST to this url with the :doc:`standard request ` body. .. code-block:: http GET /api/repositories/jupiter/library/entities/2/businessrules/1 HTTP/1.1 Accept: application/json .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, No error 500, Server error The response will be a :doc:`standard-response`. The columns array will contain the following: .. csv-table:: :header: Human Name, Column Name, Description :widths: 25, 25, 50 "Name", "actual_name", "Test name." "Description", "actual_description", "Test Description." "Threshold", "threshold_percent", "Compliance ThresholdPercentage." "Enabled", "_model_check", "True if the test is enabled." "Priority", "actual_priority", "Priority of the rule." "Priority Description", "_priority_description", "Description of the priority" "Index Control", "_model_index_control", "Compliance Threshold Percentage." "Index Threshold", "_model_index_threshold", "Compliance Threshold Percentage." "Expression", "predicate", "The Business Rule Test." "Filtering", "_model_is_filtering", "Are the rows being filtered." "Filter Expression", "_model_filter_predicate", "The Business Rule Filter." "Grouping", "_model_is_grouping", "Are the rows being grouped." "Group Function", "_model_group_function", "Business Rule Group-by function" "Aggregating", "_model_is_aggregating", "Are the rows being aggregated" "Aggregate Method", "_model_aggregate_method", "Method used to aggregate." "Aggregate Function", "_model_aggregate_function", "Business Rule Aggregate function" "Created By", "CREATED_BY", "Who created this business rule." "Date Created", "_created_date", "When this business rule was created." "Edited By", "EDITED_BY", "Who changed this business rule." "Date Changed", "_edited_date", "When this business rule was changed." "XML", "actual_predicate", "Business Rule represented in XML." "Sequence Number", "seqno", "Sequence number identifying the rule." "Identifier", "actual_uuid", "The rule identifier." "Local identifier", "_local_identifier", "A unique identifier for the rule." "Rule Categories", "_rule_categories", "Business Rule categories." "Associations", "_associations", "Are there any associations for this rule." If there isn't a business rule matching the rule ID, or the :doc:`libraryentity` does not exist, the ``rows`` array will be empty. If the rule does exist, the ``rows`` array will have a single element: .. code-block:: json { "dataRow": [ "MyRule", "", "100", "yes", "1", "{}", "Normal", "", "Row <> 0:rowid:0\r\r\n", "no", "", "no", "", "no", "", "", "bob", "2014/11/06 12:25:13", "", "", "Row <> 0:rowid:0\r\r\n", "1", "c1ca546a-5402-4f96-a428-251b6496448f", "", "", "1" ], "metadata": { "url": "/api/repositories/jupiter/library/entities/2/businessrules/1" } } .. _lebr_add: Add ~~~~ .. http:post:: /api/repositories/(string:repository)/library/entities/(int:libraryID)/businessrules/(int:ruleID) :synopsis: Edit a library business rule Add a business rule for a :doc:`libraryentity`. .. code-block:: http POST /api/repositories/jupiter/library/entities/2/businessrules HTTP/1.1 Content-Type: application/json { "command": "add", "data": { "NAME" : "Rule4", "DESCRIPTION" : "description", "ENABLED" : "1", "EXPRESSION" : "attr2>0", "FILTER_EXPRESSION" : "new2>9", "GROUP_EXPRESSION" : "new5=0", "GROUP_LIMIT" : "0", "AGGREGATE_EXPRESSION" : "acc_id<0", "AGGREGATE_METHOD" : "0", "PRIORITY" : "1", "THRESHOLD" : "100", "INDEX_CONTROL":"", "INDEX_THRESHOLD":"", "RULE_KEYWORD_ID_LIST":"1 0:2 1" } } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 204, Success 400, No command specified 400, Invalid command 400, No data received 400, Error converting data to Tcl 400, Error executing command The table below shows all the fields that are available for edit. .. csv-table:: :header: Field, Description, Values :widths: 30, 70, 70 EXPRESSION, "Humanized expression" THRESHOLD, "Numerical threshold value", Between 0 to 100 ENABLED, "Name of the library rule", 0 or 1 DESCRIPTION, "Description of the library rule" FILTER_EXPRESSION, "Humanized expression for filter" AGGREGATE_EXPRESSION, "Humanized aggregate expression" GROUP_EXPRESSION, "Humanized group expression" GROUP_LIMIT, "Numerical value for group limit" AGGREGATE_METHOD, "Name of aggregate method", 0 to 4. Here is the mapping of the number to aggregate method:0-Sum 1-Average 2-Maximum 3-Minimum and 4-Count INDEX_CONTROL, "Numeric value", 0 1 or 2. Mapping of number to index_control: 0-Normal 1-Unlimited and 2-Limited. INDEX_THRESHOLD, "Valid only if `INDEX_CONTROL` is 2" PRIORITY, "Numeric value between 1 and 10" RULE_KEYWORD_ID_LIST, "Array of keyword IDs", List of separated by colon. A value of 0 in keyword_id fields specify that the rule is attached to all the keywords of that category. | All the fields are optional. .. _lebr_edit: Edit ~~~~ .. http:post:: /api/repositories/(string:repository)/library/entities/(int:libraryID)/businessrules/(int:ruleID) :synopsis: Edit a library business rule Edit a business rule for a :doc:`libraryentity`. .. code-block:: http POST /api/repositories/jupiter/library/entities/2/businessrules/1 HTTP/1.1 Content-Type: application/json { "command": "edit", "data": { "NAME" : "Rule4", "DESCRIPTION" : "description", "ENABLED" : "1", "EXPRESSION" : "attr2>0", "FILTER_EXPRESSION" : "new2>9", "GROUP_EXPRESSION" : "new5=0", "GROUP_LIMIT" : "0", "AGGREGATE_EXPRESSION" : "acc_id<0", "AGGREGATE_METHOD" : "0", "PRIORITY" : "1", "THRESHOLD" : "100", "INDEX_CONTROL":"", "INDEX_THRESHOLD":"", "RULE_KEYWORD_ID_LIST":"1 0:2 1" } } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 204, Success 400, No command specified 400, Invalid command 400, No data received 400, Error converting data to Tcl 400, Error executing command The table below shows all the fields that are available for edit. .. csv-table:: :header: Field, Description, Values :widths: 30, 70, 70 EXPRESSION, "Humanized expression" THRESHOLD, "Numerical threshold value", Between 0 to 100 ENABLED, "Name of the library rule", 0 or 1 DESCRIPTION, "Description of the library rule" FILTER_EXPRESSION, "Humanized expression for filter" AGGREGATE_EXPRESSION, "Humanized aggregate expression" GROUP_EXPRESSION, "Humanized group expression" GROUP_LIMIT, "Numerical value for group limit" AGGREGATE_METHOD, "Name of aggregate method", 0 to 4. Here is the mapping of the number to aggregate method:0-Sum 1-Average 2-Maximum 3-Minimum and 4-Count INDEX_CONTROL, "Numeric value", 0 1 or 2. Mapping of number to index_control: 0-Normal 1-Unlimited and 2-Limited. INDEX_THRESHOLD, "Valid only if `INDEX_CONTROL` is 2" PRIORITY, "Numeric value between 1 and 10" RULE_KEYWORD_ID_LIST, "Array of keyword IDs", List of separated by colon. A value of 0 in keyword_id fields specify that the rule is attached to all the keywords of that category. | All the fields are optional. .. _lebr_delete: Delete ~~~~~~ .. http:delete:: /api/repositories/(string:repository)/library/entities/(int:libraryID)/businessrules/(int:ruleID) :synopsis: Execute commands against a business rule Delete a library business rule from a library entity. .. code-block:: http DELETE /api/repositories/jupiter/library/entities/2/businessrules/1 HTTP/1.1 Content-Type: application/json { "disassociate": ["4"] } The ``disassociate`` key, if specified, will have an array of :doc:`entity` IDs to disassociate on deleting the library business rule. When a library business rule is deleted, it may be disassociated from any :doc:`entity` it is associated with. If a rule is not disassociated from the :doc:`entity`, the rule is also deleted from the :doc:`entity` as well as from the library. .. csv-table:: :header: Response Code, Reason :widths: 25, 75 204, Success