use of com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyStatusDTO in project ArachneCentralAPI by OHDSI.
the class StudyStatusController method list.
@ApiOperation("List study statuses.")
@RequestMapping(value = "/api/v1/study-management/study-statuses", method = RequestMethod.GET)
public JsonResult<List<StudyStatusDTO>> list() {
JsonResult<List<StudyStatusDTO>> result;
Iterable<StudyStatus> studyStatuses = studyStatusService.list();
result = new JsonResult<>(JsonResult.ErrorCode.NO_ERROR);
List<StudyStatusDTO> studyStatusDTOs = new LinkedList<>();
for (StudyStatus studyStatus : studyStatuses) {
studyStatusDTOs.add(conversionService.convert(studyStatus, StudyStatusDTO.class));
}
result.setResult(studyStatusDTOs);
return result;
}
use of com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyStatusDTO in project ArachneCentralAPI by OHDSI.
the class StudyStatusToStudyStatusDTOConverter method convert.
@Override
public StudyStatusDTO convert(StudyStatus source) {
StudyStatusDTO dto = new StudyStatusDTO(source.getId(), source.getName());
Arrays.asList(StudyState.values()).stream().filter(ss -> ss.getStateName().equals(source.getName())).findFirst().ifPresent(ss -> dto.setAvailableActions(Arrays.stream(ss.getActions()).map(sa -> sa.name()).toArray(String[]::new)));
return dto;
}
use of com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyStatusDTO in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateStudyEndDate.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/study/study-before-updating.xml")
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-after-updating-end-date.xml", assertionMode = NON_STRICT) })
public void testUpdateStudyEndDate() throws Exception {
StudyDTO updatedStudyDTO = new StudyDTO();
updatedStudyDTO.setId(STUDY_ID);
updatedStudyDTO.setDescription("description");
updatedStudyDTO.setEndDate(UPDATED_DATE);
StudyStatusDTO status = new StudyStatusDTO(STUDY_STATUS_ID, "Initiate");
updatedStudyDTO.setStatus(status);
testUpdate(updatedStudyDTO, UPDATED_STUDY_END_DATE_JSON_OBJECT, UPDATED_DATE);
}
use of com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyStatusDTO in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateStudyStartDate.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/study/study-before-updating.xml")
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-after-updating-start-date.xml", assertionMode = NON_STRICT) })
public void testUpdateStudyStartDate() throws Exception {
StudyDTO updatedStudyDTO = new StudyDTO();
updatedStudyDTO.setId(STUDY_ID);
updatedStudyDTO.setDescription("description");
updatedStudyDTO.setStartDate(UPDATED_DATE);
StudyStatusDTO status = new StudyStatusDTO(STUDY_STATUS_ID, "Initiate");
updatedStudyDTO.setStatus(status);
testUpdate(updatedStudyDTO, UPDATED_STUDY_START_DATE_JSON_OBJECT, UPDATED_DATE);
}
use of com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyStatusDTO 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);
}
Aggregations