This commit allows to separate creation of beans dedicated to Spring Data Couchbase from the ones that can be made more common (SDK instances) and now can be provided externally through a a strategy interface, `CouchbaseConfigurer`.
Rather than having to extend a few methods from the base Configuration
class, `CouchbaseConfigurer` represents all the components that the Spring Data integration requires.
Configuration is based on Document annotation. When read of document takes place then touch action is executed on document. It is an asynchronous action so it does not block read. It is executed only on single reads (not view-based or N1QL-based ones).
In addition to annotating the repository with xxxIndexed annotations, user must now opt-in to the feature by redefining the indexManager bean in the configuration. This is so production use of this feature is actively discouraged.
Choice of placeholder "mode" is determined by the syntax used inside the query, early during repository instantiation.
An IllegalArgumentException is thrown if both named and positional parameters are used.
The generated view's default map function now emits meta.id so that CRUD findAll(ids) works.
The default value for the view name is now "all".
The ViewIndexed isn't documented as applicable to METHODs (deferred feature).
This change allows simple projections to types long, boolean, String when an inline N1QL query uses an aggregation function like AVG, COUNT.
The projection's result must be a single row with a single key/value pair in the N1QL response. Only the value gets returned.
Added an integration test for custom method customization.
Moved the integration test for base class customization.
Put the samples in the documentation in a new "Changing Repository Behaviour" section.
This commit ensures that methods in the template and the repository base classes are correctly ignoring documents that have been deleted but are still identified by the view due to using weak consistency (Stale.TRUE).
FindByView in template now ignores null rows in its result list. It also correctly forces the includeDocs parameter in order not to risk a bad transcoding of the document (javadoc clarified).
DeleteAll in the repository CRUD implementation will correctly detect attempts at deleting a non-existing document (DocumentDoesNotExistException is also correctly mapped to a Spring Data exception now).
DeleteAll behavior with DataRetrievalFailureException is tested in RepositoryIndexUsageTest.
The CRUD methods that are backed by a view in SimpleCouchbaseRepository now take the default view consistency into account.
This includes findAll(), findAll(keys), count() and deleteAll().
PagingAndSortingRepository findAll methods already took the default N1QL consistency into account.
This is verified in an unit test and has been made more explicit in the repository documentation.
This fixes the fact that EnableCouchbaseRepository(repositoryBaseClass = Something.class) was ignored.
Now using reflection to choose the target implementation. Note that custom base classes MUST extend SimpleCouchbaseRepository (or its subclass N1qlCouchbaseRepository).
An example in the form of an integration test has been added in src/integration/java/org/springframework/data/couchbase/repository/base/RepositoryBaseTest.java.
Jackson 2.6.0 -> 2.6.2 (which is also the version of Jackson embedded in Couchbase SDK 2.2.2)
Spring Data Commons 1.11.0.BUILD-SNAPSHOT -> 1.11.2.RELEASE
So far with geo queries a bounding box approximation was performed on Circle and Polygon queries (since Couchbase internally only supports Bounding Box queries).
It was confusing since in previous iteration it was up to the user to remove these false positives "after the fact" in code calling the repository.
This change allows for the framework to retain enough information to perform false positives elimination automatically and transparently for the user.
The configuration step made it look like a new mapping was necessary in overrides, whereas it is actually possible and clearer to mutate the base mapping.
Added a convenience method to get the MappingContext from the repository mapping.
Main indexes (ie indexes that can be used by repositories to retrieve ALL the documents of a particular entity type) are covered.
Repository interfaces can be annotated with an annotation for each type of main index that can be automatically created.
The IndexManager is responsible for creating said indexes (potentially skipping creation if an index is already in place, or if the IndexManager has been configured to skip it, see constructor).
Since IndexManager is created as a bean (either in JavaConfig or xml), there can be a different instance eg. in Prod vs Dev.
Added doc and integration test.
Renamed package core.view to core.query since it now contains various non-view related annotations and classes.