Commit Graph

843 Commits

Author SHA1 Message Date
Christoph Strobl
30b5edbdd5 Updated changelog.
See #975
2021-02-17 10:58:26 +01:00
Michael Reiche
41ee1f99ee DATACOUCH-1066 - Make QueryCriteria key a N1qlExpression. (#1082)
This is a merge of mmonti's changeset into master. The changeset was made
on top of 4.1.x instead of master so it has a little catching up to do.

Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2021-02-16 18:08:06 -08:00
dependabot[bot]
9356e43008 Bump hibernate-validator from 5.2.4.Final to 5.3.6.Final (#254)
Bumps [hibernate-validator](https://github.com/hibernate/hibernate-validator) from 5.2.4.Final to 5.3.6.Final.
- [Release notes](https://github.com/hibernate/hibernate-validator/releases)
- [Changelog](https://github.com/hibernate/hibernate-validator/blob/5.3.6.Final/changelog.txt)
- [Commits](https://github.com/hibernate/hibernate-validator/compare/5.2.4.Final...5.3.6.Final)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-16 16:03:15 -08:00
Michael Reiche
6ab350df35 DATACOUCH-1041 - Add withCas() method to RemoveById. (#1051)
Add withCas() method to RemoveById.

Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2021-02-16 15:16:12 -08:00
Jorge Rodríguez Martín
1329cae703 DATACOUCH-652 - Inject translation service bean in CouchbaseTemplateSupport. (#294) 2021-01-15 10:29:14 -08:00
Michael Reiche
ad5551625d DATACOUCH-958 - Restore auditorAwareRef and dateTimeProviderRef to empty. (#1050)
Restore auditorAwareRef and dateTimeProviderRef to empty. To us them, they will need to be specified in
@EnableCouchbaseAuditing( auditorAwareRef="auditorAwareRef", dateTimeProviderRef="dateTimeProviderRef")

Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2021-01-14 16:07:04 -08:00
Aaron Whiteside
80bae4bf67 DATACOUCH-550 - Refactored the usage of CouchbasePersistentEntityIndexCreator. (#298)
pom.xml
- updated CouchbaseMock dependency to the official release on maven central, which now includes the required commit.

CouchbaseTemplate.java
- remove creation of CouchbasePersistentEntityIndexCreator
- there can only be a single CouchbaseMappingContext and CouchbasePersistentEntityIndexCreator, not sure why there was code dealing with multiples of each, and there was no corresponding tests for these assumptions.
- no longer does the job of a @Configuation class by gluing beans together with their dependencies.

CouchbaseMappingContext.java
- removed references to auto index creation, that functionality should be a completely separate concern.

CouchbasePersistentEntityIndexCreator.java
- as well as implementing ApplicationListener, it now also implements InitializingBean
- when afterPropertiesSet() is called it uses CouchbaseMappingContext#getPersistentEntities to retrieve the list of entity candidates for index creation. This will handle the creation of indices for entities known at @Configuration time.
- for entities not in the initialEntitySet of the MappingContext, the ApplicationListener will handle those entities at runtime.
- this is needed because the AbstractMappingContext will emit events when it is initialized via InitializingBean, and any beans that depend on MappingContext and also implement ApplicationListener expecting to receive those events won't.
 - in our case because Spring will have fully initialised the CouchbaseMappingContext instance before passing it to the CouchbasePersistentEntityIndexCreator instance we won't get those events.
- added a boolean flag to indicate if automatic index creation is to be enabled or now, passed in by the factory method that creates this bean.
- minor logging cleanup, use property placeholders where appropriate

AbstractCouchbaseConfiguration.java
- added a new factory method for the CouchbasePersistentEntityIndexCreator bean.
- CouchbaseMappingContext no longer has anything to do with index creation, other than supplying a candidate list of entities that may need indices.

Prompted by:
https://github.com/spring-projects/spring-boot/issues/24525
and the discussion on https://github.com/spring-projects/spring-data-couchbase/pull/295

Co-authored-by: Aaron Whiteside <awhiteside@yapstone.com>
2021-01-14 11:42:44 -08:00
Michael Reiche
59bf9d7457 DATACOUCH-1048 - Update copyright in two new classes. (#1049)
Update copyright in two new classes.

Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2021-01-14 11:22:15 -08:00
Michael Reiche
0e8d5a255a DATACOUCH-588 - Part 2 of framework changes. Add support for projection and distinct. (#1040)
Support for projection is only for properties of the top-level entity. For instance, in UserSubmission, only the properties below can be specified in the projection. Projection support does not provide means of specifying something like address.street - you can only project (or not project) the whole address property. However, the address type in your resultType could have a subset of the properties in Address.

If the corresponding submissions in the resultType contained only the userId property

public class UserSubmission extends ComparableEntity {
	private String id;
	private String username;
	private List<String> roles;
	private Address address;
	private List<Submission> submissions;

Support for Distinct - I have appropriated the MongoDB model for Distinct.  It defines a separate DistinctOperationSupport class (within ExecutableFindByQuerySupport) which supports the distinct( distinctFields ) api and execution. The DistinctOperationSupport class has only a distinctFields member, and a 'delegate' member, which is an ExecutableFindByQuerySupport object. TBH, I don't see the advantage over simply adding a distinctFields member to ExecutableFindByQuerySupport

Amend #1 - changes as discussed in Pull Request
         - clean up test entity types

Amend #2
- Eliminate DistinctOperationSupport class. In MongoDB, only distinct on a single field is supported, so the returnType from distinct was very different from the returnType of other query operations (all(), one() etc. (but so is count(), and it doesn't need it's own class)). In Couchbase, distinct on any fields in the entity is allowed - so the returned type could be the domainType or resultType. And as(resultType) still allows any resultType to be specified. This makes it unnecessary to have combinations of interfaces such as DistinctWithProjection and DistinctWithQuery.

- Clean up the interfaces in ExecutableFindByQuery. There are two types of interfaces (a) the TerminatingFindByQuery which has the one(), oneValue() first(), firstValue(), all(), count(), exists() and stream(); and (b) the option interfaces (FindByQueryWithConsistency etc), which are essentially with-er interfaces. The changes are:
1) make all the with-er interfaces base interfaces instead of chaining them together. (I don't know why there isn't simply one interface with all the with-er methods).
2) make the ExecutableFindByQuery interface extend the Terminating interface and all the with-er interfaces.

Amend #3
- Add execution support for collections

Amend #4
- Add tests for collections. This includes a new CollectionAwareIntegrationTests class which extends a new JavaIntegratationTests class which extends the existing ClusterAwareIntegrationTests.
- Fixed up several issues collections issues that were uncovered by the tests.
- Did further cleanup of OperationSupport interfaces.

Amend #5
- Revert changes to interfaces in *Operation
- Sorted interfaces in same order for consistency (because of the chaining of interfaces, fluent methods must be called in order).

Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2021-01-14 11:03:20 -08:00
Christoph Strobl
a4e6027f01 After release cleanups.
See #978
2021-01-13 15:47:00 +01:00
Christoph Strobl
6574c55133 Prepare next development iteration.
See #978
2021-01-13 15:46:59 +01:00
Christoph Strobl
a61f4df636 Release version 4.2 M2 (2021.0.0).
See #978
2021-01-13 15:34:04 +01:00
Christoph Strobl
1738028359 Prepare 4.2 M2 (2021.0.0).
See #978
2021-01-13 15:33:34 +01:00
Christoph Strobl
4172006d01 Updated changelog.
See #978
2021-01-13 15:33:33 +01:00
Christoph Strobl
a8c9f81937 Updated changelog.
See #979
2021-01-13 15:16:25 +01:00
Michael Reiche
3364e0fa7f DATACOUCH-588 - Refactoring part 1 of n. (#278)
* DATACOUCH-588 - Implement pageable and realign repo query

This implements pageable for non-reactive queries and
realigns reactive queries with other spring-data projects
to facilitate the implementaion of pageable (done) and other
types of queries such as projection and distinct (not yet
done)

* DATACOUCH-588 - Implement pageable and realign repo query

This implements pageable for non-reactive queries and
realigns reactive queries with other spring-data projects
to facilitate the implementaion of pageable (done) and other
types of queries such as projection and distinct (not yet
done)

* DATACOUCH-588 - Refactoring part 1 of n.

Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2020-12-21 13:48:50 -08:00
Michael Reiche
9c9dde7312 DATACOUCH-645 - Support document expiryExpression. (#296)
Support document expiryExpression and make the initial expiry
to be null instead of Zero in the fluent API. This allows
a client to 'unset' the expiry from an annotation by explcitly
setting withExpiry(Zero).

Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2020-12-16 15:06:37 -08:00
Michael Reiche
03ad3697ae DATACOUCH-550 - Autoindexing does not work spring-boot application. (#297)
Due to the interdependencies of beans, autoindexing does not work
in the startup of a normal spring-boot application. Processing of
entities occurs during the initialization of CouchbaseMappinContext,
which occurs before initialization of MappingCouchbaseConverter,
which occurs before the initialization of CouchbaseTemplate -
which creates the indexCreator listener. So when the
AbstractMappingContext (CouchbaseMappingContext) is publishing
MappingContextEvents - there is not yet any indexCreator.
And subsequent processing of entities finds the entities cached,
and therefore does not publish MappingContextEvents. This change
overrides the addPersistentEntity() and getPersistentEntity()
methods of AbstractMappingContext such that caching does not
preven the MappingContextEvents from being published.  This change
also exposes indexCreator classesSeen map to CouchbaseMappingContext
so that once an entity has been processed by indexCreator, it is
not published again.

Autoindexing by SpringJUnitConfig did work prior to this change.

Co-authored-by: mikereiche <michael.reiche@couchbase.com>

Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2020-12-16 15:02:46 -08:00
mikereiche
6c6dc13de4 DATACOUCH-677 - Revert "Datacouch 550 autoindex not working in spring boot app (#295)"
This reverts commit 8ebb81b62d.
2020-12-16 14:58:06 -08:00
Michael Reiche
8ebb81b62d Datacouch 550 autoindex not working in spring boot app (#295)
* DATACOUCH-550 Autoindexing only works from SpringJunitConfig

Due to the interdependency in bean creation, Autoindexing does not
work in a normal spring-boot application. This change overrides
the addPersistentEntity and getPersistentEntity of CouchbaseMappingContext
to avoid entries cached before the indexCreator was listening from
preventing MappingContextEvents from being published after the indexCreator
is listening. It also exposes the indexCreators classesSeen map so that
MappingEvents for an entity are not re-published after the indexCreator
has seen them.

* DATACOUCH-550 - Autoindexing does not work spring-boot application.

Due to the interdependencies of beans, autoindexing does not work
in the startup of a normal spring-boot application. Processing of
entities occurs during the initialization of CouchbaseMappinContext,
which occurs before initialization of MappingCouchbaseConverter,
which occurs before the initialization of CouchbaseTemplate -
which creates the indexCreator listener. So when the
AbstractMappingContext (CouchbaseMappingContext) is publishing
MappingContextEvents - there is not yet any indexCreator.
And subsequent processing of entities finds the entities cached,
and therefore does not publish MappingContextEvents. This change
overrides the addPersistentEntity() and getPersistentEntity()
methods of AbstractMappingContext such that caching does not
preven the MappingContextEvents from being published.  This change
also exposes indexCreator classesSeen map to CouchbaseMappingContext
so that once an entity has been processed by indexCreator, it is
not published again.

Autoindexing by SpringJUnitConfig did work prior to this change.

Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2020-12-16 14:23:24 -08:00
Greg L. Turnquist
f7b6765c30 DATACOUCH-664 - Use Docker hub credentials for all CI jobs. 2020-12-15 11:56:56 -06:00
Michael Reiche
608b013de8 DATACOUCH-675 - Factor out interfaces for common methods. (#293)
Added interfaces for apis on core objects which are common among
many objects. For instance withExpiry and withExpirty on all the
insert/replace/upsert/remove objects.  The definition of an interface
simplyfies testing of all the possible combinations - instead of having
four (or eight, counting Reactive), there is one interface to test
them all.

Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2020-12-14 13:50:04 -08:00
Michael Reiche
0494247cb1 DATACOUCH-526 - N1qlJoinResolver not escaping bucketNames with special characters (#291)
It escape the first bucket name, but not the second one.

Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2020-12-09 23:50:26 -08:00
Michael Reiche
662a84bba6 DATACOUCH-672 - reinstate replace expiry tests (#289)
Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2020-12-09 08:44:23 -08:00
Michael Reiche
69e0a1dc33 DATACOUCH-666 - Handle immutable entity in replace. (#288)
Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2020-12-09 08:44:17 -08:00
Michael Reiche
bce764c712 DATACOUCH-630 - Add expiry to replace 4.2.x (#287)
Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2020-12-09 07:56:08 -08:00
Mark Paluch
af51c27015 DATACOUCH-648 - Updated changelog. 2020-12-09 16:47:44 +01:00
Mark Paluch
599e4a4250 DATACOUCH-640 - After release cleanups. 2020-12-09 15:32:21 +01:00
Mark Paluch
419cad7ae4 DATACOUCH-640 - Prepare next development iteration. 2020-12-09 15:32:17 +01:00
Mark Paluch
5a2826f852 DATACOUCH-640 - Release version 4.2 M1 (2021.0.0). 2020-12-09 15:21:57 +01:00
Mark Paluch
93fc6891fa DATACOUCH-640 - Prepare 4.2 M1 (2021.0.0). 2020-12-09 15:21:30 +01:00
Mark Paluch
83e3e3af9c DATACOUCH-640 - Updated changelog. 2020-12-09 15:21:27 +01:00
Mark Paluch
d325d98a4a DATACOUCH-638 - Updated changelog. 2020-12-09 12:42:28 +01:00
Mark Paluch
214d0765cd DATACOUCH-637 - Updated changelog. 2020-12-09 09:59:13 +01:00
Michael Reiche
3c59af3cc8 DATACOUCH-661 - Fix integrations tests from 650. (#281)
Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2020-12-08 00:30:45 -08:00
Michael Reiche
d592758ae0 DATACOUCH-660 - Upgrade Couchbase Java SDK to 3.1.0 for 4.2. (#282)
Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2020-12-08 00:27:57 -08:00
Michael Reiche
8c1a24c619 DATACOUCH-653 - Update example versions in documentation. (#280)
The format has changed as well. The release versions no longer have
the .RELEASE suffix - they are just the version number (i.e. 4.1.1)
And the snapshot versions have the suffix -SNAPSHOT (i.e. 4.2.0-SNAPSHOT)
instead of 4.1.0.BUILD-SNAPSHOT

Co-authored-by: mikereiche <michael.reiche@couchbase.com>
2020-12-04 10:25:58 -08:00
Mark Paluch
94e6308123 DATACOUCH-650 - Polishing.
Reorder methods. Remove superfluous final keyword. Reformat pom. Fix dependency to Spring Data Commons.

Original pull request: #279.
2020-11-25 11:48:04 +01:00
Jens Schauder
3aeff66a3b DATACOUCH-650 - Implements CrudRepository and ReactiveCrudRepository.deleteById(Iterable<ID> ids).
Original pull request: #279.
2020-11-25 11:47:49 +01:00
Mark Paluch
605285188b DATACOUCH-639 - Updated changelog. 2020-11-11 12:34:41 +01:00
Mark Paluch
851dcb0c8a DATACOUCH-641 - Enable Maven caching for Jenkins jobs. 2020-10-30 08:33:19 +01:00
Mark Paluch
aa0a9623b2 DATACOUCH-635 - After release cleanups. 2020-10-28 16:10:25 +01:00
Mark Paluch
e4777dd280 DATACOUCH-635 - Prepare next development iteration. 2020-10-28 16:10:22 +01:00
Mark Paluch
3c69b45854 DATACOUCH-635 - Release version 4.1 GA (2020.0.0). 2020-10-28 15:46:57 +01:00
Mark Paluch
6a51b0c573 DATACOUCH-635 - Prepare 4.1 GA (2020.0.0). 2020-10-28 15:46:33 +01:00
Mark Paluch
3d52b583b8 DATACOUCH-635 - Updated changelog. 2020-10-28 15:46:28 +01:00
Mark Paluch
7c5be60f9e DATACOUCH-611 - Updated changelog. 2020-10-28 15:03:04 +01:00
Mark Paluch
29c37ba80d DATACOUCH-610 - Updated changelog. 2020-10-28 12:15:06 +01:00
Mark Paluch
eb35485f2d DATACOUCH-636 - Updated changelog. 2020-10-28 11:32:32 +01:00
Greg L. Turnquist
b170c3e3f3 DATACOUCH-614 - Use JDK 15 for latest CI jobs. 2020-10-26 13:01:45 -05:00