Java 类org.springframework.data.repository.query.parser.Part 实例源码

项目:spring-data-documentdb    文件:DocumentDbQueryCreator.java   
@Override
protected Criteria create(Part part, Iterator<Object> iterator) {
    final PersistentPropertyPath<DocumentDbPersistentProperty> propertyPath =
            mappingContext.getPersistentPropertyPath(part.getProperty());
    final DocumentDbPersistentProperty property = propertyPath.getLeafProperty();
    final LinkedHashMap<String, Object> params = new LinkedHashMap<String, Object>();
    final Collection<Object> clonedIterator = new ArrayList<Object>();

    while (iterator.hasNext()) {
        final Object obj = iterator.next();
        params.put(propertyPath.toDotPath(), obj);
        clonedIterator.add(obj);
    }

    final Criteria criteria = from(part, property, Criteria.where(propertyPath.toDotPath(), params),
            clonedIterator.iterator());
    return criteria;
}
项目:spring-data-documentdb    文件:DocumentDbQueryCreator.java   
private Criteria createLikeRegexCriteriaOrThrow(Part part, DocumentDbPersistentProperty property,
    Criteria criteria, Iterator<Object> parameters, boolean shouldNegateExpression) {
    final PropertyPath path = part.getProperty().getLeafProperty();

    switch (part.shouldIgnoreCase()) {
        case ALWAYS:
            if (path.getType() != String.class) {
                throw new IllegalArgumentException("part must be String, but: " + path.getType() + ", " + path);
            }

            /* fall through */
        case WHEN_POSSIBLE:

            return criteria;

        case NEVER:
            break;
    }

    return null;
}
项目:springfield    文件:QueryMethodResolver.java   
private Predicate createPredicate(PathBuilder<?> builder, PartTree tree, BeanWrapper bean){

    //BeanWrapper paramWrapper = PropertyAccessorFactory.forBeanPropertyAccess(param);

    BooleanExpression base = null;
    for (OrPart node : tree) {
        //logger.debug("OrPart : "+node.getClass());

        BooleanExpression criteria = null;
        for (Part part : node) {
            //logger.debug("Part "+part.getClass());

            if(part.getProperty() != null){
                BooleanExpression newCriteria = create(builder, part, bean);
                if(newCriteria != null){
                    //logger.debug("ok....");
                    criteria = criteria == null ? newCriteria : and(criteria, newCriteria, bean);
                }
            }
        }
        base = base == null ? criteria : or(base, criteria, bean);
    }
    //logger.debug("base "+base);

    return base;
}
项目:spring-data-documentdb    文件:DocumentDbQueryCreator.java   
private Criteria from(Part part, DocumentDbPersistentProperty property,
                      Criteria criteria, Iterator<Object> parameters) {

    final Part.Type type = part.getType();

    switch (type) {
        case SIMPLE_PROPERTY:

            return isSimpleComparisionPossible(part) ? criteria.is(parameters.next())
                    : createLikeRegexCriteriaOrThrow(part, property, criteria, parameters, false);
        default:
            throw new IllegalArgumentException("unsupported keyword: " + type);
    }
}
项目:spring-data-documentdb    文件:DocumentDbQueryCreator.java   
private boolean isSimpleComparisionPossible(Part part) {
    switch (part.shouldIgnoreCase()) {
        case NEVER:
            return true;
        case WHEN_POSSIBLE:
            return part.getProperty().getType() != String.class;
        case ALWAYS:
            return false;
        default:
            return true;
    }
}
项目:spring-data-tarantool    文件:TarantoolQueryCreator.java   
@Override
protected TarantoolQuery create(Part part, Iterator<Object> iterator) {
    switch (part.getType()) {
        case SIMPLE_PROPERTY:
            return new TarantoolQuery(part.getProperty().toDotPath(), iterator.next());
        default:
            throw new IllegalArgumentException(part.getType() + "is not supported for redis query derivation");
    }
}
项目:spring-data-snowdrop    文件:SnowdropQueryCreator.java   
@Override
protected CriteriaQuery<?> and(Part part, CriteriaQuery<?> base, Iterator<Object> iterator) {
    if (base == null) {
        return create(part, iterator);
    }
    PersistentPropertyPath<SnowdropPersistentProperty> path = context.getPersistentPropertyPath(part.getProperty());
    return base.addCriteria(from(part, new AndCriteria(path.toDotPath(SnowdropPersistentProperty.PropertyToFieldNameConverter.INSTANCE)), iterator));
}
项目:spring-data-gclouddatastore    文件:GcloudDatastoreQueryCreator.java   
@Override
protected StructuredQuery.Filter create(Part part, Iterator<Object> parameters) {
    if (part.getType().getKeywords().contains("Equals")) {
        List<String> segments = new ArrayList<String>();
        Iterator<PropertyPath> propertyPathIter = part.getProperty().iterator();
        while (propertyPathIter.hasNext()) {
            segments.add(propertyPathIter.next().getSegment());
        }
        String property = String.join(".", segments);

        Object value = parameters.next();
        if (value == null) {
            return StructuredQuery.PropertyFilter.isNull(property);
        }
        else if (value instanceof Boolean) {
            return StructuredQuery.PropertyFilter.eq(property, (Boolean) value);
        }
        else if (value instanceof Double || value instanceof Float) {
            return StructuredQuery.PropertyFilter.eq(property,
                    ((Number) value).doubleValue());
        }
        else if (value instanceof Number) {
            return StructuredQuery.PropertyFilter.eq(property,
                    ((Number) value).longValue());
        }
        else if (value instanceof CharSequence) {
            return StructuredQuery.PropertyFilter.eq(property,
                    ((CharSequence) value).toString());
        }
        else {
            throw new UnsupportedOperationException(
                    "Value type not supported: " + value + " : " + value.getClass());
        }
    }
    else {
        throw new UnsupportedOperationException(
                "Part type not supported: " + part.getType());
    }
}
项目:spring-data-objectify    文件:ObjectifyRepositoryQuery.java   
protected Object doExecute(Object[] parameters) {
    Class<?> domainClass = queryMethod.getEntityInformation().getJavaType();
    int paramIndex = 0;

    PartTree tree = new PartTree(getQueryMethod().getName(), getQueryMethod().getEntityInformation().getJavaType());
    System.out.println(tree);

    List<Filter> orFilters = new ArrayList<Filter>();
    for (Iterator<OrPart> orPartIter = tree.iterator(); orPartIter.hasNext();) {
        OrPart orPart = orPartIter.next();

        List<Filter> andFilters = new ArrayList<Filter>();
        for (Iterator<Part> partIter = orPart.iterator(); partIter.hasNext();) {
            Part part = partIter.next();
            PropertyPath propertyPath  = part.getProperty();
            String propName = propertyPath.getSegment();
            Object propValue = parameters[paramIndex++];

            FilterOperator operator = getFilterOperation(part);
            Filter filter = new Query.FilterPredicate(propName, operator, propValue);
            andFilters.add(filter);
        }
        if (andFilters.size() == 1) {
            orFilters.add(andFilters.get(0));
        } else if (andFilters.size() >= 2){
            orFilters.add(CompositeFilterOperator.and(andFilters));
        }
    }

    com.googlecode.objectify.cmd.Query q = ofy().load().type(domainClass);
    if (orFilters.size() == 1) {
        q = q.filter(orFilters.get(0));
    } else if (orFilters.size() >= 2){
        q = q.filter(CompositeFilterOperator.or(orFilters));
    }
    return q.list();
}
项目:spring-data-objectify    文件:ObjectifyRepositoryQuery.java   
private FilterOperator getFilterOperation(Part part){
    FilterOperator operator = null;
    switch (part.getType()) {
        case LESS_THAN:
            operator = Query.FilterOperator.LESS_THAN;
            break;
        case LESS_THAN_EQUAL:
            operator = Query.FilterOperator.LESS_THAN_OR_EQUAL;
            break;
        case GREATER_THAN:
            operator = Query.FilterOperator.GREATER_THAN;
            break;
        case GREATER_THAN_EQUAL:
            operator = Query.FilterOperator.GREATER_THAN_OR_EQUAL;
            break;
        case SIMPLE_PROPERTY:
            operator = Query.FilterOperator.EQUAL;
            break;
        case NEGATING_SIMPLE_PROPERTY:
            operator = Query.FilterOperator.NOT_EQUAL;
            break;
        case IN:
            operator = Query.FilterOperator.IN;
            break;
        default:
            throw new UnsupportedOperationException("Unsupported Part Type: " + part.getType());
    }

    return operator;
}
项目:spring-data-ebean    文件:ParameterMetadataProvider.java   
/**
 * Builds a new {@link ParameterMetadata} for the given type and name.
 *
 * @param <T>
 * @param part      must not be {@literal null}.
 * @param type      parameter type, must not be {@literal null}.
 * @param parameter
 * @return
 */
private <T> ParameterMetadata<T> next(Part part, Class<T> type, Parameter parameter) {
  Assert.notNull(type, "Type must not be null!");

  ParameterMetadata<T> value = new ParameterMetadata<T>(type, parameter.getName().get(), part.getType(),
      bindableParameterValues == null ? ParameterMetadata.PLACEHOLDER : bindableParameterValues.next());
  expressions.add(value);

  return value;
}
项目:spring-data-ebean    文件:EbeanQueryCreator.java   
/**
 * Creates a new {@link ExpressionBuilder} for the given {@link Part} and {@link ExpressionList}.
 *
 * @param part must not be {@literal null}.
 * @param root must not be {@literal null}.
 */
public ExpressionBuilder(Part part, ExpressionList<?> root) {
  Assert.notNull(part, "Part must not be null!");
  Assert.notNull(root, "ExpressionList must not be null!");
  this.part = part;
  this.root = root;
}
项目:spring-data-keyvalue-redis    文件:RedisQueryCreator.java   
private RedisOperationChain from(Part part, Iterator<Object> iterator, RedisOperationChain sink) {

        switch (part.getType()) {
            case SIMPLE_PROPERTY:
                sink.sismember(part.getProperty().toDotPath() + ":" + iterator.next());
                break;
            default:
                throw new IllegalArgumentException(part.getType() + "is not supported for redis query derivation");
        }

        return sink;

    }
项目:dubbox-solr    文件:SolrQueryCreator.java   
@Override
protected Query and(Part part, Query base, Iterator<Object> iterator) {
    if (base == null) {
        return create(part, iterator);
    }
    PersistentPropertyPath<SolrPersistentProperty> path = context.getPersistentPropertyPath(part.getProperty());
    return base.addCriteria(from(part.getType(),
            new Criteria(path.toDotPath(SolrPersistentProperty.PropertyToFieldNameConverter.INSTANCE)), iterator));
}
项目:spring-data-solr    文件:SolrQueryCreator.java   
@Override
protected Query and(Part part, Query base, Iterator<Object> iterator) {
    if (base == null) {
        return create(part, iterator);
    }
    PersistentPropertyPath<SolrPersistentProperty> path = context.getPersistentPropertyPath(part.getProperty());
    return base.addCriteria(from(part.getType(),
            new Criteria(path.toDotPath(SolrPersistentProperty.PropertyToFieldNameConverter.INSTANCE)), iterator));
}
项目:spring-data-hazelcast    文件:HazelcastPartTreeQuery.java   
/**
 * <P>
 * Determine if the arguments to the method need reordered.
 * </P>
 * <P>
 * For searches such as {@code findBySomethingNotNull} there may be more parts than parameters needed to be bound to
 * them.
 * </P>
 *
 * @param partTree Query parts
 * @param bindableParameters Parameters expected
 */
@SuppressWarnings("unchecked")
private void prepareRearrange(final PartTree partTree, final Parameters<?, ?> bindableParameters) {

    this.isRearrangeRequired = false;
    if (partTree == null || bindableParameters == null) {
        return;
    }

    List<String> queryParams = new ArrayList<>();
    List<String> methodParams = new ArrayList<>();

    Iterator<Part> partTreeIterator = partTree.getParts().iterator();
    while (partTreeIterator.hasNext()) {
        Part part = partTreeIterator.next();
        queryParams.add(part.getProperty().getSegment());
    }

    Iterator<Parameter> bindableParameterIterator = (Iterator<Parameter>) bindableParameters.iterator();
    while (bindableParameterIterator.hasNext()) {
        Parameter parameter = bindableParameterIterator.next();
        methodParams.add(parameter.getName());
    }

    this.rearrangeIndex = new int[queryParams.size()];

    String[] paramsExpected = queryParams.toArray(new String[queryParams.size()]);
    String[] paramsProvided = methodParams.toArray(new String[methodParams.size()]);

    for (int i = 0; i < this.rearrangeIndex.length; i++) {
        this.rearrangeIndex[i] = i;

        for (int j = 0; j < paramsProvided.length; j++) {
            if (paramsProvided[j] != null && paramsProvided[j].equals(paramsExpected[i])) {
                this.rearrangeIndex[i] = j;
                this.isRearrangeRequired = true;
            }
        }
    }
}
项目:spring-data-dynamodb    文件:AbstractDynamoDBQueryCreator.java   
@Override
protected DynamoDBQueryCriteria<T, ID> create(Part part, Iterator<Object> iterator) {

    DynamoDBQueryCriteria<T, ID> criteria = entityMetadata.isRangeKeyAware() ? new DynamoDBEntityWithHashAndRangeKeyCriteria<T, ID>(
            (DynamoDBIdIsHashAndRangeKeyEntityInformation<T, ID>) entityMetadata)
            : new DynamoDBEntityWithHashKeyOnlyCriteria<T, ID>(entityMetadata);
    return addCriteria(criteria, part, iterator);
}
项目:spring-data-simpledb    文件:PartTreeConverter.java   
/**
 * Convert a {@link PartTree} into a where query alike to the one present in the
 * {@link Query}'s where property.  
 */
public static String toIndexedQuery(final PartTree tree) {
    final StringBuilder result = new StringBuilder();

    final Iterator<OrPart> orIt = tree.iterator();
    while(orIt.hasNext()) {

        final OrPart orPart = orIt.next();

        final Iterator<Part> partIt = orPart.iterator();
        while(partIt.hasNext()) {
            final Part part = partIt.next();

            result.append(" " + part.getProperty().getSegment() + " ");
            result.append(convertOperator(part.getType()));

            if(partIt.hasNext()) {
                result.append(" AND ");
            }
        }

        if(orIt.hasNext()) {
            result.append(" OR ");
        }
    }

    return StringUtil.removeExtraSpaces(result.toString());
}
项目:spring-data-jdbc    文件:JdbcByNameRepositoryQueryCreator.java   
@Override
protected String create(Part part, Iterator<Object> iterator) {
    return new QueryPartBuilder(part, iterator).build();
}
项目:spring-data-jdbc    文件:JdbcByNameRepositoryQueryCreator.java   
@Override
protected String and(Part part, String left, Iterator<Object> iterator) {
    return builder.and(left, create(part, iterator));
}
项目:spring-data-documentdb    文件:DocumentDbQueryCreator.java   
@Override
protected Criteria and(Part part, Criteria base, Iterator<Object> iterator) {
    // not supported yet
    return null;
}
项目:spring-data-tarantool    文件:TarantoolQueryCreator.java   
@Override
protected TarantoolQuery and(Part part, TarantoolQuery base, Iterator<Object> iterator) {
    throw new UnsupportedOperationException("and is not supported");
}
项目:spring-data-snowdrop    文件:SnowdropQueryCreator.java   
@Override
protected CriteriaQuery<?> create(Part part, Iterator<Object> iterator) {
    PersistentPropertyPath<SnowdropPersistentProperty> path = context.getPersistentPropertyPath(part.getProperty());
    return new CriteriaQuery(entityClass, from(part, new AndCriteria(path.toDotPath(SnowdropPersistentProperty.PropertyToFieldNameConverter.INSTANCE)), iterator));
}
项目:spring-data-gclouddatastore    文件:GcloudDatastoreQueryCreator.java   
@Override
protected StructuredQuery.Filter and(Part part, StructuredQuery.Filter filter,
        Iterator<Object> parameters) {

    return StructuredQuery.CompositeFilter.and(filter, create(part, parameters));
}
项目:spring-data-mapdb    文件:QueryCreator.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected Predicate<?> create(Part part, Iterator<Object> iterator) {
    return from(part, (Iterator<Comparable<?>>) (Iterator) iterator);
}
项目:spring-data-mapdb    文件:QueryCreator.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected Predicate<?> and(Part part, Predicate<?> base, Iterator<Object> iterator) {
    return ((Predicate<Object>) base).and((Predicate<Object>) from(part, (Iterator<Comparable<?>>) (Iterator) iterator));
}
项目:spring-data-mapdb    文件:QueryCreator.java   
private Predicate<?> from(Part part, Iterator<Comparable<?>> iterator) {

        String property = part.getProperty().toDotPath();
        Type type = part.getType();
        boolean ignoreCase = (part.shouldIgnoreCase() != IgnoreCaseType.NEVER);

        Predicate<?> predicate = null;

        switch (type) {

        case TRUE:
            predicate = new EqualsPredicate(true);
            break;

        case FALSE:
            predicate = new EqualsPredicate(false);
            break;

        case SIMPLE_PROPERTY:
            if (ignoreCase) {
                predicate = new ILikePredicate(iterator.next().toString());
            } else {
                predicate = new EqualsPredicate(iterator.next());
            }
            break;

        case GREATER_THAN:
        case GREATER_THAN_EQUAL:
        case LESS_THAN:
        case LESS_THAN_EQUAL:
            predicate = fromInequalityVariant(type, ignoreCase, iterator);
            break;

        case LIKE:
            predicate = new LikePredicate(iterator.next().toString());
            break;

        case IS_NULL:
            predicate = NullCheckPredicate.isNull();
            break;

        case IS_NOT_NULL:
            predicate = NullCheckPredicate.notNull();
            break;

        // TODO
        /*
         * case AFTER: case BEFORE: case BETWEEN: case CONTAINING: case
         * ENDING_WITH: case EXISTS: case IN: case NEAR: case
         * NEGATING_SIMPLE_PROPERTY: case NOT_CONTAINING: case NOT_IN: case
         * NOT_LIKE: case REGEX: case STARTING_WITH: case WITHIN:
         */
        default:
            throw new InvalidDataAccessApiUsageException(String.format("Found invalid part '%s' in query", type));
        }

        return PropertyPredicate.wrap(predicate, property);

    }
项目:spring-data-ebean    文件:EbeanQueryCreator.java   
@Override
protected Expression create(Part part, Iterator<Object> iterator) {
  return toExpression(part, root);
}
项目:spring-data-ebean    文件:EbeanQueryCreator.java   
@Override
protected Expression and(Part part, Expression base, Iterator<Object> iterator) {
  return Expr.and(base, toExpression(part, root));
}
项目:spring-data-ebean    文件:EbeanQueryCreator.java   
/**
     * Builds a Ebean {@link Expression} from the underlying {@link Part}.
     *
     * @return
     */
    public Expression build() {
      PropertyPath property = part.getProperty();
      Part.Type type = part.getType();

      switch (type) {
        case BETWEEN:
          ParameterMetadataProvider.ParameterMetadata<Comparable> first = provider.next(part);
          ParameterMetadataProvider.ParameterMetadata<Comparable> second = provider.next(part);
          return Expr.between(property.toDotPath(), first.getParameterValue(), second.getParameterValue());
        case AFTER:
        case GREATER_THAN:
          return Expr.gt(property.toDotPath(), provider.next(part).getParameterValue());
        case GREATER_THAN_EQUAL:
          return Expr.ge(property.toDotPath(), provider.next(part).getParameterValue());
        case BEFORE:
        case LESS_THAN:
          return Expr.lt(property.toDotPath(), provider.next(part).getParameterValue());
        case LESS_THAN_EQUAL:
          return Expr.le(property.toDotPath(), provider.next(part).getParameterValue());
        case IS_NULL:
          return Expr.isNull(property.toDotPath());
        case IS_NOT_NULL:
          return Expr.isNotNull(property.toDotPath());
        case NOT_IN:
          ParameterMetadataProvider.ParameterMetadata<? extends Collection> pmNotIn = provider.next(part, Collection.class);
          return Expr.not(Expr.in(property.toDotPath(), ParameterMetadataProvider.ParameterMetadata.toCollection(pmNotIn.getParameterValue())));
        case IN:
          ParameterMetadataProvider.ParameterMetadata<? extends Collection> pmIn = provider.next(part, Collection.class);
          return Expr.in(property.toDotPath(), ParameterMetadataProvider.ParameterMetadata.toCollection(pmIn.getParameterValue()));
        case STARTING_WITH:
          return Expr.startsWith(property.toDotPath(), (String) provider.next(part).getParameterValue());
        case ENDING_WITH:
          return Expr.endsWith(property.toDotPath(), (String) provider.next(part).getParameterValue());
        case CONTAINING:
          return Expr.contains(property.toDotPath(), (String) provider.next(part).getParameterValue());
        case NOT_CONTAINING:
          return Expr.not(Expr.contains(property.toDotPath(), (String) provider.next(part).getParameterValue()));
        case LIKE:
          return Expr.like(property.toDotPath(), (String) provider.next(part).getParameterValue());
        case NOT_LIKE:
          return Expr.not(Expr.like(property.toDotPath(), (String) provider.next(part).getParameterValue()));
        case TRUE:
          return Expr.eq(property.toDotPath(), true);
        case FALSE:
          return Expr.eq(property.toDotPath(), false);
        case SIMPLE_PROPERTY:
          ParameterMetadataProvider.ParameterMetadata<Object> pmEquals = provider.next(part);
          return pmEquals.isIsNullParameter() ? Expr.isNull(property.toDotPath())
              : Expr.eq(property.toDotPath(), pmEquals.getParameterValue());
        case NEGATING_SIMPLE_PROPERTY:
          ParameterMetadataProvider.ParameterMetadata<Object> pmNot = provider.next(part);
          return pmNot.isIsNullParameter() ? Expr.isNull(property.toDotPath())
              : Expr.ne(property.toDotPath(), pmNot.getParameterValue());
//              case IS_EMPTY:
//                  return root.isEmpty(part.getProperty().getSegment());
//              case IS_NOT_EMPTY:
//                  return root.isEmpty(part.getProperty().getSegment());
        default:
          throw new IllegalArgumentException("Unsupported keyword " + type);
      }
    }
项目:spring-data-mybatis    文件:PartTreeMybatisQuery.java   
private String buildQueryCondition(boolean basic) {

        StringBuilder builder = new StringBuilder();
        builder.append("<trim prefix=\" where \" prefixOverrides=\"and |or \">");
        int c = 0;
        for (Iterator<PartTree.OrPart> iterator = tree.iterator(); iterator.hasNext(); ) {
            PartTree.OrPart orPart = iterator.next();
            builder.append(" or (");
            builder.append("<trim prefix=\"\" prefixOverrides=\"and |or \">");

            for (Iterator<Part> it = orPart.iterator(); it.hasNext(); ) {
                String columnName = null;
                Part part = it.next();
                MybatisPersistentProperty property = persistentEntity.getPersistentProperty(part.getProperty().getSegment());
                if (null == property) {
                    throw new MybatisQueryException("can not find property: " + part.getProperty().getSegment() + " from entity: " + persistentEntity.getName());
                }
                if (!property.isEntity()) {
                    columnName = quota(persistentEntity.getEntityName()) + "." + dialect.wrapColumnName(property.getColumnName());
                } else if (!basic) {
                    if (property.isAssociation()) {
                        Association<MybatisPersistentProperty> ass = property.getAssociation();
                        if (ass instanceof MybatisManyToOneAssociation) {
                            MybatisManyToOneAssociation association = (MybatisManyToOneAssociation) ass;

                            MybatisPersistentEntity<?> obversePersistentEntity = association.getObversePersistentEntity();
                            if (null == obversePersistentEntity) {
                                throw new MybatisQueryException("can not find obverse persistent entity.");
                            }

                            PropertyPath leaf = part.getProperty().getLeafProperty();

                            if (obversePersistentEntity.getType() == leaf.getType()) {

                                //columnName = quota(persistentEntity.getEntityName() + "." + part.getProperty().getSegment()) + "." + dialect.wrapColumnName(obversePersistentEntity.getIdProperty().getColumnName());
                                throw new UnsupportedOperationException("findBy{Association Model} Style is not support now.");

                            } else {
                                MybatisPersistentProperty leafProperty = obversePersistentEntity.getPersistentProperty(leaf.getSegment());
                                if (null == leafProperty) {
                                    throw new MybatisQueryException("can not find property: " + leaf.getSegment() + " from entity: " + obversePersistentEntity.getName());
                                }
                                columnName = quota(persistentEntity.getEntityName() + "." + part.getProperty().getSegment()) + "." + dialect.wrapColumnName(leafProperty.getColumnName());
                            }
                        } else if (ass instanceof MybatisEmbeddedAssociation) {
                            columnName = quota(persistentEntity.getEntityName()) + "." + dialect.wrapColumnName(ass.getObverse().getColumnName());
                        }
                    }
                }

                if (null == columnName) {
                    throw new MybatisQueryException("can not find property: " + part.getProperty().getSegment() + " in " + method.getName());
                }

                builder.append(" and ");

                IgnoreCaseType ignoreCaseType = part.shouldIgnoreCase();
                if (ignoreCaseType == ALWAYS || ignoreCaseType == WHEN_POSSIBLE) {
                    builder.append("upper(").append(columnName).append(")");
                } else {
                    builder.append(columnName);
                }

                builder.append(generator.buildConditionOperate(part.getType()));
                String[] properties = new String[part.getType().getNumberOfArguments()];
                for (int i = 0; i < properties.length; i++) {
                    properties[i] = resolveParameterName(c++);
                }
                builder.append(generator.buildConditionCaluse(part.getType(), ignoreCaseType, properties));
            }

            builder.append("</trim>");

            builder.append(" )");

        }
        builder.append("</trim>");
        return builder.toString();
    }
项目:spring-vault    文件:VaultQueryCreator.java   
@Override
protected VaultQuery create(Part part, Iterator<Object> parameters) {
    return new VaultQuery(createPredicate(part, parameters));
}
项目:spring-vault    文件:VaultQueryCreator.java   
@Override
protected VaultQuery and(Part part, VaultQuery base, Iterator<Object> parameters) {
    return base.and(createPredicate(part, parameters));
}
项目:spring-vault    文件:VaultQueryCreator.java   
private static VariableAccessor getVariableAccessor(Part part) {
    return isIgnoreCase(part) ? VariableAccessor.Lowercase : VariableAccessor.AsIs;
}
项目:spring-vault    文件:VaultQueryCreator.java   
private static boolean isIgnoreCase(Part part) {
    return part.shouldIgnoreCase() != IgnoreCaseType.NEVER;
}
项目:spring-data-keyvalue-redis    文件:RedisQueryCreator.java   
@Override
protected RedisOperationChain create(Part part, Iterator<Object> iterator) {
    return from(part, iterator, new RedisOperationChain());
}
项目:spring-data-keyvalue-redis    文件:RedisQueryCreator.java   
@Override
protected RedisOperationChain and(Part part, RedisOperationChain base, Iterator<Object> iterator) {
    return from(part, iterator, base);
}
项目:dubbox-solr    文件:SolrQueryCreator.java   
@Override
protected Query create(Part part, Iterator<Object> iterator) {
    PersistentPropertyPath<SolrPersistentProperty> path = context.getPersistentPropertyPath(part.getProperty());
    return new SimpleQuery(from(part.getType(),
            new Criteria(path.toDotPath(SolrPersistentProperty.PropertyToFieldNameConverter.INSTANCE)), iterator));
}
项目:ignite    文件:IgniteQueryGenerator.java   
/**
 * @param mtd Method.
 * @param metadata Metadata.
 */
@NotNull public static IgniteQuery generateSql(Method mtd, RepositoryMetadata metadata) {
    PartTree parts = new PartTree(mtd.getName(), metadata.getDomainType());

    StringBuilder sql = new StringBuilder();

    if (parts.isDelete())
        throw new UnsupportedOperationException("DELETE clause is not supported now.");
    else {
        sql.append("SELECT ");

        if (parts.isDistinct())
            throw new UnsupportedOperationException("DISTINCT clause in not supported.");

        if (parts.isCountProjection())
            sql.append("COUNT(1) ");
        else
            sql.append(" * ");
    }

    sql.append("FROM ").append(metadata.getDomainType().getSimpleName());

    if (parts.iterator().hasNext()) {
        sql.append(" WHERE ");

        for (PartTree.OrPart orPart : parts) {
            sql.append("(");
            for (Part part : orPart) {
                handleQueryPart(sql, part);
                sql.append(" AND ");
            }

            sql.delete(sql.length() - 5, sql.length());

            sql.append(") OR ");
        }

        sql.delete(sql.length() - 4, sql.length());
    }

    addSorting(sql, parts.getSort());

    if (parts.isLimiting()) {
        sql.append(" LIMIT ");
        sql.append(parts.getMaxResults().intValue());
    }

    return new IgniteQuery(sql.toString(), parts.isCountProjection(), getOptions(mtd));
}