DATACOUCH-273 - Adapt to API changes in Spring Data Commons.
This commit is contained in:
@@ -53,7 +53,7 @@ public class AuditingEventListener implements ApplicationListener<BeforeConvertE
|
||||
*/
|
||||
public void onApplicationEvent(BeforeConvertEvent<Object> event) {
|
||||
|
||||
Object entity = event.getSource();
|
||||
auditingHandlerFactory.getObject().markAudited(Optional.of(entity));
|
||||
Optional.ofNullable(event.getSource())//
|
||||
.ifPresent(it -> auditingHandlerFactory.getObject().markAudited(it));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,9 +86,9 @@ public abstract class AbstractN1qlBasedQuery implements RepositoryQuery {
|
||||
public Object execute(Object[] parameters) {
|
||||
ParametersParameterAccessor accessor = new ParametersParameterAccessor(queryMethod.getParameters(), parameters);
|
||||
|
||||
ResultProcessor processor = this.queryMethod.getResultProcessor().withDynamicProjection(Optional.of(accessor));
|
||||
ResultProcessor processor = this.queryMethod.getResultProcessor().withDynamicProjection(accessor);
|
||||
ReturnedType returnedType = processor.getReturnedType();
|
||||
|
||||
|
||||
Class<?> typeToRead = returnedType.getTypeToRead();
|
||||
typeToRead = typeToRead == null ? returnedType.getDomainType() : typeToRead;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.couchbase.client.java.query.dsl.path.LimitPath;
|
||||
import com.couchbase.client.java.query.dsl.path.WherePath;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Mark Ramach
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@@ -55,7 +55,7 @@ public class N1qlCountQueryCreator extends N1qlQueryCreator {
|
||||
}
|
||||
|
||||
public Pageable getPageable() {
|
||||
return delegate.getPageable() != Pageable.NONE ? new CountPageable(delegate.getPageable()) : Pageable.NONE;
|
||||
return delegate.getPageable().isPaged() ? new CountPageable(delegate.getPageable()) : Pageable.unpaged();
|
||||
}
|
||||
|
||||
public Sort getSort() {
|
||||
|
||||
@@ -132,7 +132,7 @@ public class N1qlQueryCreator extends AbstractQueryCreator<LimitPath, Expression
|
||||
OrderByPath selectFromWhere = selectFrom.where(whereCriteria);
|
||||
|
||||
//sort of the Pageable takes precedence over the sort in the query name
|
||||
if ((queryMethod.isPageQuery() || queryMethod.isSliceQuery()) && !Pageable.NONE.equals(accessor.getPageable())) {
|
||||
if ((queryMethod.isPageQuery() || queryMethod.isSliceQuery()) && accessor.getPageable().isPaged()) {
|
||||
Pageable pageable = accessor.getPageable();
|
||||
sort = pageable.getSort();
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class PartTreeN1qlBasedQuery extends AbstractN1qlBasedQuery {
|
||||
Pageable pageable = accessor.getPageable();
|
||||
Assert.notNull(pageable, "Pageable must not be null!");
|
||||
return selectFromWhereOrderBy.limit(pageable.getPageSize()).offset(Math.toIntExact(pageable.getOffset()));
|
||||
} else if (queryMethod.isSliceQuery() && accessor.getPageable() != Pageable.NONE) {
|
||||
} else if (queryMethod.isSliceQuery() && accessor.getPageable().isPaged()) {
|
||||
Pageable pageable = accessor.getPageable();
|
||||
Assert.notNull(pageable, "Pageable must not be null!");
|
||||
return selectFromWhereOrderBy.limit(pageable.getPageSize() + 1).offset(Math.toIntExact(pageable.getOffset()));
|
||||
|
||||
@@ -52,7 +52,7 @@ public abstract class ReactiveAbstractN1qlBasedQuery implements RepositoryQuery
|
||||
@Override
|
||||
public Object execute(Object[] parameters) {
|
||||
ReactiveCouchbaseParameterAccessor accessor = new ReactiveCouchbaseParameterAccessor(queryMethod, parameters);
|
||||
ResultProcessor processor = this.queryMethod.getResultProcessor().withDynamicProjection(Optional.of(accessor));
|
||||
ResultProcessor processor = this.queryMethod.getResultProcessor().withDynamicProjection(accessor);
|
||||
ReturnedType returnedType = processor.getReturnedType();
|
||||
|
||||
Class<?> typeToRead = returnedType.getTypeToRead();
|
||||
|
||||
Reference in New Issue
Block a user