public String makeWhereString(final ModelEntity modelEntity, final List entityConditionParams) { return condition.makeWhereString(modelEntity, entityConditionParams); }
public void checkCondition(final ModelEntity modelEntity) throws GenericModelException { condition.checkCondition(modelEntity); } }
@Override public int getParameterCount(ModelEntity modelEntity) { int count = 0; for (EntityCondition condition : conditionList) { count += condition.getParameterCount(modelEntity); } return count; }
/** * Returns the number of SQL parameters that would be generated for this condition. * * @param modelEntity the entity being queried for (required) * @return the number of SQL parameters. */ public int getParameterCount(ModelEntity modelEntity) { List<EntityConditionParam> paramList = new ArrayList<EntityConditionParam>(); makeWhereString(modelEntity, paramList); return paramList.size(); } }
public void checkCondition(ModelEntity modelEntity) throws GenericModelException { // if (Debug.verboseOn()) Debug.logVerbose("checkCondition for entity " + modelEntity.getEntityName()); for (EntityCondition condition : conditionList) { condition.checkCondition(modelEntity); } }
private boolean shouldRewrite() { final int parameterCount = whereEntityCondition.getParameterCount(modelEntity); return (databaseType == MSSQL && parameterCount > MS_SQL_MAX_PARAMETER_COUNT) || (databaseType == POSTGRES_7_3 && parameterCount > POSTGRESQL_MAX_PARAMETER_COUNT); }
public String makeWhereString(ModelEntity modelEntity, List entityConditionParams) { // if (Debug.verboseOn()) Debug.logVerbose("makeWhereString for entity " + modelEntity.getEntityName()); StringBuffer whereStringBuffer = new StringBuffer(); if (conditionList != null && conditionList.size() > 0) { for (int i = 0; i < conditionList.size(); i++) { EntityCondition condition = (EntityCondition) conditionList.get(i); whereStringBuffer.append('('); whereStringBuffer.append(condition.makeWhereString(modelEntity, entityConditionParams)); whereStringBuffer.append(')'); if (i < conditionList.size() - 1) { whereStringBuffer.append(' '); whereStringBuffer.append(operator.getCode()); whereStringBuffer.append(' '); } } } return whereStringBuffer.toString(); }
public void checkCondition(ModelEntity modelEntity) throws GenericModelException { // if (Debug.verboseOn()) Debug.logVerbose("checkCondition for entity " + modelEntity.getEntityName()); Iterator exprIter = conditionList.iterator(); while (exprIter.hasNext()) { EntityCondition entityCondition = (EntityCondition) exprIter.next(); entityCondition.checkCondition(modelEntity); } }
parameterCount += lhsCondition.getParameterCount(modelEntity); parameterCount += rhsCondition.getParameterCount(modelEntity);
public String makeWhereString(ModelEntity modelEntity, List<? super EntityConditionParam> entityConditionParams) { // if (Debug.verboseOn()) Debug.logVerbose("makeWhereString for entity " + modelEntity.getEntityName()); StringBuilder whereStringBuilder = new StringBuilder(); if (conditionList != null && conditionList.size() > 0) { for (int i = 0; i < conditionList.size(); i++) { EntityCondition condition = conditionList.get(i); whereStringBuilder.append('('); whereStringBuilder.append(condition.makeWhereString(modelEntity, entityConditionParams)); whereStringBuilder.append(')'); if (i < conditionList.size() - 1) { whereStringBuilder.append(' '); whereStringBuilder.append(operator.getCode()); whereStringBuilder.append(' '); } } } return whereStringBuilder.toString(); }
public void checkCondition(ModelEntity modelEntity) throws GenericModelException { // if (Debug.verboseOn()) Debug.logVerbose("checkCondition for entity " + modelEntity.getEntityName()); Iterator exprIter = conditionList.iterator(); while (exprIter.hasNext()) { EntityCondition entityCondition = (EntityCondition) exprIter.next(); entityCondition.checkCondition(modelEntity); } }
public String makeWhereString(ModelEntity modelEntity, List entityConditionParams) { // if (Debug.verboseOn()) Debug.logVerbose("makeWhereString for entity " + modelEntity.getEntityName()); StringBuffer whereStringBuffer = new StringBuffer(); if (conditionList != null && conditionList.size() > 0) { for (int i = 0; i < conditionList.size(); i++) { EntityCondition condition = (EntityCondition) conditionList.get(i); whereStringBuffer.append('('); whereStringBuffer.append(condition.makeWhereString(modelEntity, entityConditionParams)); whereStringBuffer.append(')'); if (i < conditionList.size() - 1) { whereStringBuffer.append(' '); whereStringBuffer.append(operator.getCode()); whereStringBuffer.append(' '); } } } return whereStringBuffer.toString(); }
public void checkCondition(ModelEntity modelEntity) throws GenericModelException { // if (Debug.verboseOn()) Debug.logVerbose("checkCondition for entity " + modelEntity.getEntityName()); if (lhs instanceof String) { if (modelEntity.getField((String) lhs) == null) { throw new GenericModelException("Field with name " + lhs + " not found in the " + modelEntity.getEntityName() + " Entity"); } } else if (lhs instanceof EntityCondition) { ((EntityCondition) lhs).checkCondition(modelEntity); ((EntityCondition) rhs).checkCondition(modelEntity); } }
private Predicate<GenericValue> getPredicateFor(final EntityCondition entityCondition) { if (entityCondition instanceof EntityFieldMap) { return getPredicateForEntityFieldMap((EntityFieldMap) entityCondition); } if (entityCondition instanceof EntityExpr) { return getPredicateForEntityExpr((EntityExpr) entityCondition); } if (entityCondition instanceof EntityConditionList) { return getPredicateForEntityConditionList((EntityConditionList) entityCondition); } if (entityCondition instanceof EntityWhereString && StringUtils.isEmpty(entityCondition.makeWhereString(null, null))) { return Predicates.alwaysTrue(); } throw new UnsupportedOperationException("Mock cannot yet handle EntityCondition of type " + entityCondition.getClass()); }
public void checkCondition(ModelEntity modelEntity) throws GenericModelException { // if (Debug.verboseOn()) Debug.logVerbose("checkCondition for entity " + modelEntity.getEntityName()); if (lhs instanceof String) { if (modelEntity.getField((String) lhs) == null) { throw new GenericModelException("Field with name " + lhs + " not found in the " + modelEntity.getEntityName() + " Entity"); } } else if (lhs instanceof EntityCondition) { ((EntityCondition) lhs).checkCondition(modelEntity); ((EntityCondition) rhs).checkCondition(modelEntity); } }
String entityCondWhereString = ""; if (whereEntityCondition != null) { entityCondWhereString = whereEntityCondition.makeWhereString(modelEntity, whereEntityConditionParams); entityCondHavingString = havingEntityCondition.makeWhereString(modelEntity, havingEntityConditionParams);
public void checkCondition(ModelEntity modelEntity) throws GenericModelException { // if (Debug.verboseOn()) Debug.logVerbose("checkCondition for entity " + modelEntity.getEntityName()); if (lhs instanceof String) { if (modelEntity.getField((String) lhs) == null) { throw new GenericModelException("Field with name " + lhs + " not found in the " + modelEntity.getEntityName() + " Entity"); } } else if (lhs instanceof EntityCondition) { ((EntityCondition) lhs).checkCondition(modelEntity); ((EntityCondition) rhs).checkCondition(modelEntity); } }
whereStringBuffer.append(((EntityCondition) lhs).makeWhereString(modelEntity, entityConditionParams)); whereStringBuffer.append(") "); whereStringBuffer.append(this.getOperator().toString()); whereStringBuffer.append(" ("); whereStringBuffer.append(((EntityCondition) rhs).makeWhereString(modelEntity, entityConditionParams)); whereStringBuffer.append(')');
final ModelEntity modelEntity = getModelReader().getModelEntity(entityName); if (whereEntityCondition != null) { whereEntityCondition.checkCondition(modelEntity); havingEntityCondition.checkCondition(modelEntity);
whereStringBuilder.append(((EntityCondition) lhs).makeWhereString(modelEntity, entityConditionParams)); whereStringBuilder.append(") "); whereStringBuilder.append(this.getOperator().toString()); whereStringBuilder.append(" ("); whereStringBuilder.append(((EntityCondition) rhs).makeWhereString(modelEntity, entityConditionParams)); whereStringBuilder.append(')');