Commit Graph

1152 Commits

Author SHA1 Message Date
Oliver Gierke
e294fb5ef4 DATACMNS-908 - Introduced Order.withProperty(…).
The introduced method allows creating new Order instances for a different property ensuring all other aspects (ignore case, null handling) are retained.
2016-09-05 14:46:51 +02:00
Oliver Gierke
acf12423e0 DATACMNS-888 - Added dedicated Sort type to be able to express directions for revisions.
Introduced dedicated RevisionSort property that allows to define the sort order independent of the revision property to be used.

Introduced methods to find out whether a Sort is descending or ascending to avoid having to refer to the enum.
2016-09-01 19:48:23 +02:00
Mark Paluch
8bc022ebd7 DATACMNS-875 - Add support for exists projection in repository query derivation.
We now support exists projections in derived queries by parsing the exists keyword and expose it via PartTree.isExistsProjection().

Original pull request: #171.
2016-09-01 17:36:57 +02:00
Mark Paluch
2b14d1ea54 DATACMNS-899 - Fix recursion in ParameterizedTypeInformation.getMapValueType().
Previously, calls to ParameterizedTypeInformation.getMapValueType() caused an infinite recursion when invoked on a type information that was not a map type. This lead to a StackOverflowError.

We now call the super method doGetMapValueType() instead of calling the entry super method getMapValueType() and return by that null in case the map value type is not resolvable.

Original pull request: #176.
2016-09-01 17:28:10 +02:00
Mark Paluch
ac51b1671d DATACMNS-900 - Added equals(…) and hashCode() methods for ExampleMatcher utility classes.
We now provide equals(…) and hashCode() methods for GenericPropertyMatcher, PropertySpecifier and PropertySpecifiers so that they can be compared and used in sets.

Original pull request: #175.
2016-09-01 17:24:32 +02:00
Jasper Blues
b7f4709b7c DATACMNS-903 - Fix typo in reference documentation.
Original pull request: #170.
2016-08-29 16:31:41 +02:00
Oleksandr Mandryk
1d5273c048 DATACMNS-902 - Fix attribute name in example showing how to define a custom repository base class.
Original pull request: #173.
2016-08-29 16:21:16 +02:00
Kirill Gavrilov
eb2029310f DATACMNS-903 - Fix typo in reference documentation.
Original pull request: #174.
2016-08-29 16:16:31 +02:00
Oliver Gierke
4fa84fc983 DATACMNS-896 - Improved detection of type variable mappings in recursively nested generics.
If the same generic type was used on recursively nested generics declarations, like this:

class GenericType<T> {}

class Nested extends GenericType<String> {}

class Concrete extends GenericType<Nested> {}

our traversal of the generics discovered T bound to String in Nested and as that is extending GenericType as well, the T detected here is the same instance as the T within the map discovered for Concrete. As we previously added the nested types after we added the original entry, the nested discovery overwrote the more local one.

We now make sure the detected nested type variable mappings don't overwrite already existing ones.
2016-08-19 19:49:24 +02:00
Oliver Gierke
f75320f33c DATACMNS-891 - Repository bean definition registration now exposes repository type in metadata.
We now set an explicit attribute on the BeanDefinition created for every repository factory to allow BeanFactoryPostProcessors to inspect those.
2016-08-09 17:01:54 +02:00
Oliver Gierke
c6624be8a7 DATACMNS-838 - After release cleanups. 2016-07-27 14:32:37 +02:00
Oliver Gierke
eac6d7e9f2 DATACMNS-838 - Prepare next development iteration. 2016-07-27 14:32:33 +02:00
Oliver Gierke
856724f3aa DATACMNS-838 - Release version 1.13 M1 (Ingalls). 2016-07-27 13:52:12 +02:00
Oliver Gierke
c6391dc7f1 DATACMNS-838 - Prepare 1.13 M1 (Ingalls). 2016-07-27 13:51:37 +02:00
Oliver Gierke
f4b16298da DATACMNS-838 - Updated changelog. 2016-07-27 13:51:26 +02:00
Oliver Gierke
c23c7b9cc7 DATACMNS-885 - Fixed implementation of canRead(…) for projecting HttpMessageConverters.
Changed the implementation of both the JSON Path and XPath based projecting HttpMessageConverters to make sure the cached decisions don't depend on the media type. Reuse the evaluation of the media type in AbstractHttpMessageConverter.
2016-07-26 18:35:29 +02:00
Oliver Gierke
f53795d48e DATACMNS-880 - TransactionalRepositoryFactoryBeanSupport.setBeanFactory(…) now delegates to parent implementation.
Previously TransactionalRepositoryFactoryBeanSupport.setBeanFactory(…) didn't invoke the method of the super class preventing the BeanFactory to be propagated to the repository factory resulting in the ProjectionFactory implementation created being unaware of the BeanFactory and thus no bean references being available in projection interfaces.
2016-07-26 09:46:15 +02:00
Oliver Gierke
14eb1b946a DATACMNS-887 - Updated Sonargraph architecture description. 2016-07-25 19:40:56 +02:00
Oliver Gierke
37c895c04a DATACMNS-886 - Fix version ranges for Spring Framework in template.mf. 2016-07-25 19:28:54 +02:00
Oliver Gierke
e79c19d277 DATACMNS-885 - Added XML support for incoming projections based on XMLBeam.
Added an XML flavor of the support added in previous commits based on XML Beam [0].

[0] http://www.xmlbeam.org.
2016-07-25 18:23:53 +02:00
Oliver Gierke
762a12b4a2 DATACMNS-885 - Workaround for bug in Jayway's JSONPath array access.
When a recursive decent operator is used in a JSON Path expression there's no way to get out of the array mode again to indicate one is interested in a particular element (e.g. "the first one no matter where in the document") [0]. We now work around this by always letting the parser return lists, so that the mapping library finally kicking in can be equipped with the correct target type to create.

Unfortunately this causes arrays to be double-wrapped for definite paths so that we basically have to adapt the type handed to Jackson in another round to the unwrap the mapping result in turn [1].

[0] https://github.com/jayway/JsonPath/issues/248
[1] https://github.com/jayway/JsonPath/issues/249
2016-07-25 17:26:37 +02:00
Oliver Gierke
eec2b43fd0 DATACMNS-885 - Support for binding JSON payloads to projection interfaces.
Projection types annotated with @ProjectedPayload can now be used as parameters for @RequestBody annotated Spring MVC controller method parameters.

Accessor methods will be translated into JSON path property expressions which can be customized by using the @JsonPath annotation. The methods are allowed to return simple types, nested projection interfaces or complex classes which will will be mapped using a Jackson ObjectMapper.
2016-07-25 17:26:32 +02:00
Oliver Gierke
86c1086976 DATACMNS-884 - Polishing.
Renamed PageableExecutionSupport to …Utils as …Support classes are usually empty adapter classes for interfaces and meant to be extended.
2016-07-19 15:08:24 +02:00
Mark Paluch
29c86d74b3 DATACMNS-884 - Move PageableExecutionSupport from JPA to Spring Data Commons.
PageableExecutionSupport assumes that data queries are cheaper than count queries so we can apply some optimizations. We determine the total from the pageable and the results in which we don't hit the page size bounds (i.e. results are less than a full page without offset or results are greater 0 and less than a full page with offset). In all other cases we issue an additional count query.
2016-07-19 15:08:24 +02:00
Oliver Gierke
f2a6d63dbb DATACMNS-883 - Improved collection path binding for Querydsl-backed web requests.
Improved the dot-path translation of existing Querydsl Path instances by not relying on the toString() representation of the metadata but manually traversing the elements up to the root. Extracted the translation method into QueryDslUtils.

Furthermore, we now automatically insert an CollectionPathBase.any() step for Path instances of that type when reifying the paths from request attributes.
2016-07-15 11:39:43 +02:00
Oliver Gierke
8599ecf019 DATACMNS-879 - Polishing.
Some cleanups in ExampleMatcherAccessor.
2016-07-14 21:03:10 +02:00
Oliver Gierke
d41a9cb5c5 DATACMNS-879 - ExampleMatcher now allows to define whether all or any match should be used.
Introduced dedicated factory methods for ExampleMatcher so that it exposes whether the predicates built from Example instances have to be fulfilled all or if it's sufficient that any of them matches.
2016-07-14 08:54:56 +02:00
Mark Paluch
20653a7ebc DATACMNS-874 - Fix Scala Option unwrapping.
We now correctly unwrap empty Scala Options so the unwrapping no longer fails.

Original pull request: #165.
2016-06-28 14:31:34 +02:00
Oliver Gierke
c787073357 DATACMNS-839 - Updated changelog. 2016-06-15 14:31:48 +02:00
Pascal Grün
ce2e788374 DATACMNS-869 - Fix Javadoc for parametric types of Pair.
Original pull request: #164.
2016-06-11 18:21:20 +02:00
John Blum
1d880f2e08 DATACMNS-868 - Assert JDK 6 compatibility in ResultProcessor.
Turned the previously anonymous inner class that applies result processing to a JDK 8 Stream into a dedicated inner class to avoid JDK types being loaded on older JDKs. The previous way was causing issues due to the JVM trying to resolve the Function interface when loading the ResultProcessor class.

Original pull request: #163.
2016-06-09 09:13:16 +02:00
Oliver Gierke
d4c0aa70ba DATACMNS-866 - Improved error message in invalid invocations of BasicPersistentEntity.getPropertyAccessor(…).
We now explicitly report the given object's type and the one expected in case of a mismatch when BasicPersistentEntity.getPropertyAccessor(…) is invoked.
2016-06-08 16:10:25 +02:00
Oliver Gierke
241d18a212 DATACMNS-863 - Fixed parameter type lookup for wrapper types.
When repository parameters use wrapper types (e.g. Optional) the Parameter instance for that parameter now returns the component type.
2016-06-04 14:35:39 +02:00
Oliver Gierke
65bfd5b33a DATACMNS-743 - Optimizations in TypeDiscoverer getProperty(…) in case if invalid property names.
We now also cache a failed property lookup so that we can return null on a subsequent call for the same invalid property name right away and don't have to reattempt the lookup unnecessarily.
2016-06-01 18:38:58 +02:00
Oliver Gierke
e414cd6801 DATACMNS-862 - ReturnedInterface now considers interfaces implemented by the domain type.
We now check whether the interface return type is implemented by the domain type and opt out of all projection efforts if so.
2016-06-01 17:50:08 +02:00
Oliver Gierke
5b5daaf397 DATACMNS-831 - Polishing.
Formatting. Fixed copyright header and author. Added missing assertions in AbstractMappingContext.addPersistentEntity(…).

Original pull request: #157.
2016-05-31 18:52:36 +02:00
Mikael Klamra
046f0408d1 DATACMNS-831 - AbstractMappingContext.addPersistentEntity(…) now acquires necessary read lock.
The lookup for already available PersistentEntity instances now acquires a read lock to shield the execution from partially equipped PersistentEntity instances currently in creation from another thread.

Original pull request: #157.
2016-05-31 18:50:59 +02:00
Oliver Gierke
1bedfe4f4a DATACMNS-856, DATACMNS-685 - Made ToEntityConverter.matches(…) less offensive.
ToEntityConverter.matches(…) now doesn't throw an exception anymore as it might be picked up by classpath scanning an the exception previously thrown causing the entire conversion attempt to abort.

We're now rather inspecting the ToEntityConverter in case the target type is a repository managed one and the ToIdConverter otherwise.
2016-05-31 18:10:39 +02:00
Oliver Gierke
bdc61a044f DATACMNS-859, DATACMNS-860 - Improvements to ResourceProcessor.
ResourceProcessor supports Streams now and adds a map(…) step to apply projections.

Also, the ProjectingConverter falls back to use a default ConversionService instance to make use of the object mapping functionality implemented in ObjectToObjectConverter, i.e. the ability to just map an object returned from the store to a DTO in case that latter exposes a constructor or factory methods taking the source instance as parameter.

Related tickets: DATAJPA-903.
2016-05-25 15:04:29 +02:00
Oliver Gierke
3a36ed55dd DATACMNS-854 - Polishing.
Simplified conditional expressions in DefaultRepositoryInformation. Reordered test method to reflect natural order of adding.

Original pull request: #162.
2016-05-24 19:05:37 +02:00
Terje Strand
e0fc7deb05 DATACMNS-854 - Allow custom implementation of repository methods with generics.
Add additional check for detecting customized method where method contains generics. Overriding methods without generics already works, this patch simply makes the behavior consistent.

Original pull request: #162.
2016-05-24 19:05:31 +02:00
Oliver Gierke
87566df432 DATACMNS-858 - Polishing.
Some JavaDoc and formatting.
2016-05-21 12:02:19 +02:00
Oliver Gierke
c51f55346f DATACMNS-858 - Fixed JavaDoc for CrudMethods.getDeleteMethod().
We're now correctly stating that we're preferring the delete method that takes the entity as argument over the one taking the id to match what's actually implemented.
2016-05-21 12:01:59 +02:00
Oliver Gierke
fa7ab50c5f DATACMNS-855 - Fixed generic type lookup in SyntheticParamterizedType.
The translation of the list of actual type parameters into an array now uses the loop index correctly. Previously, it always used the first type parameter.
2016-05-13 11:32:31 +02:00
Oliver Gierke
9db6278e77 DATACMNS-855 - Prevent memory leak in SyntheticParameterizedType.
Added proper equals(…) and hashCode() methods to SyntheticParameterizedType to make sure instances created for the same type information and type parameters are considered equal.
2016-05-12 16:48:01 +02:00
Oliver Gierke
f29cbf5752 DATACMNS-853 - Polishing.
Simplified test case. Formatting in ClassGeneratingPropertyAccessorFactory.

Related tickets: DATACMNS-809.
Original pull request: #161.
Related pull request: #160.
2016-05-12 15:45:05 +02:00
Mark Paluch
db5259292c DATACMNS-853 - Support interface entity types using generated property accessors.
Property accessors (getter and setter) defined on an interface require a different instruction opcode for invoking methods. We now distinguish whether a property accessor is defined on an interface and use either INVOKEINTERFACE or INVOKEVIRTUAL otherwise.

Related tickets: DATACMNS-809.
Original pull request: #161.
Related pull request: #160.
2016-05-12 15:31:09 +02:00
John Blum
08e8f15845 DATACMNS-853 - Added test case reproducing the issue.
Reproduce issue accessing persistent properties from interface-based entities using the ClassGeneratingPropertyAccessorFactory.

Related tickets: DATACMNS-809.
Original pull request: #161.
Related pull request: #160.
2016-05-12 15:31:09 +02:00
Oliver Gierke
38a41139fc DATACMNS-809 - Polishing.
Removed DefaultPersistentPropertyAccessorFactory as it only delegates to the class generating one. Tweaked AbstractMappingContext to actually use the latter in the first place. Introduced BeanWrapperPropertyAccessorFactory to implement the default behavior of using a BeanWrapper and initialize BasicPersistentEntity to avoid a null clause in getPersistentPropertyAccessor(…).

Removed getPersistentPropertyAccessorFactory and rather rely on ReflectionTestUtils in tests to avoid additional API being exposed.

Original pull request: #159.
2016-05-03 16:47:54 +02:00
Mark Paluch
defc3c7874 DATACMNS-809 - Refactor BasicPersistentEntity to set PersistentPropertyAccessorFactory.
PersistentPropertyAccessorFactory can be set on a BasicPersistentEntity. This is done by AbstractMappingContext once the entity is verified. This change reduces the count of PersistentPropertyAccessorFactory instances and performs the isSupported check only once, when initializing the entity.

Original pull request: #159.
2016-05-03 16:47:54 +02:00