当前位置: 首页>>代码示例>>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;未经允许,请勿转载。