Commit Graph

367 Commits

Author SHA1 Message Date
Greg Turnquist
d65179ccc8 DATAREST-95 - Add support for PATCH to partially update entities.
Added general support for HTTP PATCH to partially update entities and amend property resources.
2014-02-14 13:08:13 +01:00
Oliver Gierke
c662065ef2 DATAREST-216 - Added integration test.
Forgot to commit integration test with 5dd33b.

Related pull request: #126.
2014-02-14 10:26:57 +01:00
Oliver Gierke
922827fe56 DATAREST-217 - Significant overhaul of HTTP method support detection.
Refactored the way the general support for an HTTP method for the resource exported. The decision is implemented in RootResourceInformation (formerly RepositoryRestRequest). Removed request specific information from that class and introduced a HandlerMethodArgumentResolver to be able to inject HttpMethod instance into controller methods (filed https://jira.springsource.org/browse/SPR-11425 to get that support into Spring Framework itself).

Generally moved away from throwing NoSuchMethodExceptions and correctly expose HttpRequestMethodNotSupportedException instead to make sure Spring MVC renders the appropriate allowed methods if possible.

Removed RepositoryInvokerHandlerMethodArgumentResolver as a RepositoryInvoker can be obtained from the RootResourceInformation where necessary.

Related pull request: #125.
2014-02-14 10:26:45 +01:00
Greg Turnquist
ef1ee10940 DATAREST-238 - Changed JSON deserializer to ignore links.
Links are a read-only and basically have to be ignored during any inputs. This required removing the deserializer from PersistentEntityJackson2Module. This will cause the object mapping to fail as it doesn't know about the links property in the request body. Instead of requiring that every entity apply the necessary annotation, the mapper is configured to not fail on non-existent attributes. This allowed all the tests to pass while properly handling PUT operations.

Original pull request: #130.
2014-02-13 12:23:57 +01:00
Oliver Gierke
5dd33ba7c0 DATAREST-216 - CrudRepositoryInvoker considers redeclared methods correctly.
CrudRepositoryInvoker now detects re-declared CRUD methods and falls back to reflection invocation if the re-declaration is detected.

Inspired by PR #126 by Nick Weedon but avoiding the introduction of a dependency to Spring Security by using a more precise testing approach.

Original pull request: #126.
2014-02-13 10:28:19 +01:00
Greg Turnquist
4508bc094a DATAREST-228 - Added Maven Enforcer plugin to ensure project is built with Java 7.
Original pull request: #131.
2014-02-12 16:29:11 +01:00
Oliver Gierke
13d90efbca DATAREST-246 - ValidatingRepositoryEntityListener now uses ObjectFactory<Repository>.
ValidatingRepositoryEntityListener previous referred to a Repositories instance which causes a circular reference on initialization after some changes in Spring Data Commons Repositories.

Major cleanups in the ValidatingRepositoryEntityListener implementation.
2014-02-12 16:03:59 +01:00
Greg Turnquist
6e817c440b DATAREST-50 - Added test case demonstrating this issue no longer exists.
Properties with null values properly get rendered in JSON outputs. This was fixed some time ago. Added test case to prove it.

Original pull request: #132.
2014-02-11 17:49:54 +01:00
Oliver Gierke
a5e7aebb65 DATAREST-226 - After release cleanups.
Upgraded to Spring Data snapshot dependencies. Added missing changelog entries.
2014-02-03 14:34:01 +01:00
Spring Buildmaster
84880ffe5e DATAREST-226 - Prepare next development iteration. 2014-01-29 06:40:33 -08:00
Spring Buildmaster
3a87ad8d49 DATAREST-226 - Release version 2.0.0.RC1. 2014-01-29 06:40:30 -08:00
Oliver Gierke
20a407d40c DATAREST-226 - Prepare 2.0 RC1 release.
Upgraded to Spring Data RC modules, Spring HATEOAS 0.9.0.RELEASE and Spring Plugin 1.0.0.RELEASE. Removed placeholder for Jackson 2 version as it's in the parent build pom now. Switched to milestone repository.
2014-01-29 15:35:46 +01:00
Oliver Gierke
04f733bdef DATAREST-226 - Added distribution module. 2014-01-28 15:19:27 +01:00
Oliver Gierke
b6a321494c DATAREST-226 - Moved reference documentation into correct location. 2014-01-28 15:05:23 +01:00
Oliver Gierke
bd8d3afa65 DATAREST-219 - Polishing.
Generally polished implementation and test cases for Greg's contribution.
Re-ordered parameters in ControllerUtils' helper methods for consistency.
Use Spring's CollectionFactory to create a suitable collection for the handled properties in the first place to avoid unnecessary conversion later on.

Removed duplication in test cases. Polished JavaDoc in UriListHttpMessageConverter and moved to a Scanner based implementation to read the request body. 

Adapted to latest changes in Spring HATEOAS. Reactivated ResourceStringUtilsTests.

Related pull requests: #128, #86.
2014-01-24 16:03:22 +01:00
Greg Turnquist
1f0b9bd664 DATAREST-219 - Make editing collection-based properties more efficient
This PR is inspired by #86, but had to be written from scratch because it was over 10 months old when this was undertaken. It was unmergeable.

Essentially, by casting existing collections and then iterating over them and making adjustments should render more efficient back end database operations. Only for a PUT should a new collection be created.

This PR not only updates these operations, but provides test cases to back up these edits, i.e. a test case for POSTing to a collection, PUTing to a collection, and DELETE-ing from a collection.

Adds ability to return an empty response with only the Location header populated by looking at the property update's incoming URL.

Original pull request: #128, #86.
2014-01-24 15:17:38 +01:00
Oliver Gierke
d59ec3bdd4 DATAREST-233 - Introduced @RepositoryRestResource.
@RepositoryRestResource exposes more detailed attributes tailored to the use case of exposing a repository. @RestResource is still recognized on repository interfaces but we now issue a warning and indicate the new annotation to be used.

Introduced a minimal ResourceDescription interface and let @Description be used within @RestResource and @RepositoryRestResource. We now generate default resource bundle keys and resolve them against a "rest-messages" resource bundle by default. JsonSchema converter now uses the rendered descriptions for schema descriptions.
2014-01-24 15:17:14 +01:00
Oliver Gierke
61d3d1c0bf DATAREST-31 - Improved link rendering for search resources.
If the search resource is capable of paging we now augment the link with pagination template variables.
2014-01-23 17:11:40 +01:00
Oliver Gierke
88b2f05edf DATAREST-229 - RepositoryEntityLinks now exposes templated links.
If the resource exposed for a domain or repository type is considered a paging resource we now return a templated URI. Introduced ResourceMapping.isPagingResource() to allow clients to find out about whether the resource is actually capable of pagination. Adapted implementations to inspect the findAll(…) method as well as the search methods for a Pageable parameter.

Tweaked pom.xml to create correct classpaths if the IDE uses direct workspace project references.
2014-01-23 17:11:34 +01:00
Oliver Gierke
5778ff9940 DATAREST-224 - Removed Gradle build files. 2014-01-20 13:49:11 +01:00
Oliver Gierke
9159339960 DATAREST-226 - Upgraded to Spring Data Neo4j 3.0 snapshots. 2014-01-20 13:48:47 +01:00
Oliver Gierke
f02000e619 DATAREST-224 - Introduce Maven POMs.
Adapted JpaWebTests to compile on Java6. Fixed some broken test case in Neo4jWebTests.
2014-01-20 10:18:44 +01:00
Oliver Gierke
5409bfd472 DATAREST-31 - Adapted to latest changes in Spring HATEOAS. 2014-01-19 20:11:11 +01:00
Oliver Gierke
4b6f0f620a DATAREST-31 - Search links are now rendered as link templates.
MethodResourceMapping now exposes the parameters a query method expects. The RepositorySearchController the uses these to append the 

Upgraded to Spring Data Commons 1.7.0.BUILD-SNAPSHOT.
2014-01-17 13:28:10 +01:00
Oliver Gierke
5ff6457911 DATAREST-222 - Path now quotes reference before matching.
We now actively quote the String reference to match a path against as it most likely is not a regular expression.
2014-01-17 13:22:04 +01:00
Oliver Gierke
a9f3ce5912 DATAREST-220 - Added contribution guidelines.
Linked to the actual contribution guidelines maintained in the Spring Data Build project.
2014-01-14 13:50:25 +01:00
Oliver Gierke
074c77cc3e DATAREST-107 - Polishing test cases.
Extracted DATAREST-107 specific test cases into separate test method.
2014-01-14 10:28:34 +01:00
Greg Turnquist
bc30b74cbe DATAREST-107 - Add tests to verify ambiguous mapping detection. 2014-01-14 10:28:00 +01:00
Phillip Webb
e7ce0e3f0b DATAREST-107 - Respect @RestResource exported flag on query methods.
ResourceMappings now only adds a RepositoryMethodResourceMapping if it's really exported.
2014-01-14 10:18:23 +01:00
Oliver Gierke
7c66a217be DATAREST-130 - Polished test implementation.
JavaDoc, formatting, simplified implementation.
2014-01-14 10:15:53 +01:00
Greg Turnquist
d32e69c1d3 DATAREST-130 - Added test case for DomainObjectMerger. 2014-01-14 10:12:07 +01:00
Oliver Gierke
4e5fa30282 DATAREST-130 - Code polish and JavaDoc. 2014-01-14 10:11:33 +01:00
Willie Wheeler
eafdc4771e DATAREST-130 - Support nulling out properties when doing HTTP PUTs. 2014-01-14 10:11:14 +01:00
Oliver Gierke
b3a03ea832 DATAREST-198 - Added test case accessing linked resources.
Added Author and Book domain types to JPA tests to show that following the referenced properties works.
2013-12-29 20:03:48 +01:00
Oliver Gierke
b2c9a5b1dc DATAREST-203 - Fixed listing of searches.
RepositorySearchController now returns a ResourceSupport instead of a Resource as it will only return links anyway. Latest changes in Spring HATEOAS prevent Resource from being used with collection based content to prevent invalid rendering.
2013-12-29 20:03:42 +01:00
Oliver Gierke
8c13ee3b7e DATAREST-203 - Added test cases to show POSTs are generally working.
Some polishing in PersistentEntityResourceArgumentResolver.
2013-12-28 18:04:46 +01:00
Oliver Gierke
c953e6f54d DATAREST-203 - Fixed accidentally broken RepositorySearchController.
Due to the change in the default media type, the RepositorySearchController was totally broken as it used "produces" clauses in the request mapping. I've removed them and added test cases to make sure the search resources are exposed and are accessible.
2013-12-28 16:06:31 +01:00
Oliver Gierke
f641398465 DATAREST-213 - Make sure legacy representation can be activated.
Altered the order of HttpMessageConvertersRegistered based on the default media type being defined. This causes the legacy representation to be rendered as default representation if the default media type on RepositoryRestConfiguration is set to something different from HAL.
2013-12-28 15:48:58 +01:00
Oliver Gierke
110af70de3 DATAREST-210 - Added workaround for SPR-11251.
We're now using @EnableHypermediaSupport via a delegated class to prevent @EnableHypermediaSupport from breaking when RepositoryRestMvcConfiguration is subclassed.
2013-12-20 20:01:17 +01:00
Oliver Gierke
5584040e92 DATAREST-93 - Removed Gradle wrapper script customizations. 2013-12-19 17:04:36 +01:00
Oliver Gierke
204d2870e7 DATAREST-209 - Removed hard dependency on Jackson Hibernate 4 module.
The build script now declares the Jackson Hibernate 4 as optional dependency to avoid being registered in a non-Hibernate environment. Tightened auto-registration checks to also check for Hibernate 4 presence at all.

We automatically activate verbose date rendering when registering the Joda Time module.
2013-12-19 16:31:46 +01:00
Oliver Gierke
af520871dc DATAREST-203, DATAREST-75 - Initial support for HAL.
This commit introduces support for HAL rendering and making it the default rendering option. The configuration now registers an additional MappingJackson2HttpMessageConverter with the according HAL modules registered and makes this the default JSON renderer if the default media type is configured to HAL (which it is by default). To change this, set RepositoryRestConfiguration.setDefaultMediaType(…) back to application/json.

Refactored the PersistentEntityJackson2Module to turn the PersistentEntityResource into it's correct shape (turning associations into links) and the delegate to the default rendering, so that the HAL customizations provided by Spring HATEOAS can kick in. Adapted test cases to the change in default representation format.


Upgraded to Jackson 2.3.0, Spring 3.2.6 and Spring HATEOAS 0.9.0.BUILD-SNAPSHOT. Upgraded to Gradle 1.10.
2013-12-19 16:31:29 +01:00
Oliver Gierke
44420d862c DATAREST-199 - Tweaked unmarshalling of JSON payloads.
The BeanWrapper used to set and get values of entities now gets a autowired ConversionService applied. Simplified collection and map creation by using Spring API. Added test case to update an entity with an embedded collection.
2013-12-05 07:43:11 +01:00
Oliver Gierke
0667e0bfb2 DATAREST-200 - Embedded associations get rendered again.
Removed too strong guard that prevented managed but not-exported types to be rendered at all.
2013-12-04 21:41:57 +01:00
Spring Buildmaster
73a2fd7430 DATAREST-193 - Prepare next development iteration. 2013-11-21 06:10:13 -08:00
Spring Buildmaster
8fe3452065 DATAREST-193 - Release version 2.0 M1. 2013-11-21 06:10:11 -08:00
Oliver Gierke
ac799cff43 DATAREST-193 - Prepare 2.0 M1 release.
Updated changelog. Upgraded to milestone dependencies of Codd.
2013-11-21 14:59:07 +01:00
Oliver Gierke
a9862eb7c5 DATAREST-185 - Upgraded Spring Data dependencies.
Upgraded to Spring Data Neo4j 3.0 and Spring Data Gemfire 1.4 snapshots.
2013-11-18 18:42:09 +01:00
Oliver Gierke
4ee1850a37 DATAREST-93 - Improvements after API updates in Spring Data Commons.
Switched to the usage of Simple(Property|Association)Handler to avoid having to use raw PersistentProperty instances.
2013-11-14 10:04:28 +00:00
Oliver Gierke
8f2e3eb4fe DATAREST-163 - Fixed rendering of embedded documents for MongoDB.
Removed the attempt to add a link to the response for non-associations. Switched to the usage of Simple(Property|Association)Handlers for simplified generics.
2013-11-14 10:04:28 +00:00