高级自定义 > 业务逻辑自定义 > 业务规则 > 略过业务规则 > 示例 > 执行所有必需和非必需业务规则集
执行所有必需和非必需业务规则集
为了显示所有必需和非必需规则冲突,请将 Audit Change Notice 工作流任务条件更新为使用 EXAMPLE1_RELEASE_RULE_SETEXAMPLE1_NON_REQUIRED_ATTRIBUTE_RULE_SET 规则集。
if (wt.change2.ChangeHelper2.service.getTrackingChange((wt.inf.container.WTContained)primaryBusinessObject)){
result = "Revisioning Enabled";
}else {
result = "Revisioning Disabled";
}
com.ptc.core.businessRules.engine.BusinessRuleSetBean[]
beans = new com.ptc.core.businessRules.engine.BusinessRuleSetBean[] {

// Configure to call non-required rule set
com.ptc.core.businessRules.engine.BusinessRuleSetBean.
newBusinessRuleSetBean
("EXAMPLE1_NON_REQUIRED_ATTRIBUTE_RULE_SET",
"wt.change2.ChangeRecord2"),
// Configure to call required rule set
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)) {

businessRulesResultSetGlobal = wt.businessRules.BusinessRulesHelper.
serialize(resultSet);
preReleaseConflictsMsg = "The release of this change notice cannot occur because the following business rules failed:";
preReleaseConflictsMsg = preReleaseConflictsMsg + "\n" +
resultSet.getFailedRulesMessage(java.util.Locale.getDefault());
}
以下示例将显示 Audit Change Notice 工作流任务的冲突。
这对您有帮助吗?