use of org.openforis.commons.web.Response in project collect by openforis.
the class RecordController method updateOwner.
@RequestMapping(value = "survey/{surveyId}/data/update/records/{recordId}", method = POST, produces = APPLICATION_JSON_VALUE)
@ResponseBody
public Response updateOwner(@PathVariable("surveyId") int surveyId, @PathVariable("recordId") int recordId, @RequestBody Map<String, String> body) throws RecordLockedException, MultipleEditException {
String ownerIdStr = body.get("ownerId");
Integer ownerId = ownerIdStr == null ? null : Integer.parseInt(ownerIdStr);
CollectSurvey survey = surveyManager.getById(surveyId);
SessionState sessionState = sessionManager.getSessionState();
recordManager.assignOwner(survey, recordId, ownerId, sessionState.getUser(), sessionState.getSessionId());
return new Response();
}
use of org.openforis.commons.web.Response in project collect by openforis.
the class AbstractPersistedObjectEditFormController method validate.
@RequestMapping(value = "validate", method = POST)
@ResponseBody
public Response validate(@Validated F form, BindingResult result) {
List<ObjectError> errors = result.getAllErrors();
Response response = new SimpleFormUpdateResponse(errors);
return response;
}
use of org.openforis.commons.web.Response in project collect by openforis.
the class AbstractPersistedObjectEditFormController method createErrorResponse.
protected Response createErrorResponse(Exception e) {
Response response = new Response();
response.setErrorStatus();
response.setErrorMessage(e.getMessage());
return response;
}
use of org.openforis.commons.web.Response in project collect by openforis.
the class BasicController method generateFormValidationResponse.
protected Response generateFormValidationResponse(BindingResult result) {
List<ObjectError> errors = result.getAllErrors();
Response response = new Response();
if (!errors.isEmpty()) {
response.setErrorStatus();
response.addObject("errors", errors);
}
return response;
}
Aggregations