Search in sources :

Example 1 with PaperFileDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.PaperFileDTO 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 PaperFileDTO

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

the class PaperFileToPaperFileDTOConverter method convert.

@Override
public PaperFileDTO convert(AbstractPaperFile paperFile) {
    final PaperFileDTO paperFileDTO = new PaperFileDTO();
    paperFileDTO.setUuid(paperFile.getUuid());
    paperFileDTO.setName(paperFile.getRealName());
    paperFileDTO.setLabel(paperFile.getLabel());
    paperFileDTO.setCreated(paperFile.getCreated());
    paperFileDTO.setUpdated(paperFile.getUpdated());
    paperFileDTO.setDocType(paperFile.getContentType());
    final UserInfoDTO authorDTO = conversionService.convert(paperFile.getAuthor(), UserInfoDTO.class);
    paperFileDTO.setAuthor(authorDTO);
    paperFileDTO.setLink(paperFile.getLink());
    paperFileDTO.setAntivirusStatus(paperFile.getAntivirusStatus());
    paperFileDTO.setAntivirusDescription(paperFile.getAntivirusDescription());
    paperFileDTO.setInsightId(paperFile.getPaper().getId());
    return paperFileDTO;
}
Also used : PaperFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.PaperFileDTO) UserInfoDTO(com.odysseusinc.arachne.portal.api.v1.dto.UserInfoDTO)

Aggregations

PaperFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.PaperFileDTO)2 PaperDTO (com.odysseusinc.arachne.portal.api.v1.dto.PaperDTO)1 PermissionsDTO (com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO)1 StudyMediumDTO (com.odysseusinc.arachne.portal.api.v1.dto.StudyMediumDTO)1 UserInfoDTO (com.odysseusinc.arachne.portal.api.v1.dto.UserInfoDTO)1 BaseConversionServiceAwareConverter (com.odysseusinc.arachne.portal.api.v1.dto.converters.BaseConversionServiceAwareConverter)1 Paper (com.odysseusinc.arachne.portal.model.Paper)1 Study (com.odysseusinc.arachne.portal.model.Study)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