本文整理汇总了Java中org.kuali.rice.krms.framework.type.ValidationRuleType.VALID属性的典型用法代码示例。如果您正苦于以下问题:Java ValidationRuleType.VALID属性的具体用法?Java ValidationRuleType.VALID怎么用?Java ValidationRuleType.VALID使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.kuali.rice.krms.framework.type.ValidationRuleType
的用法示例。
在下文中一共展示了ValidationRuleType.VALID属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadRule
@Override
public Rule loadRule(RuleDefinition validationRuleDefinition) {
if (validationRuleDefinition == null) { throw new RiceIllegalArgumentException("validationRuleDefinition must not be null"); }
if (validationRuleDefinition.getAttributes() == null) { throw new RiceIllegalArgumentException("validationRuleDefinition must not be null");}
if (!validationRuleDefinition.getAttributes().containsKey(VALIDATIONS_RULE_TYPE_CODE_ATTRIBUTE)) {
throw new RiceIllegalArgumentException("validationRuleDefinition does not contain an " +
VALIDATIONS_RULE_TYPE_CODE_ATTRIBUTE + " attribute");
}
String validationRuleTypeCode = validationRuleDefinition.getAttributes().get(VALIDATIONS_RULE_TYPE_CODE_ATTRIBUTE);
if (StringUtils.isBlank(validationRuleTypeCode)) {
throw new RiceIllegalArgumentException(VALIDATIONS_RULE_TYPE_CODE_ATTRIBUTE + " attribute must not be null or blank");
}
if (ValidationRuleType.VALID.getCode().equals(validationRuleTypeCode)) {
return new ValidationRule(ValidationRuleType.VALID, validationRuleDefinition.getName(),
translator.translatePropositionDefinition(validationRuleDefinition.getProposition()),
translator.translateActionDefinitions(validationRuleDefinition.getActions()));
}
if (ValidationRuleType.INVALID.getCode().equals(validationRuleTypeCode)) {
return new ValidationRule(ValidationRuleType.INVALID, validationRuleDefinition.getName(),
translator.translatePropositionDefinition(validationRuleDefinition.getProposition()),
translator.translateActionDefinitions(validationRuleDefinition.getActions()));
}
return null;
}
示例2: testValidRulePassesActionDoesntFire
@Test
public void testValidRulePassesActionDoesntFire() {
Rule validationRule = new ValidationRule(ValidationRuleType.VALID, "testValidRulePassesActionDoesntFire",
new ComparableTermBasedProposition(operatorEquals, term, "true"), Collections
.<Action>singletonList(actionMock));
assertTrue(validationRule.evaluate(new BasicExecutionEnvironment(testEvent, facts, executionOptions,
termResolutionEngine)));
assertFalse(actionMock.actionFired("a1"));
}
示例3: testValidRuleFailsActionFires
@Test
public void testValidRuleFailsActionFires() {
Rule validationRule = new ValidationRule(ValidationRuleType.VALID, "testValidRuleFailsActionFires",
new ComparableTermBasedProposition(operatorEquals, term, "false"), Collections
.<Action>singletonList(actionMock));
assertFalse(validationRule.evaluate(new BasicExecutionEnvironment(testEvent, facts, executionOptions,
termResolutionEngine)));
assertTrue(actionMock.actionFired("a1"));
}