Commit Graph

782 Commits

Author SHA1 Message Date
Oliver Gierke
94436dd609 DATACMNS-533 - Implemented handling of root objects.
Refactored the implementation of the dynamic lookup of properties and functions on EvaluationContextExtensions. All the reflective lookup logic has moved into an EvaluationContextExtensionAdapter.

We now also distinguish between the meta-information that can be looked up once and cached (so that we avoid reflection overhead for subsequent context creations).

Related pull request: spring-projects/spring-data-jpa#101
Related ticket: DATAJPA-564
2014-07-10 12:21:12 +02:00
Thomas Darimont
1e489bbd6d DATACMNS-533 - Added test cases for root object integration in SpEL extension API.
Changed SPI to expose a Function type rather than plain methods as well as an arbitrary root object.

Related pull request: spring-projects/spring-data-jpa#101
Related ticket: DATAJPA-564
2014-07-10 12:20:59 +02:00
Oliver Gierke
39f028bb6c DATACMNS-533 - Polishing of special parameter handling.
Collapsed variable gathering methods into one, make sure we expose all values (also null ones). Renamed unit test for ExtensionAwareEvaluationContextProvider according to the class name. Some further cleanups in the test case.

Related pull request: spring-projects/spring-data-jpa#101
Related ticket: DATAJPA-564
2014-07-10 12:20:49 +02:00
Thomas Darimont
31848f87eb DATACMNS-533 - Expose special parameters in SpEL expressions.
We now expose special parameters like Pageable and Sort to be used in SpEL expressions if they don't collide with existing named parameters.

Related pull request: spring-projects/spring-data-jpa#101
Related ticket: DATAJPA-564
2014-07-10 12:20:33 +02:00
Thomas Darimont
d23e7baa2c DATACMNS-533 - Support scoping for functions provided by EvaluationContextExtension.
Added test case for scoped functions.

Related pull request: spring-projects/spring-data-jpa#101
Related ticket: DATAJPA-564
2014-07-10 12:20:22 +02:00
Thomas Darimont
1ff4961cbc DATACMNS-533 - Discover declared properties on EvaluationContextExtension.
We new automatically register public static fields declared on classes extending EvaluationContextExtensionSupport as properties to be used within SpEL expressions.

Related pull request: spring-projects/spring-data-jpa#101
Related ticket: DATAJPA-564
2014-07-10 12:20:11 +02:00
Thomas Darimont
9ab9467386 DATACMNS-533 - Discover declared functions on EvaluationContextExtension.
We new automatically register public static methods declared on classes extending EvaluationContextExtensionSupport as functions to be used within SpEL expressions.

Related pull request: spring-projects/spring-data-jpa#101
Related ticket: DATAJPA-564
2014-07-10 12:19:58 +02:00
Oliver Gierke
d303f6ac37 DATACMNS-533 - Infrastructure support for SpEL expressions in manually defined queries.
Extracted SPI build for DATAJPA-564 into Spring Data Commons. Simplified the configuration setup code and removed the ability to define a custom EvaluationContextProvider for now. We directly declare a bean definition which automatically picks up EvaluationContextExtensions.

RepositoryFactory(Bean)Support is now aware of the EvaluationContextProvider to hand it to the template method that creates the QueryLookupStrategy. Deprecated the previously existing template method in favor of an extended one.

Removed variable declarations from the extension interface for now as usually properties serve the same purposes as variables which makes the latter superfluous for now. Applied some JavaDoc and API signature polish. Added unit tests for ExtensionAwareEvaluationContextProvider.

Related pull request: spring-projects/spring-data-jpa#101
Related ticket: DATAJPA-564
2014-07-10 12:19:48 +02:00
Brad Nussbaum
e588a40bcf DATACMNS-536 - Polish APT plugin configuration.
Original pull request: #87.
2014-07-09 22:07:03 +02:00
Christoph Strobl
3477583514 DATACMNS-527 - Remove links to forum.spring.io.
Linked to spring-data tag on StackOverflow.

Original pull request: #90.
2014-07-09 20:45:01 +02:00
Christoph Strobl
acd3a9b6fd DATACMNS-534 - Add support to mark a persistent property as read only.
This commit introduces @ReadOnlyProperty to mark properties as not to be persisted. That trait is exposed via the newly added PersistentProperty.isWritable() which supersedes shallBePersisted(). Currently all non-transient property that are not annotated with @ReadOnlyProperty are considered writable.

Original pull request: #88.
2014-07-09 14:41:31 +02:00
Christoph Strobl
3e10e6f20e DATACMNS-535 - Build now requires Java 7 to run.
Remove ‘openjdk6’ from travis.yml.
2014-07-08 11:20:38 +02:00
Oliver Gierke
15597d35dc DATACMNS-532 - Added support for default methods on repository interfaces.
DefaultRepositoryInformation now excludes default methods from the query methods it detects. RepositoryFactorySupport adds a special MethodInterceptor to the proxy which handles the invocation of default methods.

Related tickets: DATACMNS-535.
2014-07-07 17:26:06 +02:00
Oliver Gierke
6f79d9d727 DATACMNS-535 - Build now requires Java 7 to run.
Added Maven Enforcer Plugin to make sure the build is run against a JDK 7.

Related ticket: DATACMNS-532.
2014-07-07 14:18:06 +02:00
Oliver Gierke
0841c7dc43 DATACMNS-529 - Removed reflective lookup of DefaultParameterNameDiscoverer.
As we build against Spring 4 now, we can replace the reflective lookup of DefaultParameterNameDiscoverer to a simple instantiation.
2014-07-02 08:52:54 +02:00
Oliver Gierke
d28c9bfd3f DATACMNS-529 - Adapt to Spring 4 upgrade.
Upgraded Servlet API version to 3.0.1 as it's required by Spring 4's test packages.
2014-07-01 10:37:55 +02:00
Oliver Gierke
c899201040 DATACMNS-527 - Upgraded to Java 8 stub in correct version. 2014-06-30 14:36:05 +02:00
Oliver Gierke
74793143be DATACMNS-528 - Upgraded to Spring HATEOAS 0.14.0.RELEASE. 2014-06-30 14:05:51 +02:00
Oliver Gierke
cb993963cd DATACMNS-522 - Updated changelog. 2014-06-30 10:45:10 +02:00
Thomas Darimont
2586344218 DATACMNS-518 - Avoid potential infinite loops in PreferredConstructor.
We now synchronize the (seldom) writes to the isPropertyParameterCache HashMap in PreferredConstructor via a ReadWriteLock. We could as well have used a ConcurrentHashMap here without the need for manual locking but this would potentially waste memory for a mostly read-only data structure. We also anticipate potential multiple writes for the same property.

Original pull request: #86.
2014-06-26 14:07:31 +02:00
Oliver Gierke
a885b57dbf DATACMNS-523 - Pulled up FieldNamingStrategy SPI from Spring Data MongoDB.
Pulled up the SPI for field naming from Spring Data MongoDB for reuse in other Spring Data modules.
2014-06-20 21:22:21 +02:00
Oliver Gierke
c43d7cb23e DATACMNS-521 - Disabled querydsl-next profile in Travis build. 2014-06-12 16:20:22 +02:00
Oliver Gierke
aa8d5987d9 DATACMNS-520 - Fixed @Param validation in Parameters.
Parameters erroneously rejected @Param annotated query method parameters that were preceded by a non-bindable type (like Pageable or Sort) as it checked for a 0 index of the parameter. We now manually keep an index in the check itself and have removed the Parameter.isFirst() method as it's not used anywhere else.
2014-06-12 15:59:57 +02:00
Oliver Gierke
28b3221bcf DATACMNS-519 - PagedResourcesAssembler now keeps template variables of base link.
Significant overhaul of the link creation in PagedResourcesAssembler.
2014-06-11 15:30:23 +02:00
Thomas Darimont
1697c77f31 DATACMNS-516 - Add support for limiting the query result in the query derivation mechanism.
We can now detect whether a given query method wants to limit the query results based on two new supported prefixes (findFirstBy…(…) and findFirstKBy…(…)) where "First" part can also be replaced by "Top" and an following optional K (which must be a decimal int) that denotes the maximal number of result rows to be retuned by the query.

This can be used by the stores to allow queries like:

- T findFirstBy…OrderBy…Asc -> smallest
- T findFirstBy…OrderBy…Desc -> greatest
- T findTopBy…OrderBy…Desc -> greatest
- T findFirstBy…(Sort sort) -> general purpose
- T findTopBy…(Sort sort) -> general purpose
- List<T> findFirstKBy…OrderBy…Asc -> smallest K
- List<T> findFirstKBy…OrderBy…Desc -> biggest K
- List<T> findFirstKBy…(Sort sort) -> general purpose TOP K
- List<T> findTopKBy…(Sort sort) -> general purpose TOP K

The limiting expressions also support the Distinct expression. Also, for the queries limiting the result set to one instance, wrapping the result into an Optional is supported.

If pagination or slicing is applied to a limiting query pagination (and the calculation of the number of pages available) is happening within the limited result.

Original pull request: #85.
2014-06-06 15:20:37 +02:00
Oliver Gierke
d41da583e9 DATACMNS-513 - PagedResourcesAssemblerArgumentResolver now correctly resolves mappings for sub-class invocations.
We're now using the newly introduced method on ControllerLinkBuilderFactory that takes both a type and a method to forward the method the invocation is happening on independently from the method being invoked.
2014-06-05 17:16:16 +02:00
Thomas Darimont
347a883dee DATACMNS-514 - Fixed typo in RepositoryPopulator examples.
The property "location" should actually be "locations" since this attribute is read by org.springframework.data.repository.config.ResourceReaderRepositoryPopulatorBeanDefinitionParser.doParse(Element, BeanDefinitionBuilder).
2014-06-04 11:28:16 +02:00
Oliver Gierke
fd4121e03e DATACMNS-511 - Improve equals(…) and hashCode() in TypeVariableTypeInformation.
The equals(…) and hashCode() methods of TypeVariableTypeInformation previously tried to evaluate the unresolved context of the type variable. This can cause issues in recursive type definitions as set up in the according test case. We now implement the methods based on the resolved type to makes sure we break the recursive lookup of PersistentEntity instances in AbstractMappingContext. 

The erroneous lookup was actually caused by unresolved base types being added to the mapping context within the JPA project as the JPA meta-model also returns those types as managed types.

Related pull request: #84.
2014-05-28 15:40:21 +02:00
Oliver Gierke
58fa6c350b DATACMNS-507 - After release cleanups. 2014-05-20 22:10:04 +02:00
Spring Buildmaster
6d3623a5d4 DATACMNS-507 - Prepare next development iteration. 2014-05-20 07:51:26 -07:00
Spring Buildmaster
403f4bb56e DATACMNS-507 - Release version 1.8.0.RELEASE. 2014-05-20 07:51:22 -07:00
Oliver Gierke
8050d9428d DATACMNS-507 - Prepare 1.8 GA. 2014-05-20 16:37:57 +02:00
Oliver Gierke
0163283b00 DATACMNS-507 - Updated changelog. 2014-05-20 16:37:57 +02:00
Oliver Gierke
b94d1fac8e DATACMNS-494 - Removed the defaulting of the environment in RepositoryBeanDefinitionRegistrarSupport.
As SPR-11744 got fixed recently and will be available in Spring 3.2.9, we removed the guard in RepositoryBeanDefinitionRegistrarSupport which defaulted the environment in case it was not set by the container.

Related tickets: SPR-11744.
2014-05-20 16:36:17 +02:00
Oliver Gierke
1d8717712c DATACMNS-498 - Removed assumption form RepositoryFactorySupportUnitTests.
We now run the test case for the query method execution with Futures on Spring 3.2 as well (as SPR-11725 was fixed recently).

Related tickets: DATACMNS-489, DATACMNS-499, SPR-11725.
2014-05-20 16:36:17 +02:00
Christoph Strobl
c4c9d02638 DATACMNS-507 - Prepare release 1.8 GA.
Update reference documentation for derived 'count' and 'delete' queries.

Original pull request: #83.
2014-05-20 15:59:32 +02:00
Oliver Gierke
05acb8ee40 DATACMNS-507 - Upgrade to Spring HATEOAS 0.12.0.RELEASE. 2014-05-20 15:58:25 +02:00
Oliver Gierke
bb9496876c DATACMNS-508 - Re-enable Querydsl profile for Travis build. 2014-05-20 09:10:26 +02:00
Oliver Gierke
5541989058 DATACMNS-509 - Fixed non-NullableWrapper conversion.
In case the repository method execution returns a collection that needs to be converted into a different collection (e.g. List -> Set) we erroneously ran into a NullableWrapper conversion. This was due to the fact that we only used the raw method return type, which caused the ObjectToCollectionConverter to kick in (as the target type's component type falls back to Object if we use raw types).

We're now using Spring's MethodParameter abstraction to create a TypeDescriptor for the method's return type which fully supports generics, so that the conversion check for NullableWrapper -> target type does not match the ObjectToCollectionWrapper.

Prepared the QueryExecutionConverters to be able to support recursive type conversion once we move to Spring 4 as TypeDescriptor exposes the ResolvedType as of this version so that we can inspect the type parameter of the wrapper type to invoke a nested conversion (e.g. Integer -> Optional<String> requires NullableWrapperTo(Guava|Jdk)OptionalConverter being invoked and in turn recursively convert the Integer to String).
2014-05-20 08:46:08 +02:00
Oliver Gierke
2d024bc38e DATACMNS-508 - Enable .m2 directory caching for Travis build. 2014-05-19 15:34:40 +02:00
Oliver Gierke
f5184a719d DATACMNS-508 - Improvements to Travis setup.
Removed Querydsl build step until [0] gets fixed. Skip the install phase to reduce build times.

[0] https://github.com/querydsl/querydsl/issues/763
2014-05-19 15:19:02 +02:00
Oliver Gierke
6b13173b8a DATACMNS-508 - Added Travis config file for matrix builds. 2014-05-19 14:59:47 +02:00
Oliver Gierke
f9d326e32d DATACMNS-506 - Added section on escaping underscores in query method names.
We now explicitly discuss the case of referring to properties with underscores (e.g. first_name) in repository query methods.

Added missing language declaration for a code block.
2014-05-19 08:58:33 +02:00
Oliver Gierke
8164426981 DATACMNS-506 - PreferredConstructorDiscoverer now uses Spring 4's ParameterNameDiscoverer if present.
We now also reflectively check for the presence of DefaultParameterNameDiscoverer. This allows the usage of the new reflection methods introduced in Java 8 if the user code is running on Spring 4.

Changed the name of the constant for the ParameterNameDiscoverer in Parameters to meet conventions for constants.
2014-05-19 08:48:05 +02:00
Oliver Gierke
a1c67a5265 DATACMNS-503 - Upgraded to Guava 17.0. 2014-05-08 12:45:47 +02:00
Oliver Gierke
28f7630acc DATACMNS-502 - Prevent IndexOutOfBoundException in AnnotationRepositoryConfigurationSource.
If a configuration class resides in the default package and no base package is defined in the @Enable…Repositories annotation we previously failed in extracting the package from the class name (as there is none).

We now use Spring's ClassUtils that correctly handles this case and returns an empty String for the default package.
2014-05-08 12:11:21 +02:00
Oliver Gierke
e0006e21ae DATACMNS-501 - Work around potential null returned from GenericTypeResolver in Spring 4.
Spring 4's GenericTypeResolver returns null when trying to resolve type arguments for types that do not fully resolve the generic types.

Related issues: SPR-11763.
2014-05-06 09:50:25 +02:00
Oliver Gierke
fbebdf420c DATACMNS-495 - After release cleanups. 2014-05-02 15:23:54 +02:00
Spring Buildmaster
a71f7b1230 DATACMNS-495 - Prepare next development iteration. 2014-05-02 04:48:23 -07:00
Spring Buildmaster
d6163c0a3d DATACMNS-495 - Release version 1.8.0.RC1. 2014-05-02 04:48:21 -07:00