@@ -51,7 +51,7 @@ public class ValidationErrors extends AbstractPropertyBindingResult {
|
||||
* Creates a new {@link ValidationErrors} instance for the given source object and {@link PersistentEntity}.
|
||||
*
|
||||
* @param source the source object to gather validation errors on, must not be {@literal null}.
|
||||
* @param entity the {@link PersistentEntity} for the given source instance, must not be {@literal null}.
|
||||
* @param entities the {@link PersistentEntities} for the given source instance, must not be {@literal null}.
|
||||
*/
|
||||
public ValidationErrors(Object source, PersistentEntities entities) {
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class MetadataConfiguration {
|
||||
/**
|
||||
* Configures whether to expose the ALPS resources.
|
||||
*
|
||||
* @param alpsEnabled the alpsEnabled to set
|
||||
* @param enableAlps whether to expose ALPS resources.
|
||||
*/
|
||||
public void setAlpsEnabled(boolean enableAlps) {
|
||||
this.alpsEnabled = enableAlps;
|
||||
|
||||
@@ -46,7 +46,6 @@ import org.springframework.util.StringUtils;
|
||||
* @author Greg Turnquist
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class RepositoryRestConfiguration {
|
||||
|
||||
static final URI NO_URI = URI.create("");
|
||||
@@ -367,7 +366,7 @@ public class RepositoryRestConfiguration {
|
||||
/**
|
||||
* Set whether to return a response body after updating an entity.
|
||||
*
|
||||
* @param returnBody can be {@literal null}, expressing the decision shall be derived from the presence of an
|
||||
* @param returnBodyOnUpdate can be {@literal null}, expressing the decision shall be derived from the presence of an
|
||||
* {@code Accept} header in the request.
|
||||
* @return {@literal this}
|
||||
*/
|
||||
@@ -535,7 +534,7 @@ public class RepositoryRestConfiguration {
|
||||
/**
|
||||
* Configures whether to enable enum value translation via the Spring Data REST default resource bundle. Defaults to
|
||||
* {@literal false} for backwards compatibility reasons. Will use the fully qualified enum name as key. For further
|
||||
* details see {@link EnumTranslator}.
|
||||
* details see {code EnumTranslator}.
|
||||
*
|
||||
* @param enableEnumTranslation
|
||||
* @see #getEnumTranslationConfiguration()
|
||||
@@ -675,7 +674,7 @@ public class RepositoryRestConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@link RelProvider} to be used to calculate the link relation defaults for repositories.
|
||||
* The {@link LinkRelationProvider} to be used to calculate the link relation defaults for repositories.
|
||||
*
|
||||
* @deprecated since 3.5, use {@link #setLinkRelationProvider(LinkRelationProvider)} instead.
|
||||
*/
|
||||
|
||||
@@ -139,7 +139,7 @@ public class ExposureConfiguration implements ExposureConfigurer {
|
||||
/**
|
||||
* Returns whether PUT requests can be used to create new instances of the given domain type.
|
||||
*
|
||||
* @param metadata must not be {@literal null}.
|
||||
* @param domainType must not be {@literal null}.
|
||||
* @return
|
||||
*/
|
||||
public boolean allowsPutForCreation(Class<?> domainType) {
|
||||
|
||||
@@ -33,11 +33,13 @@ public final class ParameterMetadata {
|
||||
/**
|
||||
* Creates a new {@link ParameterMetadata} for the given {@link MethodParameter} and base rel.
|
||||
*
|
||||
* @param name must not be {@literal null} or empty.
|
||||
* @param parameter must not be {@literal null} or empty.
|
||||
* @param baseRel must not be {@literal null} or empty.
|
||||
*/
|
||||
public ParameterMetadata(MethodParameter parameter, String baseRel) {
|
||||
|
||||
Assert.notNull(parameter, "MethodParameter must not be null!");
|
||||
|
||||
this.name = parameter.getParameterName();
|
||||
|
||||
Assert.hasText(name, "Parameter name must not be null or empty!");
|
||||
|
||||
@@ -65,9 +65,8 @@ public interface ResourceMetadata extends CollectionResourceMapping {
|
||||
SearchResourceMappings getSearchResourceMappings();
|
||||
|
||||
/**
|
||||
* Returns the supported {@link HttpMethod}s for the given {@link ResourceType}.
|
||||
* Returns the supported {@link HttpMethod}s.
|
||||
*
|
||||
* @param resourcType must not be {@literal null}.
|
||||
* @return
|
||||
*/
|
||||
SupportedHttpMethods getSupportedHttpMethods();
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.hateoas.server.LinkRelationProvider;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* A {@link RelProvider} based on the {@link ResourceMappings} for the registered repositories.
|
||||
* A {@link LinkRelationProvider} based on the {@link ResourceMappings} for the registered repositories.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ControllerUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a resource as a {@link ResourceEntity} and attach given headers and status.
|
||||
* Wrap a resource as a {@link ResponseEntity} and attach given headers and status.
|
||||
*
|
||||
* @param status
|
||||
* @param headers
|
||||
|
||||
@@ -55,8 +55,8 @@ public class EmbeddedResourcesAssembler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the embedded resources to render. This will add an {@link RelatedResource} for linkable associations if
|
||||
* they have an excerpt projection registered.
|
||||
* Returns the embedded resources to render. This will add a projection for linkable associations if they have an
|
||||
* excerpt projection registered.
|
||||
*
|
||||
* @param instance must not be {@literal null}.
|
||||
* @return
|
||||
|
||||
@@ -33,7 +33,8 @@ import org.springframework.util.Assert;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
/**
|
||||
* A Spring HATEOAS {@link Resource} subclass that holds a reference to the entity's {@link PersistentEntity} metadata.
|
||||
* A Spring HATEOAS {@link EntityModel} subclass that holds a reference to the entity's {@link PersistentEntity}
|
||||
* metadata.
|
||||
*
|
||||
* @author Jon Brisbin
|
||||
* @author Oliver Gierke
|
||||
@@ -168,8 +169,9 @@ public class PersistentEntityResource extends EntityModel<Object> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the builder to embed the given {@link EmbeddedWrapper} instances. Creates a {@link Resources} instance
|
||||
* to make sure the {@link EmbeddedWrapper} handling gets applied to the serialization output ignoring the links.
|
||||
* Configures the builder to embed the given {@link EmbeddedWrapper} instances. Creates a {@link CollectionModel}
|
||||
* instance to make sure the {@link EmbeddedWrapper} handling gets applied to the serialization output ignoring the
|
||||
* links.
|
||||
*
|
||||
* @param resources can be {@literal null}.
|
||||
* @return the builder
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.hateoas.server.core.EmbeddedWrapper;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* {@link ResourceAssembler} to create {@link PersistentEntityResource}s for arbitrary domain objects.
|
||||
* {@link RepresentationModelAssembler} to create {@link PersistentEntityResource}s for arbitrary domain objects.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
*/
|
||||
package org.springframework.data.rest.webmvc;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
|
||||
import org.springframework.hateoas.Link;
|
||||
import org.springframework.hateoas.server.RepresentationModelProcessor;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* {@link ResourceProcessor} to add a {@code profile} link to the root resource to point to multiple forms of metadata.
|
||||
* {@link RepresentationModelProcessor} to add a {@code profile} link to the root resource to point to multiple forms of
|
||||
* metadata.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Greg Turnquist
|
||||
@@ -39,7 +39,6 @@ public class ProfileResourceProcessor implements RepresentationModelProcessor<Re
|
||||
*
|
||||
* @param configuration must not be {@literal null}.
|
||||
*/
|
||||
@Autowired
|
||||
public ProfileResourceProcessor(RepositoryRestConfiguration configuration) {
|
||||
|
||||
Assert.notNull(configuration, "RepositoryRestConfiguration must not be null!");
|
||||
|
||||
@@ -37,11 +37,9 @@ public class RepositoryRestHandlerAdapter extends RequestMappingHandlerAdapter {
|
||||
private final List<HandlerMethodArgumentResolver> argumentResolvers;
|
||||
|
||||
/**
|
||||
* Creates a new {@link RepositoryRestHandlerAdapter} using the given {@link HandlerMethodArgumentResolver} and
|
||||
* {@link org.springframework.hateoas.server.mvc.ResourceProcessorInvoker}.
|
||||
* Creates a new {@link RepositoryRestHandlerAdapter} using the given {@link HandlerMethodArgumentResolver}s.
|
||||
*
|
||||
* @param argumentResolvers must not be {@literal null}.
|
||||
* @param invoker must not be {@literal null}.
|
||||
*/
|
||||
public RepositoryRestHandlerAdapter(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
||||
|
||||
|
||||
@@ -16,13 +16,14 @@
|
||||
package org.springframework.data.rest.webmvc;
|
||||
|
||||
import org.springframework.hateoas.RepresentationModel;
|
||||
import org.springframework.hateoas.server.RepresentationModelProcessor;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
/**
|
||||
* A custom {@link ResourceSupport} type to be able to write custom {@link ResourceProcessor}s to add additional links
|
||||
* to ones automatically exposed for Spring Data repository query methods.
|
||||
* A custom {@link RepresentationModel} type to be able to write custom {@link RepresentationModelProcessor}s to add
|
||||
* additional links to ones automatically exposed for Spring Data repository query methods.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
|
||||
@@ -25,6 +25,8 @@ import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.BeanFactoryUtils;
|
||||
import org.springframework.beans.factory.ObjectFactory;
|
||||
@@ -114,6 +116,7 @@ import org.springframework.hateoas.server.mvc.TypeConstrainedMappingJackson2Http
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.http.server.ServerHttpRequest;
|
||||
import org.springframework.plugin.core.PluginRegistry;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
|
||||
@@ -136,7 +139,7 @@ import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
|
||||
/**
|
||||
* Main application configuration for Spring Data REST. To customize how the exporter works, subclass this and override
|
||||
* any of the {@literal configure*} methods.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Any XML files located in the classpath under the {@literal META-INF/spring-data-rest/} path will be automatically
|
||||
* found and loaded into this {@link org.springframework.context.ApplicationContext}.
|
||||
*
|
||||
@@ -388,20 +391,13 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon
|
||||
return new BaseUri(repositoryRestConfiguration.getBasePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link org.springframework.beans.factory.config.BeanPostProcessor} to turn beans annotated as
|
||||
* {@link org.springframework.data.rest.repository.annotation.RepositoryEventHandler}s.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public static AnnotatedEventHandlerInvoker annotatedEventHandlerInvoker() {
|
||||
return new AnnotatedEventHandlerInvoker();
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns an {@link javax.servlet.http.HttpServletRequest} into a
|
||||
* {@link org.springframework.http.server.ServerHttpRequest}.
|
||||
* Turns an {@link HttpServletRequest} into a {@link ServerHttpRequest}.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -459,7 +455,6 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon
|
||||
* configuration into account when generating links.
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Bean
|
||||
public RepositoryEntityLinks entityLinks(ObjectFactory<HateoasPageableHandlerMethodArgumentResolver> pageableResolver, //
|
||||
@@ -640,7 +635,6 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon
|
||||
* Special {@link org.springframework.web.servlet.HandlerAdapter} that only recognizes handler methods defined in the
|
||||
* provided controller classes.
|
||||
*
|
||||
* @param resourceProcessors {@link ResourceProcessor}s available in the {@link ApplicationContext}.
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
|
||||
@@ -19,12 +19,11 @@ import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
|
||||
/**
|
||||
* SPI to be able to register extensions that add static resource routes.
|
||||
* SPI to be able to register extensions that add static resource routes. See
|
||||
* {@code org.springframework.data.rest.webmvc.halexplorer.HalExplorerConfiguration} in the HAL Explorer module.
|
||||
*
|
||||
* @author Oliver Drotbohm
|
||||
* @since 3.2
|
||||
* @see org.springframework.data.rest.webmvc.halbrowser.HalBrowserConfiguration
|
||||
* @see org.springframework.data.rest.webmvc.halexplorer.HalExplorerConfiguration
|
||||
*/
|
||||
public interface StaticResourceProvider {
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.http.converter.HttpMessageNotWritableException;
|
||||
|
||||
/**
|
||||
* {@link Converter} to render all {@link Link}s contained in a {@link ResourceSupport} as {@code text/uri-list} and
|
||||
* parse a request of that media type back into a {@link ResourceSupport} instance.
|
||||
* {@link Converter} to render all {@link Link}s contained in a {@link RepresentationModel} as {@code text/uri-list} and
|
||||
* parse a request of that media type back into a {@link RepresentationModel} instance.
|
||||
*
|
||||
* @author Jon Brisbin
|
||||
* @author Greg Turnquist
|
||||
|
||||
@@ -146,7 +146,7 @@ public class PersistentEntityJackson2Module extends SimpleModule {
|
||||
|
||||
/**
|
||||
* Custom {@link JsonSerializer} for {@link PersistentEntityResource}s to turn associations into {@link Link}s.
|
||||
* Delegates to standard {@link Resource} serialization afterwards.
|
||||
* Delegates to standard {@link EntityModel} serialization afterwards.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@@ -331,7 +331,7 @@ public class PersistentEntityJackson2Module extends SimpleModule {
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializer to wrap values into an {@link Resource} instance and collecting all association links.
|
||||
* Serializer to wrap values into an {@link EntityModel} instance and collecting all association links.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Alex Leigh
|
||||
|
||||
@@ -87,10 +87,11 @@ public class PersistentEntityToJsonSchemaConverter implements ConditionalGeneric
|
||||
* {@link ResourceMappings}.
|
||||
*
|
||||
* @param entities must not be {@literal null}.
|
||||
* @param mappings must not be {@literal null}.
|
||||
* @param associations must not be {@literal null}.
|
||||
* @param resolver must not be {@literal null}.
|
||||
* @param objectMapper must not be {@literal null}.
|
||||
* @param configuration must not be {@literal null}.
|
||||
* @param customizerFactory must not be {@literal null}.
|
||||
*/
|
||||
public PersistentEntityToJsonSchemaConverter(PersistentEntities entities, Associations associations,
|
||||
MessageResolver resolver, ObjectMapper objectMapper, RepositoryRestConfiguration configuration,
|
||||
@@ -101,6 +102,7 @@ public class PersistentEntityToJsonSchemaConverter implements ConditionalGeneric
|
||||
Assert.notNull(resolver, "MessageResolver must not be null!");
|
||||
Assert.notNull(objectMapper, "ObjectMapper must not be null!");
|
||||
Assert.notNull(configuration, "RepositoryRestConfiguration must not be null!");
|
||||
Assert.notNull(customizerFactory, "ValueTypeSchemaPropertyCustomizerFactory must not be null!");
|
||||
|
||||
this.entities = entities;
|
||||
this.associations = associations;
|
||||
|
||||
@@ -56,7 +56,6 @@ public abstract class PatchOperation {
|
||||
*
|
||||
* @param targetObject the target object, used as assistance in determining the evaluated object's type.
|
||||
* @param entityType the entityType
|
||||
* @param <T> the entity type
|
||||
* @return the result of late-value evaluation if the value is a {@link LateObjectEvaluator}; the value itself
|
||||
* otherwise.
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.rest.webmvc.support;
|
||||
|
||||
import static org.springframework.http.HttpHeaders.*;
|
||||
@@ -27,7 +26,7 @@ import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.method.support.ModelAndViewContainer;
|
||||
|
||||
/**
|
||||
* {@link HandlerMethodArgumentResolver} to resolve If-Match headers for optimistic locking handling {@link IfMatch}.
|
||||
* {@link HandlerMethodArgumentResolver} to resolve If-Match headers for optimistic locking handling {@link ETag}.
|
||||
*
|
||||
* @author Pablo Lozano
|
||||
* @author Oliver Gierke
|
||||
|
||||
@@ -24,9 +24,9 @@ package org.springframework.data.rest.webmvc.support;
|
||||
public interface ExcerptProjector {
|
||||
|
||||
/**
|
||||
* Creates a excerpt projection for the given source. If no excerpt projection is available, the call will fall back
|
||||
* to the behavior of {@link #project(Object)}. If you completely wish to skip handling the object, check for the
|
||||
* presence of an excerpt projection using {@link #hasExcerptProjection(Class)}.
|
||||
* Creates a excerpt projection for the given source. If no excerpt projection is available, the object will be
|
||||
* returned as is. If you completely wish to skip handling the object, check for the presence of an excerpt projection
|
||||
* using {@link #hasExcerptProjection(Class)}.
|
||||
*
|
||||
* @param source must not be {@literal null}.
|
||||
* @return
|
||||
|
||||
Reference in New Issue
Block a user