Ejemplo n.º 1
0
 public Condition interpretFilter(
     InterpretationContext context, ObjectFilter filter, Restriction parent)
     throws QueryException {
   Restriction restriction = findAndCreateRestriction(filter, context, parent);
   Condition condition = restriction.interpret();
   return condition;
 }
Ejemplo n.º 2
0
  private <T extends ObjectFilter> Restriction findAndCreateRestriction(
      T filter, InterpretationContext context, Restriction parent) throws QueryException {

    Validate.notNull(filter, "filter");
    Validate.notNull(context, "context");

    LOGGER.trace("Determining restriction for filter {}", filter);

    ItemPathResolver helper = context.getItemPathResolver();
    JpaEntityDefinition baseEntityDefinition;
    if (parent != null) {
      baseEntityDefinition = parent.getBaseHqlEntityForChildren().getJpaDefinition();
    } else {
      baseEntityDefinition = context.getRootEntityDefinition();
    }
    Restriction restriction =
        findAndCreateRestrictionInternal(filter, context, parent, helper, baseEntityDefinition);

    LOGGER.trace("Restriction for {} is {}", filter.getClass().getSimpleName(), restriction);
    return restriction;
  }