use of com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO in project ArachneCentralAPI by OHDSI.
the class BaseStudyController method getDataSource.
@ApiOperation("Get data source linked to study")
@RequestMapping(value = "/api/v1/study-management/studies/{studyId}/data-sources/{dataSourceId}", method = GET)
public DataSourceDTO getDataSource(Principal principal, @PathVariable("studyId") Long studyId, @PathVariable("dataSourceId") Long dataSourceId) throws PermissionDeniedException {
final IUser createdBy = getUser(principal);
final DS dataSource = studyService.getStudyDataSource(createdBy, studyId, dataSourceId);
final DataSourceDTO dataSourceDTO = conversionService.convert(dataSource, DataSourceDTO.class);
final List<ShortUserDTO> userDTOs = dataSource.getDataNode().getDataNodeUsers().stream().map(dnu -> {
final IUser user = dnu.getUser();
final ShortUserDTO userDTO = new ShortUserDTO();
userDTO.setId(user.getUuid());
userDTO.setFirstname(user.getFirstname());
userDTO.setLastname(user.getLastname());
return userDTO;
}).distinct().collect(Collectors.toList());
dataSourceDTO.getDataNode().setDataOwners(userDTOs);
return dataSourceDTO;
}
use of com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO in project ArachneCentralAPI by OHDSI.
the class UserToShortUserDTOConverter method convert.
@Override
public ShortUserDTO convert(User user) {
ShortUserDTO dto = new ShortUserDTO();
dto.setId(user.getUuid());
dto.setFirstname(user.getFirstname());
dto.setLastname(user.getLastname());
return dto;
}
use of com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO in project ArachneCentralAPI by OHDSI.
the class SubmissionStatusHistoryToSubmissionStatusHistoryDTOConverter method convert.
@Override
public SubmissionStatusHistoryElementDTO convert(SubmissionStatusHistoryElement source) {
Date date = source.getDate();
SubmissionStatus status = source.getStatus();
SubmissionStatusDTO submissionStatusDTO = null;
if (status != null) {
submissionStatusDTO = new SubmissionStatusDTO(status);
}
IUser author = source.getAuthor();
ShortUserDTO shortUser = null;
if (author != null) {
shortUser = conversionService.convert(author, ShortUserDTO.class);
}
return new SubmissionStatusHistoryElementDTO(date, submissionStatusDTO, shortUser, source.getComment());
}
Aggregations