Search in sources :

Example 1 with PaperDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.PaperDTO in project ArachneCentralAPI by OHDSI.

the class BasePaperToPaperDTOConverter method convert.

@Override
public PD convert(P paper) {
    final PD paperDTO = createResultObject();
    paperDTO.setId(paper.getId());
    final Study study = paper.getStudy();
    final StudyMediumDTO studyDTO = conversionService.convert(study, StudyMediumDTO.class);
    paperDTO.setStudy(studyDTO);
    paperDTO.setPublishState(paper.getPublishState());
    paperDTO.setPublishedDate(paper.getPublishedDate());
    final List<PaperFileDTO> protocols = paper.getProtocols().stream().map(protocolFile -> conversionService.convert(protocolFile, PaperFileDTO.class)).collect(Collectors.toList());
    paperDTO.setProtocols(protocols);
    final List<PaperFileDTO> paperFileDTOs = paper.getPapers().stream().map(paperFile -> conversionService.convert(paperFile, PaperFileDTO.class)).collect(Collectors.toList());
    paperDTO.setPapers(paperFileDTOs);
    paperDTO.setPermissions(conversionService.convert(paper, PermissionsDTO.class));
    proceedAdditionalFields(paperDTO, paper);
    return paperDTO;
}
Also used : List(java.util.List) Component(org.springframework.stereotype.Component) PaperDTO(com.odysseusinc.arachne.portal.api.v1.dto.PaperDTO) StudyMediumDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyMediumDTO) Autowired(org.springframework.beans.factory.annotation.Autowired) BaseConversionServiceAwareConverter(com.odysseusinc.arachne.portal.api.v1.dto.converters.BaseConversionServiceAwareConverter) GenericConversionService(org.springframework.core.convert.support.GenericConversionService) PaperFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.PaperFileDTO) PermissionsDTO(com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO) Collectors(java.util.stream.Collectors) Paper(com.odysseusinc.arachne.portal.model.Paper) Study(com.odysseusinc.arachne.portal.model.Study) Study(com.odysseusinc.arachne.portal.model.Study) PaperFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.PaperFileDTO) PermissionsDTO(com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO) StudyMediumDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyMediumDTO)

Example 2 with PaperDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.PaperDTO in project ArachneCentralAPI by OHDSI.

the class BasePaperToShortPaperDTOConverter method convert.

@Override
public SPD convert(P paper) {
    final SPD paperDTO = createResultObject();
    paperDTO.setId(paper.getId());
    paperDTO.setPublishState(paper.getPublishState());
    paperDTO.setPublishedDate(paper.getPublishedDate());
    final Study study = paper.getStudy();
    final StudyMediumDTO studyDTO = conversionService.convert(study, StudyMediumDTO.class);
    paperDTO.setStudy(studyDTO);
    proceedAdditionalFields(paperDTO, paper);
    return paperDTO;
}
Also used : Study(com.odysseusinc.arachne.portal.model.Study) StudyMediumDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyMediumDTO)

Aggregations

StudyMediumDTO (com.odysseusinc.arachne.portal.api.v1.dto.StudyMediumDTO)2 Study (com.odysseusinc.arachne.portal.model.Study)2 PaperDTO (com.odysseusinc.arachne.portal.api.v1.dto.PaperDTO)1 PaperFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.PaperFileDTO)1 PermissionsDTO (com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO)1 BaseConversionServiceAwareConverter (com.odysseusinc.arachne.portal.api.v1.dto.converters.BaseConversionServiceAwareConverter)1 Paper (com.odysseusinc.arachne.portal.model.Paper)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 GenericConversionService (org.springframework.core.convert.support.GenericConversionService)1 Component (org.springframework.stereotype.Component)1