Commit Graph

538 Commits

Author SHA1 Message Date
Oliver Gierke
6e3114f3cb DATACMNS-867 - Updates to QueryExecutionConverters.
Introduced an overload in AbstractWrapperTypeConverter to simplify the constructors in implementations. Switched to Streamable.map(…) in getConvertibleTypes().
2017-03-24 08:00:45 +01:00
Oliver Gierke
628dc8b9c8 DATACMNS-867 - Introduced monadic methods on Streamable.
Streamable now exposes map(…), flatMap(…) and filter(…) to allow easy conversion into new Streamables. Introduced LazyStreamable to back those implementations. Simplified implementation of methods in PartTree to use those new methods.

Changed Page and Slice map(…) method to take a Function over a Converter so that act as specialization of the newly introduced map(…) method.
2017-03-24 08:00:45 +01:00
Oliver Gierke
bdbdb46adb DATACMNS-867 - API updates after rebase on latest changes. 2017-03-24 08:00:44 +01:00
Oliver Gierke
e861d0343b DATACMNS-867 - Additions to Lazy.
Added mapping functions to Lazy.
2017-03-24 08:00:44 +01:00
Oliver Gierke
8372e34adf DATACMNS-867 - Cleanups in Pageable API.
Dropped Pageable.NONE in favor of ….unpaged() for consistency with Sort.unsorted(). Extracted the implementation for the value backing it into an Unpaged enum instance. Introduced defaulted isPaged() / isUnpaged() to avoid having to compare instances.

JavaDoc in Sort and a couple of API polishes.
2017-03-24 08:00:44 +01:00
Oliver Gierke
a5c4be5f0a DATACMNS-867 - Removed Optional from ResultProcessor.withDynamicProjection(…).
We now expect the PropertyAccessor to either be non-null or the method not being called at all.
2017-03-24 08:00:44 +01:00
Oliver Gierke
c84e6c8427 DATACMNS-867 - More required metadata lookup.
Introduced overloads to lookup required RepositoryInformation and PersistentEntity instances to Repositories and PersistentEntities.
2017-03-24 08:00:44 +01:00
Christoph Strobl
be347eaaab DATACMNS-867 - Additional Java 8 language feature cleanup.
Make use of lambdas and method references though out the codebase. Remove no longer required generic type parameters.
Additionally remove unused imports and replace single element list initialization with dedicated singletonList.
Use Assertion overloads taking Supplier for dynamic assertion error messages.
2017-03-24 08:00:43 +01:00
Christoph Strobl
aa4c51e1ea DATACMNS-867 - Cache constructors in ClassGeneratingPropertyAccesssorFactory.
Fix hotspot in constructor lookup - in particular the propertyAccessorClass.getConstructors() call.
Additionally fix another minor issue in assertion message creation.
2017-03-24 08:00:43 +01:00
Christoph Strobl
d363e8f2c2 DATACMNS-867 - Favor LocalDateTime over ZonedDateTime in CurrentDateTimeProvider.
Use LocalDateTime to avoid timezone issues just because the default auditing cannot handle it when the domain type property comes from eg. jodatime.
2017-03-24 08:00:43 +01:00
Mark Paluch
378baba06a DATACMNS-867 - Use Optional in AbstractQueryCreator to handle ParameterAccessor presence.
AbstractQueryCreator now requires constructor arguments and no longer permits passing null values for ParameterAccessor. ParameterAccessor is wrapped in Optional to correctly handle its presence and absence without dealing with null values.
2017-03-24 08:00:43 +01:00
Christoph Strobl
8bcd8cb3da DATACMNS-867 - Fixed glitch causing failure in PropertyDescriptor lookup for ProjectionInformation.
Re added PropertyDescriptor collection. Looks like the method got dropped during one of the rebase operations.
Additionally make use of .distinct() name collection in tests as descriptors might appear multiple times for the same property name.
2017-03-24 08:00:43 +01:00
Oliver Gierke
cc1c07ecca DATACMNS-867 - Hacking. 2017-03-24 08:00:43 +01:00
Christoph Strobl
47e2e61ff5 DATACMNS-867 - Preserve underscores when resolving PropertyPath for PersistentProperties.
Preserve underscores in variable names (eg. String foo_bar) when resolving the actual type information for the property via PropertyPath by quoting (Pattern#quote) the property name.
2017-03-24 08:00:43 +01:00
Mark Paluch
2da5acc553 DATACMNS-981 - Consider merged annotations when populating for annotation cache.
We now consider property annotations as merged annotations when initially scanning for annotations in a property declaration. Composed annotations such as declared outside our code are captured correctly because they use an own type that is not queried by users of PersistentProperty. Own, revised annotations, using @AliasFor providing an alias for annotation values require merged annotation processing.

Previously, annotations were cached as-is without resolving @AliasFor. This caused a later lookup via findAnnotation(…) to return the cached annotation without aliasing. Because the annotation was cached, no further lookup via AnnotatedElementUtils.findMergedAnnotation(…) was attempted.

@Retention(RetentionPolicy.RUNTIME)
@Target(value = { FIELD, METHOD })
public @interface RevisedAnnnotationWithAliasFor {

	@AliasFor("value")
	String name() default "";

	@AliasFor("name")
	String value() default "";
}

public class Person {
	@RevisedAnnnotationWithAliasFor(value = "spring")
	String firstname;
}

PersistentProperty firstname = …

property.findAnnotation(…) returned previously @RevisedAnnnotationWithAliasFor(value = "spring", name = "")

now we return @RevisedAnnnotationWithAliasFor(value = "spring", name = "spring")
2017-03-24 08:00:43 +01:00
Christoph Strobl
bab5ddade9 DATACMNS-867 - ReflectionEntityInformation getId(Object) considers potential null values. 2017-03-24 08:00:42 +01:00
Oliver Gierke
250b1cf613 DATACMNS-867 - Cleanups in Querydsl support. 2017-03-24 08:00:42 +01:00
Oliver Gierke
282881a64c DATACMNS-867 - Removed obsolete reference to Environment from @EnableSpringDataWebSupport. 2017-03-24 08:00:42 +01:00
Oliver Gierke
9c6f764131 DATACMNS-867 - Consistent non-capitalization of Querydsl. 2017-03-24 08:00:42 +01:00
Oliver Gierke
2210f2e8e9 DATACMNS-867 - Adapt codebase after rebase on forward ports. 2017-03-24 08:00:36 +01:00
Christoph Dreis
9b3dd05baa DATACMNS-867 - Avoid allocations from Method.getParameterTypes() where possible.
We now prefer an explicit Method.getParameterCount() over accessing the parameter types array and its length to avoid the overhead of cloning the array.

Original pull request: #187.
2017-03-24 08:00:26 +01:00
Oliver Gierke
1ad82cb82d DATACMNS-867 - Update forward ported code.
Polished method lookup in DefaultRepositoryInformation using Optionals.firstNonEmpty(…). Optimized creation of JavaSlang's Option type as we don't have to rely on reflection to call static methods on interfaces on Java 8. AssertJ updates in corresponding tests.
2017-03-24 08:00:26 +01:00
Oliver Gierke
2d282b2d7f DATACMNS-867 - Cleanups. 2017-03-24 08:00:26 +01:00
Mark Paluch
798bbc3b0c DATACMNS-867 - Fix generic type matching for reactive repository base method discovery.
Base method discovery is now aligned with blocking base method discovery to consider type variables in parameter assignability checking.

Related ticket: DATACMNS-836.
2017-03-24 08:00:26 +01:00
Mark Paluch
7c31d9916a DATACMNS-867 - Simplify base method matching. 2017-03-24 08:00:26 +01:00
Oliver Gierke
dba5308d79 DATACMNS-867 - Removed conditional guards for the presence of TransactionalProxy.
TransactionalProxy is now available on the classpath by definition, so we don't need the guards anymore.
2017-03-24 08:00:26 +01:00
Oliver Gierke
bdd55fc7ab DATACMNS-867 - Java 8 polish of ReflectiveRepositoryInformation.
Introduced Optionals.firstNonEmpty(…) to consume a set of Suppliers until one returns a non-empty Optional.
2017-03-24 08:00:25 +01:00
Oliver Gierke
d7340e391c DATACMNS-867 - Further fixes. 2017-03-24 08:00:25 +01:00
Oliver Gierke
fd2c400c4e DATACMNS-867 - Optionals in CrudMethods API. 2017-03-24 08:00:25 +01:00
Oliver Gierke
8268373d11 DATACMNS-867 - Further polishing in MappingContext APIs. 2017-03-24 08:00:25 +01:00
Oliver Gierke
90683ed68a DATACMNS-867 - Re-introduced CdiRepositoryBean.getDependencyInstance(…) with explicit type. 2017-03-24 08:00:24 +01:00
Oliver Gierke
8d22b3ae7c DATACMNS-867 - Fixed repository base class configuration in RepositoryBeanDefinitionBuilder.
We erroneously forwarded the factory class from the extension in case of an absent repository base class name in the configuration (which is the default).
2017-03-24 08:00:24 +01:00
Oliver Gierke
49575fd4ce DATACMNS-867 - Introduced Stream-based alternatives for PersistentEntity.doWith… methods. 2017-03-24 08:00:24 +01:00
Oliver Gierke
db4bf10ebb DATACMNS-867 - Introduced PersistentEntity.getRequiredPersistentProperty(). 2017-03-24 08:00:24 +01:00
Oliver Gierke
d4811e29d9 DATACMNS-867 - Second draft. 2017-03-24 08:00:23 +01:00
Mark Paluch
57ed50a730 DATACMNS-867 - Adopt Optional<T> in ASM generated property accessor factories. 2017-03-24 08:00:23 +01:00
Oliver Gierke
cc63e5b7a4 DATACMNS-867 - First draft. 2017-03-24 08:00:23 +01:00
Oliver Gierke
1b17271915 DATACMNS-1008 - Polishing.
Formatting and copyright years in DefaultRepositoryInformation.
2017-03-14 07:46:00 +01:00
Oliver Gierke
47d00bf696 DATACMNS-1008 - Reintroduced lost support for non-generic redeclarations of generic CRUD methods.
The changes for DATACMNS-854 and DATACMNS-912 dropped the support for the simpler redeclaration of generic methods like CrudRepository.save(…) which as of the changes requires to be redeclared like <T extends Foo> T save(T entity). Previously a simple redeclaration like Foo save(Foo entity) was sufficient.

This commit reintroduces the check for a direct match of the parameter types and shortcuts the more detailed check that's necessary in case of type variables being involved.

Related tickets: DATACMNS-854, DATACMNS-912.
2017-03-14 07:45:54 +01:00
Oliver Gierke
d98c0df40b DATACMNS-1007 - Polishing.
Moved the enum declaration to a more appropriate position. Moved the author addition to the part of the codebase that was actually changed. Expanded copyright year.

Moved unit tests to more appropriate position. Added another one to make sure a reference to a boolean property "empty" can still be supported by adding an explicit Is to make sure we detect a simple property reference.

Original pull request: #203.
2017-03-13 13:02:12 +01:00
Michael Cramer
760f09a059 DATACMNS-1007 - Added IsEmpty and IsNotEmpty keywords to query parser.
The query derivation mechanism now detects IsEmpty and NotIsEmpty as keywords and exposes them in the PartTree.

Original pull request: #203.
2017-03-13 13:02:06 +01:00
Oliver Gierke
be4498659d DATACMNS-1005 - Polishing.
Simplified type check by using Set as method signature to avoid unnecessary manual array wrapping. Simplification in the test assertions. A bit of Javadoc, corrected imports and author tags.

Original pull request: #200.
2017-03-09 12:11:32 +01:00
Maciek Opala
b194f7794d DATACMNS-1005 - Paginated query methods now support Javaslang collection types.
To eagerly catch invalid declarations, query methods using pagination had a check applied that the method either returns a Page or List. We've introduced support for alternative collection libraries (Javaslang in particular) and thus the check needs to take these newly supported types into account.

This is now fixed by externalizing the valid types into QueryExecutionConverters and using the ones returned by that to check against.

Original pull request: #200.
2017-03-09 12:09:20 +01:00
Oliver Gierke
a3afa84198 DATACMNS-940 - Fix query method query result type detection for custom collections.
The nullable wrapper types now expose whether they're a single value type or a multi value type. This is necessary as Javaslang's Option implements Iterable (something we previously checked for to detect a collection query) and the custom collections potentially being usable within other wrapper types (e.g. Future<Seq<User>>).
2017-03-09 12:08:19 +01:00
Oliver Gierke
642e92b2eb DATACMNS-1006 - SimpleTypeHolder now considers java.lang types simple ones.
This prevents AbstractMappingContext from adding them as entities.

Related tickets: DATAREST-1018.
2017-03-07 13:44:44 +01:00
Oliver Gierke
ebd871b566 DATACMNS-989 - Polishing.
Introduced overload for CustomRepositoryImplementationDetector.detectCustomImplementation(…) to take a RepositoryConfiguration to simplify the invocation from the Spring container related client. Further simplification to unify invocations also from the CDI implementation to be done in 2.0.

Expose getExcludeFilter() on RepositoryConfiguration to not have to inspect the configuration source on clients.

Formatting and Javadoc. Missing license headers in newly created types.

Original pull request: #195.
2017-03-01 16:31:57 +01:00
Peter Rietzler
3ca77831e1 DATACMNS-989 - Use exclude filters when scanning for custom repository implementations.
The detection algorithm for custom repository implementations now considers the exclude filters declared in the overall repository setup (XML and annotations).

Original pull request: #195.
2017-03-01 16:31:57 +01:00
Christoph Strobl
aaf4ccc69c DATACMNS-999 - Improve resource extensive error message concatenation.
We now use Assert.isTrue(…) taking a Supplier to avoid unnecessary String concatenation.

Original pull request: #198.
2017-02-28 19:03:51 +01:00
Oliver Gierke
27ce92cd16 DATACMNS-987 - Polishing.
Removed a bit of reflection from ApplicationContext interaction. Some generics tweaks to avoid unnecessary casts and compiler warnings. Static methods where possible. JavaDoc polish in ProjectingJackson2HttpMessageConverter.
2017-02-13 13:36:00 +01:00
Mark Paluch
f453130569 DATACMNS-987 - Polishing.
Remove unused Querydsl tests. Add author. Reformat code. Extend Javadoc.
2017-02-13 13:32:42 +01:00