Commit Graph

298 Commits

Author SHA1 Message Date
Oliver Gierke
af32b38a2a DATACMNS-543 - Avoid duplicate repository bean registration in XML namespace.
We're now firing the component registration event manually in RepositoryBeanDefinitionParser as ParserContext.registerBeanComponent(…) registers the given BeanComponentDefinition with the registry. As we do that manually before this previously resulted in the BeanDefinition overriding the very same one and container warnings in turn.
2014-07-18 12:22:24 +02:00
Thomas Darimont
196d8ae883 DATACMNS-538 - Updated section on pagination in reference documentation.
Reworked section that contained outdated parameter names and examples.

Original pull request: #91.
2014-07-17 21:49:53 +02:00
Christoph Strobl
aa83c03542 DATACMNS-527 - Remove links to forum.spring.io.
Linked to spring-data tag on StackOverflow.

Original pull request: #90.
2014-07-09 20:45:12 +02:00
Oliver Gierke
bee15dd5b2 DATACMNS-527 - Prepare 1.8.1.RELEASE (Dijkstra SR1). 2014-06-30 14:37:45 +02:00
Oliver Gierke
e21b6d46ac DATACMNS-527 - Updated changelog. 2014-06-30 14:37:45 +02:00
Oliver Gierke
700943bd82 DATACMNS-522 - Updated changelog. 2014-06-30 10:46:21 +02:00
Thomas Darimont
f1ff280790 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:08:37 +02:00
Oliver Gierke
218a820c95 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 16:00:05 +02:00
Oliver Gierke
558b9865ba 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:06 +02:00
Thomas Darimont
9ddf20f2e9 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:32:39 +02:00
Oliver Gierke
314aad7caa 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:44 +02: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
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
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
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
47d27ceacd DATACMNS-495 - Prepare 1.4.0.RC1.
Upgraded to Spring Data Parent 1.4.0.RC1. Switched to milestone repository.
2014-05-02 13:43:03 +02:00
Oliver Gierke
ecfb785bdf DATACMNS-495 - Updated changelog. 2014-05-02 13:42:19 +02:00
Oliver Gierke
4a4753bbd4 DATACMNS-495 - Removed obsolete headline from readme.txt. 2014-05-02 13:18:24 +02:00
Oliver Gierke
619f9b8af0 DATACMNS-495 - Forward port changelog entries from bugfix branch. 2014-05-02 12:46:00 +02:00
Oliver Gierke
5791e9b201 DATACMNS-495 - Prepare 1.8.0.RC1.
Removed compiler warnings (obsolete @SuppressWarnings and obsolete code). Upgraded to Spring HATEOAS 0.11.0.
2014-05-01 20:23:58 +02:00
Oliver Gierke
02a3c08ee1 DATACMNS-489 - Support for Future<T> as return value wrapper for repository methods.
Added a converter to process a NullableWrapper into a Future by producing an AsyncResult. This is to support repository methods annotated with @Async and returning a Future<T>. With Spring's asynchronous method invocation support activated this will cause the repository method being executed asynchronously.

Note, that this currently only works on Spring 4 as Spring 3.2.8 async support is not discovering the introduction on the repository proxy and thus fails to discover the @Async annotation on the repository method. This will be resolved in Spring 3.2.9, see the related tickets.

Related tickets: DATACMNS-483, SPR-11725, DATACMNS-499.
2014-05-01 14:33:26 +02:00
Christoph Strobl
57271baf54 DATACMNS-496 - Version.parse(…) now drops non-numeric artifacts.
Version parsing failed when given version contained non-numeric parts (like 2.0.0-rc1). We now strip everything after the first non numeric part to create a logical version equivalent of the source String.

Original pull request: #81.
2014-04-29 16:02:10 +02:00
Oliver Gierke
ec49499e50 DATACMNS-492 - RepositoryConfigurationDelegate now expects an Environment.
Added a constructor to RepositoryConfigurationDelegate that takes an additional Environment instance to make sure we can equip ClasspathScanningCandidateComponentProviders with Environments to make sure they only find components matching the environment.

Retain the old constructor by defaulting to the Environment the ResourceLoader potentially contains or even a StandardEnvironment in worse cases. This is primarily to not break existing clients. Those should be upgraded to use the new constructor, of course.

Needed to add an additional guard in BeanDefinitionRegistrarSupport as Spring 3.2.8 fails to invoke EnvironmentAware (filed SPR-11744 for that). This should be removed once we upgrade to Spring 3.2.9.

Related pull request: #80.
Related tickets: DATACMNS-493, DATACMNS-494, SPR-11744.
2014-04-29 08:01:07 +02:00
Oliver Gierke
63e595b0af DATACMNS-491 - Polishing of null handling API in Sort.Order.
Fixed @since-tags, added author tags where appropriate, fixed copyright header in SortUnitTests. Removed unnecessary formatting line comments. Renamed nullHandlingHint to nullHandling inside Order. Changed builder method signatures to be consistent with with(…) methods defining the direction.

Fixed copy & paste test in SortUnitTests.

Original pull request: #79.
2014-04-28 11:34:34 +02:00
Thomas Darimont
f689b5d5f3 DATACMNS-491 - Add support for configuring null handling hints in Sort.Order.
Null handling hints can now be configured on Order as being either NATIVE (we let the data store decide how to order nulls), NULLS_FIRST or NULLS_LAST.

This is the foundation for custom null-handling in other data store support modules like SD JPA and SD MongoDB.

Original pull request: #79.
2014-04-28 11:34:26 +02:00
Oliver Gierke
248e314486 DATACMNS-483 - Added test case for recursive object wrapper resolution.
AbstractRepositoryMetadata now correctly resolves the domain type in case it's nested in multiple levels of wrapper types.
2014-04-22 17:47:41 +02:00
Oliver Gierke
c141fb771d DATACMNS-483 - Support for wrapper types as return types for repository methods.
The repository method invocation mechanism now post-processes the result of the actual method invocation in case it's not type-compatible with the return type of the invoked method and invokes a conversion if applicable. This allows us to register custom converters for well-known wrapper types. We currently support Optional from both Google Guava and JDK 8.

Implementation notice

We use some JDK 8 type stubs from the Spring Data Build project to be able to compile using JDKs < 8. This is necessary as we need to remain compatible with Spring 3.2.x for the Dijkstra release train and our test executions still run into some issues with it a Java 8 runtime (mostly ASM related). These issues were reported in [0, 1] and we'll probably get off the hack for Dijkstra GA by upgrading to Spring 3.2.9.

[0] https://jira.spring.io/browse/SPR-11719
[1] https://jira.spring.io/browse/SPR-11718
2014-04-22 14:20:54 +02:00
Oliver Gierke
165c0595e3 DATACMNS-485 - API improvements to in TypeInformationMapper area.
The default implementations of the TypeInformation Mapper interfaces now work with ClassTypeInformation where possible to express they only map raw types effectively.

Added TypeInformation.getRawTypeInformation() to easily turn whatever TypeInformation into the raw type representation. Changed ClassTypeInformation.from(…) to return ClassTypeInformations directly.
2014-04-15 07:49:46 +02:00
Oliver Gierke
64caad04a3 DATACMNS-485 - Fixed false negative type alias detection in MappingContextTypeInformationMapper.
MappingContextTypeInformationMapper now considers the raw type only for type alias conflict detection.
2014-04-15 07:49:38 +02:00
Oliver Gierke
e13fc294bb DATACMNS-486 - Added ParsingUtils helper class to easily transform camel case Strings.
Refactored XmlRepositoryConfigurationSource to use the newly introduced type.
2014-04-10 18:35:36 +02:00
Oliver Gierke
f52635da13 DATACMNS-485 - Fixed bug in ParameterizedTypeInformation.hashCode().
Previously, ParameterizedTypeInformation.hashCode() had been inconsistent to equals in case of a fully resolved parameterized type. This is now fixed by not including the parent reference in case a parameterized type is resolved completely.

Also, TypeDiscoverer.getActualType() does not return the component type for non-collection/non-maps anymore to make sure we don't accidentally unwrap parameterized types.
2014-04-02 09:59:44 +02:00
Dave Syer
389edd6748 DATACMNS-484 - Fix grammar in exception message of RepositoryFactorySupport.
Original pull request: #78.
2014-04-01 18:31:23 +02:00
Oliver Gierke
966a6248ec DATACMNS-450 - Prepare release 1.8.0.M1.
Updated pom.xml, readme and changelog.
2014-03-31 12:32:40 +02:00
Thomas Darimont
a30068c02d DATACMNS-482 - Added serialization support for Geospatial Types.
Added Serializable marker interface to Shape to make all geospatial types serializable. Changed equals implementation in GeoResults to use equals(…) instead of reference equality.

Original pull request: #77.
2014-03-31 11:42:03 +02:00
Oliver Gierke
9bd8e4db81 DATACMNS-480 - Added EntityInformation implementation based on PersistentEntity.
Related ticket: DATACMNS-476.
2014-03-27 18:40:58 +01:00
Oliver Gierke
5391547eac DATACMNS-478 - Allow build to be run on Java 8.
Introduced XmlUnit to make sure we can test XML rendering Java 6, 7 and 8.
2014-03-27 17:05:08 +01:00
Oliver Gierke
fa41724bfe DATACMNS-479 - Make sure Map types are not added to the mapping context.
Changed the algorithm for nested PersistentEntity detection to only use PersistentProperty.getPersistentEntityTypes(…) and make sure we return unwrap Maps and Collections inside the method correctly.
2014-03-27 12:24:28 +01:00
Oliver Gierke
f33f57b887 DATACMNS-477 - PageableHandlerMethodArgumentResolver now handles null default.
We now explicitly check for the configured default being null and subsequently return that value if we don't have both the page and the size parameter configured.
2014-03-26 18:15:16 +01:00
Oliver Gierke
de1e9ac684 DATACMNS-475 - Added configuration class to auto-register GeoModule.
Added a JavaConfig class to declare a Spring bean for the newly introduced GeoModule. 

@EnableSpringDataWebSupport automatically registers this config class in case Jackson is on the classpath. This comes in handy in combination with Spring Boot which auto-registers all global Module beans with all global ObjectMappers.
2014-03-21 14:28:19 +01:00
Thomas Darimont
b882d33d7b DATACMNS-474 - Allow conversion of Distance into other Metrics.
Added support for distance conversion via Distance.in(Metric).
2014-03-21 13:42:40 +01:00
Oliver Gierke
176be042c9 DATACMNS-475 - Added Jackson 2 module to (de)serialize new geo types.
Newly introduced GeoModule contains mixins for Distance, Point, Circle, Box and Polygon.
2014-03-21 13:36:15 +01:00
Oliver Gierke
877a74b8bc DATACMNS-471 - Added sample config files for PagedResourcesAssembler setup in XML.
Related issues: Spring HATEOAS - #161.
2014-03-19 14:30:35 +01:00
Oliver Gierke
cdc84e45c8 DATACMNS-470 - Removed code deprecated in version 1.6.
Removed support for Jackson 1 based repository populators in favor of Jackson 2 based ones. Removed PageableArgumentResolver in favor of PageableHandlerMethodArgumentResolver. Removed legacy setup code of the new HandlerMethodArgumentResolver implementations.
2014-03-19 13:17:58 +01:00
Oliver Gierke
e9bcca11be DATACMNS-365 - Enhanced auditing subsystem to work with accessor annotations.
Added a MappingAuditableBeanWrapperFactory to be able to use themapping metamodel to lookup annotations on persistent properties. This propagates into AuditingHandler and IsNewAwareAuditingHandler getting new constructors taking a MappingContext to set themselves up correctly. This will probably need store specific updates in the setup of the auditing infrastructure for namespace implementations and annotation based JavaConfig.

Introduced ….getPersistentProperty(Class<? extends Annotation> annotationType) on PersistentEntity to be able to access properties with a given annotation.

Updated SonarGraph architecture description and moved auditing related config classes into auditing.config package.
2014-03-18 19:56:45 +01:00