本文整理匯總了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"));
}