DATAREST-93 - Code cleanups.

Added missing license header. Polished code in RepositoryEntityController.
This commit is contained in:
Oliver Gierke
2013-10-01 17:41:03 +02:00
parent 282132994b
commit 6260d3fba9
2 changed files with 18 additions and 5 deletions

View File

@@ -164,6 +164,7 @@ class RepositoryEntityController extends AbstractRepositoryRestController implem
PersistentEntityResource<?> incoming) {
RepositoryInvoker invoker = repoRequest.getRepositoryInvoker();
if (!invoker.exposesSave()) {
throw new NoSuchMethodError();
}
@@ -176,11 +177,8 @@ class RepositoryEntityController extends AbstractRepositoryRestController implem
HttpHeaders headers = new HttpHeaders();
headers.setLocation(URI.create(selfLink.getHref()));
if (config.isReturnBodyOnCreate()) {
return ControllerUtils.toResponseEntity(headers, perAssembler.toResource(obj), HttpStatus.CREATED);
} else {
return ControllerUtils.toResponseEntity(headers, null, HttpStatus.CREATED);
}
PersistentEntityResource<Object> resource = config.isReturnBodyOnCreate() ? perAssembler.toResource(obj) : null;
return ControllerUtils.toResponseEntity(headers, resource, HttpStatus.CREATED);
}
/**