高级自定义 > 业务逻辑自定义 > 业务规则 > 略过业务规则 > 示例 > 执行所有必需和非必需业务规则集
执行所有必需和非必需业务规则集
为了显示所有必需和非必需规则冲突,请将审计更改通告工作流任务条件更新为使用规则集 EXAMPLE1_RELEASE_RULE_SETEXAMPLE1_NON_REQUIRED_ATTRIBUTE_RULE_SET
if (wt.change2.ChangeHelper2.isTrackingChange((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 = 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());
}
以下示例将显示审计更改通告工作流任务的冲突。
这对您有帮助吗?