From cdf94f45c5bc73e1c3c27131ea338abc008afcb9 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Mon, 8 Feb 2016 17:10:13 +0100 Subject: [PATCH] DATACOUCH-202 - Adapted to new API in QueryMethod and QueryLookupStrategy. --- .../repository/query/CouchbaseQueryMethod.java | 10 +++++----- .../repository/support/CouchbaseRepositoryFactory.java | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/springframework/data/couchbase/repository/query/CouchbaseQueryMethod.java b/src/main/java/org/springframework/data/couchbase/repository/query/CouchbaseQueryMethod.java index 2af0cd9e..c67ffd16 100644 --- a/src/main/java/org/springframework/data/couchbase/repository/query/CouchbaseQueryMethod.java +++ b/src/main/java/org/springframework/data/couchbase/repository/query/CouchbaseQueryMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2015 the original author or authors. + * Copyright 2013-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import org.springframework.data.couchbase.core.query.Dimensional; import org.springframework.data.couchbase.core.query.Query; import org.springframework.data.couchbase.core.query.View; import org.springframework.data.mapping.context.MappingContext; +import org.springframework.data.projection.ProjectionFactory; import org.springframework.data.repository.core.RepositoryMetadata; import org.springframework.data.repository.query.QueryMethod; import org.springframework.util.StringUtils; @@ -35,18 +36,17 @@ import org.springframework.util.StringUtils; * * @author Michael Nitschinger * @author Simon Baslé + * @author Oliver Gierke */ public class CouchbaseQueryMethod extends QueryMethod { private final Method method; - private final MappingContext, CouchbasePersistentProperty> mappingContext; - public CouchbaseQueryMethod(Method method, RepositoryMetadata metadata, + public CouchbaseQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory, MappingContext, CouchbasePersistentProperty> mappingContext) { - super(method, metadata); + super(method, metadata, factory); this.method = method; - this.mappingContext = mappingContext; } /** diff --git a/src/main/java/org/springframework/data/couchbase/repository/support/CouchbaseRepositoryFactory.java b/src/main/java/org/springframework/data/couchbase/repository/support/CouchbaseRepositoryFactory.java index 2096eb3c..5052590d 100644 --- a/src/main/java/org/springframework/data/couchbase/repository/support/CouchbaseRepositoryFactory.java +++ b/src/main/java/org/springframework/data/couchbase/repository/support/CouchbaseRepositoryFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,6 @@ import org.springframework.data.couchbase.core.query.N1qlSecondaryIndexed; import org.springframework.data.couchbase.core.query.Query; import org.springframework.data.couchbase.core.query.View; import org.springframework.data.couchbase.core.query.ViewIndexed; -import org.springframework.data.couchbase.repository.CouchbaseRepository; import org.springframework.data.couchbase.repository.config.RepositoryOperationsMapping; import org.springframework.data.couchbase.repository.query.CouchbaseEntityInformation; import org.springframework.data.couchbase.repository.query.CouchbaseQueryMethod; @@ -41,6 +40,7 @@ import org.springframework.data.couchbase.repository.query.StringN1qlBasedQuery; import org.springframework.data.couchbase.repository.query.ViewBasedCouchbaseQuery; import org.springframework.data.mapping.context.MappingContext; import org.springframework.data.mapping.model.MappingException; +import org.springframework.data.projection.ProjectionFactory; import org.springframework.data.repository.core.NamedQueries; import org.springframework.data.repository.core.RepositoryInformation; import org.springframework.data.repository.core.RepositoryMetadata; @@ -56,6 +56,7 @@ import org.springframework.util.Assert; * * @author Michael Nitschinger * @author Simon Baslé + * @author Oliver Gierke */ public class CouchbaseRepositoryFactory extends RepositoryFactorySupport { @@ -220,11 +221,11 @@ public class CouchbaseRepositoryFactory extends RepositoryFactorySupport { } @Override - public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, NamedQueries namedQueries) { + public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, ProjectionFactory factory, NamedQueries namedQueries) { CouchbaseOperations couchbaseOperations = couchbaseOperationsMapping.resolve(metadata.getRepositoryInterface(), metadata.getDomainType()); - CouchbaseQueryMethod queryMethod = new CouchbaseQueryMethod(method, metadata, mappingContext); + CouchbaseQueryMethod queryMethod = new CouchbaseQueryMethod(method, metadata, factory, mappingContext); String namedQueryName = queryMethod.getNamedQueryName(); if (queryMethod.hasDimensionalAnnotation()) {