Commit Graph

1641 Commits

Author SHA1 Message Date
Oliver Gierke
5212d1389f DATAREST-976 - Polishing.
Extracted test for the newly supported sorting scenario so that we now.

Original pull request: #251.
2017-01-16 13:36:38 +01:00
Mark Paluch
69c39377ec DATAREST-976 - Embedded properties are now considered in sort property paths.
We now allow sorting by properties of embedded objects. An embedded object is not linkable to a root object but embedded in the resource itself. If any part of the sort property path points to a linkable association, the whole sort property path is discarded silently and not used for sorting any further.

Original pull request: #251.
2017-01-16 13:36:15 +01:00
Mark Paluch
ebe45bcf1f DATAREST-979 - Update project documentation with the CLA tool integration. 2017-01-13 11:56:23 +01:00
Mark Paluch
e2f88141ca DATAREST-978 - Polishing.
Convert @see http://… links to valid format using @see <a href=…>…</a>.
2017-01-13 10:09:53 +01:00
Mark Paluch
6bb989018c DATAREST-978 - Migrate ticket references in test code to Spring Framework style. 2017-01-13 10:09:53 +01:00
Oliver Gierke
992512cf96 DATAREST-932 - Updated changelog. 2016-12-21 19:35:37 +01:00
Oliver Gierke
0b2f685a82 DATAREST-862 - Updated changelog. 2016-12-21 18:46:44 +01:00
Oliver Gierke
4eea46aa09 DATAREST-899 - Prefer user registered modules over default ones.
We now issue the user registration of Jackson modules before any of the default modules Spring Data registers get applied. Testing module registration seems to be rather difficult as Jackson doesn't actually expose API to do so. An issue [0] was filed for Jackson to improve on this.

[0] https://github.com/FasterXML/jackson-databind/issues/1478
2016-12-20 12:53:19 +01:00
Oliver Gierke
8c1ee5608b DATAREST-964 - Removed deprecated configuration methods in RepositoryRestMvcConfiguration. 2016-12-20 12:10:43 +01:00
Oliver Gierke
bccb5fdcb8 DATAREST-962 - Fixed imports in Gemfire integration tests after move to Geode. 2016-12-16 11:01:39 +01:00
Oliver Gierke
c03653b7e9 DATAREST-959 - Polishing.
Skip all merge logic if the source value is null. That frees all nested logic from handling with that case and us falling back to plain Jackson reading.

The array handling now also opts out if the source value is not a collection or array in the first place as it means we need to let Jackson override the value with the collection given to be deserialized.

Original pull request: #246.
2016-12-13 10:09:02 +01:00
Milos Cubrilo
0b1bbbab31 DATAREST-959 - Fix adding elements to empty array in DomainObjectReader.
Original pull request: #246.
2016-12-13 10:09:00 +01:00
Oliver Gierke
83899bb42a DATAREST-793 - RepositoryRestConfiguration's setters return this consistently.
Adapted the return type of setter methods in RepositoryRestConfiguration to consistently return the current instance to allow call chaining.
2016-12-12 17:00:05 +01:00
Oliver Gierke
aa7eec4683 DATAREST-835 - Search resources returning a single resource now get and consider ETag and Last-Modified headers.
We now interpret If-None-Match and If-Modified-Since headers on requests to resources backed by query methods returning a single instance only. This allows clients to optimize GET requests to those resources to save bandwidth.
2016-12-08 21:35:37 +01:00
Oliver Gierke
42378ab34d DATAREST-957 - Polish most critical Sonar warnings.
Fixed broken equals(…) in ProjectionDefinition. Switched to iterating over Map's entry set instead of the keys. Made UriAwareHttpServletRequest static.
2016-12-08 10:12:31 +01:00
Oliver Gierke
c0df12d9fa DATAREST-956 - Polishing.
Some tiny refactorings in DomainObjectReader. We're now using TypeInformation instead of Class to preserve more generics information when it comes to deeper nesting.

Moved some code around in the unit tests.

Original pull request: #245.
2016-12-08 09:49:17 +01:00
Mathias Düsterhöft
667576c661 DATAREST-956 - Fixed handling of collection element addition and removal for PUT requests.
DomainObjectMerger now properly adds and removes elements to and from collections.

Original pull request: #245.
2016-12-08 09:48:20 +01:00
Oliver Gierke
6c99760621 DATAREST-953 - Added test case to verify this is fixed.
Seems the change for DATAREST-938 has also fixed this one. Added a test case similar to what was provided in the example for the original ticket.
2016-12-07 18:50:44 +01:00
Oliver Gierke
e7c4b2176e DATAREST-938 - Polishing.
Formatting and author.

Original pull request: #241.
2016-12-07 18:50:42 +01:00
Craig Andrews
b859b8b91f DATAREST-938 - Update nested entities instead of replacing them with new instances.
Original pull request: #241.
2016-12-07 18:50:38 +01:00
Oliver Gierke
a4f88fe1ac DATAREST-910 - Polishing.
Minor code reorganizations. Eagerly create SortTranslator to avoid repeated instantiation.

Original pull request: #232.
2016-12-06 12:00:39 +01:00
Mark Paluch
0dc97dcc56 DATAREST-910 - Support nested Sort properties.
We now support nested Sort properties considering Jackson mapping. Sort translation is optional and skipped if the domain class is not resolvable. Translation in the scope of a domain class maps property paths to apply sorting using embedded properties.

A sort string `nested-name` resolves to a property path `anotherWrap.embedded.name`.

class Aggregate {

	@JsonUnwrapped
	public UnwrapEmbedded anotherWrap;
}

class UnwrapEmbedded {

	@JsonUnwrapped(prefix = "nested-")
	public Embedded embedded;
}

class Embedded {
	public String name;
}

Original pull request: #232.
2016-12-06 12:00:38 +01:00
Mark Paluch
24d26943af DATAREST-910 - Adopt interfaces for Pageable and Sort method argument resolvers.
Original pull request: #232.
2016-12-06 12:00:38 +01:00
Oliver Gierke
7855613415 DATAREST-937 - Polishing.
Moved the newly added test case to the end of the list. Formatting.

Original pull request: #240.
2016-12-06 09:38:19 +01:00
Craig Andrews
4150688851 DATAREST-937 - Transient properties in JSON are now included in merge.
We now don't prematurely drop fields that don't have a persistent property exposed in DomainObjectReader. Doing so dropped values for transient fields as the latter are not exposed as persistent property in the first place. We still skip any nested merging though.

Original pull request: #240.
2016-12-06 09:38:19 +01:00
Ken Dombeck
603db869c0 DATAREST-951 - Fixed example in sample in reference documentation.
Original pull request: #244.
2016-12-06 08:32:54 +01:00
Oliver Gierke
21b7d7cbed DATAREST-925 - Polishing.
Original pull request: #238.
2016-12-02 20:17:08 +01:00
Craig Andrews
8149a02820 DATAREST-925 - Invoke ResourceProcessors for ProjectionResources.
The serializer for projection resources now also invokes ResourceProcessor instances registered for that particular projection.

Original pull request: #238.
2016-12-02 20:17:08 +01:00
Lukasz Kryger
80e9af743d DATAREST-960 - Fixed typos in reference documentation.
Fix typo "returnBodyOnupdate" -> "returnBodyOnUpdate".

Original pull request: #242.
2016-12-02 19:41:38 +01:00
Oliver Gierke
9fea1ab605 DATAREST-941 - Polishing.
Minor formatting in pom.xml of the HAL Browser module.
2016-11-30 18:25:57 +01:00
Greg Turnquist
015a8a331b DATAREST-941 - Modify existing browser.html
Instead of replacing the HAL Browser's browser.html, take the existing one and alter it inside the build job. This ensures that future updates don't break so horribly.

Related to https://github.com/mikekelly/hal-browser/pull/89 which will provide an explicit token to match, instead of using the closing `</body>` tag.
2016-11-30 18:25:57 +01:00
Oliver Gierke
78ca7a7895 DATAREST-934 - After release cleanups. 2016-11-23 10:59:11 +01:00
Oliver Gierke
03aa65890e DATAREST-934 - Prepare next development iteration. 2016-11-23 10:59:09 +01:00
Oliver Gierke
4e8771eee8 DATAREST-934 - Release version 3.0 M1 (Kay). 2016-11-23 10:35:48 +01:00
Oliver Gierke
3f408ba0fd DATAREST-934 - Prepare 3.0 M1 (Kay). 2016-11-23 10:35:08 +01:00
Oliver Gierke
aa3fa8da91 DATAREST-934 - Updated changelog. 2016-11-23 10:35:04 +01:00
Oliver Gierke
8327b6f4ab DATAREST-935 - Prepare 3.0 development.
Upgraded version numbers and dependencies to Spring Data build parent, Commons and store modules. Fixed a compiler issue in DomainObjectReader.
2016-11-18 16:13:54 +01:00
Oliver Gierke
f4705c8197 DATAREST-941 - Upgraded to latest version of the HAL Browser. 2016-11-17 00:03:35 +01:00
Oliver Gierke
63bc492140 DATAREST-915 - Updated changelog. 2016-11-03 18:56:47 +01:00
Oliver Gierke
8fd259dd32 DATAREST-906 - Polishing. 2016-11-03 16:28:33 +01:00
Oliver Gierke
7329e20fa8 DATAREST-919 - Merging of nested maps for PUT/PATCH requests now handles nested arrays and simple types. 2016-11-03 16:19:46 +01:00
Oliver Gierke
68d0a1aa6a DATAREST-931 - Polishing.
Switched to non-deprecated property naming strategy in test case.
2016-11-03 09:13:52 +01:00
Oliver Gierke
50d2678d01 DATAREST-931 - DomainObjectMerger now handles arrays with complex objects correctly.
We now explicitly manually merge array nodes that contain complex objects. Previously arrays would've been skipped and the subsequent Jackson update would wipe out all properties not contained in the original document even on PATCH requests.
2016-11-02 13:40:54 +01:00
Oliver Gierke
40bb8e8e6c DATAREST-573 - Polishing.
Removed RepositoryRestConfiguration.addCorsMapping(…) as we currently don't have any other shortcut methods for configuration like this.

Tweaked the setup of (now Repository)CorsConfigurationAccessor to be created earlier so that we avoid recreation for every lookup. Introduced a NoOpStringValueResolver to be used by default so that we don't need to deal with the case of the resolver being null at the end of the call chain. Replaced constructor of RepositoryCorsConfigurationAccessor with corresponding Lombok annotation.

Updated reference documentation accordingly.

Original pull request: #233.
2016-10-28 14:19:26 +02:00
Mark Paluch
a3870ca528 DATAREST-573 - Add support for new CORS configuration mechanisms introduced in Spring 4.2.
We now support CORS configuration mechanisms introduced in Spring 4.2. CORS can be configured on multiple levels: Repository interface, Repository REST controller and global level. Spring Data REST CORS configuration is isolated so Spring Web MVC'S CORS configuration does not apply to Spring Data REST resources.

 Multiple configuration sources are merged so different aspects of CORS can be configured in separate locations.

@CrossOrigin
interface PersonRepository extends CrudRepository<Person, Long> {}

@RepositoryRestController
@RequestMapping("/person")
public class PersonController {

	@CrossOrigin(maxAge = 3600)
	@RequestMapping(method = RequestMethod.GET, "/xml/{id}", produces = MediaType.APPLICATION_XML_VALUE)
	public Person retrieve(@PathVariable Long id) {
		// ...
	}
}

@Component
public class SpringDataRestCustomization extends RepositoryRestConfigurerAdapter {

  @Override
  public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {

    config.addCorsMapping("/person/**")
        .allowedOrigins("http://domain2.com")
        .allowedMethods("PUT", "DELETE")
        .allowedHeaders("header1", "header2", "header3")
        .exposedHeaders("header1", "header2")
        .allowCredentials(false).maxAge(3600);
  }
}
2016-10-28 14:19:26 +02:00
Oliver Gierke
19aa41926a DATAREST-929 - Polishing.
Some formatting.
2016-10-26 11:50:30 +02:00
Oliver Gierke
b4f99b83a0 DATAREST-929 - EnumTranslatingDeserializers now handles container types correctly.
When translating enumerations, we now inspect the property and use a container type's value type as translation target.
2016-10-26 11:50:27 +02:00
Oliver Gierke
a516d8e61f DATAREST-575 - Fixed property lookup in MappedProperties.
Previously, MappedProperties didn't handle Jackson properties correctly, that do not expose a PersistentProperty, e.g. transient ones. That led to potential nullPointerExceptions in clients as the guarding hasPersistentPropertyForField(…) still answered true, as the backing cache contained an entry with a null value. We now skip those properties completely.
2016-10-23 20:36:59 +02:00
Oliver Gierke
7bfe442691 DATAREST-903 - Updated changelog. 2016-09-29 14:42:09 +02:00
Oliver Gierke
f5ad5d23c2 DATAREST-913 - Updated changelog. 2016-09-29 11:42:09 +02:00