Java Code Examples for org.springframework.data.repository.query.ResultProcessor#processResult()

The following examples show how to use org.springframework.data.repository.query.ResultProcessor#processResult() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractNeo4jQuery.java    From sdn-rx with Apache License 2.0 6 votes vote down vote up
@Override
public final Object execute(Object[] parameters) {

	Neo4jParameterAccessor parameterAccessor = getParameterAccessor(parameters);
	ResultProcessor resultProcessor = queryMethod.getResultProcessor().withDynamicProjection(parameterAccessor);

	PreparedQuery<?> preparedQuery = prepareQuery(resultProcessor.getReturnedType().getReturnedType(),
		getInputProperties(resultProcessor), parameterAccessor, null, getMappingFunction(resultProcessor));

	Object rawResult = new DefaultQueryExecution(neo4jOperations).execute(
		preparedQuery, queryMethod.isCollectionLikeQuery() || queryMethod.isPageQuery());

	Object processedResult = resultProcessor.processResult(rawResult, OptionalUnwrappingConverter.INSTANCE);

	if (!queryMethod.isPageQuery()) {
		return processedResult;
	} else {
		return PageableExecutionUtils.getPage((List<?>) processedResult, parameterAccessor.getPageable(), () -> {

			PreparedQuery<Long> countQuery = prepareQuery(Long.class, Collections.emptyList(), parameterAccessor,
				Neo4jQueryType.COUNT, null);
			return neo4jOperations.toExecutableQuery(countQuery).getRequiredSingleResult();
		});
	}
}
 
Example 2
Source File: AbstractReactiveNeo4jQuery.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
public final Object execute(Object[] parameters) {

	Neo4jParameterAccessor parameterAccessor = getParameterAccessor(parameters);
	ResultProcessor resultProcessor = queryMethod.getResultProcessor().withDynamicProjection(parameterAccessor);

	PreparedQuery<?> preparedQuery = prepareQuery(resultProcessor.getReturnedType().getReturnedType(),
		getInputProperties(resultProcessor), parameterAccessor, null, getMappingFunction(resultProcessor));

	Object rawResult = new Neo4jQueryExecution.ReactiveQueryExecution(neo4jOperations).execute(
		preparedQuery, queryMethod.isCollectionLikeQuery());

	return resultProcessor.processResult(rawResult, OptionalUnwrappingConverter.INSTANCE);
}
 
Example 3
Source File: AbstractMybatisQuery.java    From spring-data-mybatis with Apache License 2.0 5 votes vote down vote up
@Nullable
private Object doExecute(MybatisQueryExecution execution, Object[] values) {

	Object result = execution.execute(this, values);

	ParametersParameterAccessor accessor = new ParametersParameterAccessor(
			method.getParameters(), values);
	ResultProcessor withDynamicProjection = method.getResultProcessor()
			.withDynamicProjection(accessor);

	return withDynamicProjection.processResult(result,
			new TupleConverter(withDynamicProjection.getReturnedType()));
}
 
Example 4
Source File: KeyValuePartTreeQuery.java    From spring-data-keyvalue with Apache License 2.0 5 votes vote down vote up
@Override
public Object execute(Object[] parameters) {

	ParameterAccessor accessor = new ParametersParameterAccessor(getQueryMethod().getParameters(), parameters);
	KeyValueQuery<?> query = prepareQuery(parameters);
	ResultProcessor processor = queryMethod.getResultProcessor().withDynamicProjection(accessor);

	return processor.processResult(doExecute(parameters, query));
}