Commit Graph

140 Commits

Author SHA1 Message Date
Simon Baslé
a2f26f4310 DATACOUCH-165 - Add geospatial support
Add support for geo queries through the use of Spatial Views. This needs the query method to be annotated with @Dimensional (or a meta-annotation of it that is runtime retained).

See SpatialViewQueryCreator javadoc for supported part types and corresponding expected arguments (to be documented).
In a nutshell WITHIN Box (other shapes supported but approximated to bounding box), NEAR Point+Distance (approximated to bounding box), plus a few simple operators for dimensions beyond 2.

When approximating, a DEBUG log is made along the logging of the query.

Conversion methods from Shapes to bounding boxes are done in a GeoUtils class.

Unit and Integration test of the feature.

Added documentation for @Dimensional query derivation.
2015-10-14 15:26:22 +02:00
Simon Baslé
2914f57897 DATACOUCH-161 - Allow repositories to use different templates
Added a configuration bean that allows to express what CouchbaseOperations each repository should use, individually or by domain type.

Added documentation for the feature in repository section.
2015-10-14 15:22:54 +02:00
Oliver Gierke
46e16d951d DATACOUCH-167 - Updated changelog. 2015-10-14 14:46:27 +02:00
Simon Baslé
e4b103cdfa DATACOUCH-158 - Allow more explicit expiry unit
The Document annotation now also support explicitly giving a TimeUnit for the expiry, ensuring the framework will correctly convert that to the expected Couchbase format.
2015-10-14 10:43:01 +02:00
Simon Baslé
7654af7608 DATACOUCH-164 - Use stable Couchbase SDK
Make modifications due to name changing in 2.2.0, the latest stable release of the Couchbase SDK.
2015-09-21 16:46:51 +02:00
Simon Baslé
56ae8217e9 DATACOUCH-138 - Add Page/Slice/PagingAndSortingRepo
Add support for Page / Slice in N1QL query derived methods.
Add PagingAndSortingRepository support through a N1qlCouchbaseRepository implementation. It will only be used as a base if N1QL is actually available on the cluster.

Refactor out some steps of entity related query creation in a N1qlUtils class, so that they can be also done eg. in repository base classes.

Add tests for both N1qlUtils and the N1qlCouchbaseRepository.

Document that PagingAndSortingRepository is supported provided N1QL is available on the Couchbase cluster.
2015-09-21 15:17:53 +02:00
Simon Baslé
89e56d6342 DATACOUCH-159 - Improved performance of decoding of longs.
Original pull requests: #67.
Cherry-pick of e5bed8e, adapted with polishing from 6fec488.
2015-08-31 19:04:01 +02:00
Oliver Gierke
931055e6fc DATACOUCH-150 - Prepare 2.0.0.M1.
Updated changelog and pom.
2015-08-04 19:00:04 +02:00
Oliver Gierke
f4e6317544 DATACOUCH-157 - Updated changelog. 2015-08-04 18:59:38 +02:00
Simon Baslé
f57a03ad21 DATACOUCH-156 - Make generated N1QL queries filter on the type field.
The generated N1QL queries currently don't filter on the type at all.

Add a criteria to the WHERE clause that checks the field holding type information is matching the entity fully qualified class name.

Add a placeholder for inline N1QL queries that can be replaced by the same type information criteria.
2015-07-31 18:58:00 +02:00
Simon Baslé
60196095a6 DATACOUCH-155 - Correctly escape property path.
Additionally to resolving a POJO attribute to JSON field name, the path conversion step will also escape each part of the doted path, in order to avoid problems with N1QL keywords.
2015-07-31 17:59:18 +02:00
Simon Baslé
2035a88dba DATACOUCH-154 - Guess design doc as uncapitalized class name.
In the SimpleCouchbaseRepository the guessed design document was lowercase of the entity class, whereas in ViewBasedCouchbaseQuery it is uncapitalized (only first letter is lowercase).

This has been made consistent, using the uncapitalize method. The doc now reflects that and explicitly have examples with camel case classes (UserInfo instead of User).
2015-07-30 17:44:53 +02:00
Simon Baslé
f543e2b037 DATACOUCH-148 - Allow to configure repository queries consistency globally.
The consistency to apply on generated view queries (Stale) and N1QL queries (ScanConsistency) can now be chosen via the configuration, through a more abstract Consistency enumeration.

It is accessed from the CouchbaseOperations interface but is used in the repository only. In xml, the consistency attribute is on the couchbase:template element (string value of the enum to be passed in).

Documentation has been amended to describe this feature.
2015-07-30 11:21:02 +02:00
Simon Baslé
508f190270 DATACOUCH-152 - Bump SDK to 2.2.0-dp2 and fix related TODOs.
ParametrizedQuery is now ParameterizedQuery, a few parameters have been added to the environment parsing, made use of N1QL Functions where newly available.
2015-07-27 13:22:05 +02:00
Simon Baslé
96e4b7ed37 DATACOUCH-149 - Switched to PersistentPropertyAccessor API.
Replaces all references to BeanWrapper with usage of PersistentPropertyAccessor API. MappingCouchbaseEntityInformation now extends PersistentEntityInformation to get rid of obsolete code implemented by the superclass.
2015-07-23 11:52:00 +02:00
Oliver Gierke
74c100cca4 DATACOUCH-150 - Polished reference docs.
Moved migration docs into the preface. Defined explicit anchor names to make sure they stay stable in case of a section rename.
2015-07-23 11:50:57 +02:00
Simon Baslé
5114ddb867 DATACOUCH-145 - Use Id/Field annotations from Couchbase SDK
The @Field annotation has been removed in favor of the one from the Couchbase SDK.

Similarly, CouchbasePersistentEntity now recognize the SDK's @Id annotation. Note that if both Spring Data and Couchbase @Id are present (on two distinct fields), the one from Spring Data will be taken into account.
2015-07-20 17:12:05 +02:00
Simon Baslé
712bc66006 DATACOUCH-144 - Detect N1QL dependency and fail fast if not available.
Detect N1QL is not available at configuration time for the repositories and at runtime for the template. This throws a UnsupportedCouchbaseFeatureException.

The ClusterInfo is captured at bootstrap and used to determine if the feature is available. The xml configuration will need the ClusterInfo-related credentials to be provided explicitly.
2015-07-20 11:25:39 +02:00
Simon Baslé
93405c5da8 DATACOUCH-142 - Update documentation and provide migration cheatsheet.
The documentation has been updated to reflect the changes in the new Spring Data Couchbase 2.0.

A simple list of major changes to take into account when migrating from 1.x to 2.x has been added.

README.md has also been updated.
2015-07-20 10:44:41 +02:00
Simon Baslé
e0972d57b9 DATACOUCH-140 - Use Converter to match query params and stored values.
When deriving a query, use the CouchbaseConverter to transform the parameters for fields that would be converted upon storage.

Reworked the DateConverters so that reading conversion is done from any Number (since N1QL may return longs in Double scientific notation for example).
2015-07-17 12:02:41 +02:00
Simon Baslé
4f0ba9d215 DATACOUCH-143 - Log executed queries in DEBUG. 2015-07-16 16:48:45 +02:00
Simon Baslé
4b453d4246 DATACOUCH-139 - Add limited support for @View query derivation.
@View can now trigger a basic query derivation. If viewName's explicitly
set, query derivation is attempted. Otherwise, no derivation is made but
instead the viewName is guessed by using the method name and removing a
"find" or "count" prefix.

Methods prefixed with "count" (and in general detected as count
projections) will trigger a reduce on the view.
2015-07-16 09:19:06 +02:00
Simon Baslé
4920acc214 DATACOUCH-141 - Change query lookup order and make N1QL default.
The @N1QL annotation was changed to @Query, for discoverability and also
convey that this is now the preferred method.

Order is now view if @View present, N1ql inline if @Query present with
a Statement, N1ql query derivation if @Query without attribute or no
annotation.

@View can be without attribute in order to compute the view
and design document from method name.
2015-07-13 16:20:15 +02:00
Simon Baslé
2bf2d3e544 DATACOUCH-134 - allow changing the name of field storing type. 2015-07-13 14:55:21 +02:00
Simon Baslé
c29727595c DATACOUCH-137 - queryDerivation for N1QL annotated methods.
Abstracted the N1QL-based variants in AbstractN1qlBasedQuery. This implementation doesn't recognize QueryParams or QueryPlan anymore in the method parameters so that the method signatures are not store-dependent.

Added query derivation from PartTree to N1QL query, using N1qlQueryCreator.

Unit tested the mapping between a Part.Type and the corresponding N1QL Expression.
2015-07-10 16:40:54 +02:00
Simon Baslé
9deaf6b480 DATACOUCH-136 - Add @N1QL query annotation.
The annotation allows to execute N1QL queries that are provided inline. For ease of use, one can use the placeholder $SELECT_ENTITY$ instead of writing the SELECT and FROM clauses.

QueryParams passed in as a method parameter will be used to enrich the Query. Other parameters on the annotated method will be used as values for positional placeholders in the statement.

The template's findByN1QL now expect enough data to reconstruct the full CouchbaseDocument (including ID and CAS), the ad hoc version of it has been renamed findByN1QLProjection.
2015-07-10 14:50:34 +02:00
Simon Baslé
b9f23f3fd5 DATACOUCH-135 - Migrate to Couchbase SDK 2.0 and add N1QL find method.
Adaptation were made to use SDK 2.0:
 - Reworked the configuration approach (more parts to be configured, like Environment, Cluster and Bucket)
 - Added a new xml schema for configuration of 2.0 version
 - Adapted the template
 - Added N1QL support in the template (findByN1QL)
 - Removed the cache package
 - Adapted the repository
 - Better separated Unit Tests from Integration Tests

All integration and unit tests pass, except one (SimpleCouchbaseRepositoryTests.shouldFindCustom).

Customisation of a ViewQuery will be addressed in another ticket.
2015-07-10 14:46:30 +02:00
Oliver Gierke
28dcdee1db DATACOUCH-130 - Updated changelog. 2015-07-01 10:20:08 +02:00
Oliver Gierke
702e74e158 DATACOUCH-131 - Updated changelog. 2015-07-01 08:00:02 +02:00
Oliver Gierke
0b78f207d9 DATACOUCH-132 - Updated changelog. 2015-06-30 14:13:06 +02:00
Christoph Strobl
de1c2581f7 DATACOUCH-129 - Ensure Spring Framework 4.2 compatibility.
Removed deprecated (and in 4.2 removed) usage of ConversionServiceFactory in MappingCouchbaseConverter.

Original pull request: #42.
2015-06-30 10:49:18 +02:00
Oliver Gierke
946c6cbdcc DATACOUCH-127 - Prepare 1.4.0.M1 (Gosling M1). 2015-06-02 08:25:10 +02:00
Oliver Gierke
857573874d DATACOUCH-127 - Updated changelog. 2015-06-02 08:24:54 +02:00
A.J. Brown
572e48b4b6 DATACOUCH-126: add the repositoryBaseClass annotation attribute.
The repositoryBaseClass attribute is needed for spring-data-commons 1.4
support.  Without it, an assertion fails while spring is trying to
configure the repositories enabled by this annotation,.
2015-05-16 11:59:08 +02:00
Oliver Gierke
45f150e7a1 DATACOUCH-122 - Prepare 1.3.0.RELEASE (Fowler GA). 2015-03-23 12:04:16 +01:00
Oliver Gierke
69903593be DATACOUCH-122 - Updated changelog. 2015-03-23 12:04:03 +01:00
Oliver Gierke
7905f22191 DATACOUCH-122 - Polish reference docs before release.
Updated copyright years. Fall back to locally available Spring Data Commons reference docs as the remote variant doesn't seem to work currently. Included reference to the return type listing appendix from Spring Data Commons.
2015-03-23 11:14:53 +01:00
Oliver Gierke
9f12576900 DATACOUCH-121 - Prepare 1.3.0.RC1 (Fowler RC1). 2015-03-05 16:24:51 +01:00
Oliver Gierke
d37849bcd0 DATACOUCH-121 - Updated changelog. 2015-03-05 15:54:30 +01:00
Mark Paluch
2da3840334 DATACOUCH-109 - Provide CDI support for Spring Data Couchbase repositories
Initial integration to enable CDI usage of Spring Data Couchbase repositories
along with custom repository implementations.
2015-02-20 10:13:23 +01:00
Joel Stevenson
76be140c07 DATACOUCH-102 - Pass event source to onBeforeDelete() and onAfterDelete() event handlers 2015-02-20 09:58:39 +01:00
Ståle Lyngaas
5ed6ec3490 DATACOUCH-110 - SimpleTypeHolders in CouchbaseList
Include the customSimpleTypes from Converters in SimpleTypeHolders
2015-02-20 09:48:26 +01:00
kkrol89
ff15112959 DATACOUCH-25 - added support for TTL properties in Couchbase Cache Manager 2015-02-16 11:22:54 +01:00
Oliver Gierke
19df181749 DATACOUCH-119 - Updated changelog. 2015-01-28 20:49:56 +01:00
Oliver Gierke
39170eb0c2 DATACOUCH-118 - Updated changelog. 2015-01-28 10:06:35 +01:00
Michael Nitschinger
264266c792 DATACOUCH-117 - Fix flaky tests when asserting json objects.
This changeset also increses the timeout for operations to 10 seconds
to reduce the possibility of false timeouts during test runs.
2015-01-20 10:47:16 +01:00
Oliver Gierke
1dd840cea5 DATACOUCH-116 - Prepare 1.3.0.M1 (Fowler M1). 2014-12-01 11:33:26 +01:00
Oliver Gierke
74c476e6c0 DATACOUCH-116 - Updated changelog. 2014-12-01 11:33:19 +01:00
Oliver Gierke
7bedc916f8 DATACOUCH-114 - Updated changelog. 2014-11-28 12:11:24 +01:00
Oliver Gierke
92b161251d DATACOUCH-113 - CouchbaseCache now implements Spring 4.1's Cache interface.
Added putIfAbsent(…) to make sure CouchbaseCache can be used in a Spring 4.1 environment.
2014-10-30 10:43:13 +01:00