Commit Graph

379 Commits

Author SHA1 Message Date
Oliver Gierke
5346215d47 DATAREST-588 - Upgraded to Spring HATEOAS 0.18.0 to benefit from downstream fix. 2015-06-19 16:56:55 +02:00
Oliver Gierke
290c1886f0 DATAREST-577 - Excerpt projections are now configured automatically.
Excerpt projections defined in @RepositoryRestResource had to be discoverable (i.e. located in a sub-package of the domain type). RepositoryRestMvcConfiguration now uses an newly introduced constructor of ProjectionDefinitionConfiguration that automatically registers all projects in the given ResourceMappings.
2015-06-16 15:24:31 +02:00
Spring Buildmaster
42fc85afdc DATAREST-563 - Prepare next development iteration. 2015-06-02 01:58:14 -07:00
Spring Buildmaster
0604e7b876 DATAREST-563 - Release version 2.4.0 M1 (Gosling). 2015-06-02 01:58:12 -07:00
Oliver Gierke
e4277378a0 DATAREST-553 - Polishing.
Removed obsolete logger in RepositoryRestConfiguration. Removed obsolete Commons IO dependency from POM.

Original pull request: #178.
2015-06-01 13:38:34 +02:00
Greg Turnquist
07986acc54 DATAREST-553 - Removed RepositoryRestConfiguration.setBaseUri(…).
Updated existing unit tests to use setBasePath. Added extra assertion to setBasePath to guard against sending in a URI with a protocol.

Original pull request: #178.
2015-06-01 13:38:34 +02:00
Oliver Gierke
f2d8a996bc DATAREST-523 - Re-enabled POST for collection based association resources.
We now support augmenting elements of a collection resource by using POST which previously only worked with PATCH requests. Took the chance to clean up RepositoryPropertyReferenceController by quite a bit and refactor functionality to discover the supported HTTP methods for a PersistentProperty into RootResourceInformation.
2015-05-19 15:36:56 +02:00
Oliver Gierke
17305f4067 DATAREST-479 - Empty collections now render a dedicated _embedded property.
Instead of rendering an empty _embedded document for empty collections and pages we now explicitly trigger the creations of an EmbeddedWrapper for that empty, collection to preserve the collection's element type.

Tweaked ResourceProcessorHandlerMethodReturnValueHandler to invoke ResourceProcessor instances for those empty collections, too. PRHMRVH now checks the assignability of the raw resource type before analyzing the value type for a match.

RepositorySearchController now adds additional self links for the list of searches and a search execution.
2015-05-18 19:55:23 +02:00
Oliver Gierke
3537bbd20b DATAREST-518 - MappingResourceMetadata is now not exported by default. 2015-04-14 22:27:02 +02:00
Oliver Gierke
7c3b93fffd DATAREST-511 - Support for executing repository methods returning Optionals.
Added an UnwrappingRepositoryInvokerFactory that transparently unwraps JDK 8 and Guava Optionals to make sure the consuming code works with values or plain nulls correctly.
2015-04-13 08:38:44 +02:00
Oliver Gierke
c412bc3a76 DATAREST-514 - Fixed resource exposure for customized associations.
We no correctly handle the customized association path if @RestResource is used on an association. Took the chance to refactor the resource mapping subsystem quite significantly to improve the handling of property mappings. Those had been externalized before.
2015-04-10 16:08:51 +02:00
Oliver Gierke
1bb228df17 DATAREST-502 - Prepare request parameters to enable URI-to-entity resolution for executing searches.
RepositorySearchController now takes all request parameters as MultiValueMap to execute query methods. For parameters mapping to a managed resource we try to interpret the given parameter value as URI to actually trigger the URI-to-entity resolution through the newly registered UriToEntityConverter.

The latter is now registered with the default ConversionService registered so that it's

A lot of cleanups in RepositorySearchController. Removed some obsolete prints to the console to reduce log output during test execution.

Related ticket: DATACMNS-678.
2015-04-07 17:02:16 +02:00
Spring Buildmaster
829bbdd221 DATAREST-493 - Prepare next development iteration. 2015-03-23 05:36:59 -07:00
Spring Buildmaster
338047fd62 DATAREST-493 - Release version 2.3.0.RELEASE (Fowler GA). 2015-03-23 05:36:57 -07:00
Oliver Gierke
5486712b1b DATAREST-34 - Polishing.
Moved decision logic on whether to return response bodies int RepositoryRestConfig to ease testability of the controller. Added more unit tests and simplified the controller integration tests accordingly. Had to deactivate some Cassandra related tests as they don't seem to handle nulling of properties correctly.

Changed configuration to rely on the presence of the Accept header by default. Deprecated parameterless isReturnBodyFor…(…) methods in favor of the ones taking the Accept header to avoid the null checks on the calling side.

Polished JavaDoc for the isReturnBodyOn(Create|Update) methods. Polished formatting in RepositoryEntityController.

Original pull request: #167.
2015-03-20 08:50:47 +01:00
Jeremy Rickard
f3c74ac9db DATAREST-34 - PUT and POST request now consider Accept header by default.
By default, whether to return response bodies for PUT and POST is determined by the presence of an Accept header, unless explicitly activated or deactivated in RepositoryRestConfiguration.

Original pull request: #167.
2015-03-20 08:50:30 +01:00
Spring Buildmaster
7b53546236 DATAREST-487 - Prepare next development iteration. 2015-03-05 10:28:08 -08:00
Spring Buildmaster
c52b72047f DATAREST-487 - Release version 2.3.0.RC1. 2015-03-05 10:28:07 -08:00
Oliver Gierke
b1ef67211f DATAREST-487 - Dependency upgrades in preparation of the release.
Upgraded to Spring HATEOAS 0.17.0.RELEASE, Spring Plugin 1.2.0.RELEASE as well as Evo Inflector 1.2.1.
2015-03-05 11:22:29 +01:00
Oliver Gierke
def74e6618 DATAREST-354 - General rewrite of the JSONSchema support.
Significant overhaul of the JSONSchema support. This currently adds the following features:

- Complex nested types are exposed as descriptors with the properties pointing to them whenever necessary.
- Sets are treated as unique collections.
- Enums are handled as expected (enum values are listed).
- Renamings via @JsonProperty are considered.
- @JsonProperty(required = true) is considered and added to required properties.
- Date/time types (legacy Date, JSR-310, ThreeTenBP and Joda Time) are exposed with format "date-time".
- Objects with @JsonValue methods are considered to be rendered as String value.
- Formats and patterns can be manually configured on MetadataConfiguration.

TODOs:

- Implementation polish, JavaDoc
- Automatically inspect ObjectMapper to detect customizations made through Mixins and custom Serializers.
2015-03-05 10:13:47 +01:00
Oliver Gierke
8cbd952d88 DATAREST-483 - Upgrade to JSONPath 0.9.1 and Spring HATEOAS 0.17.0 snapshots. 2015-03-02 17:41:02 +01:00
Oliver Gierke
14cee9c94f DATAREST-467 - RepositoryEntityLinks now exposes methods to create links to search resources.
RepositoryEntityLinks now exposes methods to obtain links to all search resources and individual ones, including overloads to pre-expand Pageable and Sort parameters potentially contained in the method signature.

Search links now also contain a projection template variable if the type returned by the query method backing the search resource has projections registered.
2015-01-30 20:46:03 +01:00
Oliver Gierke
c3ffe7793b DATAREST-446 - Removed RepositoriesUtils in favor of RepositoryMetadata.
To be sure to pick up domain type lookup customizations we now consistently use RepositoryMetadata instead of trying to be clever and re-detecting it via RepositoriesUtils.
2015-01-16 13:15:38 +01:00
Oliver Gierke
8700c60cef DATAREST-445 - Fixed domain type lookup in RepositoryCollectionResourceMapping.
We now use the domain type provided by RepositoryMetadata instead of manually looking up to be sure to pick up customizations correctly.
2015-01-16 12:22:17 +01:00
Oliver Gierke
f09880ff16 DATAREST-437 - Moved to projections API of Spring Data Commons.
Related tickets: DATACMNS-630, DATACMNS-618.
2015-01-11 16:45:41 +01:00
Oliver Gierke
e39d624832 DATAREST-427 - Refactorings in UriToEntityConverter.
Instead of using a DomainClassConverter directly we now use a raw ConversionService in UriToEntityConverter. This allos us to get rid off the bean definitions for UriToEntityConverter and DomainClassConverter. The population of the ConversionService is now taken care of by calling SpringDataWebConfiguration's addFormatter(…) in defaultConversionService().

Added unit tests for UriToEntityConverter.
2015-01-05 13:55:07 +01:00
Oliver Gierke
55cf4cd9e0 DATAREST-429 - Improved handling of custom base paths.
Introduced a new property basePath on RepositoryRestConfiguration to allow a smooth migration to a new non-absolute base path configuration model to customize the URIs under which repository resources are exposed.

We're deprecating the current baseUri property as it previously supported absolute URIs. These are still supported but a warning is logged to ping users to move to the new base path based configuration.

We now use the base path to dynamically augment the mappings detected on our controllers with the path configured.
2015-01-03 16:32:16 +01:00
Oliver Gierke
7f990b006b DATAREST-388 - Improved annotation based event handling.
The annotation based event handling now relies on the type of the first method argument to determine the domain type the handler is interested in. Improved method invocation to not unnecessarily wrap exceptions thrown from them. Changed the test cases to throw a dedicated runtime exception to implicitly test that the 

Renamed LinkSaveEvent to LinkedEntityEvent as it's not only used for save-events for entities. Make use of Methods' USER_METHOD filter. Moved the class into the util package. Removed the UUID converter as Spring's DefaultFormattingConversionService provides it out of the box.

Added missing license headers and JavaDoc. Deprecated Class<?> attributes on handling annotations.

Related pull request: #151.
2014-12-04 20:25:20 +01:00
Oliver Gierke
e6a19a366d DATAREST-394, DATAREST-408 - Projections now consider collections and maps.
The ProjectingMethodInterceptor now inspects collections and maps to apply projections to collection elements and map values. Test cases inspired by a contribution of Saulo Medeiros de Araujo.

Related pull request: #152.
2014-12-01 19:05:48 +01:00
Spring Buildmaster
7f4c97bf0a DATAREST-418 - Prepare next development iteration. 2014-12-01 04:29:46 -08:00
Spring Buildmaster
aa30ac65ec DATAREST-418 - Release version 2.3.0.M1. 2014-12-01 04:29:44 -08:00
Oliver Gierke
afd1027d36 DATAREST-416 - Switched to IdentifierAccessor API where needed.
We now use the newly introduced IdentifierAccessor API to make sure we benefit from store specific optimizations when looking up identifier values.

Added some user class lookups to make sure the projection and resource mapping lookup works if proxies types are handed around.
2014-11-24 13:25:43 +01:00
Oliver Gierke
458cdfa7e8 DATAREST-409 - Port RepositoryInvoker API to Spring Data Commons.
Introduced SupportedHttpMethods abstraction to be able to test the exposure of HTTp methods based on a CrudMethods instance only. Moved ResourceType to the core module.
2014-11-14 16:49:31 +01:00
Oliver Gierke
8504a8837c DATAREST-384 - Fixed affordances and execution of sortable search resources.
Search resources are now considered sortable if they contain a Sort parameter. This is now reflected in MethodResourceMapping.isSortableResource().

Building on top of that, the RepositorySearchController now appends the sort template variable to links generated when listing search resources. It also now accepts resolved Sort instances to forward them to the query method execution. The controller now also uses DefaultedPageable so that request missing pagination information use the defaults configured for the PageableHandlerMethodArgumentResolver.
2014-10-15 13:30:53 +02:00
Oliver Gierke
0b5726ac41 DATAREST-385 - Projection definition configurations are now detected for super types.
Projections defined for a parent type are now also available for sub-types.
2014-10-15 11:56:39 +02:00
Spring Buildmaster
648a50a2c1 DATAREST-380 - Prepare next development iteration. 2014-09-05 03:56:17 -07:00
Spring Buildmaster
31b689a566 DATAREST-380 - Release version 2.2.0.RELEASE (Evans GA). 2014-09-05 03:56:15 -07:00
Oliver Gierke
e4942c74ff DATAREST-380 - Prepare 2.2.0.RELEASE (Evans GA). 2014-09-05 12:49:12 +02:00
Spring Buildmaster
78ec4a8771 DATAREST-374 - Prepare next development iteration. 2014-08-13 07:27:55 -07:00
Spring Buildmaster
37a5300e87 DATAREST-374 - Release version 2.2.0.RC1 (Evans RC1). 2014-08-13 07:27:52 -07:00
Oliver Gierke
2d64fb4d84 DATAREST-326 - Improved configuration setup for better Boot compatibility.
We now don't expose the PersistentEntityJackson2Module as bean anymore to prevent global registration in case of a Boot setup. The HttpMessageConverters registered are now TypeConstrainedMappingJackson2HttpMessageConverters so that they only get used of the object to marshal is of type ResourceSupport.
2014-07-25 16:33:07 +02:00
Oliver Gierke
07a8dd2ca6 DATAREST-319 - Adapt to changes in Spring Data Commons.
Fixed ReflectionRepositoryInvokerIntegrationTests after some CRUD method detection changes that invalidated the test cases.

Related ticket: DATACMNS-539.
2014-07-15 11:03:18 +02:00
Spring Buildmaster
9e1c607abb DATAREST-350 - Prepare next development iteration. 2014-07-10 20:35:04 +02:00
Spring Buildmaster
527d2391ce DATAREST-350 - Release version 2.2.0.M1. 2014-07-10 20:35:04 +02:00
Oliver Gierke
12d2b813cc DATAREST-350 - Upgraded to Spring HATEOAS 0.15.0.RELEASE. 2014-07-10 17:07:56 +02:00
Oliver Gierke
020de45c1b DATAREST-230 - Support for serving Alps documents.
This commit adds the support to expose additional resources that serve ALPS [0] resources to document the available state transitions and representations. The exposure is enabled by default and can be customized using the RepositoryRestConfiguration.metadataConfiguration() object.

Currently the set of descriptors exposed includes:

- A descriptor for the representation of the domain type. Linkable associations are represented as safe descriptors, ones that are not linked are semantic descriptors.
- Descriptors for each supported HTTP method for both the collection and item resources to indicate the ability to update, create, delete etc.
- Safe descriptors (e.g. to access the collection or item resource) get potentially available customizations (pagination, projections) attached through nested descriptors.

Documentation

An ALPS descriptor contains a doc attribute to carry semantic information for the end user or a potential client to display. The information can be described in two ways: the first one is the @Description annotation that captures the plain text information one wants to get listed. It is supported in @RepositoryRestResource, on query methods, projection interfaces and accessors etc.

The preferred approach however is to use a resource bundle rest-messages.properties. For each descriptor we will resolve a key starting with rest.description followed by a dot path into the resource. By default, doc attributes are only rendered if the resource bundle contains an entry for the relevant key. You can enforce displaying unresolved keys by configuring MetadataConfiguration.omitUnresolvableDescriptionKeys(…).

For representation descriptors and and the parameter list of query method descriptors we will display enum values by default as comma-separated list. The list is also available as message resolution argument, so that you can refer to the list in your description message via the {0} placeholder.

TODOs:

- Improve descriptors for associations (indicate ability to update etc.)

[0] ALPS - http://alps.io
2014-07-10 17:07:55 +02:00
Oliver Gierke
bffa378bc5 DATAREST-350 - Upgraded to Spring HATEOAS 0.15.0.BUILD-SNAPSHOT. 2014-07-08 21:08:10 +02:00
Oliver Gierke
65c95d9068 DATAREST-351 - Upgraded to Evo Inflector 1.2.
This is mainly to prevent users from running into Java 6 incompatibility as the Evo library was accidentally compiled requiring Java 7 compatibility in version 1.1.
2014-07-08 17:01:26 +02:00
Oliver Gierke
b9aef87e05 DATAREST-337 - Fix trailing whitespace in poms. 2014-07-08 14:05:24 +02:00
Oliver Gierke
ca2e88ae34 DATAREST-346 - Fixed invocation of overridden delete(…) methods.
We now defensively invoke the ConversionService prior to the reflective invocation of the delete method as we have to assume the clients providing the id value in a raw form, i.e. as obtained from the request and thus most likely as String.

Related ticket: DATAREST-335.
2014-07-02 13:26:03 +02:00