Search in sources :

Example 1 with CharacterizationDTO

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;
}
Also used : AchillesFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.AchillesFileDTO) CharacterizationDTO(com.odysseusinc.arachne.portal.api.v1.dto.CharacterizationDTO)

Example 2 with CharacterizationDTO

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;
}
Also used : Characterization(com.odysseusinc.arachne.portal.model.achilles.Characterization) NotExistException(com.odysseusinc.arachne.portal.exception.NotExistException) CharacterizationDTO(com.odysseusinc.arachne.portal.api.v1.dto.CharacterizationDTO) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

CharacterizationDTO (com.odysseusinc.arachne.portal.api.v1.dto.CharacterizationDTO)2 JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)1 AchillesFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.AchillesFileDTO)1 NotExistException (com.odysseusinc.arachne.portal.exception.NotExistException)1 Characterization (com.odysseusinc.arachne.portal.model.achilles.Characterization)1 ApiOperation (io.swagger.annotations.ApiOperation)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1