Package org.springframework.data.repository.query

Examples of org.springframework.data.repository.query.ParametersParameterAccessor


   * (non-Javadoc)
   * @see org.springframework.data.repository.query.RepositoryQuery#execute(java.lang.Object[])
   */
  @Override
  public Object execute(Object[] parameters) {
    ParametersParameterAccessor parameterAccessor = new ParametersParameterAccessor(method.getParameters(), parameters);

    QueryString query = new GemfireQueryCreator(tree, method.getPersistentEntity())
      .createQuery(parameterAccessor.getSort());

    RepositoryQuery repositoryQuery = new StringBasedGemfireRepositoryQuery(query.toString(), method, template);

    return repositoryQuery.execute(prepareStringParameters(parameters));
  }
View Full Code Here


   * (non-Javadoc)
   * @see org.springframework.data.repository.query.RepositoryQuery#execute(java.lang.Object[])
   */
  @Override
  public Object execute(Object[] parameters) {
    ParametersParameterAccessor parameterAccessor = new ParametersParameterAccessor(method.getParameters(), parameters);

    QueryString query = (isUserDefinedQuery() ? this.query : this.query.forRegion(
      method.getEntityInformation().getJavaType(), template.getRegion()));

    for (Integer index : query.getInParameterIndexes()) {
      query = query.bindIn(toCollection(parameterAccessor.getBindableValue(index - 1)));
    }

    Collection<?> result = toCollection(template.find(query.toString(), parameters));

    if (method.isCollectionQuery()) {
View Full Code Here

    @Override
    public Object execute(final Object[] parameters) {
        return template.exec(new GraphCallback<Object>() {
            @Override
            public Object doWithGraph(GraphDatabase graph) throws Exception {
                final ParameterAccessor accessor = new ParametersParameterAccessor(queryMethod.getParameters(), parameters);
                Map<String, Object> params = resolveParams(accessor);
                final String queryString = createQueryWithPagingAndSorting(accessor);
                return dispatchQuery(queryString, params, accessor);
            }
        });
View Full Code Here

    protected void assertRepositoryQueryMethod(Class<ThingRepository> repositoryClass, String methodName, Object[] paramValues, String expectedQuery, Object...expectedParam) {
        Method method = methodFor(repositoryClass, methodName);
        DerivedCypherRepositoryQuery derivedCypherRepositoryQuery = new DerivedCypherRepositoryQuery(ctx, new GraphQueryMethod(method, new DefaultRepositoryMetadata(repositoryClass), null, ctx), template);
        Parameters<?, ?> parameters = new DefaultParameters(method);
        ParametersParameterAccessor accessor = new ParametersParameterAccessor(parameters, paramValues);
        String query = derivedCypherRepositoryQuery.createQueryWithPagingAndSorting(accessor);
        Map<String, Object> params = derivedCypherRepositoryQuery.resolveParams(accessor);
        String firstWord = expectedQuery.split("\\s+")[0];
        int beginIndex = query.indexOf(firstWord);
        assertTrue("didn't find word "+firstWord+" in "+query,beginIndex != -1);
View Full Code Here

        this.query = query;
    }

    @Override
    public Object execute(Object[] parameters) {
        ParametersParameterAccessor accessor = new ParametersParameterAccessor(queryMethod.getParameters(), parameters);
        StringQuery stringQuery = createQuery(accessor);
        if(queryMethod.isPageQuery()){
            stringQuery.setPageable(accessor.getPageable());
            return  elasticsearchOperations.queryForPage(stringQuery, queryMethod.getEntityInformation().getJavaType());
        } else if(queryMethod.isCollectionQuery()) {
            if(accessor.getPageable() != null) {
                stringQuery.setPageable(accessor.getPageable());
            }
            return elasticsearchOperations.queryForList(stringQuery,queryMethod.getEntityInformation().getJavaType());
        }

        return elasticsearchOperations.queryForObject(stringQuery, queryMethod.getEntityInformation().getJavaType());
View Full Code Here

        this.mappingContext = elasticsearchOperations.getElasticsearchConverter().getMappingContext();
    }

    @Override
    public Object execute(Object[] parameters) {
        ParametersParameterAccessor accessor = new ParametersParameterAccessor(queryMethod.getParameters(), parameters);
        CriteriaQuery query = createQuery(accessor);
        if(queryMethod.isPageQuery()){
            query.setPageable(accessor.getPageable());
            return elasticsearchOperations.queryForPage(query, queryMethod.getEntityInformation().getJavaType());
        } else if (queryMethod.isCollectionQuery()) {
            if(accessor.getPageable() != null){
                query.setPageable(accessor.getPageable());
            }
            return elasticsearchOperations.queryForList(query,queryMethod.getEntityInformation().getJavaType());
        }
        return elasticsearchOperations.queryForObject(query, queryMethod.getEntityInformation().getJavaType());
    }
View Full Code Here

TOP

Related Classes of org.springframework.data.repository.query.ParametersParameterAccessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.