use of com.odysseusinc.arachne.portal.model.StudyStatus in project ArachneCentralAPI by OHDSI.
the class StudyStatusController method create.
@ApiOperation(value = "Register new study status.", hidden = true)
@RequestMapping(value = "/api/v1/admin/study-statuses", method = RequestMethod.POST)
public JsonResult<StudyStatusDTO> create(@RequestBody @Valid CreateStudyStatusDTO studyStatusDTO, BindingResult binding) throws NotExistException, NotUniqueException, PermissionDeniedException {
JsonResult<StudyStatusDTO> result;
if (binding.hasErrors()) {
result = new JsonResult<>(JsonResult.ErrorCode.VALIDATION_ERROR);
for (FieldError fieldError : binding.getFieldErrors()) {
result.getValidatorErrors().put(fieldError.getField(), fieldError.getDefaultMessage());
}
} else {
StudyStatus studyStatus = conversionService.convert(studyStatusDTO, StudyStatus.class);
studyStatus = studyStatusService.create(studyStatus);
result = new JsonResult<>(JsonResult.ErrorCode.NO_ERROR);
result.setResult(conversionService.convert(studyStatus, StudyStatusDTO.class));
}
return result;
}
use of com.odysseusinc.arachne.portal.model.StudyStatus in project ArachneCentralAPI by OHDSI.
the class CreateStudyStatusDTOToStudyStatusConverter method convert.
@Override
public StudyStatus convert(CreateStudyStatusDTO source) {
StudyStatus studyStatus = new StudyStatus();
studyStatus.setId(source.getId());
studyStatus.setName(source.getName());
return studyStatus;
}
use of com.odysseusinc.arachne.portal.model.StudyStatus in project ArachneCentralAPI by OHDSI.
the class StudyStatusDTOToStudyStatusConverter method convert.
@Override
public StudyStatus convert(StudyStatusDTO source) {
StudyStatus studyStatus = new StudyStatus();
studyStatus.setId(source.getId());
studyStatus.setName(source.getName());
return studyStatus;
}
Aggregations