當前位置: 首頁>>代碼示例>>Java>>正文


Java ValidationRuleType.VALID屬性代碼示例

本文整理匯總了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;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:28,代碼來源:ValidationRuleTypeServiceImpl.java

示例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"));
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:9,代碼來源:ValidationRuleTest.java

示例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"));
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:9,代碼來源:ValidationRuleTest.java


注:本文中的org.kuali.rice.krms.framework.type.ValidationRuleType.VALID屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。