use of com.odysseusinc.arachne.portal.api.v1.dto.CharacterizationDTO in project ArachneCentralAPI by OHDSI.
the class CharacterizationToCharacterizationDTOConverter method convert.
@Override
public CharacterizationDTO convert(Characterization characterization) {
CharacterizationDTO dto = new CharacterizationDTO();
dto.setId(characterization.getId());
dto.setDate(characterization.getDate());
if (characterization.getFiles() != null) {
dto.setFiles(characterization.getFiles().stream().map(f -> conversionService.convert(f, AchillesFileDTO.class)).collect(Collectors.toList()));
} else {
dto.setFiles(new ArrayList<>());
}
return dto;
}
use of com.odysseusinc.arachne.portal.api.v1.dto.CharacterizationDTO in project ArachneCentralAPI by OHDSI.
the class BaseAchillesController method getLatestCharacterization.
@ApiOperation("List latest characterization for given datasource")
@RequestMapping(value = "datasource/{id}", method = RequestMethod.GET)
public JsonResult<CharacterizationDTO> getLatestCharacterization(@PathVariable("id") Long datasourceId) throws NotExistException {
DS dataSource = checkDataSource(datasourceId);
Characterization characterization = achillesService.getLatestCharacterization(dataSource).orElseThrow(() -> new NotExistException(String.format("Characterization doesn't exist for dataSource: %s", datasourceId), Characterization.class));
JsonResult<CharacterizationDTO> result = new JsonResult<>();
result.setErrorCode(NO_ERROR.getCode());
CharacterizationDTO dto = conversionService.convert(characterization, CharacterizationDTO.class);
result.setResult(dto);
return result;
}
Aggregations