Commit efebf219 authored by Matija Obreza's avatar Matija Obreza
Browse files

Use JSON_OK response instead of boolean

parent 62d18c6f
......@@ -145,7 +145,6 @@ public class AccessionController extends RestController {
return rets;
}
/**
* Update accessions in the system
*
......@@ -155,8 +154,9 @@ public class AccessionController extends RestController {
*/
@RequestMapping(value = "/{instCode}/upsert", method = { RequestMethod.POST, RequestMethod.PUT }, produces = { MediaType.APPLICATION_JSON_VALUE })
public @ResponseBody
boolean upsertInstituteAccession(@PathVariable("instCode") String instCode, @RequestBody String content) throws JsonProcessingException, IOException {
// User's permission to WRITE to this WIEWS institute are checked in BatchRESTService.
String upsertInstituteAccession(@PathVariable("instCode") String instCode, @RequestBody String content) throws JsonProcessingException, IOException {
// User's permission to WRITE to this WIEWS institute are checked in
// BatchRESTService.
FaoInstitute institute = instituteService.getInstitute(instCode);
if (institute == null) {
throw new ResourceNotFoundException();
......@@ -181,7 +181,8 @@ public class AccessionController extends RestController {
batch.put(dataJson, (ObjectNode) json);
}
return batchRESTService.upsertAccessionData(institute, batch);
batchRESTService.upsertAccessionData(institute, batch);
return JSON_OK;
}
private BatchRESTService.DataJson readAid3(JsonNode json) {
......
......@@ -48,7 +48,8 @@ public class PermissionController extends RestController {
Permission[] permissions = new Permission[] { BasePermission.CREATE, BasePermission.DELETE, BasePermission.READ, BasePermission.WRITE,
BasePermission.ADMINISTRATION };
return aclService.addPermissions(permissionJson.oid, permissionJson.clazz, permissionJson.uuid, permissionJson.principal, permissions);
aclService.addPermissions(permissionJson.oid, permissionJson.clazz, permissionJson.uuid, permissionJson.principal, permissions);
return JSON_OK;
}
public static class PermissionJson {
......
......@@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
public abstract class RestController {
protected final Log LOG = LogFactory.getLog(getClass());
protected static final String JSON_OK = "{\"result\":true}";
public RestController() {
super();
}
......
......@@ -47,8 +47,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
public class UserController extends RestController {
private static final Log LOG = LogFactory.getLog(UserController.class);
private static final String JSON_OK = "{\"response\":\"OK\"}";
@Autowired
protected UserService userService;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment