DATAREST-1341 - Adapt to package refactorings in Spring HATEOAS.

This commit is contained in:
Oliver Drotbohm
2019-02-27 12:59:45 +01:00
parent 85694576b2
commit 1bf08180db
69 changed files with 370 additions and 1043 deletions

View File

@@ -32,8 +32,8 @@ import org.springframework.data.rest.core.mapping.RepositoryDetectionStrategy;
import org.springframework.data.rest.core.mapping.RepositoryDetectionStrategy.RepositoryDetectionStrategies;
import org.springframework.data.rest.core.support.EntityLookup;
import org.springframework.hateoas.MediaTypes;
import org.springframework.hateoas.RelProvider;
import org.springframework.hateoas.core.EvoInflectorRelProvider;
import org.springframework.hateoas.server.RelProvider;
import org.springframework.hateoas.server.core.EvoInflectorRelProvider;
import org.springframework.http.MediaType;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

View File

@@ -62,7 +62,7 @@ public class CrudMethodsSupportedHttpMethods implements SupportedHttpMethods {
@Override
public HttpMethods getMethodsFor(ResourceType resourceType) {
Assert.notNull(resourceType, "Resource type must not be null!");
Assert.notNull(resourceType, "EntityRepresentationModel type must not be null!");
Set<HttpMethod> methods = new HashSet<HttpMethod>();
methods.add(OPTIONS);

View File

@@ -16,7 +16,7 @@
package org.springframework.data.rest.core.mapping;
import org.atteo.evo.inflector.English;
import org.springframework.hateoas.RelProvider;
import org.springframework.hateoas.server.RelProvider;
/**
* {@link TypeBasedCollectionResourceMapping} extension to use Evo Inflector to pluralize the simple class name by as

View File

@@ -23,8 +23,8 @@ import org.springframework.data.rest.core.Path;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.data.rest.core.annotation.RestResource;
import org.springframework.hateoas.LinkRelation;
import org.springframework.hateoas.RelProvider;
import org.springframework.hateoas.core.EvoInflectorRelProvider;
import org.springframework.hateoas.server.RelProvider;
import org.springframework.hateoas.server.core.EvoInflectorRelProvider;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;

View File

@@ -31,8 +31,8 @@ import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.Path;
import org.springframework.data.rest.core.annotation.RestResource;
import org.springframework.hateoas.LinkRelation;
import org.springframework.hateoas.core.AnnotationAttribute;
import org.springframework.hateoas.core.MethodParameters;
import org.springframework.hateoas.server.core.AnnotationAttribute;
import org.springframework.hateoas.server.core.MethodParameters;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

View File

@@ -28,7 +28,7 @@ import org.springframework.data.repository.core.RepositoryInformation;
import org.springframework.data.repository.support.Repositories;
import org.springframework.data.rest.core.annotation.RestResource;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
import org.springframework.hateoas.RelProvider;
import org.springframework.hateoas.server.RelProvider;
import org.springframework.util.Assert;
/**

View File

@@ -22,8 +22,8 @@ import org.springframework.data.rest.core.Path;
import org.springframework.data.rest.core.annotation.Description;
import org.springframework.data.rest.core.annotation.RestResource;
import org.springframework.hateoas.LinkRelation;
import org.springframework.hateoas.RelProvider;
import org.springframework.hateoas.core.EvoInflectorRelProvider;
import org.springframework.hateoas.server.RelProvider;
import org.springframework.hateoas.server.core.EvoInflectorRelProvider;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

View File

@@ -18,8 +18,8 @@ package org.springframework.data.rest.core.support;
import java.util.List;
import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.hateoas.EntityLinks;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.server.EntityLinks;
import org.springframework.plugin.core.PluginRegistry;
import org.springframework.util.Assert;
@@ -65,7 +65,7 @@ public class DefaultSelfLinkProvider implements SelfLinkProvider {
Assert.notNull(instance, "Domain object must not be null!");
return entityLinks.linkToSingleResource(instance.getClass(), getResourceId(instance));
return entityLinks.linkToItemResource(instance.getClass(), getResourceId(instance));
}
/**
@@ -81,7 +81,7 @@ public class DefaultSelfLinkProvider implements SelfLinkProvider {
return lookups.getPluginFor(instanceType)//
.map(it -> it.getClass().cast(it))//
.map(it -> (Object) it.getResourceIdentifier(instance))//
.map(it -> it.getResourceIdentifier(instance))//
.orElseGet(() -> identifierOrNull(instance));
}

View File

@@ -20,7 +20,7 @@ import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.data.rest.core.mapping.ResourceMappings;
import org.springframework.hateoas.LinkRelation;
import org.springframework.hateoas.RelProvider;
import org.springframework.hateoas.server.RelProvider;
import org.springframework.util.Assert;
/**
@@ -46,7 +46,7 @@ public class RepositoryRelProvider implements RelProvider {
/*
* (non-Javadoc)
* @see org.springframework.hateoas.RelProvider#getCollectionResourceRelFor(java.lang.Class)
* @see org.springframework.hateoas.server.RelProvider#getCollectionResourceRelFor(java.lang.Class)
*/
@Override
public LinkRelation getCollectionResourceRelFor(Class<?> type) {
@@ -55,7 +55,7 @@ public class RepositoryRelProvider implements RelProvider {
/*
* (non-Javadoc)
* @see org.springframework.hateoas.RelProvider#getItemResourceRelFor(java.lang.Class)
* @see org.springframework.hateoas.server.RelProvider#getItemResourceRelFor(java.lang.Class)
*/
@Override
public LinkRelation getItemResourceRelFor(Class<?> type) {

View File

@@ -16,7 +16,7 @@
package org.springframework.data.rest.core.support;
import org.springframework.hateoas.LinkRelation;
import org.springframework.hateoas.RelProvider;
import org.springframework.hateoas.server.RelProvider;
import org.springframework.util.StringUtils;
/**
@@ -35,7 +35,7 @@ public class SimpleRelProvider implements RelProvider {
/*
* (non-Javadoc)
* @see org.springframework.hateoas.RelProvider#getItemResourceRelFor(java.lang.Class)
* @see org.springframework.hateoas.server.RelProvider#getItemResourceRelFor(java.lang.Class)
*/
@Override
public LinkRelation getItemResourceRelFor(Class<?> type) {
@@ -46,7 +46,7 @@ public class SimpleRelProvider implements RelProvider {
/*
* (non-Javadoc)
* @see org.springframework.hateoas.RelProvider#getCollectionResourceRelFor(java.lang.Class)
* @see org.springframework.hateoas.server.RelProvider#getCollectionResourceRelFor(java.lang.Class)
*/
@Override
public LinkRelation getCollectionResourceRelFor(Class<?> type) {

View File

@@ -27,8 +27,8 @@ import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RestResource;
import org.springframework.data.rest.core.domain.Person;
import org.springframework.data.rest.core.mapping.ResourceMapping;
import org.springframework.hateoas.RelProvider;
import org.springframework.hateoas.core.EvoInflectorRelProvider;
import org.springframework.hateoas.server.RelProvider;
import org.springframework.hateoas.server.core.EvoInflectorRelProvider;
/**
* Ensure the {@link ResourceMapping} components convey the correct information.

View File

@@ -35,7 +35,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext;
import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.rest.core.domain.Profile;
import org.springframework.hateoas.EntityLinks;
import org.springframework.hateoas.server.EntityLinks;
import org.springframework.hateoas.Link;
/**
@@ -58,7 +58,7 @@ public class DefaultSelfLinkProviderUnitTests {
@Before
public void setUp() {
when(entityLinks.linkToSingleResource((Class<?>) any(), any())).then(invocation -> {
when(entityLinks.linkToItemResource((Class<?>) any(), any())).then(invocation -> {
Class<?> type = invocation.getArgument(0);
Serializable id = invocation.getArgument(1);