当前位置: 首页>>代码示例>>Java>>正文


Java CaseConstraint.setOperator方法代码示例

本文整理汇总了Java中org.kuali.rice.krad.datadictionary.validation.constraint.CaseConstraint.setOperator方法的典型用法代码示例。如果您正苦于以下问题:Java CaseConstraint.setOperator方法的具体用法?Java CaseConstraint.setOperator怎么用?Java CaseConstraint.setOperator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.krad.datadictionary.validation.constraint.CaseConstraint的用法示例。


在下文中一共展示了CaseConstraint.setOperator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processCaseConstraint

import org.kuali.rice.krad.datadictionary.validation.constraint.CaseConstraint; //导入方法依赖的package包/类
/**
 * This method processes a single CaseConstraint. Internally it makes calls to
 * processWhenConstraint for each WhenConstraint that exists in this constraint. It adds a
 * "dependsOn" css class to this field for the field which the CaseConstraint references.
 * 
 * @param field input field
 * @param view active view
 * @param constraint case constraint providing the field reference
 * @param andedCase the boolean logic to be anded when determining if this case is satisfied
 *        (used for nested CaseConstraints)
 * @param validationState validation state
 * @param stateMapping state mapping
 */
public static void processCaseConstraint(InputField field, View view, CaseConstraint constraint, String andedCase,
        String validationState, StateMapping stateMapping) {
    if (constraint.getOperator() == null) {
        constraint.setOperator("equals");
    }

    String operator = "==";
    if (constraint.getOperator().equalsIgnoreCase("not_equals") || constraint.getOperator().equalsIgnoreCase(
            "not_equal")) {
        operator = "!=";
    } else if (constraint.getOperator().equalsIgnoreCase("greater_than_equal")) {
        operator = ">=";
    } else if (constraint.getOperator().equalsIgnoreCase("less_than_equal")) {
        operator = "<=";
    } else if (constraint.getOperator().equalsIgnoreCase("greater_than")) {
        operator = ">";
    } else if (constraint.getOperator().equalsIgnoreCase("less_than")) {
        operator = "<";
    } else if (constraint.getOperator().equalsIgnoreCase("has_value")) {
        operator = "";
    }
    // add more operator types here if more are supported later

    field.getControl().addStyleClass("dependsOn-" + ScriptUtils.escapeName(constraint.getPropertyName()));

    if (constraint.getWhenConstraint() != null && !constraint.getWhenConstraint().isEmpty()) {
        //String fieldPath = field.getBindingInfo().getBindingObjectPath() + "." + constraint.getPropertyName();
        String fieldPath = constraint.getPropertyName();
        for (WhenConstraint wc : constraint.getWhenConstraint()) {
            wc = ConstraintStateUtils.getApplicableConstraint(wc, validationState, stateMapping);
            if (wc != null) {
                processWhenConstraint(field, view, constraint, wc, ScriptUtils.escapeName(fieldPath), operator,
                        andedCase, validationState, stateMapping);
            }
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:51,代码来源:ClientValidationUtils.java

示例2: processCaseConstraint

import org.kuali.rice.krad.datadictionary.validation.constraint.CaseConstraint; //导入方法依赖的package包/类
/**
 * This method processes a single CaseConstraint. Internally it makes calls
 * to processWhenConstraint for each WhenConstraint that exists in this
 * constraint. It adds a "dependsOn" css class to this field for the field
 * which the CaseConstraint references.
 *
 * @param view
 * @param andedCase the boolean logic to be anded when determining if this case is
 * satisfied (used for nested CaseConstraints)
 */
public static void processCaseConstraint(InputField field, View view, CaseConstraint constraint, String andedCase,
        String validationState, StateMapping stateMapping) {
    if (constraint.getOperator() == null) {
        constraint.setOperator("equals");
    }

    String operator = "==";
    if (constraint.getOperator().equalsIgnoreCase("not_equals") || constraint.getOperator().equalsIgnoreCase(
            "not_equal")) {
        operator = "!=";
    } else if (constraint.getOperator().equalsIgnoreCase("greater_than_equal")) {
        operator = ">=";
    } else if (constraint.getOperator().equalsIgnoreCase("less_than_equal")) {
        operator = "<=";
    } else if (constraint.getOperator().equalsIgnoreCase("greater_than")) {
        operator = ">";
    } else if (constraint.getOperator().equalsIgnoreCase("less_than")) {
        operator = "<";
    } else if (constraint.getOperator().equalsIgnoreCase("has_value")) {
        operator = "";
    }
    // add more operator types here if more are supported later

    field.getControl().addStyleClass("dependsOn-" + ScriptUtils.escapeName(constraint.getPropertyName()));

    if (constraint.getWhenConstraint() != null && !constraint.getWhenConstraint().isEmpty()) {
        //String fieldPath = field.getBindingInfo().getBindingObjectPath() + "." + constraint.getPropertyName();
        String fieldPath = constraint.getPropertyName();
        for (WhenConstraint wc : constraint.getWhenConstraint()) {
            wc = ConstraintStateUtils.getApplicableConstraint(wc, validationState, stateMapping);
            if (wc != null) {
                processWhenConstraint(field, view, constraint, wc, ScriptUtils.escapeName(fieldPath), operator,
                        andedCase, validationState, stateMapping);
            }
        }
    }
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:48,代码来源:ClientValidationUtils.java


注:本文中的org.kuali.rice.krad.datadictionary.validation.constraint.CaseConstraint.setOperator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。