Commit Graph

129 Commits

Author SHA1 Message Date
Thomas Darimont
fc5ce662af DATACMNS-342 - Open up id property selection API in BasicPersistentEntity.
To support more advanced id property selection mechanisms we introduced a callback method returnPropertyIfBetterIdPropertyCandidate(…).

Pull request: #30.
2013-07-08 12:07:21 +02:00
Oliver Gierke
3a496b1f44 DATACMNS-337 - PersistentProperty now exposes getActualType().
The call transparently resolves map value types and collection component types if the property is either one of them.
2013-06-10 15:01:39 +02:00
Oliver Gierke
3f41810b86 DATACMNS-336 - Config classes backing @EnableSpringDataWebSupport are now public. 2013-06-10 14:12:42 +02:00
Oliver Gierke
15c4e34716 DATACMNS-335 - PageableHandlerMethodArgumentResolver now has configurable max page size.
The default is set to 2000.
2013-06-10 14:11:26 +02:00
Oliver Gierke
a7dfb9c27c DATACMNS-313 - Prepare 1.6.0.M1 release.
Upgraded to Spring Data Build 1.1.0.RELEASE, upgraded to Spring HATEOAS 0.6.0.RELEASE. Updated changelog.
2013-05-31 19:04:54 +02:00
Oliver Gierke
5cd136dd56 DATACMNS-330, DATACMNS-331 - Documentation of new web support. 2013-05-31 12:03:33 +02:00
Oliver Gierke
e0dda2a4f0 DATACMNS-333 - Added Jackson 2 support to repository populators.
Added necessary infrastructure to use Jackson 2 with repository populators. Expose a jackson2-populator XML element in the namespace to setup a Jackson2 based repository populator.
2013-05-29 17:51:39 +02:00
Oliver Gierke
cd2ea03928 DATACMNS-332 - Further performance improvements.
Reverted from ConcurrentHashMap to plain HashMap where concurrency wasn't an issue and profiling showed performance hotspots. Introduced caches for ParameterizedTypeInformation.getComponentType() and the resolved raw type in TypeDiscoverer.
2013-05-23 18:57:48 +02:00
Oliver Gierke
905565cbcc DATACMNS-332 - Cache AnnotationBasedPersistentProperty.isTransient(). 2013-05-23 10:03:05 +02:00
Oliver Gierke
24bc432d48 DATACMNS-332 - AbstractMappingContext now prefers most concrete property.
BasicPersistentEntity now only caches the most concrete property for a by-name lookup to mimic the behavior that was implemented in getPersistentProperty(String name). This is to prevent shadowed properties of superclasses leaking into the by-name lookups.

Improved AbstractPersistentProperty.toString() to rather render the concrete field it is backed by.
2013-05-22 18:37:51 +02:00
Oliver Gierke
73b9d60be5 DATACMNS-330, DATACMNS-331 - More improvements on web configuration.
Reverting the registration of the DomainClassConverter as a Spring bean an prefer direct registration against the FormatterRegistry handed into addFormatters(…) of WebMvcConvfigurerAdapter. Otherwise we run into CGLib issues while enhancing the config classes.
2013-05-22 10:18:26 +02:00
Oliver Gierke
16c3c15204 DATACMNS-330, DATACMNS-331 - Improved web configuration support.
Updated backing implementation of @EnableSpringDataWebSupport to use WebMvcConfigurerAdapter instead of WebMvcConfigurationSupport as the latter is a very custom beast in terms of configuration. Let the Spring HATEOAS specific configuration class extend the default one to register additional components. The default one accesses the FormattingConversionService through a qualified autowiring. It issues a warning in case none has been configured and asks the user to enable Spring MVC.

Updated Sonargraph architecture description to allow logging from web config layer.
2013-05-21 17:10:13 +02:00
Oliver Gierke
a9abb40fbd DATACMNS-332 - Performance improvements in conversion subsystem hotspots.
Added caching to DefaultTypeMapper, SimpleTypeInformationMapper, BasicPersistentEntity and PreferredConstructor as these seem to be performance hotspots on the reading side of object conversion.
2013-05-17 13:58:14 +02:00
Oliver Gierke
a8b912c09f DATACMNS-310 - Integrated ChainedTransactionManager from Spring Data Neo4j.
We now integrate a best-effort PlatformTransactionManager that will propagate commits and rollbacks to all PlatformTransactionManager instances registered. This assumes that the exceptional cases which will cause a rollback to happen either before the commits or during the first commit.
2013-05-15 16:34:09 +02:00
Oliver Gierke
a93c2bff94 DATACMNS-330, DATACMNS-331 - Advanced web integration.
Added PagedResourcesAssembler to easily convert Page instances into a PagedResource instance and automatically build the required previous/next links based on the PageableHandlerMethodArgumentResolver present in the MVC configuration. The assembler can either be injected into a Spring MVC controller or a controller method. The latter will then assume the controller methods URI to be used as pagination link base.

Added @EnableSpringDataWebSupport to automatically register HandlerMethodArgumentResolvers for Pageable and Sort as well as a DomainClassConverter that will allow the usage of domain types being managed by Spring Data repositories in controller method signatures. In case Spring HATEOAS is present on the classpath, we'll also register a PagedResourcesAssembler for injection as well as the appropriate HandlerMethodArgumentResolver for injection into controller methods.

Adapted Sonargraph configuration accordingly. Upgraded to Spring HATEOAS 0.6.0.BUILD-SNAPSHOT.
2013-05-15 16:03:46 +02:00
Oliver Gierke
a741651672 DATACMNS-329, DATACMNS-319 - Added test case for Repositories looking up beans by name.
Essentially a regression test that runs for Spring versions newer than 3.2.2.RELEASE and checks that repository factories are found even if not instantiated yet. This should also make sure DATAJPA-323 does not occur anymore.
2013-05-14 20:51:50 +02:00
Oliver Gierke
70ce9a0908 DATACMNS-323 - PageImpl returns correct number of pages for use with content only.
So far, the PageImpl class returned 0 as total number of pages if set up from a plain List. This returns 1 now (as it should be). We've also adapted the hasNextPage() implementation to correctly calculate whether a next page is available.
2013-05-14 16:45:13 +02:00
Emanuele Blanco
602834f86a DATACMNS-328 - Fixed "fallbackPageable" typo in PageableArgumentResolver.
Pull request: #28.
2013-05-14 16:21:45 +02:00
Oliver Gierke
2c83144269 DATACMNS-327 - AbstractMappingContext implements InitializingBean again.
This causes the configured persistent entities being added to the context on its initialization instead of a delayed initialization on ApplicationContext refreshed event.
2013-05-12 23:45:11 +02:00
Oliver Gierke
8074bc87e8 DATACMNS-325 - RepositoryInterfaceAwareBeanPostProcess now implements PriorityOrdered.
This makes sure it is also applied in cases of dependency lookups for {{BeanPostProcessor}} implementation's dependencies.
2013-05-04 13:50:52 +02:00
Oliver Gierke
02cacf59bc DATACMNS-322 - CdiRepositoryBean implements PassivationCapable.
To allow the CdiRepositoryBeans being used inside scoped CDI beans we need to implement PassivationCapable so that the CDI contain can serialize the bean instance and detect the contextual instance on deserialization. As the repositories are application scoped we simply consider a bean of a given type plus its qualifier annotations unique.
2013-04-26 18:46:15 +02:00
Oliver Gierke
0cf875b358 DATACMNS-320 - Be less restrictive in finding mapping ambiguities.
So far we threw exceptions in case we find the same exception on getters *and* setters. We now allow this scenario in case the annotations are semantically equivalent.
2013-04-25 15:13:42 +02:00
Oliver Gierke
454defc637 DATACMNS-319 - Made Repositories less greedy in looking up beans.
We now don't try to eagerly lookup the beans Repositories shall capture in the constructor anymore but leniently look them up on the first request. Update tests for classes using Repositories alongside.
2013-04-25 11:20:43 +02:00
Oliver Gierke
4303fdf399 DATACMNS-318 - Refined persistence exception translation infrastructure.
Extracted the activation of persistence exception translation into a separate RepositoryProxyPostProcessor. Adapted TransactionalRepositoryFactoryBeanSupport to also register the newly introduced PersistenceExceptionTranslationRepositoryProxyPostProcessor.
2013-04-19 15:18:11 +02:00
Oliver Gierke
8a67259aef DATACMNS-236 - Fixed potential NPEs in SortHandlerMethodArgumentResolver. 2013-04-18 12:15:36 +02:00
Oliver Gierke
8d69459f74 DATACMNS-311 - TypeDiscoverer now also finds properties in type hierarchy.
We now also inspect the entire type hierarchy to lookup a property descriptor to inspect for read methods in case no field is found for a property.
2013-04-12 16:41:39 +02:00
Oliver Gierke
59af5770dd DATAJPA-324 - Test case to show property lookup on interface methods work. 2013-04-05 20:44:40 +02:00
Oliver Gierke
a7820c8cc6 DATACMNS-309 - Fixed lookup of nested properties on TypeDiscoverer.
So far the property lookup of a nested property path (e.g. "foo.bar") failed in cases the head property was not cached already. We now recursively resolve the type information even for an unpopulated cache.
2013-04-05 20:44:27 +02:00
Oliver Gierke
64dada5896 DATACMNS-306 - RepositoryBeanDefinitionBuilder not correctly sets source.
Previously, the RepositoryBeanDefinitionBuilder did not forward the repository configuration's source instance into the built BeanDefinitions. This is now fixed to enable STS track the origin of the BeanDefinition back to the configuration source (an @Enable-annotation or an XML namespace element).
2013-03-28 18:53:17 +01:00
Oliver Gierke
e8b2db8463 DATACMNS-305 - Added toString() methods to PersistentProperty implementations. 2013-03-28 15:50:17 +01:00
Oliver Gierke
fd91313f75 DATACMNS-303 - Added support for count projects in query parsing.
PartTree now supports query methods starting with "count…By" and exposes that fact through an isCountProjection() method to be used by query creators upstream
2013-03-26 14:40:23 +01:00
Oliver Gierke
31618f9198 DATACMNS-299 - Default scope of CDI repository beans to application scope.
Polished JavaDoc along the way.
2013-03-25 17:41:12 +01:00
Johannes Mockenhaupt
596908946d DATACMNS-300 - Fixed exception handling in ReflectionEntityInstantiator.
ReflectionEntityInstantiator now actually throws the wrapped exception created in the catch block handling BeanInstantiationExceptions.

Pull request: #25.
2013-03-25 13:35:09 +01:00
Oliver Gierke
9781f603ea DATACMNS-295 - Expose modify-on-creation flag in XML namespace.
Introduced additional attribute in schema in version 1.6. Added parsing of the attribute.
2013-03-21 15:44:03 +01:00
Oliver Gierke
645a605f58 DATACMNS-304 - Fixed compile error on JDK6.
Changed variable declaration in PageableHandlerMethodArgumentResolver from int to Integer to satisfy JDK6 generics resolution.
2013-03-03 15:28:09 +01:00
Kevin Raymond
a588f43857 DATACMNS-281 - Added support to Order for case insensitive sorts.
Modified the Order class to allow an ignore case flag to be set so that case insensitive sorts could be supported.
2013-02-27 15:17:21 +01:00
Oliver Gierke
b26f09f3b4 DATACMNS-291 - Fixed typo in JavaDoc of CrudRepository. 2013-02-27 14:46:17 +01:00
Oliver Gierke
e11efede4d DATACMNS-236, DATACMNS-117 - Added (Pageable|Sort)HanderMethodArgumentResolvers.
Added HandlerMethodArgumentResolver implementations for Pageable and Sort exposing a new default set of properties (page, size, sort) to resolve pagination and sorting information from the request. To mimic the legacy behavior we expose a (deprecated) LEGACY constant in PageableHandlerMethodArgumentResolver. Clients should move to the new properties structure ASAP. Added unit tests to verify old and new defaulting behavior.

Introduced new annotations @SortDefault (with @SortDefaults wrapper annotation) and @PageableDefault (superseding the legacy @PageableDefaults). The new annotations have more speaking attribute names and the HMAR implementations transparently alias the generic value attribute into a more semantic one (size).

The HMAR implementations implement Spring HATEOAS' UriComponentsContributor to be able to turn Pageable / Sort instances back into URIs created through the MethodLinkBuilderFactory API in Spring HATEOAS.

Extracted common API between legacy PageableArgumentResolver and PageableHandlerMethodArgumentResolver into common helper class.
Upgraded to Spring Hateoas 0.5.0.BUILD-SNAPSHOT.
2013-02-19 13:09:40 +01:00
Oliver Gierke
ed32d83ab3 DATACMNS-287 - Added missing package-info.java files. 2013-02-19 12:47:01 +01:00
Oliver Gierke
9fae10750e DATACMNS-286 - Extended Page/Pageable APIs.
Pageable and Page interfaces now expose API to easily access Pageables pointing to the previous and next Page instance if available.
2013-02-19 12:45:11 +01:00
Oliver Gierke
0aef8c60b7 DATACMNS-283 - MappingInstantiationException captures more context now.
If an exception occurs in ReflectionEntityInstantiator we now capture more context about the failed instantiation.
2013-02-15 18:34:56 +01:00
Oliver Gierke
e093aead13 DATACMNS-117 - Added PageableHandlerArgumentResolver.
Added PageableHandlerArgumentResolver to supersede the now deprecated PageableArgumentResolver. The latter still stays available for Spring 3.0.x based deployments. Updated reference documentation to mention the newly introduced type as well as possible configuration options.
2013-02-12 17:35:15 +01:00
Oliver Gierke
0bbf0aec99 DATACMNS-282 - Improved caching in AnnotationBasedPersistentProperty.
AnnotationBasedPersistentProperty now caches direct annotations on construction but still tries to lookup an annotation as meta-annotation if not found in cache on later requests. Extended try/catch block in AbstractMappingContext.addPersistentEntity(…) to invalidate cache on exceptions during property creation as well.
2013-02-11 15:56:14 +01:00
Oliver Gierke
1564704f0c DATACMNS-279 - Prepare release of version 1.5.0. 2013-02-07 13:53:47 +01:00
Oliver Gierke
80b6dd2217 DATACMNS-278 - Added Converter implementations for JodaTime types.
Upgraded to JodaTime 2.1 based on super pom property definition.
2013-02-06 17:49:24 +01:00
Oliver Gierke
e79035cb42 DATACMNS-277 - Added general documentation on auditing. 2013-01-30 13:51:57 +01:00
Oliver Gierke
3e40413ffe DATACMNS-275 - Introduced getObfuscatedPassword in UserCredentials. 2013-01-29 13:10:36 +01:00
Oliver Gierke
6b49eb4ca5 DATACMNS-276 - Added hashCode() to ParameterizedTypeInformation.
Implemented hashCode() to be as close as possible to the equals(…) implementation.
2013-01-29 13:07:44 +01:00
Oliver Gierke
f18055a4c9 DATACMNS-274 - Fixed package cycle in mapping subsystem.
Updated Sonargraph architecture description along the way.
2013-01-29 10:50:50 +01:00
Oliver Gierke
33a31a25e0 DATACMNS-271 - AnnotationBasedPersistentProperty now caches annotation lookups. 2013-01-28 14:28:12 +01:00