use of com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO in project ArachneCentralAPI by OHDSI.
the class StudyTypeController method list.
@ApiOperation("List study types.")
@RequestMapping(value = "/api/v1/study-management/study-types", method = RequestMethod.GET)
public JsonResult<List<StudyTypeDTO>> list() {
JsonResult result;
try {
Iterable<StudyType> studyTypees = studyTypeService.list();
result = new JsonResult<>(JsonResult.ErrorCode.NO_ERROR);
List<StudyTypeDTO> studyTypeDTOs = new LinkedList<>();
for (StudyType studyType : studyTypees) {
studyTypeDTOs.add(conversionService.convert(studyType, StudyTypeDTO.class));
}
result.setResult(studyTypeDTOs);
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
result = new JsonResult<>(JsonResult.ErrorCode.SYSTEM_ERROR);
result.setErrorMessage(ex.getMessage());
}
return result;
}
use of com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateStudyTitle.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/study/study-before-updating.xml")
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-after-updating-title.xml", assertionMode = NON_STRICT) })
public void testUpdateStudyTitle() throws Exception {
StudyDTO updatedStudyDTO = new StudyDTO();
updatedStudyDTO.setId(STUDY_ID);
updatedStudyDTO.setTitle("Study Title New");
updatedStudyDTO.setDescription("description");
StudyTypeDTO type = new StudyTypeDTO(STUDY_TYPE_ID);
type.setName("type");
updatedStudyDTO.setType(type);
StudyStatusDTO status = new StudyStatusDTO(STUDY_STATUS_ID, "Initiate");
updatedStudyDTO.setStatus(status);
testUpdate(updatedStudyDTO, UPDATED_STUDY_TITLE_JSON_OBJECT, UPDATED_STUDY_TITLE);
}
use of com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO in project ArachneCentralAPI by OHDSI.
the class StudyTypeToStudyTypeDTOConverter method convert.
@Override
public StudyTypeDTO convert(StudyType source) {
StudyTypeDTO dto = new StudyTypeDTO(source.getId());
dto.setName(source.getName());
return dto;
}
use of com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateStudyStatus.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/study/study-before-updating.xml")
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-after-updating-status.xml", assertionMode = NON_STRICT_UNORDERED) })
public void testUpdateStudyStatus() throws Exception {
StudyDTO updatedStudyDTO = new StudyDTO();
updatedStudyDTO.setId(STUDY_ID);
updatedStudyDTO.setDescription("description");
StudyTypeDTO type = new StudyTypeDTO(STUDY_TYPE_ID);
type.setName("type1");
updatedStudyDTO.setType(type);
StudyStatusDTO status = new StudyStatusDTO(2L, "Active");
updatedStudyDTO.setStatus(status);
testUpdate(updatedStudyDTO, UPDATED_STUDY_STATUS_JSON_OBJECT, "Active");
}
use of com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateStudyType.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/study/study-before-updating.xml")
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-after-updating-type.xml", assertionMode = NON_STRICT_UNORDERED) })
public void testUpdateStudyType() throws Exception {
StudyDTO updatedStudyDTO = new StudyDTO();
updatedStudyDTO.setId(STUDY_ID);
updatedStudyDTO.setDescription("description");
StudyTypeDTO type = new StudyTypeDTO(1L);
type.setName("type1");
updatedStudyDTO.setType(type);
StudyStatusDTO status = new StudyStatusDTO(STUDY_STATUS_ID, "Initiate");
updatedStudyDTO.setStatus(status);
testUpdate(updatedStudyDTO, UPDATED_STUDY_TYPE_JSON_OBJECT, "type1");
}
Aggregations