Search in sources :

Example 1 with StudyShortDTO

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

the class StudyToStudyShortDTOConverter method convert.

@Override
public StudyShortDTO convert(Study source) {
    StudyShortDTO studyDTO = new StudyShortDTO();
    studyDTO.setId(source.getId());
    studyDTO.setTitle(source.getTitle());
    return studyDTO;
}
Also used : StudyShortDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyShortDTO)

Example 2 with StudyShortDTO

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

the class SubmissionInsightToSubmissionInsightDTOConverter method analysisConverter.

private AnalysisDTO analysisConverter(final Analysis analysis) {
    final AnalysisDTO analysisDTO = new AnalysisDTO();
    analysisDTO.setId(analysis.getId());
    analysisDTO.setTitle(analysis.getTitle());
    final StudyShortDTO studyDTO = new StudyShortDTO();
    final Study study = analysis.getStudy();
    studyDTO.setId(study.getId());
    studyDTO.setTitle(study.getTitle());
    analysisDTO.setStudy(studyDTO);
    return analysisDTO;
}
Also used : Study(com.odysseusinc.arachne.portal.model.Study) StudyShortDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyShortDTO) AnalysisDTO(com.odysseusinc.arachne.portal.api.v1.dto.AnalysisDTO)

Example 3 with StudyShortDTO

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

the class InvitationableToInvitationDTOConverter method convert.

@Override
public InvitationDTO convert(Invitationable source) {
    final InvitationDTO invitationDTO = new InvitationDTO();
    final List<ActionDTO> actionList = Arrays.asList(new ActionDTO("Accept", "accept", "success"), new ActionDTO("Decline", "decline", "cancel"));
    invitationDTO.setActionList(actionList);
    invitationDTO.setType(source.getInvitationType());
    invitationDTO.setId(source.getId());
    invitationDTO.setActionType(source.getActionType());
    invitationDTO.setDate(source.getCreated());
    invitationDTO.setUser(conversionService.convert(source.getAuthor(), ShortUserDTO.class));
    final Object entity = source.getEntity();
    String title = "";
    Long id = null;
    if (entity instanceof Study) {
        final Study study = (Study) entity;
        title = study.getTitle();
        id = study.getId();
    } else if (entity instanceof Paper) {
        final Paper paper = (Paper) entity;
        title = paper.getStudy().getDescription();
        id = paper.getId();
    } else if (entity instanceof Analysis) {
        final Analysis analysis = (Analysis) entity;
        title = analysis.getTitle();
        id = analysis.getId();
    }
    final InvitationEntityDTO studyShortDTO = getInvitationEntityDTO(title, id);
    invitationDTO.setEntity(studyShortDTO);
    return invitationDTO;
}
Also used : Study(com.odysseusinc.arachne.portal.model.Study) ShortUserDTO(com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO) Analysis(com.odysseusinc.arachne.portal.model.Analysis) InvitationDTO(com.odysseusinc.arachne.portal.api.v1.dto.InvitationDTO) Paper(com.odysseusinc.arachne.portal.model.Paper) ActionDTO(com.odysseusinc.arachne.portal.api.v1.dto.ActionDTO) InvitationEntityDTO(com.odysseusinc.arachne.portal.api.v1.dto.InvitationEntityDTO)

Example 4 with StudyShortDTO

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

the class InvitationableToInvitationDTOConverter method getInvitationEntityDTO.

private InvitationEntityDTO getInvitationEntityDTO(String title, Long id) {
    final InvitationEntityDTO studyShortDTO = new InvitationEntityDTO();
    studyShortDTO.setTitle(title);
    studyShortDTO.setId(id);
    return studyShortDTO;
}
Also used : InvitationEntityDTO(com.odysseusinc.arachne.portal.api.v1.dto.InvitationEntityDTO)

Aggregations

InvitationEntityDTO (com.odysseusinc.arachne.portal.api.v1.dto.InvitationEntityDTO)2 StudyShortDTO (com.odysseusinc.arachne.portal.api.v1.dto.StudyShortDTO)2 Study (com.odysseusinc.arachne.portal.model.Study)2 ActionDTO (com.odysseusinc.arachne.portal.api.v1.dto.ActionDTO)1 AnalysisDTO (com.odysseusinc.arachne.portal.api.v1.dto.AnalysisDTO)1 InvitationDTO (com.odysseusinc.arachne.portal.api.v1.dto.InvitationDTO)1 ShortUserDTO (com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO)1 Analysis (com.odysseusinc.arachne.portal.model.Analysis)1 Paper (com.odysseusinc.arachne.portal.model.Paper)1