Added the ability to control the exporting of Repositories, query methods or entity fields by adding "exported = true|false" to the @RestResource annotation.
This commit is contained in:
@@ -299,7 +299,9 @@ public class RepositoryRestController
|
||||
URI path = buildUri(baseUri, repository, "search", entry.getKey());
|
||||
RestResource resourceAnno = entry.getValue().method().getAnnotation(RestResource.class);
|
||||
if (null != resourceAnno) {
|
||||
path = buildUri(baseUri, repository, "search", resourceAnno.path());
|
||||
if (StringUtils.hasText(resourceAnno.path())) {
|
||||
path = buildUri(baseUri, repository, "search", resourceAnno.path());
|
||||
}
|
||||
if (StringUtils.hasText(resourceAnno.rel())) {
|
||||
rel = repoMeta.rel() + "." + resourceAnno.rel();
|
||||
}
|
||||
@@ -1069,10 +1071,7 @@ public class RepositoryRestController
|
||||
}
|
||||
|
||||
for (String attrName : entityMetadata.linkedAttributes().keySet()) {
|
||||
URI uri = UriComponentsBuilder.fromUri(baseUri)
|
||||
.pathSegment(attrName)
|
||||
.build()
|
||||
.toUri();
|
||||
URI uri = buildUri(baseUri, attrName);
|
||||
Link l = new SimpleLink(repoRel + "." + entity.getClass().getSimpleName() + "." + attrName, uri);
|
||||
List<Link> links = (List<Link>) entityDto.get(LINKS);
|
||||
if (null == links) {
|
||||
|
||||
@@ -8,6 +8,8 @@ import javax.persistence.Id;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Version;
|
||||
|
||||
import org.springframework.data.rest.repository.annotation.RestResource;
|
||||
|
||||
/**
|
||||
* @author Jon Brisbin <jbrisbin@vmware.com>
|
||||
*/
|
||||
|
||||
@@ -3,9 +3,11 @@ package org.springframework.data.rest.test.webmvc;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.rest.repository.annotation.RestResource;
|
||||
|
||||
/**
|
||||
* @author Jon Brisbin <jbrisbin@vmware.com>
|
||||
*/
|
||||
@RestResource(exported = false)
|
||||
public interface UuidTestRepository extends CrudRepository<UuidTest, UUID> {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user