Advanced Customization > Business Logic Customization > Business Rules > Business Rules Configuration and Execution > Customization Example of Multiple Rules, Rule Sets, and Relationships
  
Customization Example of Multiple Rules, Rule Sets, and Relationships
Here is another example of how you might configure rules against multiple products and multiple relationships. In this case, there are 4 rules, 4 rule sets and 4 containers.
After all the rules are created, you could configure the workflow to use these rule sets by using some code that looks like this:
com.ptc.core.businessRules.engine.BusinessRuleSetBean[] ruleSetBeans =
new com.ptc.core.businessRules.engine.BusinessRuleSetBean[] {
com.ptc.core.businessRules.engine.BusinessRuleSetBean.
newBusinessRuleSetBean("CNOrgRuleSet",
com.ptc.core.businessRules.engine.BusinessRuleSetBean.PRIMARY_BUSINESS_OBJECT),
com.ptc.core.businessRules.engine.BusinessRuleSetBean.
newBusinessRuleSetBean("AffectedPartProdRuleSet",
wt.change2.AffectedActivityData.class.getName()),
com.ptc.core.businessRules.engine.BusinessRuleSetBean.
newBusinessRuleSetBean("ResultingPartProdRuleSet",
wt.change2.ChangeRecord2.class.getName())
};
com.ptc.core.businessRules.validation.RuleValidationResultSet
resultSet = wt.businessRules.BusinessRulesHelper.engine.execute(primaryBusinessObject,
ruleSetBeans );
Examples
If we had a part in Product 1 that was a Resulting Object, the part would have to have a part name less than 10 characters, and it could not be checked out.
If we had a document in Product 2 that was a resulting object, then there are no rules for it. This is because there are only rules for Parts.