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:
Jon Brisbin
2012-05-09 09:47:52 -05:00
parent 29c839f5c6
commit e1e460e718
10 changed files with 93 additions and 31 deletions

View File

@@ -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) {

View File

@@ -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>
*/

View File

@@ -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> {
}