Interface BusinessRulesEngine
The business rules engine will execute the validation of each business rule
in order as defined by the execution plan set in the business rule set.
Identifies the set of BusinessRulesEngine methods that are invokable only
from classes running in the method server.
The following information is required to obtain a business rule set from the
system:
For each object in the collection of seed objects the
Supported API: true
Extendable: false
- The key of the business rule set
- Container reference on which the rules should be evaluated
- Creation of a RuleValidation instance based on the ruleKey defined in the rule.
- The RuleValidation instance will use the configuration from the persisted
rule to determine if it is valid using the
isConfigurationValidmethod. - If the configuration is not valid, the engine will immediately return a validation result set with a result failure and error will be logged.
- Initializing each rule validation with the following items:
- Collection of objects that rules are to evaluate
- Context specific criteria (such as the container reference) that may be used by a rule validation to configure its execution.
- The rule validation instance is added to the execution plan.
prepareForValidate method will be provided
with the entire set of the objects that will be validated. This is to allow
any collection-based pre-validation to occur within the Windchill server
(example might be retrieving the life cycle template which would be common to
many of the items). This method will not be considered thread-safe. The
instantiation of the RuleValidation will be based on the ruleKey defined in
the business rule. Application services will be used to lookup the
implementing class for the defined ruleKey. If no implementing class is
defined, or the class fails to be instantiated an error will be logged. Since
the business rule set is persisted and does support loading via IXB loaders,
it is possible that the current system does not have a properly configured
business rule key entry. For each object in the collection of seed objects the
RuleValidation#performValidation method will be called for each
rule in the plan and return a validation result:
- A
RuleValidationObjectwill be created for each seed object - If the seed object is a link object and the rule validation handles links
then the
RuleValidationObject#getTargetObjectLinkshould be used. - If the rule validation cannot handle links then the validation should use
the
RuleValidationObject#getTargetObject - If the rule validation does not support target object or target object
link class type on the
RuleValidationObject, the rule will be skipped for the unsupported object.
Supported API: true
Extendable: false
-
Method Summary
Modifier and TypeMethodDescriptionexecute(Object primaryBusinessObject, BusinessRuleSetBean[] ruleSetBeans) Given a primary business object and business rule set beans executes all business rule sets and return an accumulation of the validation results.execute(String ruleSetKey, RuleValidationCriteria criteria) Given a collection of target objects specified in theRuleValidationCriteriaexecutes all business rules in the business rule set in the container that is specified in the criteria.booleanisBusinessRuleValid(RuleValidationKey ruleKey) Given a business rule object, Checks if the rule has a registered validator and is properly configured.
-
Method Details
-
execute
Given a collection of target objects specified in theRuleValidationCriteriaexecutes all business rules in the business rule set in the container that is specified in the criteria. If the container is null then the engine will try to use the container of the target objects to look up the business rule set to execute. This method will bypass access control in order to execute rules the user does not have access to.
Supported API: true- Parameters:
ruleSetKey-criteria-- Returns:
- validation result set
-
execute
Given a primary business object and business rule set beans executes all business rule sets and return an accumulation of the validation results. The target collection is generated for the given primary business object and the relationship specified on the business rule set bean. The target collection is then organized into one or more target collections based on the container that the objects in the target collection belong to. The specific business rule set will be looked up using the container of the target objects. If the target objects do not have a container then the engine will try to use the container of the primary business object to look up the business rule set. This method will bypass access control in order to execute rules the user does not have access to.
Supported API: true- Parameters:
primaryBusinessObject-ruleSetBeans-- Returns:
- validation results for all configured business rule sets.
- See Also:
-
isBusinessRuleValid
Given a business rule object, Checks if the rule has a registered validator and is properly configured.- Parameters:
ruleKey-- Returns:
- true if rule has a registered validator and is properly
configured. Returns false otherwise
Supported API: true
-