@Override public void describeTo(final Description description) { description.appendText("Entity condition list joined with '") .appendText(expectedOperator.getCode()) .appendText("' and ") .appendDescriptionOf(conditions); }
public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof EntityOperator)) { return false; } final EntityOperator otherOper = (EntityOperator) obj; return this.idInt == otherOper.getId(); } }
/** * Small utility method to get an entity operator from it's code * * @deprecated Not used in JIRA code - please replicate this if you want to use it. Since v5.1. */ public static EntityOperator getOperator(final String code) { for (final EntityOperator operator : entityOperators) { if (operator.toString().trim().equals(code.trim())) { return operator; } } return null; }
if (this.getRhs() == null) { whereStringBuffer.append(field.getColName()); if (EntityOperator.NOT_EQUAL.equals(this.getOperator())) { whereStringBuffer.append(" IS NOT NULL "); } else { whereStringBuffer.append(this.getOperator().toString()); whereStringBuffer.append(' '); if (EntityOperator.IN.equals(this.getOperator())) { whereStringBuffer.append('('); whereStringBuffer.append(((EntityCondition) lhs).makeWhereString(modelEntity, entityConditionParams)); whereStringBuffer.append(") "); whereStringBuffer.append(this.getOperator().toString()); whereStringBuffer.append(" ("); whereStringBuffer.append(((EntityCondition) rhs).makeWhereString(modelEntity, entityConditionParams));
private boolean matches(final EntityConditionList other) { return expectedOperator.equals(other.getOperator()) && conditions.matches(toList(other)); }
final Object rhs = expr.getRhs(); if (EntityOperator.EQUALS.equals(expr.getOperator())) else if (EntityOperator.NOT_EQUAL.equals(expr.getOperator())) else if (EntityOperator.GREATER_THAN.equals(expr.getOperator()) || EntityOperator.GREATER_THAN_EQUAL_TO.equals(expr.getOperator()) || EntityOperator.LESS_THAN.equals(expr.getOperator()) || EntityOperator.LESS_THAN_EQUAL_TO.equals(expr.getOperator())) if ((comparison <= 0) && EntityOperator.LESS_THAN_EQUAL_TO.equals(expr.getOperator())) else if ((comparison < 0) && EntityOperator.LESS_THAN.equals(expr.getOperator())) else if ((comparison >= 0) && EntityOperator.GREATER_THAN_EQUAL_TO.equals(expr.getOperator())) else if ((comparison > 0) && EntityOperator.GREATER_THAN.equals(expr.getOperator())) "Operation " + expr.getOperator().getCode() + " is not yet supported by filterByAnd with objects that do not implement Comparable"); throw new IllegalArgumentException("Operation " + expr.getOperator().getCode() + " is not yet supported by filterByAnd");
public boolean compare(Object o1, Object o2) { return !(GREATER_THAN.compare(o1,o2)); } };
if (this.getRhs() == null) { whereStringBuilder.append(field.getColName()); if (EntityOperator.NOT_EQUAL.equals(this.getOperator())) { whereStringBuilder.append(" IS NOT NULL "); } else { whereStringBuilder.append(this.getOperator().toString()); whereStringBuilder.append(' '); if (EntityOperator.IN.equals(this.getOperator())) { whereStringBuilder.append('('); whereStringBuilder.append(((EntityCondition) lhs).makeWhereString(modelEntity, entityConditionParams)); whereStringBuilder.append(") "); whereStringBuilder.append(this.getOperator().toString()); whereStringBuilder.append(" ("); whereStringBuilder.append(((EntityCondition) rhs).makeWhereString(modelEntity, entityConditionParams));
public boolean apply(EntityExpr input) { return input.getOperator().equals(EntityOperator.IN) && input.getRhs() instanceof Collection && ((Collection<?>) input.getRhs()).size() > maxListSize; } }));
public boolean compare(Object o1, Object o2) { return !(LESS_THAN.compare(o1,o2)); } };
public String toString() { StringBuffer outputBuffer = new StringBuffer(); outputBuffer.append("[firstEntity," + (firstEntity == null ? "null" : firstEntity) + "]"); outputBuffer.append("[secondEntity," + (secondEntity == null ? "null" : secondEntity) + "]"); outputBuffer.append("[firstField," + (firstField == null ? "null" : firstField) + "]"); outputBuffer.append("[secondField," + (secondField == null ? "null" : secondField) + "]"); outputBuffer.append("[firstModelEntity," + (firstModelEntity == null ? "null" : (firstModelEntity.getEntityName() == null ? "null" : firstModelEntity.getEntityName())) + "]"); outputBuffer.append("[secondModelEntity," + (secondModelEntity == null ? "null" : (secondModelEntity.getEntityName() == null ? "null" : secondModelEntity.getEntityName())) + "]"); outputBuffer.append("[interFieldOperation," + (interFieldOperation == null ? "null" : (interFieldOperation.getCode() == null ? "null" : interFieldOperation.getCode())) + "]"); outputBuffer.append("[intraFieldOperation," + (intraFieldOperation == null ? "null" : (intraFieldOperation.getCode() == null ? "null" : intraFieldOperation.getCode())) + "]"); outputBuffer.append("[value," + (getValue().toString() == null ? "null" : getValue().toString()) + "]"); return outputBuffer.toString(); }
if (this.getRhs() == null) { whereStringBuffer.append(field.getColName()); if (EntityOperator.NOT_EQUAL.equals(this.getOperator())) { whereStringBuffer.append(" IS NOT NULL "); } else { whereStringBuffer.append(this.getOperator().toString()); whereStringBuffer.append(' '); if (EntityOperator.IN.equals(this.getOperator())) { whereStringBuffer.append('('); whereStringBuffer.append(((EntityCondition) lhs).makeWhereString(modelEntity, entityConditionParams)); whereStringBuffer.append(") "); whereStringBuffer.append(this.getOperator().toString()); whereStringBuffer.append(" ("); whereStringBuffer.append(((EntityCondition) rhs).makeWhereString(modelEntity, entityConditionParams));
private Predicate<GenericValue> getPredicateForEntityConditionList(final EntityConditionList conditionList) { final List<Predicate<GenericValue>> conditions = newArrayListWithCapacity(conditionList.getConditionListSize()); final Iterator<? extends EntityCondition> iter = conditionList.getConditionIterator(); while (iter.hasNext()) { conditions.add(getPredicateFor(iter.next())); } if (conditionList.getOperator().equals(EntityOperator.AND)) { return Predicates.and(conditions); } if (conditionList.getOperator().equals(EntityOperator.OR)) { return Predicates.or(conditions); } throw new UnsupportedOperationException("Mock cannot yet handle EntityConditionList with operator " + conditionList.getOperator()); }
public boolean compare(Object o1, Object o2) { return !(GREATER_THAN.compare(o1,o2)); } };
private Predicate<GenericValue> getPredicateForEntityFieldMap(final EntityFieldMap entityFieldMap) { if (entityFieldMap.getOperator().getId() == EntityOperator.ID_AND) { return gv -> !any( entityFieldMap.getFieldKeyIterator(), fieldName -> !Objects.equal(entityFieldMap.getField(fieldName), gv.get(fieldName))); } if (entityFieldMap.getOperator().getId() == EntityOperator.ID_OR) { return gv -> any( entityFieldMap.getFieldKeyIterator(), fieldName -> Objects.equal(entityFieldMap.getField(fieldName), gv.get(fieldName))); } throw new IllegalStateException("I don't like the operator " + entityFieldMap.getOperator()); }
public String toString() { StringBuilder outputBuffer = new StringBuilder(); outputBuffer.append("[firstEntity," + (firstEntity == null ? "null" : firstEntity) + "]"); outputBuffer.append("[secondEntity," + (secondEntity == null ? "null" : secondEntity) + "]"); outputBuffer.append("[firstField," + (firstField == null ? "null" : firstField) + "]"); outputBuffer.append("[secondField," + (secondField == null ? "null" : secondField) + "]"); outputBuffer.append("[firstModelEntity," + (firstModelEntity == null ? "null" : (firstModelEntity.getEntityName() == null ? "null" : firstModelEntity.getEntityName())) + "]"); outputBuffer.append("[secondModelEntity," + (secondModelEntity == null ? "null" : (secondModelEntity.getEntityName() == null ? "null" : secondModelEntity.getEntityName())) + "]"); outputBuffer.append("[interFieldOperation," + (interFieldOperation == null ? "null" : (interFieldOperation.getCode() == null ? "null" : interFieldOperation.getCode())) + "]"); outputBuffer.append("[intraFieldOperation," + (intraFieldOperation == null ? "null" : (intraFieldOperation.getCode() == null ? "null" : intraFieldOperation.getCode())) + "]"); outputBuffer.append("[value," + (getValue().toString() == null ? "null" : getValue().toString()) + "]"); return outputBuffer.toString(); }
if (EntityOperator.AND.equals(entityConditionList.getOperator())) { tempResult = findByConditionWorker(tempEntityCache, modelEntity, subEntityCondition, fieldsToSelect, orderBy); tempEntityCache.put(genericValue, genericValue); } else if (EntityOperator.OR.equals(entityConditionList.getOperator())) { EntityFieldMap entityCond = (EntityFieldMap) entityCondition; if (entityCond.getOperator().equals(EntityOperator.AND))