Commit Graph

148 Commits

Author SHA1 Message Date
Thomas Darimont
f7679d41b8 DATACMNS-363 - Support unicode characters in in query method names.
Modified the regex for prefix_template and keyword_template in PartTree in order to support arbitrary unicode characters. Before that change we didn't support unicode correctly since we assumed that a character would have a lower and upper case representation which is often not the case, e.g. in chinese.

Original pull request: #41.
2013-09-08 17:21:22 -07:00
Oliver Gierke
77199cbec4 DATACMNS-358 - Test case for 1-index pages in PagedResourcesAssembler.
Added a test case to show that PagedResourcesAssembler correctly renders 1-indexed, empty pages after upgrading to Spring HATEOAS 0.8.0.BUILD-SNAPSHOT.
2013-08-26 18:30:34 +02:00
Oliver Gierke
1976878bd5 DATACMNS-362 - Resolved concurrency problem in Repositories.
We now create a copy of the keys before iterating over them in Repositories.getRepoInforFor(…) to make sure other threads can safely trigger lookupRepositoryFactoryInformationFor(…) which potentially alters the repositories instance variable. So far we haven't guarded against this scenario which caused a ConcurrentModificationException.
2013-08-26 18:29:04 +02:00
Oliver Gierke
5ccb0bc9c2 DATACMNS-360 - Scanning for repository interfaces now considers active profiles.
The configuration entry points (RepositoryBeanDefinitionParser and RepositoryBeanDefinitionRegistrar) now hand the Environment they're running in forward into the infrastructure scanning for repositories. Thus it will correctly find or not find repository interfaces based on which profiles are activated or not.
2013-08-25 18:29:52 +02:00
Nick Williams
eb4b801dc9 DATACMNS-353 - Make Spring HATEOAS purely optional.
Extracted the implementation of UriComponentsContributor from PageableHandlerMethoArgumentResolver and SortHandlerMethodArgumentResolver into dedicated subclasses so that we can really make Spring HATEOAS an optional dependency.

The integration tests are now guarded with an assumption to run on Spring 3.2 as Spring 3.1 has issues with JavaConfig and configuration method overrides. We've upgraded to Spring Data Build 1.2 snapshots so that the tests can be run with -Pspring32. This effectively means that the Spring Data Web support can only be used with a current Spring 3.2. Added a note on that in the reference docs and JavaDoc of @EnableSpringDataWebSupport.

Original pull request: #39.
2013-08-22 08:14:58 +02:00
Oliver Gierke
9843447a58 DATACMNS-357 - Cleanups in primitive id detection.
Changed implementation in AbstractEntityInformation quite a bit to not need the non-final fields and a protected callback method. Cleaned up test cases to really test the new behavior, not the artificially introduced test helper class.

Original pull request: #37.
2013-08-14 09:38:43 +02:00
Nick Williams
98b8129a74 DATACMNS-357 - Added support for primitive ids in EntityInformation.
AbstractEntityInformation now detects primitive id types and adapts the isNew state according to the Java Language Specification §4.12.5. Supported are primitive Numbers and the entity is considered new if the value of the primitive field is zero.

Original pull request: #37.
2013-08-14 09:38:17 +02:00
Oliver Gierke
b059da8f4f DATACMNS-341 - RepositoryFactory(Bean)Support is now class loader aware.
Let both RepositoryFactorySupport and RepositoryFactoryBeanSupport implement BeanClassLoaderAware to pick up the ClassLoader used by the container. The latter class forwards the configured instance into the factory it creates.
2013-08-12 10:49:36 +02:00
Thomas Darimont
7b5bdd45e6 DATACMNS-304 - JavaDoc fix for PageableArgumentResolver.
The deprecation hint in PageableArgumentResolver now points to PageableHandlerMethodArgumentResolver.

Original pull request: #38.
2013-08-12 09:30:32 +02:00
Oliver Gierke
59a8cd5566 DATACMNS-352 - Aligned setter names for argument resolvers for Pageable and Sort.
PageableHandlerMethodArgumentResolver and SortHandlerMethodArgumentResolver now consistently use set*ParameterName(…) and setQualifierDelimiter(…) for configuration.

Added some more unit tests to verify invalid configuration get rejected.
2013-08-08 12:52:11 +02:00
Oliver Gierke
541ef648f1 DATACMNS-356 - Parameters now uses DefaultParameterNameDiscoverer if present.
We now leniently try to lookup DefaultParameterNameDiscoverer and create an instance of it to make use of Spring 4's improved parameter name capabilities on Java 8. We fall back on a LocalVariableTableParameterNameDiscoverer if on Spring versions prior to 4.
2013-08-07 14:39:37 +02:00
Oliver Gierke
04d6859354 DATACMNS-355 - ReflectionAuditingBeanWrapper now uses a ConversionService.
We're not manually converting the DateTime instance into the user field type but delegate to a ConversionService instance. This will allow us to automatically adhere to enhancements in conversion capabilities to the DefaultConversionService.
2013-08-07 13:48:19 +02:00
Thomas Darimont
a63a2bbd75 DATACMNS-351 - Add setFallbackSort(…) to SortHandlerMethodArgumentResolver.
SortHandlerMethodArgumentResolver now has a setFallbackSort(…) to be able to configure the Sort instance to be used if nothing can be resolved from the request and sort default is configured on the controller method.

Renamed name of getDefaults(…) method in SortHandlerMethodArgumentResolver to getDefaultFromAnnotationOrFallback(…) and refactored implementation to be more understandable.

Original pull request: #36
2013-08-07 12:29:05 +02:00
Oliver Gierke
f502c1fece DATACMNS-314 - Prepare 1.6.0.RC1 release.
Updated changelog, notice and readme. Upgraded to Spring Data Build parent 1.1.1.RELEASE.
2013-08-01 16:47:34 +02:00
Oliver Gierke
b8e457db9b DATACMNS-350 - Improved extensibility of Parameters.
Parameters is now a class explicitly designed for extension using generics. We provide a new DefaultParameters which is essentially a drop in replacement for former Parameters as it exposes individual Parameter instances.

Modules that previously extended Parameters will now have to implement the abstract factory methods exposed to create concrete - and potentially customized - Parameter instances.
2013-07-30 15:02:51 +02:00
Thomas Darimont
cc576a7398 DATACMNS-349 - Opened up SPI in DefaultTypeMapper to allow subclasses to resolve TypeAliases.
Added getAliasFor(TypeInformation) method in DefaultTypeMapper to allow subclasses to resolve TypeAliases.
2013-07-23 13:21:59 +02:00
Thomas Darimont
2afb570729 DATACMNS-345 - Use the actual type of the persistent property.
Changed getPersistentEntity(PersistentProperty<?>) to return the actual type of the persistent property in order to deal with collection and map types transparently.

Original pull request: #31.
2013-07-16 12:42:31 +02:00
Oliver Gierke
634789c3b7 DATACMNS-344 - Allow Repositories to work with non-CrudRepositories.
Introduced CrudMethods abstraction obtainable via a RepositoryInformation to inspect a repository for the presence of individual CRUD methods. The default implementation favors more special methods (e.g. the findAll(Pageable) over a simple findAll()). Introduced a CrudInvoker to be able to easily invoke findOne(…) and save(…) independently of whether the target methods are declared explicitly or inherited from CrudRepository.

Fixed some test case names to make sure they're executed during the Maven build.
2013-07-15 15:02:32 +02:00
Oliver Gierke
8a02b4ad6e DATACMNS-343 - PageableHandlerMethodArgumentResolver replaces pagination parameters now.
PageableHandlerMethodArgumentResolver now uses replaceQueryParam(…) to make sure the query parameters necessary for pagination don't accidentally get added multiple times.
2013-07-12 12:53:14 +02:00
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