com.ibm.wbiserver.brules.mgmt

Interface Operation

All Superinterfaces:
BusinessRuleChangeDetector, BusinessRuleValidateable, java.io.Serializable

  1. public interface Operation
  2. extends BusinessRuleValidateable, BusinessRuleChangeDetector, java.io.Serializable
An object implementing this interface represents an operation of a business rule group. An operation can have one or more potential targets. Which target is invoked when the operation is invoked is determined by a selection algorithm based on date. Each target is a business rule, which can be either a ruleset or a decision table. There can be one default business rule target that is invoked if no other targets are found. There can also be 0 or more business rule targets that are selected based on date/time. Each of these targets has a date range associated with it. If the date in question falls within the specified date range for the target, then that target business rule is invoked. Each of these targets is represented by an OperationSelectionRecord object associated with the Operation. Methods are provided to make changes to all of these possible targets.

An Operation also has an available targets list. This is a list of all business rules that are valid targets for this operation. The available targets list is a superset of the set of targets that are specified as either the default or with an associated date range. This means that there can be business rules in the available targets list that are not currently specified as a target. The available targets list cannot be updated directly. The only way to change the available targets list is to create a new business rule by copying an existing one. The new business rule is implicitly adding to the appropriate available targets list.


Field Summary

Modifier and Type Field and Description
  1. static
  2. java.lang.String
COPYRIGHT

Method Summary

Modifier and Type Method and Description
  1. BusinessRuleGroup
getAssociatedBusinessRuleGroup()
Get the business rule group that this operation is associated with.
  1. java.util.List<BusinessRule>
getAvailableTargets()
Get the list of available target business rules for this operation.
  1. java.util.List<BusinessRule>
getBusinessRulesByName(java.lang.String name,QueryOperator op,int numberToSkip,int maxToReturn)
Get business rules associated with the operation using the name as a key.
  1. java.util.List<BusinessRule>
getBusinessRulesByTNS(java.lang.String tns,QueryOperator op,int numberToSkip,int maxToReturn)
Get business rules for this operation that have the specified target name space.
  1. java.util.List<BusinessRule>
getBusinessRulesByTNSAndName(java.lang.String tns,QueryOperator tnsOp,java.lang.String name,QueryOperator nameOp,int numberToSkip,int maxToReturn)
Get business rules associated with this operation using the target name space and name as a key.
  1. BusinessRule
getDefaultBusinessRule()
Get the default business rule for this operation.
  1. java.lang.String
getDescription()
Get the description of the operation.
  1. java.lang.String
getName()
Get the name of the operation.
  1. OperationSelectionRecordList
getOperationSelectionRecordList()
Get the selection records associated with this operation.
  1. void
setDefaultBusinessRule(BusinessRule newDefaultBusinessRule)
Set the default business rule for this operation.
Methods inherited from interface com.ibm.wbiserver.brules.mgmt.BusinessRuleValidateable
validate
Methods inherited from interface com.ibm.wbiserver.brules.mgmt.BusinessRuleChangeDetector
hasChanges

Field Detail

  1. static final java.lang.String COPYRIGHT
See Also:

Method Detail

getName

  1. java.lang.String getName()
Get the name of the operation.
Returns:
The name of the operation.

getDescription

  1. java.lang.String getDescription( )
Get the description of the operation.
Returns:
The description of the operation.

getDefaultBusinessRule

  1. BusinessRule getDefaultBusinessRule( )
Get the default business rule for this operation. This is the business rule that is invoked if no date-based target is found.
Returns:
The default business rule for this operation. Can be null if this operation has no default business rule.

setDefaultBusinessRule

  1. void setDefaultBusinessRule(BusinessRule newDefaultBusinessRule)
  2. throws ValidationException
Set the default business rule for this operation. This is the business rule that is invoked if no date-based target is found.
Parameters:
newDefaultBusinessRule - The new default business rule for this operation. If null, then this operation will have no default business rule.
Throws:
ValidationException - if the new default business rule is not in the available targets list for this operation.
ChangesNotAllowedException - if changes to this object are temporarily disallowed while other changes are being published.

getAvailableTargets

  1. java.util.List<BusinessRule> getAvailableTargets( )
Get the list of available target business rules for this operation. This is the list of business rules that can be used as targets for this operation. Each BusinessRule can be either a RuleSet or a DecisionTable.
Returns:
A List of BusinessRule objects representing the list of available target business rules for this operation. The returned List is unmodifiable. If a method is called that tries to change the List, an UnsupportedOperationException is thrown. The internal List can be changed implicitly by other operations. Therefore if the client code is multi-threaded, it is recommended that the client synchronize on the returned List object while accessing it. Internally the Operation class synchronizes on the List whenever it is modified.
See Also:

getBusinessRulesByTNS

  1. java.util.List<BusinessRule> getBusinessRulesByTNS( java.lang.String tns,
  2. QueryOperator op,
  3. int numberToSkip,
  4. int maxToReturn)
  5. throws BusinessRuleManagementException
Get business rules for this operation that have the specified target name space. This is a conveneince method that allows the user to perform a query based on the target name space property by calling one method rather than setting up a query tree using the APIs defined in the com.ibm.wbiserver.brules.mgmt.query package. The query is performed using the specified target name space string and the specified operator.

For example, the following invocation:

    List<BusinessRule> result = op.getBusinessRulesByTNS("%www.ibm.com/test%", QueryOperator.LIKE, 0, 0);
 
is equivalent to doing the following:
    PropertyQueryNode node = QueryNodeFactory.createPropertyQueryNode(QueryNodeFactory.PROPERTY_NAME__TARGET_NAME_SPACE, QueryOperator.LIKE, "%www.ibm.com/test%");
    List<BusinessRule> result = op.getBusinessRulesByProperties(node, 0, 0);
 

The numberToSkip and maxToReturn parameters can be used together to implement paging where only a certain number of business rules is returned with each invocation. This could be useful in situations where there are many business rules and you don't want to wait for them all to be returned. For example, to get the business rules in separate groups each containing 20 business rules you would pass 0 for numberToSkip and 20 for maxToReturn on the first invocation. On the second, you would pass 20 and 20. On the third 40 and 20, and so on.

Parameters:
tns - The target name space string to query on. This string may contain the wildcard characters '%' and '_' as used in SQL.
op - The operator to be used in the query. This specifies whether, for example, the query should be an exact match query or a "like" query using wildcards.
numberToSkip - The number of business rules to skip. If this number is greater than 0, then the specified number of business rules will be skipped and not returned by this invocation of the method. A negative or 0 value indicates that all business rules are to be returned.
maxToReturn - The maximum number of business rules to return. If this number is greater than 0, then at most the specified number of business rules will be returned by this invocation of the method. A negative or 0 value indicates that all business rules will be returned starting with the first non-skipped business rule to the end of the results.
Returns:
A List of BusinessRule objects representing the business rules associated with this operation that have target name spaces matching the specified query. If the maxToReturn parameter is greater than 0, then this list will contain at most maxToReturn business rules.
Throws:
BusinessRuleManagementException - if an unexpected error is detected.
See Also:

getBusinessRulesByName

  1. java.util.List<BusinessRule> getBusinessRulesByName( java.lang.String name,
  2. QueryOperator op,
  3. int numberToSkip,
  4. int maxToReturn)
  5. throws BusinessRuleManagementException
Get business rules associated with the operation using the name as a key. This is a conveneince method that allows the user to perform a query based on the name property by calling one method rather than setting up a query tree using the APIs defined in the com.ibm.wbiserver.brules.mgmt.query package. The query is performed using the specified name string and the specified operator.

For example, the following invocation:

    List<BusinessRule> result = op.getBusinessRulesByName("ChristmasSaleRule%", QueryOperator.LIKE, 0, 0);
 
is equivalent to doing the following:
    PropertyQueryNode node = QueryNodeFactory.createPropertyQueryNode(QueryNodeFactory.PROPERTY_NAME__NAME, QueryOperator.LIKE, "ChristmasSaleRuleGroup%");
    List<BusinessRule> result = op.getBRGsByProperties(node, 0, 0);
 

The numberToSkip and maxToReturn parameters can be used together to implement paging where only a certain number of business rules is returned with each invocation. This could be useful in situations where there are many business rules and you don't want to wait for them all to be returned. For example, to get the business rules in separate groups each containing 20 business rules you would pass 0 for numberToSkip and 20 for maxToReturn on the first invocation. On the second, you would pass 20 and 20. On the third 40 and 20, and so on.

Parameters:
name - The name string to query on. This string may contain the wildcard characters '%' and '_' as used in SQL.
op - The operator to be used in the query. This specifies whether, for example, the query should be an exact match query or a "like" query using wildcards.
numberToSkip - The number of business rules to skip. If this number is greater than 0, then the specified number of business rules will be skipped and not returned by this invocation of the method. A negative or 0 value indicates that all business rules are to be returned.
maxToReturn - The maximum number of business rules to return. If this number is greater than 0, then at most the specified number of business rules will be returned by this invocation of the method. A negative or 0 value indicates that all business rules will be returned starting with the first non-skipped business rule to the end of the results.
Returns:
A List of BusinessRule objects representing the business rules associated with this operation that have names matching the specified query. If the maxToReturn parameter is greater than 0, then this list will contain at most maxToReturn business rules.
Throws:
BusinessRuleManagementException - if an unexpected error is detected.
See Also:

getBusinessRulesByTNSAndName

  1. java.util.List<BusinessRule> getBusinessRulesByTNSAndName( java.lang.String tns,
  2. QueryOperator tnsOp,
  3. java.lang.String name,
  4. QueryOperator nameOp,
  5. int numberToSkip,
  6. int maxToReturn)
  7. throws BusinessRuleManagementException
Get business rules associated with this operation using the target name space and name as a key. This is a conveneince method that allows the user to perform a query based on the target name space property and the name property together by calling one method rather than setting up a query tree using the APIs defined in the com.ibm.wbiserver.brules.mgmt.query package. The query is performed using the specified target name space string, the specified name, and the specified operator for each.

For example, the following invocation:

    List<BusinessRule> result = op.getBusinessRulesByTNSAndName("www.ibm.com/test", QueryOperator.EQUAL, "%Christmas%", QueryOperator.LIKE, 0, 0);
 
is equivalent to doing the following:
    PropertyQueryNode tnsNode = QueryNodeFactory.createPropertyQueryNode(QueryNodeFactory.PROPERTY_NAME__TARGET_NAME_SPACE, QueryOperator.EQUAL, "www.ibm.com/test");
    PropertyQueryNode nameNode = QueryNodeFactory.createPropertyQueryNode(QueryNodeFactory.PROPERTY_NAME__NAME, QueryOperator.LIKE, "%Christmas%");
    AndNode andNode = new AndNode(tnsNode, nameNode);
    List<BusinessRule> result = op.getBusinessRulesByProperties(andNode, 0, 0);
 

The numberToSkip and maxToReturn parameters can be used together to implement paging where only a certain number of business rules is returned with each invocation. This could be useful in situations where there are many business rules and you don't want to wait for them all to be returned. For example, to get the business rules in separate groups each containing 20 business rules you would pass 0 for numberToSkip and 20 for maxToReturn on the first invocation. On the second, you would pass 20 and 20. On the third 40 and 20, and so on.

Parameters:
tns - The target name space string to query on. This string may contain the wildcard characters '%' and '_' as used in SQL.
tnsOp - The operator to be used in the query for the target name space property. This specifies whether, for example, the query should be an exact match query or a "like" query using wildcards.
name - The name string to query on. This string may contain the wildcard characters '%' and '_' as used in SQL.
nameOp - The operator to be used in the query for the name property. This specifies whether, for example, the query should be an exact match query or a "like" query using wildcards.
numberToSkip - The number of business rules to skip. If this number is greater than 0, then the specified number of business rules will be skipped and not returned by this invocation of the method. A negative or 0 value indicates that all business rules are to be returned.
maxToReturn - The maximum number of business rules to return. If this number is greater than 0, then at most the specified number of business rules will be returned by this invocation of the method. A negative or 0 value indicates that all business rules will be returned starting with the first non-skipped business rule to the end of the results.
Returns:
A List of BusinessRule objects representing the business rules associated with this operation that have target name spaces and names matching the specified query. If the maxToReturn parameter is greater than 0, then this list will contain at most maxToReturn business rules.
Throws:
BusinessRuleManagementException - if an unexpected error is detected.
See Also:

getOperationSelectionRecordList

  1. OperationSelectionRecordList getOperationSelectionRecordList( )
Get the selection records associated with this operation. Each selection record specifies the start and end dates for a particular target along with the business rule to be invoked for that date range. This list specifies the set of date-based targets used by this operation.
Returns:
The OperationSelectionRecordList for this Operation.

getAssociatedBusinessRuleGroup

  1. BusinessRuleGroup getAssociatedBusinessRuleGroup( )
Get the business rule group that this operation is associated with.
Returns:
The business rule group that this operation is associated with.