進階自訂 > Business Logic Customization > Business Rules > Bypassing Business Rules > Example > Execute Required Business Rule Sets
  
Execute Required Business Rule Sets
In order to prevent the Change Notice workflow process from proceeding for the required business rules update the conditional to only use the required rule set EXAMPLE1_RELEASE_RULE_SET for the Resolve Release Conflicts workflow task.
result = "NOT_READY";
com.ptc.core.businessRules.engine.BusinessRuleSetBean[] beans = new
com.ptc.core.businessRules.engine.BusinessRuleSetBean[] {

// Configure to call required rule set only
com.ptc.core.businessRules.engine.BusinessRuleSetBean.
newBusinessRuleSetBean
("EXAMPLE1_RELEASE_RULE_SET", "wt.change2.ChangeRecord2")
};
com.ptc.core.businessRules.validation.RuleValidationResultSet resultSet =
wt.businessRules.BusinessRulesHelper.engine.execute(primaryBusinessObject,
beans);

if ( !resultSet.hasResultsByStatus(com.ptc.core.businessRules.
validation.RuleValidationStatus.FAILURE)) {
result = "PROCEED";
}
else {

businessRulesResultSetGlobal = wt.businessRules.BusinessRulesHelper.
serialize(resultSet);
preReleaseConflictsMsg = new wt.util.WTMessage
("com.ptc.windchill.enterprise.
change2.change2ClientResource", com.ptc.windchill.enterprise.change2.
change2ClientResource.BUSINESS_RULES_PRERELEASE_VALIDATION_MSG,
null).getLocalizedMessage();
preReleaseConflictsMsg = preReleaseConflictsMsg + "\n" + resultSet.
getFailedRulesMessage(java.util.Locale.getDefault());
}
The following is an example of the conflicts shown on the Resolve Release Conflicts workflow task. Note that the Resolve Release Conflicts workflow task will continue to regenerate the task until all conflicts have been resolved.