use of com.odysseusinc.arachne.portal.api.v1.dto.WorkspaceDTO in project ArachneCentralAPI by OHDSI.
the class BaseStudyToWorkspaceDTOConverter method convert.
@Override
public DTO convert(S source) {
final DTO workspaceDTO = super.convert(source);
if (!source.getParticipants().isEmpty()) {
Optional<UserStudyExtended> leadOptional = source.getParticipants().stream().filter(participant -> participant.getRole().equals(ParticipantRole.LEAD_INVESTIGATOR)).findFirst();
workspaceDTO.setLeadParticipant(conversionService.convert(leadOptional.orElseThrow(() -> {
final String message = "Lead investigator for workspace id = " + workspaceDTO.getId() + " doesn't exist";
return new NotExistException(message, UserStudyExtended.class);
}), ParticipantDTO.class));
}
return workspaceDTO;
}
Aggregations