Commit Graph

133 Commits

Author SHA1 Message Date
Spring Operator
2f4500e9c7 DATACOUCH-439 - URL Cleanup.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 219 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).

Original Pull Request: #195
2019-03-22 11:19:57 +01:00
Spring Operator
c7bcf811a7 DATACOUCH-439 - URL Cleanup.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* http://maven.apache.org/xsd/maven-4.0.0.xsd with 1 occurrences migrated to:
  https://maven.apache.org/xsd/maven-4.0.0.xsd ([https](https://maven.apache.org/xsd/maven-4.0.0.xsd) result 200).
* http://www.springframework.org/schema/beans/spring-beans.xsd with 10 occurrences migrated to:
  https://www.springframework.org/schema/beans/spring-beans.xsd ([https](https://www.springframework.org/schema/beans/spring-beans.xsd) result 200).
* http://www.springframework.org/schema/context/spring-context.xsd with 4 occurrences migrated to:
  https://www.springframework.org/schema/context/spring-context.xsd ([https](https://www.springframework.org/schema/context/spring-context.xsd) result 200).
* http://www.springframework.org/schema/data/couchbase/spring-couchbase.xsd with 10 occurrences migrated to:
  https://www.springframework.org/schema/data/couchbase/spring-couchbase.xsd ([https](https://www.springframework.org/schema/data/couchbase/spring-couchbase.xsd) result 200).
* http://www.springframework.org/schema/data/repository/spring-repository.xsd with 1 occurrences migrated to:
  https://www.springframework.org/schema/data/repository/spring-repository.xsd ([https](https://www.springframework.org/schema/data/repository/spring-repository.xsd) result 200).
* http://java.sun.com/xml/ns/javaee/beans_1_0.xsd with 1 occurrences migrated to:
  https://java.sun.com/xml/ns/javaee/beans_1_0.xsd ([https](https://java.sun.com/xml/ns/javaee/beans_1_0.xsd) result 302).

# Ignored
These URLs were intentionally ignored.

* http://java.sun.com/xml/ns/javaee with 2 occurrences
* http://maven.apache.org/POM/4.0.0 with 2 occurrences
* http://www.springframework.org/schema/beans with 20 occurrences
* http://www.springframework.org/schema/context with 4 occurrences
* http://www.springframework.org/schema/data/couchbase with 20 occurrences
* http://www.springframework.org/schema/data/repository with 2 occurrences
* http://www.w3.org/2001/XMLSchema-instance with 12 occurrences

Original Pull Request: #188
2019-03-20 10:10:37 +01:00
Subhashni Balakrishnan
e1e4385896 DATACOUCH-438 - Move off deprecations in Spring Data Commons.
Remove stray import IsNewStrategyFactory. This has been removed from commons and causing build failure.

Related ticket: DATACMNS-1496.
2019-03-13 19:01:26 +01:00
Subhashni Balakrishnan
580a50b40f DATACOUCH-388 Add support for ANSI-JOIN across entities
Motivation
----------
To support ANSI JOIN across associated entities

Changes
-------
N1qlJoin annotation on an associated entity field is discovered by the
couchbaseTemplate, which uses N1qlJoinResolver to build and resolve the
query. The query can be resolved eagerly or lazily based on the fetch
type configuration. The retrieved results are then mapped to the
associated entity. In the lazy resolver, a proxy is set on the property
which resolves on the first access.

Results
-------
Verified by unit and integration tests. ANSI join is now possible across
entities.

Original PR: #174
2019-02-12 09:56:58 -08:00
Mark Paluch
f4116f6de6 DATACOUCH-425 - Update copyright years to 2019. 2019-01-02 12:31:10 +01:00
Subhashni Balakrishnan
c4491dc8b4 DATACOUCH-413 Use parameterized queries for Query derivation
Changes
-------
- N1ql query creators implement an interface which provides the place
holder values.
- The query creator uses a position index counter to inject place holders in
the statement created and caches the place holder values in an array.
- Repository query constructor passes the generated query statement
and place holder values to query through the SDK.
- Cleanup N1ql integration tests for count validation and also add
couple of more tests

Results
-------
The testing for changes are already covered under the modified existing tests
in N1qlQueryCreator and Repository.
2018-11-26 11:23:14 -08:00
Subhashni Balakrishnan
9840acd2c6 DATACOUCH-384 - Apply converters to string based query parameters
Apply the converters registered to serialize the positional and named
parameters to match the database representation

Original Pull Request: #172.
2018-11-07 14:39:11 -08:00
Subhashni Balakrishnan
e360c23d92 DATACOUCH-376 - Apply custom conversions for collection elements
Original Pull Request: #164.
2018-07-16 11:10:43 -07:00
Subhashni Balakrishnan
076dcc0219 DATACOUCH-389 - Update to Couchbase-Java-Client 2.6.0
Added the new committed environment configurables to the xml based
configuration parser info. Also added couchbase FLE encryption library as bean
instantiation introspects class methods and fails with ClassNotFound
exception.

Original Pull Request: #165.
2018-07-16 10:25:56 -07:00
Oliver Gierke
b18761b409 DATACOUCH-373 - Adapt to API changes in Spring Data Commons.
Related tickets: DATACMNS-1275.
2018-04-09 14:56:27 +02:00
Subhashni Balakrishnan
0960f11a9c DATACOUCH-322 - Add RBAC username and password support
Motivation
----------
Couchbase server 5.0 allows role based access control and this allows
for users to be created and granted access to use bucket. Expose this
feature in SDC.

Changes
-------
1. Couchbase configurations allow for user name to be set. The user password
property is still retrieved from bucket password property.
2. CouchbaseFactoryBean has additional constructor for the username
property.
3. Couchbase bucket schema for xml configurations also includes username
property.
4. Integration tests have been restructured majorly to accomadate for
username
    - Testcontainers are used to allow for container based testing.
    - Container based testing is optional, it can be configured using
      resources/server.properties

Results
-------
The RBAC change has been tested with pre 5.0 and 5.0+ versions using
containers. The tests pass.

Original pull request: #158.
2018-03-07 15:09:15 -08:00
Subhashni Balakrishnan
039e106032 DATACOUCH-362 - Use dynamic proxying
Dynamic proxying for couchbase environment instead of an explicit no shutdown
proxy.

Original pull request: #157.

DATACOUCH-363 - Upgrade to 2.5.5

Java client upgrade. Remove the dcpEnabled property from
CouchbaseEnvironment factory bean and parser.

Original pull request: #157.
2018-03-07 13:26:55 -08:00
Mark Paluch
e8c647fb9d DATACOUCH-350 - Polishing.
Add test to verify configuration extension. Fix reactive module name to match non-reactive module name. Add author tags. Reorder methods, add javadoc comments.

Original pull request: #153.
2017-11-25 11:08:51 +01:00
Oliver Gierke
49c0b6def9 DATACOUCH-346 - Adapt API changes in Property in test cases. 2017-10-27 11:30:35 +02:00
Ben Benoit
4908749bcd DATACOUCH-328 - Fix document expiry when using expressions
When using an expiry expression with TimeUnit.DAYS larger than 30 days
the document expiry is not correctly set.

Original pull request: #150.
2017-10-17 11:34:12 -07:00
Oliver Gierke
5f24502175 DATACOUCH-330 - Improved detectability of Couchbase repositories in strict configuration mode.
We now make sure that repositories for domain types annotated with @Document or extending CouchbaseRepository are considered strict repository candidates.
2017-08-28 11:24:48 +02:00
Mark Paluch
9218b09f26 DATACOUCH-320 - Adapt to API changes in mapping subsystem. 2017-07-04 14:37:18 +02:00
Subhashni Balakrishnan
c7e4801305 DATACOUCH-310 - Convert N1ql query parameter enums to string values
Original pull request: #148.
2017-06-12 17:24:11 -07:00
Subhashni Balakrishnan
70343b0ac1 DATACOUCH-296 Add support for delete n1ql queries
Changes to support delete query by query derivation and SpEL based
queries.
- Adds a N1qlMutateQueryCreator which constucts the delete query
using dsl.
- Adds new SpEL values delete and returning required for delete
queries.

Original pull request: #144.
2017-06-12 17:22:53 -07:00
Oliver Gierke
22205678ef DATACOUCH-305 - Adapt to API changes in repository interfaces. 2017-05-03 17:48:06 +02:00
Mark Paluch
19f7597dc0 DATACOUCH-302 - Adapt to moved CustomConversions to Spring Data Commons.
Introduce CassandraCustomConversions extending o.s.d.convert.CustomConversions.

Remove o.s.d.couchbase.core.convert.CouchbaseCustomConversions implementation and utility classes, extend CouchbaseCustomConversions. Replace references to o.s.d.c.c.c.CustomConversions with o.s.d.convert.CustomConversions. Adapt tests and MappingCouchbaseConverter to CouchbaseCustomConversions.

Related ticket: DATACMNS-1035.
2017-04-24 10:20:32 +02:00
Subhashni Balakrishnan
ffb6ab8ff3 DATACOUCH-294 Fix failing N1ql unit tests due to changes in commons 2017-04-12 16:58:19 -07:00
Subhashni Balakrishnan
03bb6372c7 DATACOUCH-276 Dont escape the order by property as a whole
Escape each nested level and concatenate with a period

Original pull request: #141.
2017-04-11 16:17:13 -07:00
Subhashni Balakrishnan
620586af3b DATACOUCH-90 Polishing
Add modified couchbase specific jsr310 converters which converts to
number formats instead of date objects which cannot be handled by the
client.

Original pull request: #139.
2017-04-11 16:17:13 -07:00
Subhashni Balakrishnan
de4e02cedb DATACOUCH-90 - Add commons Jsr310 converters to support Java 8 date/time
Original pull request: #139.
2017-04-10 11:50:15 -07:00
Subhashni Balakrishnan
4cca923c59 DATACOUCH-290 - Upgrade to java-client 2.4.4
Original pull request: #136.
2017-04-10 11:33:02 -07:00
Alexander Derkach
6429dca5e6 DATACOUCH-287 - Add CAS operations to RxJavaCouchbaseOperations.
Original pull request: #135.
2017-04-06 06:57:53 -07:00
Oliver Gierke
1fc4a05f37 DATACOUCH-273 - Adapt API changes after upgrade to Mockito 2.7. 2017-03-24 09:57:13 +01:00
Mark Paluch
439ab14131 DATACOUCH-273 - Adapt to API changes in Spring Data Commons. 2017-03-24 09:57:13 +01:00
Mark Paluch
141dbefd3d DATACOUCH-273 - Integrate Data Commons Java 8 upgrade branch.
Replace PersistentEntity.doWithProperties(…) and .doWithAssociations(…) with stream processing using PersistentEntity.getPersistentProperties() and PersistentEntity.getAssociations().
2017-03-24 09:57:13 +01:00
Subhashni Balakrishnan
162d8124ab DATACOUCH-260 - Update to 2.4.1 and fix tests
Adapted changes to 3.0 branch

Original pull request: #131.
2017-02-05 13:08:38 -08:00
Subhashni Balakrishnan
d62f4bbe8c DATACOUCH-146 - Reactive repositories support
- Adds experimental support for reactor types in reactive CRUD and Sorting
  repositories using RxJava1Template
- Refactor configuration and query classes to be reusable by reactive repositories

Original pull request: #130.
2017-02-05 10:34:57 -08:00
Subhashni Balakrishnan
b52dee3a3c DATACOUCH-251 - Wrap base where criteria with parenthesis for OR expressions.
Base criteria for the query should be wrapped before adding the entity filter criteria so the priority of filtering is clear.
2016-12-20 10:57:47 +01:00
Oliver Gierke
610a6e51d2 DATACOUCH-246 - Polishing.
Removed the dynamic return type obtained from the ResultProcessor held in a query implementation field as this breaks thread safety. We now hand the type to read into the execution methods.

Adapted test cases accordingly and removed a bit of mocking.

Original pull request: #122.
2016-12-02 18:04:15 +01:00
Subhashni Balakrishnan
ce356f827f DATACOUCH-246 - Projections support for query derivation.
Used the result processor projecting information to just fetch the selected fields and again to post process results to projection object/interfaces.

Added test for projection using DTO.

Original pull request: #122.
2016-12-02 18:04:12 +01:00
Andrey Rubtsov
341c41250d DATACOUCH-239 - Allow configurable expiry in @Document.
Fixes #120
2016-08-18 13:21:14 +02:00
markramach
f18f61e371 DATACOUCH-237 - Prevent groupby on generated count queries
Fixes #119
2016-07-07 11:05:51 +02:00
Simon Bland
a40919ef8e DATACOUCH-235 - Fixed multiple Couchbase environments.
Defining <couchbase:env/> in XML configuration was causing a double
instantiation of DefaultCoreEnvironment, with subsequent warning in
logs:

[main] WARN c.c.client.core.env.CoreEnvironment - More than 1 Couchbase
Environments found (2), this can have severe impact on performance and
stability. Reuse environments!
2016-06-17 15:57:51 +02:00
Geoffrey Mina
7a57a235d8 DATACOUCH-226 - Enable strict @Field mapping
If the MappingCouchbaseConverter strict mode is enabled and no annotation is present, the property will not be eligible for document mapping.

This allows to specifically ignore some attributes in Couchbase only. For generally ignoring attributes in any Spring Data backing store, prefer the standard `@Transient`.

Closes #112
2016-05-20 17:52:41 +02:00
James Thomson
0149144bc0 DATACOUCH-214 - Adding case insensitive sorting
Closes #105
2016-03-10 22:10:47 +01:00
Andrzej Wisłowski
40e4212ad7 DATACOUCH-59 - Allow expiry touch on read
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).
2016-02-23 14:51:27 +01:00
Simon Baslé
0095313342 DATACOUCH-199 - Make automatic index creation opt-in
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.
2016-02-05 18:08:05 +01:00
Simon Baslé
6d747e97f5 DATACOUCH-180 - Allow named parameters in inline N1QL queries
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.
2016-02-02 15:23:53 +01:00
Simon Baslé
8f5e9e3df8 DATACOUCH-187 - Allow counting queries and single projections.
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.
2016-01-27 12:23:16 +01:00
Simon Baslé
c589a13699 DATACOUCH-186 - Index-backed methods safe from deleted stales
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.
2016-01-18 18:24:50 +01:00
Simon Baslé
d81dc9aacc DATACOUCH-185 - view-based CRUD methods use default consistency
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.
2016-01-08 16:21:20 +01:00
Simon Baslé
aa3f9c380b DATACOUCH-176 - Geo false positive autoelimination
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.
2015-12-01 11:02:08 +01:00
Simon Baslé
2378e7145b DATACOUCH-166 - Improve SpEL support, prefix is now #{ 2015-11-16 14:15:50 +01:00
Simon Baslé
40d131aab0 DATACOUCH-169 - Automatic index creation
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.
2015-11-16 13:57:38 +01:00
Simon Baslé
ec129e86a8 DATACOUCH-166 - Add basic SpEL support
Added the step of parsing SpEL expressions delimited by ${ } in StringN1qlBasedQuery, then the actual evaluation of each expression.

Refactored StringN1qlBasedQuery to use SpEL across the board, including for N1QL specific placeholders (SELECT-FROM, WHERE filter, etc...).

Refactored StringN1qlBasedQuery to use local methods rather than static methods, and amended the unit tests accordingly (using mocks).

Refactored getStatement and getCountStatement so they can see the parameters passed in at runtime.

Added unit tests + integration test.

Added SpEL support example in documentation.
2015-10-20 18:06:50 +02:00