public static String conditionTypeToLdapOperator(ConditionType ct) { String op; switch (ct) { case EQUALS: case NOT_EQUALS: op = "="; break; case GREATER_THAN: case GREATER_OR_EQUALS: op = ">="; break; case LESS_THAN: case LESS_OR_EQUALS: op = "<="; break; default: String msg = String.format("Condition type %s is not supported", ct.name()); throw new RuntimeException(msg); } return op; }
for (SearchCondition<T> condition : sc.getSearchConditions()) { if (!first) { sb.append(" ").append(sc.getConditionType().toString()).append(" "); } else { first = false;
for (SearchCondition<T> condition : sc.getSearchConditions()) { if (!first) { sb.append(" ").append(sc.getConditionType().toString()).append(" "); } else { first = false;
public static String conditionTypeToLdapOperator(ConditionType ct) { String op; switch (ct) { case EQUALS: case NOT_EQUALS: op = "="; break; case GREATER_THAN: case GREATER_OR_EQUALS: op = ">="; break; case LESS_THAN: case LESS_OR_EQUALS: op = "<="; break; default: String msg = String.format("Condition type %s is not supported", ct.name()); throw new RuntimeException(msg); } return op; }
for (SearchCondition<T> condition : sc.getSearchConditions()) { if (!first) { sb.append(" ").append(sc.getConditionType().toString()).append(" "); } else { first = false;
public static String conditionTypeToLdapOperator(ConditionType ct) { String op; switch (ct) { case EQUALS: case NOT_EQUALS: op = "="; break; case GREATER_THAN: case GREATER_OR_EQUALS: op = ">="; break; case LESS_THAN: case LESS_OR_EQUALS: op = "<="; break; default: String msg = String.format("Condition type %s is not supported", ct.name()); throw new RuntimeException(msg); } return op; } }
/** * Creates search condition with same operator (equality, inequality) applied in all comparison; see * {@link #isMet(Object)} for details of comparison. * * @param cType shared condition type * @param condition template object */ public SimpleSearchCondition(ConditionType cType, T condition) { if (cType == null) { throw new IllegalArgumentException("cType is null"); } if (condition == null) { throw new IllegalArgumentException("condition is null"); } if (!SUPPORTED_TYPES.contains(cType)) { throw new IllegalArgumentException("unsupported condition type: " + cType.name()); } this.condition = condition; scts = createConditions(null, null, null, cType); }
/** * Creates search condition with same operator (equality, inequality) applied in all comparison; see * {@link #isMet(Object)} for details of comparison. * * @param cType shared condition type * @param condition template object */ public SimpleSearchCondition(ConditionType cType, T condition) { if (cType == null) { throw new IllegalArgumentException("cType is null"); } if (condition == null) { throw new IllegalArgumentException("condition is null"); } if (!SUPPORTED_TYPES.contains(cType)) { throw new IllegalArgumentException("unsupported condition type: " + cType.name()); } this.condition = condition; scts = createConditions(null, null, null, cType); }
/** * Creates search condition with same operator (equality, inequality) applied in all comparison; see * {@link #isMet(Object)} for details of comparison. * * @param cType shared condition type * @param condition template object */ public SimpleSearchCondition(ConditionType cType, T condition) { if (cType == null) { throw new IllegalArgumentException("cType is null"); } if (condition == null) { throw new IllegalArgumentException("condition is null"); } if (!supportedTypes.contains(cType)) { throw new IllegalArgumentException("unsupported condition type: " + cType.name()); } this.condition = condition; scts = createConditions(null, null, null, cType); }
public static String conditionTypeToSqlOperator(ConditionType ct, String value, String originalValue) { // TODO : if we have the same column involved, ex a >= 123 and a <=244 then // we may try to use IN or BETWEEN, depending on the values final boolean wildcardAvailable = SearchUtils.containsWildcard(originalValue); String op; switch (ct) { case EQUALS: op = wildcardAvailable ? "LIKE" : "="; break; case NOT_EQUALS: op = wildcardAvailable ? "NOT LIKE" : "<>"; break; case GREATER_THAN: op = ">"; break; case GREATER_OR_EQUALS: op = ">="; break; case LESS_THAN: op = "<"; break; case LESS_OR_EQUALS: op = "<="; break; default: String msg = String.format("Condition type %s is not supported", ct.name()); throw new RuntimeException(msg); } return op; }
public static String conditionTypeToSqlOperator(ConditionType ct, String value, String originalValue) { // TODO : if we have the same column involved, ex a >= 123 and a <=244 then // we may try to use IN or BETWEEN, depending on the values final boolean wildcardAvailable = SearchUtils.containsWildcard(originalValue); String op; switch (ct) { case EQUALS: op = wildcardAvailable ? "LIKE" : "="; break; case NOT_EQUALS: op = wildcardAvailable ? "NOT LIKE" : "<>"; break; case GREATER_THAN: op = ">"; break; case GREATER_OR_EQUALS: op = ">="; break; case LESS_THAN: op = "<"; break; case LESS_OR_EQUALS: op = "<="; break; default: String msg = String.format("Condition type %s is not supported", ct.name()); throw new RuntimeException(msg); } return op; }
break; default: String msg = String.format("Condition type %s is not supported", ct.name()); throw new RuntimeException(msg);
for (ConditionType ct : getters2operators.values()) { if (!SUPPORTED_TYPES.contains(ct)) { throw new IllegalArgumentException("unsupported condition type: " + ct.name());
break; default: String msg = String.format("Condition type %s is not supported", cond.name()); throw new RuntimeException(msg);
break; default: String msg = String.format("Condition type %s is not supported", cond.name()); throw new RuntimeException(msg);
for (ConditionType ct : getters2operators.values()) { if (!supportedTypes.contains(ct)) { throw new IllegalArgumentException("unsupported condition type: " + ct.name());
break; default: String msg = String.format("Condition type %s is not supported", cond.name()); throw new RuntimeException(msg);
for (ConditionType ct : getters2operators.values()) { if (!SUPPORTED_TYPES.contains(ct)) { throw new IllegalArgumentException("unsupported condition type: " + ct.name());
private SearchCond visitCompount(final SearchCondition<SearchBean> sc) { List<SearchCond> searchConds = new ArrayList<>(); sc.getSearchConditions().forEach(searchCondition -> { searchConds.add(searchCondition.getStatement() == null ? visitCompount(searchCondition) : visitPrimitive(searchCondition)); }); SearchCond compound; switch (sc.getConditionType()) { case AND: compound = SearchCond.getAndCond(searchConds); break; case OR: compound = SearchCond.getOrCond(searchConds); break; default: throw new IllegalArgumentException( String.format("Condition type %s is not supported", sc.getConditionType().name())); } return compound; }
throw new IllegalArgumentException(String.format("Condition type %s is not supported", ct.name()));