Commit Graph

52 Commits

Author SHA1 Message Date
Mark Paluch
fbd03cc484 DATAKV-244 - Update copyright years to 2019. 2019-01-02 14:02:26 +01:00
Mark Paluch
4f49fe98f4 DATAKV-225 - Add support for immutable objects.
Add return type to KeyValueOperations.insert/update methods to return potentially changed object instances. Return KeyValueOperations.insert/update method result in SimpleKeyValueRepository.save(…).
2018-07-12 10:42:24 +02:00
Oliver Gierke
1e14c4443b DATAKV-219 - Adapt to SpEL extension API changes in Spring Data Commons.
Related ticket: DATACMNS-1260.
2018-05-15 09:24:48 +02:00
Mark Paluch
6381daacc9 DATAKV-205 - Update copyright years to 2018. 2018-01-08 16:25:58 +01:00
Mark Paluch
83057f1288 DATAKV-197 - Introduce usage of nullable annotations for API validation.
Annotate all packages with Spring Frameworks @NonNullApi and @NonNullFields. Add Spring's @Nullable to methods, parameters and fields that take or produce null values. Adapted using code to make sure the IDE can evaluate the null flow properly. Fix Javadoc in places where an invalid null handling policy was advertised. Strengthened null requirements for types that expose null-instances.

Original Pull Request: #28
2017-09-27 14:21:31 +02:00
Mark Paluch
f0b3fc2b98 DATAKV-192 - Polishing.
Reduce member visibility according type visibility. Adapt to required argument in KeyValueRepository.findAll(Pageable). Replace cast with type to Class.cast(…). Use lombok for for getters/setters in test code. Suppress warnings, formatting.

Original pull request: #26.
2017-08-02 10:15:58 +02:00
Christoph Strobl
0025c03e5a DATAKV-192 - Move codebase to Java8 API.
Make use of stream lambdas in query execution. Remove copy of MetaAnnotationUtils in favor of @AliasFor usage.

Original pull request: #26.
2017-08-02 10:05:11 +02:00
Mark Paluch
14da42ff15 DATAKV-187 - Polishing.
Remove Serializable ID constraints from factory beans. Replace casts with type.cast(…). Convert anonymous inner classes to lambdas. Remove unused code and casts. Simplify test entities by removing Serializable and using lombok. Letter casing, formatting, Javadoc.

Original pull request: #25.
2017-07-21 15:31:59 +02:00
Christoph Strobl
d6ee87ace5 DATAKV-187 - Remove restriction of ID type to be Serializable.
Original pull request: #25.
2017-07-21 15:31:47 +02:00
Christoph Strobl
8f5fa59386 DATAKV-186 - Polishing.
Add missing author information and split test.

Original Pull Request: #24
2017-07-20 10:49:16 +02:00
EugeneNik
c5e0d1a26c DATAKV-186 - SimpleKeyValueRepository.existsById(…) now evaluates findById(…) results properly.
ExistsById now evaluates Optional.isPresent() instead of comparing findById result to null.

Original Pull Request: #24
2017-07-20 10:48:08 +02:00
Christoph Strobl
256bb16dba DATAKV-185 - Polishing.
Fix NPE by now returning an expression that always resolves to true.
2017-07-04 22:02:14 +02:00
Oliver Gierke
97a84c3445 DATAKV-179 - Adapt to API changes in QuerydslPredicateExecutor.findOne(…).
Related ticket: DATACMNS-1059.
2017-05-19 10:48:58 +02:00
Christoph Strobl
aa6e412602 DATAKV-176 - Adapt to API changes in repository interfaces.
We now follow a more consistent naming scheme for the methods in repository that are driven by the following guidelines:

* Methods referring to an identifier now all end on …ById(…).
* Methods taking or returning a collection are named …All(…)

Please see DATACMNS-944 for details.
2017-05-03 17:43:10 +02:00
Mark Paluch
3f21f10d78 DATAKV-170 - Fix KeyValue.getCriteria() method name.
Introduce KeyValue.getCriteria() method and deprecate KeyValue.getCritieria() for later removal. Use fixed method in affected classes.
2017-04-20 13:03:53 +02:00
Mark Paluch
12301efd94 DATAKV-169 - Polishing.
Fix typo in test method names. Some minor language level cleanups and removal of deprecated API usage.

Original pull request: #23.
2017-04-18 09:39:14 +02:00
Christoph Strobl
f67a66bf25 DATAKV-169 - Add support for IN keyword in derived queries.
We now support `In` keyword in derived finder methods (eg. `findByFirstnameIn(Collection<String> firstnames)`) when using SpEL based queries.

Original pull request: #23.
2017-04-18 09:38:58 +02:00
Oliver Gierke
3e9e6a97e0 DATAKV-159 - Adapt to API changes after Mockito upgrade to 2.7. 2017-03-24 10:12:15 +01:00
Christoph Strobl
d3fe2f2e56 DATAKV-159 - Integrate DATACMNS Java 8 upgrade.
Related to: DATACMNS-867
2017-03-24 10:11:44 +01:00
Mark Paluch
5444ea20f7 DATAKV-157 - Migrate ticket references in test code to Spring Framework style. 2017-01-13 09:56:35 +01:00
Oliver Gierke
33ac8d5fab DATAKV-153 - Adapt API in KeyValueRepositoryFactoryBean.
Related ticket: DATACMNS-891.
2016-12-15 16:19:26 +01:00
Christoph Strobl
37c9aa4012 DATAKV-142 - Consider PartTree.isLimiting() and PartTree.getMaxResults() when creating queries.
We now pick up result size limiting constraints from the query method name. This allows usage of `findTopN` and `findFirst` keywords.

Original pull request: #22.
2016-09-12 13:12:31 +02:00
Christoph Strobl
0ad24ece59 DATAKV-137 - Polishing.
Remove whitespaces & unused imports, fix warnings.

Original Pull Request: #20
2016-06-14 08:16:42 +02:00
Mark Paluch
302dfd407c DATAKV-137 - Fix cached query execution.
We now make sure that cached SpelCriteria's use the appropriate EvaluationContext containing parameters from the request instead of using the EvaluationContext of the cached query.

Original Pull Request: #20
2016-06-14 08:16:22 +02:00
Christoph Strobl
66534d2ae0 DATAKV-136 - Choose SecureRandom algorithm based on operating system and availability.
We now distinguish between operating systems when choosing a SecureRandom algorithm. Additionally we check the availability of the implementations and choose the first one available.

Original pull request: #21.
2016-06-13 13:19:50 +02:00
Christoph Strobl
fae6d418b6 DATAKV-117 - Pass on type information to KV Adapter.
Original pull request: #18.
2016-03-10 17:08:18 +01:00
Christoph Strobl
551b27deb2 DATAKV-112 - Make caching repository queries more explicit.
We introduced an explicit CachingKeyValuePartTreeQuery and allow setting the gernal repository query stategy via QueryCreatorType.
By default queries will not be cached.

Original pull request: #18.
2016-03-10 17:08:18 +01:00
Christoph Strobl
070be6e47d DATAKV-129 - Allow usage of @AliasFor with @KeySpace.
We now allow using Spring's meta-annotation programming model. Own meta-annotations can be composed using @KeySpace and @AliasFor annotation.
Example for a custom meta-annotation corresponding to @KeySpace("sessions") when it's used with @SessionsKeyspace class MyEntity {…}:

@Persistent
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
@KeySpace
public @interface SessionsKeyspace {

	@AliasFor(annotation = KeySpace.class, attribute = "value")
	String name() default "sessions";
}

Original pull request: #19.
2016-03-10 17:06:47 +01:00
Oliver Gierke
874b2bc880 DATAKV-123 - Introduced dedicated KeyValueRepositoryFactoryBean.createRepositoryFactory(…).
We now expose a dedicated method for implementors to use to create the repository factory instance based on the configuration of the factory.

Added unit tests to make sure the factory bean fails fast if it's configured improperly.

Original Pull Request: #17
2016-02-11 10:02:17 +01:00
Oliver Gierke
40fe2addac DATAKV-115 - Polishing.
Introduced dedicated constructor on SpelCriteria to default the EvaluationContext to StandardEvaluationContext. Switched to ternary if in KeyValuePartTreeQuery for both application of Pageable and Sort. Tweaked unit test to actually compile in Eclipse.

Original pull request: #16.
2016-02-09 15:51:47 +01:00
Christoph Strobl
e22ee22e58 DATAKV-115 - Make derived finder execution thread-safe.
We now make sure separate SpelExpression and EvaluationContext for each and every derived finder execution to assert the expression context cannot be accidentally overridden.

Original pull request: #16.
2016-02-09 15:50:19 +01:00
Oliver Gierke
d1df6d5e76 DATAKV-121 - Added support for projections on repository query methods.
Repository methods can now return interfaces that act as projections on the original entity instances stored in the repository.

Related ticket: DATACMNS-89.
2015-12-14 19:57:34 +01:00
Oliver Gierke
e7efe2912c DATAKV-119 - Upgraded to Querydsl 4. 2015-11-17 13:43:29 +01:00
Oliver Gierke
d7b2c0f499 DATAKV-114 - Polishing.
Polished newly added unit tests. Added missing license header and JavaDoc where necessary. More speaking variable names. Removed unnecessary code from test domain type.

Original pull request: #15.
2015-11-02 06:33:39 +01:00
Martin Macko
95c56c8dd4 DATAKV-114 - Fixed NullPointerException in SpelQueryEngine.
Original pull request: #15.
2015-11-02 06:31:28 +01:00
Oliver Gierke
3371a6b7a2 DATAKV-104 - Polishing.
Moved configuration setters under constructors of KeyValueTemplate.

Original pull request: #12.
2015-05-19 17:49:12 +02:00
Christoph Strobl
fe50d6b242 DATAKV-104 - Refactor event handling according to design in Spring Data MongoDB.
We now favor dedicated types over event type enum and allow events to be generically typed. We favor ApplicationEventPublisherAware over ApplicationContextAware. By default we now publish all events and allow user to opt out.

Original pull request: #12.
2015-05-19 17:49:12 +02:00
Oliver Gierke
e3733ab9b5 DATAKV-105 - Polishing.
Moved KeySpaceResolver interfaces into mapping package. Let defaulting happen in BasicKeyValuePersistentEntity so that ClassNameKeySpaceResolver can be made package protected.

FowardingCloseableIterator is now generically typed and not bound to Map.Entry.

Original pull request: #11.
2015-05-19 17:36:00 +02:00
Christoph Strobl
f19a6c0faf DATAKV-105 - Polish implementation after recent addition of features.
Remove obsolete method hasKeyspace() from KeyValueAdapter. Transition from List to Iterable for find methods in KeyValueTemplate.

We now offer a plug able KeySpace resolution by providing a KeySpaceResolver via the KeyValueMappingContext. By default an AnnotationBasedKeySpaceResolver will be used to examine the type for @KeySpace. In case of non explicit keySpace we fall back to using the class' fully-qualified name as the default key space.

Key space resolution is now fixed on resolving @KeySpace on a given PersistentEntity. In case no annotation key space can be found we by default fall back to a class name based key space. It is possible to configure the fallback via the MappingContext.

Refactored names & visibility of types required for tests.
Removed shortcut for returning results not having an explicit key space, since we now can no longer rely on the type name strategy dividing non explicit types into separate key spaces.

Original pull request: #11.
2015-05-19 17:35:56 +02:00
Christoph Strobl
02759f58ea DATAKV-99 - Polishing.
Removed dedicated Entry<K,V> interface, since Map.Entry<K,V> is already sufficient. Favoured CloseableIterator over KeyValueIterator since it offers no additional functionality but less generic parameter clutter.
Added missing JavaDoc.
2015-05-13 12:53:44 +02:00
Christoph Strobl
952a901164 DATAKV-101 - Favor Iterable over Collection types for KeyValueOperations.
Change return types for Adapter and Operations from Collection types to Iterable. Added count(keyspace) to KeyValueAdapter.

Original pull request: #8.
2015-05-11 11:39:56 +02:00
Christoph Strobl
16dc4b5e7d DATAKV-99 - Add KeyValueIterator.
We now offer the possibility to iterate through available key/value pairs via a KeyValueIterator. The default implementation for java.util.Map based Adapters is a ForwardingKeyValueIterator delegating to the underlying entrySet iterator.

Original pull request: #7.
2015-05-11 11:26:31 +02:00
Christoph Strobl
07b3a1547c DATAKV-91 - Add support for sending application events.
We now allow definition of event types to be published via the application context.

Original pull request: #5.
2015-05-05 16:09:31 +02:00
Thomas Darimont
c305988582 DATAKV-96 - Added QueryDslPredicateExecutor.findAll(Predicate, Sort).
We now support findAll on QuerydslKeyValueRepository that accepts a Querydsl Predicate and a Sort.

Original pull request: #4.
2015-02-24 10:18:19 +01:00
Oliver Gierke
8f1bc111b4 DATAKV-95 - Added exists(…) method to QuerydslKeyValueRepository.
Renamed QueryDsl… classes to Querydsl… for consistency. Restructured test cases for repositories to make better use of generics.
2015-02-03 11:50:16 +01:00
Oliver Gierke
bc88cb48ac DATAKV-87 - Polished implementation of configurability of Map type on @EnableMapRepositories.
Removed the MapKeyValueAdapterFactory in favor of using instantiating MapKeyValueAdapters directly. Reverted additional hook in KeyValueRepositoryConfigurationExtension as we now rather use inner bean definitions.

Original pull request: #2.
2014-12-05 19:38:13 +01:00
Christoph Strobl
b16a454c6c DATAKV-87 - Allow definition of target Map type via @EnableMapRepositories.
We added the configuration attribute ‘mapType’ to @EnableMapRepositories which allows to change defaulting of the Map structure used by the MapKeyValueAdapter. To do so we now register a MapKeyValueAdapterFactory and delegate creation of the adapter to it. This also allows usage of interface types such as plain java.util.Map which will initialize the adapter with the approximated type resolved via CollectionFactory.

Original pull request #2.
2014-12-05 19:37:55 +01:00
Oliver Gierke
5a14d7bc12 DATAVK-86 - Improved auto-template-registration infrastructure.
KeyValueRepositoryConfigurationExtension now need to report the default value for the KeyValueTemplate reference. We now only register a default template if the reference has not been customized. Changed the default reference value for Maps to mapKeyValueTemplate to allow individual defaults per store.

Removed obsolete RepositoryNamespaceHandler.

Original pull request: #1.
2014-12-01 16:35:28 +01:00
Christoph Strobl
ff1338a99c DATAKV-86 - Move configuration infrastructure for Map-based repositories.
We removed the EnableKeyValueRepositories in favor of store specific implementations. In this case EnableMapRepositories.

The configuration now defaults a KeyValueTemplate with a MapKeyValueAdapter but allows overriding the template in a bean named keyValueTemplate.
2014-12-01 16:13:01 +01:00
Christoph Strobl
4f37a7ecc3 DATAKV-90 - Add findAll variant with QueryDSL OrderSpecifier without a Predicate. 2014-11-28 15:17:51 +01:00