本文整理汇总了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);
}
}
}
}
示例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);
}
}
}
}