Commit Graph

207 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Michael Nitschinger
b8866b3dac DATACOUCH-94: Move FieldNamingStrategy to commons. 2014-08-26 10:21:46 +02:00
Michael Nitschinger
6844364a35 DATACOUCH-97: Expose the CouchbaseClient in the template. 2014-08-26 10:06:23 +02:00
Michael Nitschinger
a2cd30af3e DATACOUCH-86 - Implement Spring4 cache get with cast.
This changeset extends the CouchbaseCache to be compatible with the newly
added method of the Spring 4 cache interface.
2014-05-19 12:11:29 +02:00
Michael Nitschinger
e9ae5ba1c5 DATACOUCH-82 - Implement custom FieldNamingStrategies and abbreviation support. 2014-04-14 16:10:36 +02:00
Oliver Gierke
629bc1d275 DATACOUCH-78 - Adapted to changes in BeanWrapper generics.
Also adapted to API change in RepositoryProxyPostProcessor.

Related issues: DATACMNS-468, DATACMNS-464.
2014-03-19 10:00:25 +01:00
Michael Nitschinger
b3a4069696 DATACOUCH-75 - Trim off find on custom repository finder. 2014-03-12 13:13:51 +01:00
Michael Nitschinger
bef4d52ace DATACOUCH-71 - Add support for JSR 303 validation.
This changeset adds validation support for entities, and since this depends
on events, the event functionality has been added as well. Now also generic
event listeners can be attached.
2014-03-10 13:07:05 +01:00
Michael Nitschinger
62f974fa78 DATACOUCH-61 - Add Converter support for Jodatime
This changeset adds converters for Jodatime to unix timestamps and
back if jodatime is found on the classpath.
2014-03-10 10:49:07 +01:00
Michael Nitschinger
f68397f2ac DATACOUCH-69 - Support for Date and Calendar conversions.
This changeset adds aut of the box support for date and calendar objects.
They get converted to simple longs (unix timestamps) and back, since couchbase
server views have good support for those through the dateToArray() function.

A custom converter takes precedence though to customize these conversions.
2014-03-10 10:23:49 +01:00
Michael Nitschinger
332ce8c560 DATACOUCH-55 - Support custom converters.
This changeset adds the possibility to implement custom converters for entities and fields.
2014-03-10 09:22:31 +01:00
Michael Nitschinger
11ed095c58 DATACOUCH-65 - Add support for optimistic locking through @Version
@Version support is built on top of CAS values in couchbase. It does
not store an actual version number in the document, but rather reuses
cas values transparently to handle optimistic locking.

Also, write result checking has been added to the template for
better control what happens if a write fails. Defaults to NONE,
but can be sett to LOG or EXCEPTION.
2014-01-24 12:01:42 +01:00
Ken Dombeck
bb6385e08a DATACOUCH-57 - Allow for the configuration of CouchbaseClient to use properties
from property files or SPEL expressions.
2014-01-24 09:13:04 +01:00
Michael Nitschinger
7b6a3a9894 DATACOUCH-14 - Enable SLF4J as default logging.
If the whole system is constructed through the AbstractCouchbaseConfiguration or
the custom <couchbase> xml config, the logger is specified automatically.

Please note that this also changes the java config a little bit, but it should
also make it easier to construct it.
2014-01-23 16:24:58 +01:00
Michael Nitschinger
46b33e9952 DATACOUCH-52 also register shutdown for xml-based configs 2014-01-23 15:45:47 +01:00
Michael Nitschinger
7dd2a5b7b2 DATACOUCH-52 - Shut down CouchbaseClient bean when the context is destroyed.
The shutdown method will be called on the bean when the context is closed to
make sure that "no thread is left behind" running.
2014-01-23 14:47:28 +01:00
Michael Nitschinger
5414ee556b DATACOUCH-44 - Expose PersistTo/ReplicateTo on template
While users benefit from the exposure in terms of control, it is also
needed to make the unit tests more reliable as reported in the ticket.
2014-01-23 14:36:47 +01:00
Michael Nitschinger
9452c40eeb DATACOUCH-64 - Enable dynamic queries on repositories.
This changeset adds dynamic queries that can be annotated with @View and also provide a custom
Query param to change properties at runtime if needed.
2014-01-23 14:07:55 +01:00
Ken Dombeck
15ad87a82f DATACOUCH-58 allow for null values to be persisted for List elements and Map values. 2014-01-09 15:06:11 +01:00
Andrzej Wislowski
b11fc6c53c DATACOUCH-53 - protection against NPE on CouchbaseCache when putting null as a value 2014-01-09 14:41:11 +01:00
David Harrigan
7d79d79e28 DATACOUCH-30 - ObjectMapper configuration must be supported
Allow for a custom ObjectMapper to be used.
2014-01-09 14:32:18 +01:00
Michael Nitschinger
97993c2409 DATACOUCH-51 - Call replace on batch update.
This changeset fixes a typo that exposed the wrong write semantics
when calling update().
2013-12-04 10:36:20 +01:00
David Harrigan
1fc662b7cb DATACOUCH-35 - Can't deserialize Class fields.
Similar to Enums, Classes aren't a simple type, therefore have to handle using
the configured ObjectMapper.

-=david=-
2013-11-13 11:29:49 +01:00
Michael Nitschinger
5b6e8764b0 DATACOUCH-43 - Correctly encode non-ASCII characters. 2013-11-12 11:10:58 +01:00
Michael Nitschinger
694b67ae36 DATACOUCH-40 - Make ClusterInfo more reliable on the values returned. 2013-10-16 13:05:11 +02:00
David Harrigan
47a0125642 Some little tidy-ups on the codebase.
-=david=-
2013-10-16 12:52:41 +02:00
David Harrigan
d1779a5d73 DATACOUCH-38 - Can't Deserialize Enum.
Enums, even although they are a simple type, must not use writeSimpleObject
since there is no "handler" in writeSimpleObject for Enums. Instead, we just
drop back to using the built-in ObjectMapper for handling enums.

-=david=-
2013-10-16 12:35:04 +02:00
David Harrigan
fa397759e3 DATACOUCH-37 - Refactor Deprecated JUnit Asserts.
Removed deprecated methods and changed to Hamcrest.

-=david=-
2013-10-16 12:23:17 +02:00
David Harrigan
48385c965a DATACOUCH-16 - Allow View customization through @View annotations.
An initial first attempt at allowing for basic View customization using the
@View annotation.

For now, it does not support "dynamic" finders, such as findByUsername, but
I'm sure it will come shortly aftewards.

Also added in hamcrest library to gradually transistion deprecated JUnit
methods to a better assertion library :-)

-=david=-
2013-10-16 12:01:21 +02:00
Michael Nitschinger
8ade60937a Merge pull request #5 from mzasada/DATACOUCH-27
DATACOUCH-27: Mapping @Id field with MappingCouchbaseConverter
2013-10-10 03:08:29 -07:00
Maciej Zasada
0fa284e534 Merge branch 'master' into DATACOUCH-27
Conflicts:
	.gitignore
2013-10-09 23:12:24 +02:00
David Harrigan
6fd4d925fb DATACOUCH-34 - Can't deserialize long/Long/Date fields.
Catch the attempt to parse a long as an int, then attempt to return a long value.

-=david=-
2013-10-09 16:57:46 +01:00
David Harrigan
0323d1fdba DATACOUCH-36 - Don't allow NULL values to be stored.
It is illegal to store a NULL value as a document. An attempt to do so will
throw an IllegalArgumentException.

-=david=-
2013-10-08 15:51:02 +01:00
Maciej Zasada
c62ad426e3 DATACOUCH-27: Mapping @Id field with MappingCouchbaseConverter
Fixed @Id field rewriting from CouchbaseDocument into domain object.
More info can be found at DATACOUCH-27 JIRA issue.
2013-09-18 23:14:28 +02:00
Michael Nitschinger
ef3ad73268 DATACOUCH-23 - Make tests clean buckets, Import cleanup. 2013-07-26 10:58:45 +02:00
Michael Nitschinger
4511387d8e DATACOUCH-21 - Documentation and Formatting improvements 2013-07-18 12:48:21 +02:00
Michael Nitschinger
ab252f8924 DATACOUCH-6 - Add simple support for XML config 2013-07-17 14:58:51 +02:00