@SuppressWarnings("unchecked") protected Object dispatchQuery( String queryString, Map<String, Object> params, ParameterAccessor accessor) { GraphQueryMethod queryMethod = getQueryMethod(); final QueryEngine<?> queryEngine = getQueryEngine(); final Class<?> compoundType = queryMethod.getCompoundType(); if (queryMethod.isPageQuery()) { @SuppressWarnings("unchecked") final Iterable<?> result = queryEngine.query(queryString, params).to(compoundType); return createPage(result, accessor.getPageable()); } if (queryMethod.isIterableResult()) { return queryEngine.query(queryString, params).to(compoundType); } return queryEngine.query(queryString, params).to(queryMethod.getReturnType()).singleOrNull(); }
@Override public Object execute(Object[] parameters) { final ParameterAccessor accessor = new ParametersParameterAccessor(queryMethod.getParameters(), parameters); Map<String, Object> params = resolveParams(accessor); final String queryString = createQueryWithPagingAndSorting(accessor); return dispatchQuery(queryString, params, accessor); }
protected String createQueryWithPagingAndSorting(ParameterAccessor accessor) { return queryMethod.getQueryString(); }
protected Map<String, Object> resolveParams(ParameterAccessor accessor) { return queryMethod.resolveParams(accessor, this); }