Commit Graph

541 Commits

Author SHA1 Message Date
Oliver Drotbohm
dc10166679 DATAREST-1304 - EntityLookupConfiguration is now used in PUT for creation.
Previously the backend identifier derived from the URI was set as identifier on the object to be created in a PUT request. However, in case a custom entity lookup is used, this is not the identifier but an arbitrary property pointed to through user defined code, mostly a method reference.

We now use the newly introduced MethodInvocationRecorder API in Spring Data Commons to be able to obtain the property that is supposed to be used and set that to the value calculated. This requires the entity type for which the custom lookup is configured to be non-final as the invocation recording is build on top of proxies.

Related tickets: DATACMNS-1449.
2019-03-06 14:34:58 +01:00
Jeroen Reijn
6d0acfd997 DATAREST-1143 - Prefer ResourceNotFoundException over ResponseEntity.notFound().
This is to allow users to plug in custom exception handling to control these situations.

Original pull request: #284.
2019-03-05 15:46:05 +01:00
Oliver Drotbohm
017b69c4e1 DATAREST-1338 - JsonPatch handling is now able to traverse maps.
We're now able to correctly identify Map keys within JsonPatch paths so that e.g. people/Dave/name properly translates into a people['Dave'].name SpEL expression.

Streamlined the design of SpelPath to avoid duplicate parsing and properly express the difference between typed and untyped paths in the type hierarchy. Slightly refactored the type hierarchy so that only methods that make sense in either untyped or typed state appear on the instance returned (getLeafType(Class) was exposed on TypedSpelPath before, which was confusing).
2019-03-05 13:54:58 +01:00
Oliver Drotbohm
d714d10675 DATAREST-1341 - Upgrade to latest API changes in Spring HATEOAS. 2019-03-04 11:42:58 +01:00
Oliver Drotbohm
1bf08180db DATAREST-1341 - Adapt to package refactorings in Spring HATEOAS. 2019-02-27 20:31:59 +01:00
Oliver Drotbohm
85694576b2 DATAREST-1341 - Adapt RepositoryLinkBuilder to API changes in Spring HATEOAS.
Removed obsolete BaseUriLinkBuilder as well.
2019-02-22 18:33:50 +01:00
Oliver Drotbohm
554d6cb27b DATAREST-1341 - Further API adaption for Spring HATEOAS 1.0. 2019-02-15 11:10:59 +01:00
Oliver Drotbohm
93b8e68bbf DATAREST-1341 - Move off of Java8PluginRegistry in favor of Spring Plugin's update one. 2019-02-07 20:55:42 +01:00
Greg Turnquist
af6f55a92c DATAREST-1341 - Upgrade to Spring HATEOAS 1.0. 2019-02-07 20:55:42 +01:00
Oliver Drotbohm
a05d6a2a90 DATAREST-1332 - Polishing. 2019-02-07 20:55:42 +01:00
Oliver Drotbohm
e4c1625447 DATAREST-1332 - Fixed regression in CORS request handling.
The lookup of the RequestMappingInfo in exposeEffectiveLookupPathKey(…) yields null for CORS preflight requests to resources that do not support OPTIONAL explicitly. We now guard against that to avoid a subsequent NullPointerException.
2019-02-07 20:55:42 +01:00
Oliver Drotbohm
fa9b31c9af DATAREST-1321 - Lookup types can now produce non-String reference values.
Previously we assumed lookup types to always result in String based values. We now loosen that constraint to also allow other scalar types, mostly targeting numeric types like long and integer.
2019-01-08 11:47:45 +01:00
Mark Paluch
68bfd55982 DATAREST-1330 - Update copyright years to 2019. 2019-01-08 11:47:37 +01:00
Oliver Drotbohm
13370f8e2f DATAREST-1322 - Fix proxy detection for Hibernate 5+ compatibility.
Switched to Spring Data Commons' ProxyUtils for a proxy detection mechanism that supports Hibernate 5 proxies.
2018-12-20 17:16:49 +01:00
Oliver Gierke
33c156dae0 DATAREST-1294 - Polishing.
Aligned with general request attribute naming conventions and prefixed the one we now use with the class' name. Altered the local attribute name to EFFECTIVE_REPOSITORY_RESOURCE_LOOKUP_PATH.

Renamed the constant holding the name from …_KEY to …_ATTRIBUTE.
2018-10-18 15:58:31 +02:00
Oliver Gierke
3f0eb17dcf DATAREST-1294 - Expose effective repository lookup path as request attribute.
We now expose a partially resolved PathPattern to contain the explicit repository base path so that the subpaths can be grouped around the individual repositories exposed.

Related ticket: spring-projects/spring-boot#14872
2018-10-18 12:17:12 +02:00
Oliver Gierke
88b73de3b7 DATAREST-1274 - JsonPatch paths now properly verify multi-digit indexes. 2018-08-08 08:44:43 +02:00
Oliver Gierke
5635479dd1 DATAREST-1248 - SortTranslator now considers read-only properties sortable.
MappedProperties now exposes a factory method that uses the Jackson introspector for serialization (instead of deserialization) which now also includes read-only properties. Previously, read-only ones were not considered as they are excluded from the metadata if it is looked up for deserialization.
2018-08-07 15:43:50 +02:00
Oliver Gierke
501ddda59f DATAREST-1273 - Properly support adding to collections via indexes in JsonPatch expressions.
We now support adding a to a collection via JsonPatch expressions by using the collection's size as target index. Contrary to paths pointing to existing collection elements we cannot determine the type of the object to be created. Thus, we fall back to the common element type of all existing collection elements. We also reject indexes pointing to elements with an index greater than the current collection's size.
2018-08-07 10:47:41 +02:00
Oliver Gierke
429706a77e DATAREST-1260 - Tweaked DomainObjectReader to support immutable entities.
DomainObjectReader now aborts the recursive merges in case it encounters an entity that's described as @Immutable (just introduced in Spring Data Commons).

Fixed some generics and removed DomainObjectMerger as it's unused.

Related ticket: DATACMNS-1322.
2018-07-12 10:30:54 +02:00
Oliver Gierke
c644eb979f DATAREST-1259 - Removed obsolete bean definition for HttpRequestHandlerAdapter. 2018-07-10 12:33:28 +02:00
Florian Lüdiger
10dedaefa3 DATAREST-810 - Fix minor typo in Javadoc.
Original pull request: #295.
2018-07-04 16:34:58 +02:00
Oliver Gierke
6ee2b1374a DATAREST-1256 - Upgraded to Spring HATEOAS 0.25.0.BUILD-SNAPSHOT.
Adapted RepositoryRestMvcConfiguration to now create a shared fallback ObjectMapper and avoid to register it as Spring Bean. Adapted test cases that previously were relying on such a bean being present.

Adapted test cases to verify on the correct ALPS document structure (see spring-projects/spring-hateoas#665).
2018-06-20 20:01:57 +02:00
Oliver Gierke
9f3443cde9 DATAREST-1251 - PersistentEntityProjector now uses lambdas instead of anonymous inner classes. 2018-06-13 14:44:10 +02:00
Oliver Gierke
7323b950b6 DATAREST-1198 - Polishing.
Fixed @since tag in new converter implementation as we're going to backport the fix to Kay. Simplified converter setup in RepositoryRestMvcConfiguration to expose less API until someone actually requests access.

Original pull request: #290.
2018-06-13 10:14:44 +02:00
Mark Paluch
65ad7cd3e1 DATAREST-1198 - Add Converter to convert String to javax.naming.ldap.LdapName.
We now provide and configure a converter for String to LdapName conversion so Spring Data LDAP can be used with Spring Data REST without further configuration.

Original pull request: #290.
2018-06-13 10:14:44 +02:00
Oliver Gierke
843540b746 DATAREST-1250 - Polishing.
Added unit test to verify new behavior and prevent regressions. Fixed author capitalization.
2018-06-05 10:11:37 +02:00
tigger
0cc1f22741 DATAREST-296 - ResourceMetadataHandlerMethodArgumentResolver now properly implements ….supports(…).
ResourceMetadataHandlerMethodArgumentResolver.supports(…) now properly checks for ResourceMetadata. It previously checked for RepositoryInformation which is probably a left-over from a previous state of the codebase and has been unnoticed so far as the class is only used as a direct dependency of other HandlerMethodArgumentResolvers.
2018-06-05 10:04:08 +02:00
Oliver Gierke
17c8c7ee2c DATAREST-1249 - Polishing. 2018-05-30 11:04:37 +02:00
Oliver Gierke
b61cb9ab28 DATAREST-1249 - DomainObjectMerger now properly binds to uninitialized target collections. 2018-05-30 10:40:34 +02:00
Oliver Gierke
a1454058d9 DATAREST-948 - Introduced ExposureConfiguration to allow customizing the exposure of HTTP methods of repositories.
ExposureConfiguration exposes methods to register AggregateResourceHttpMethodsFilter and AssociationResourceHttpMethodsFilter (both applied by type or globally) to customize the supported HTTP methods by collection, item and association resources. It also provides shortcuts for common use cases like disabling PUT for item resources etc.
2018-05-30 10:40:28 +02:00
Oliver Gierke
7eaf50d997 DATAREST-1222 - Switched to SimpleEvaluationContext for SpEL-based PATCH handling. 2018-03-28 09:56:50 +02:00
Oliver Gierke
e79b73664a DATAREST-1212 - Deprecated RepositoryRestConfigurerAdapter.
We now recommend to implement RepositoryRestConfigurer directly as its declared methods are now default methods. We also introduced a static factory method to easily create a configurer to customize RepositoryRestConfiguration via a Lambda expression.

Moved test case setups that use that deprecated API to the new one.
2018-03-12 13:21:14 +01:00
Oliver Gierke
622cf07720 DATAREST-1193 - DelegatingHandlerMapping is now a MatchableHandlerMapping.
DelegatingHandlerMapping now implements MatchableHandlerMapping by selecting the a delegate based on the already implemented algorithm and then invoking the ….match(…) method in case the selected one is a MatchableHandlerMapping in turn.

Refactored the internals a bit to be able to reuse the selection algorithm from both ….getHandler(…) and ….match(…).
2018-02-19 18:04:25 +01:00
Oliver Gierke
a10aa934b7 DATAREST-1176 - Repository method exposure can now be controlled via RepositoryRestConfiguration.
The default exposure of repository methods is now controlled via RepositoryRestConfiguration.setExposeRepositoryMethodsByDefault(…). That allows us to remove the additional API from RepositoryDetectionStrategy as the mere detection is an orthogonal topic.

Also added RepositoryRestConfiguration.disableDefaultExposure() to set the RepositoryDetectionStategy to ANNOTATED and disables default method exposure in one go. That can be exposed via a Spring Boot configuration property downstream.
2018-01-18 18:41:07 +01:00
Simon Allegraud
d4a3ba1195 DATAREST-1181 - Prevent NullPointerException during JsonLateObjectEvaluator.evaluate(…).
Original pull request: #287.
2018-01-18 13:49:53 +01:00
Oliver Gierke
7edfc75472 DATAREST-1174 - Enable constructor properties to make sure WrappedPropertiesUnitTests continue to work.
Removed Lombok constructor and accessor generation to avoid having to deal with the changed default in Lombok 1.16.20 not generating @ConstructorProperties by default anymore.
2018-01-10 12:51:29 +01:00
Mark Paluch
5d9dbf1823 DATAREST-1170 - Update copyright years to 2018. 2018-01-09 08:44:14 +01:00
Oliver Gierke
d3c5e339db DATAREST-1160 - Adapt tests to new CORS defaults in Spring Framework.
Spring Framework 5.0.2 changes the default for the Allow-Credentials header to false. We now adapted our test case to that and also drop the expectation to see the request URL in the Allow-Origin header as that is only returned if Allow-Credentials is true, which it now isn't by default.
2017-11-27 09:57:30 +01:00
Oliver Gierke
d48499ad8d DATAREST-1152 - Overhaul of patch expression handling.
Significantly refactored the way that patch path expressions are handled and evaluated. The new design is centered around SpelPath that is aware of the original path as well as the derived SpEL expression. That SpelPath then requires clients to bind it to a type so that the original path can be validated (and rejected if invalid) and provide API to read, set, copy and move values backed by the original path. Both SpelPath and TypedSpelPath instances are cached to avoid repeated creation.

PatchOperation implementations now provide more fluent factory methods, in some cases via intermediate builders. Removed a lot of obsolete code that created JsonNodes from a list of PatchOperations as we don't actually use that functionality anywhere. Removed obsolete generics where possible.
2017-10-25 17:34:46 +02:00
Simmo Saan
74e12a55b7 DATAREST-1148 - Fix eager toString() call on domain object in ResourceStatus.
Originl pull request: #282.
2017-10-12 23:12:34 +02:00
Oliver Gierke
33c551014d DATAREST-1006 - Polishing.
Added unit test on MappingProperties directly.

Original pull request: #258.
2017-10-04 11:37:02 +02:00
Mathias Düsterhöft
4207be4243 DATAREST-1006 - MappedProperties now skips all ignored properties.
Original pull request: #258.
2017-10-04 11:36:54 +02:00
Oliver Gierke
973f932a39 DATAREST-1137 - All patch operations now verify path expressions.
We now make sure that all patch operations now get the path they're supposed to be applied to verified before execution.
2017-09-27 09:47:18 +02:00
Oliver Gierke
d56a1068ea DATAREST-1132 - Fixed @BasePathAwareController annotation lookup from CGLib proxies.
We now inspect the user class of the given bean type in BasePathAwareHandlerMapping.isHandler(…). We can't use AnnotationUtils as @RepositoryRestController is also annotated with @BasePathAwareController but must not be handled by this mapping.
2017-09-25 11:54:05 +02:00
Oliver Gierke
c0a3fb5678 DATAREST-1136 - DelegatingHandlerMapping now exposes its delegates. 2017-09-25 09:34:33 +02:00
Oliver Gierke
8f269e28fe DATAREST-1127 - Patch operations now always verify paths before operation application.
Previously the SpEL expresssion created from JSON Patch path expressions were executed without double checking whether these paths actually exist on the target object in the first place. This is now in place.
2017-09-08 12:20:44 +02:00
Oliver Gierke
530e7c773e DATAREST-1121 - Skip last modified detection for query methods that project.
For an execution of a projecting query method we now skip the last modified detection as it actually doesn't make sense if applied to non-aggregates.
2017-08-24 22:19:18 +02:00
Oliver Gierke
5836baaabf DATAREST-1105 - Polishing.
Simplified code a bit. Formatting. Adapted integration tests to make sure URI templates are always expanded.

Original pull request: #273.
2017-07-19 16:05:27 +02:00
Haroun Pacquee
0d7d84571f DATAREST-1105 - Association links now advertise projections.
Association links now explicitly indicate projections are available in case there are projection types registered for the association target type.

Original pull request: #273.
2017-07-13 17:24:43 +02:00