use of com.odysseusinc.arachne.portal.api.v1.dto.InvitationEntityDTO 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;
}
use of com.odysseusinc.arachne.portal.api.v1.dto.InvitationEntityDTO 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;
}
Aggregations