Search in sources :

Example 1 with DataOwnerParticipantDTO

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

the class ParticipantLinkToParticipantDTOConverter method convert.

@Override
public ParticipantDTO convert(ParticipantLink participantLink) {
    ParticipantDTO participantDTO = new ParticipantDTO();
    ParticipantRole role = participantLink.getRole();
    final IUser user = participantLink.getUser();
    participantDTO.setId(user.getUuid());
    participantDTO.setFullName(user.getFullName());
    participantDTO.setRole(new OptionDTO(role.name(), role.toString()));
    participantDTO.setStatus(participantLink.getStatus().toString());
    if (participantLink instanceof UserStudyExtended) {
        if (DECLINED == participantLink.getStatus() && !isEmpty(((UserStudyExtended) participantLink).getComment())) {
            participantDTO.setComment(((UserStudyExtended) participantLink).getComment());
        }
        if (role.equals(ParticipantRole.DATA_SET_OWNER)) {
            DataSource ownedDataSource = ((UserStudyExtended) participantLink).getDataSource();
            participantDTO = new DataOwnerParticipantDTO(participantDTO, ownedDataSource.getId());
        }
    }
    return participantDTO;
}
Also used : DataOwnerParticipantDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataOwnerParticipantDTO) IUser(com.odysseusinc.arachne.portal.model.IUser) ParticipantDTO(com.odysseusinc.arachne.portal.api.v1.dto.ParticipantDTO) DataOwnerParticipantDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataOwnerParticipantDTO) OptionDTO(com.odysseusinc.arachne.commons.api.v1.dto.OptionDTO) UserStudyExtended(com.odysseusinc.arachne.portal.model.UserStudyExtended) ParticipantRole(com.odysseusinc.arachne.portal.model.ParticipantRole) DataSource(com.odysseusinc.arachne.portal.model.DataSource)

Aggregations

OptionDTO (com.odysseusinc.arachne.commons.api.v1.dto.OptionDTO)1 DataOwnerParticipantDTO (com.odysseusinc.arachne.portal.api.v1.dto.DataOwnerParticipantDTO)1 ParticipantDTO (com.odysseusinc.arachne.portal.api.v1.dto.ParticipantDTO)1 DataSource (com.odysseusinc.arachne.portal.model.DataSource)1 IUser (com.odysseusinc.arachne.portal.model.IUser)1 ParticipantRole (com.odysseusinc.arachne.portal.model.ParticipantRole)1 UserStudyExtended (com.odysseusinc.arachne.portal.model.UserStudyExtended)1