@Test public void testProcess_SingleFilter_Disabled() { assertNull(process(new Filter("cVarchar", "xyz", "like", true, false))); }
@Override public Expression process(AgEntity<?> entity, List<Filter> filters) { Expression combined = null; for (Filter filter : filters) { if(filter.isDisabled()) { continue; } Expression qualifier; switch (filter.getOperator()) { case "like": qualifier = like(filter); break; case "=": qualifier = eq(filter); break; case "!=": qualifier = neq(filter); break; case ">": qualifier = gt(filter); break; case ">=": qualifier = gte(filter); break; case "<": qualifier = lt(filter); break; case "<=": qualifier = lte(filter); break; case "in": qualifier = in(filter); break; default: throw new AgException(Status.BAD_REQUEST, "Invalid filter operator: " + filter.getOperator()); } if (qualifier.getOperandCount() == 2) { pathCache.getPathDescriptor(entity, (ASTObjPath) qualifier.getOperand(0)); } combined = combined != null ? combined.andExp(qualifier) : qualifier; } return postProcessor.process(entity, combined); }
SenchaFilterExpressionCompiler implements ISenchaFilterExpressionCompiler { @Override public Expression process(AgEntity<?> entity, List<Filter> filters) { Expression combined = null; for (Filter filter : filters) { if(filter.isDisabled()) { continue; } Expression qualifier; switch (filter.getOperator()) { case "like": qualifier = like(filter); break; case "=": qualifier = eq(filter); break; case "!=": qualifier = neq(filter); break; case ">": qualifier = gt(filter); break; case ">=": qualifier = gte(filter); break; case "<": qualifier = lt(filter); break; case "<=": qualifier = lte(filter); break; case "in": qualifier = in(filter); break; default: throw new AgException(Status.BAD_REQUEST, "Invalid filter operator: " + filter.getOperator()); } if (qualifier.getOperandCount() == 2) { pathCache.getPathDescriptor(entity, (ASTObjPath) qualifier.getOperand(0)); } combined = combined != null ? combined.andExp(qualifier) : qualifier; } return postProcessor.process(entity, combined); } }
SenchaFilterExpressionCompiler implements ISenchaFilterExpressionCompiler { @Override public Expression process(AgEntity<?> entity, List<Filter> filters) { Expression combined = null; for (Filter filter : filters) { if(filter.isDisabled()) { continue; } Expression qualifier; switch (filter.getOperator()) { case "like": qualifier = like(filter); break; case "=": qualifier = eq(filter); break; case "!=": qualifier = neq(filter); break; case ">": qualifier = gt(filter); break; case ">=": qualifier = gte(filter); break; case "<": qualifier = lt(filter); break; case "<=": qualifier = lte(filter); break; case "in": qualifier = in(filter); break; default: throw new AgException(Status.BAD_REQUEST, "Invalid filter operator: " + filter.getOperator()); } if (qualifier.getOperandCount() == 2) { pathCache.getPathDescriptor(entity, (ASTObjPath) qualifier.getOperand(0)); } combined = combined != null ? combined.andExp(qualifier) : qualifier; } return postProcessor.process(entity, combined); } SenchaFilterExpressionCompiler(
            @Inject IPathDescriptorManager pathCache,
            @Inject IExpressionPostProcessor postProcessor); }
SenchaFilterExpressionCompiler implements ISenchaFilterExpressionCompiler { @Override public Expression process(AgEntity<?> entity, List<Filter> filters) { Expression combined = null; for (Filter filter : filters) { if(filter.isDisabled()) { continue; } Expression qualifier; switch (filter.getOperator()) { case "like": qualifier = like(filter); break; case "=": qualifier = eq(filter); break; case "!=": qualifier = neq(filter); break; case ">": qualifier = gt(filter); break; case ">=": qualifier = gte(filter); break; case "<": qualifier = lt(filter); break; case "<=": qualifier = lte(filter); break; case "in": qualifier = in(filter); break; default: throw new AgException(Status.BAD_REQUEST, "Invalid filter operator: " + filter.getOperator()); } if (qualifier.getOperandCount() == 2) { pathCache.getPathDescriptor(entity, (ASTObjPath) qualifier.getOperand(0)); } combined = combined != null ? combined.andExp(qualifier) : qualifier; } return postProcessor.process(entity, combined); } SenchaFilterExpressionCompiler(
            @Inject IPathDescriptorManager pathCache,
            @Inject IExpressionPostProcessor postProcessor); @Override Expression process(AgEntity<?> entity, List<Filter> filters); }
SenchaFilterExpressionCompiler implements ISenchaFilterExpressionCompiler { @Override public Expression process(AgEntity<?> entity, List<Filter> filters) { Expression combined = null; for (Filter filter : filters) { if(filter.isDisabled()) { continue; } Expression qualifier; switch (filter.getOperator()) { case "like": qualifier = like(filter); break; case "=": qualifier = eq(filter); break; case "!=": qualifier = neq(filter); break; case ">": qualifier = gt(filter); break; case ">=": qualifier = gte(filter); break; case "<": qualifier = lt(filter); break; case "<=": qualifier = lte(filter); break; case "in": qualifier = in(filter); break; default: throw new AgException(Status.BAD_REQUEST, "Invalid filter operator: " + filter.getOperator()); } if (qualifier.getOperandCount() == 2) { pathCache.getPathDescriptor(entity, (ASTObjPath) qualifier.getOperand(0)); } combined = combined != null ? combined.andExp(qualifier) : qualifier; } return postProcessor.process(entity, combined); } SenchaFilterExpressionCompiler(
            @Inject IPathDescriptorManager pathCache,
            @Inject IExpressionPostProcessor postProcessor); @Override Expression process(AgEntity<?> entity, List<Filter> filters);  }