Search in sources :

Example 1 with ShortUserDTO

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;
}
Also used : DataSourceDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO) CreateVirtualDataSourceDTO(com.odysseusinc.arachne.portal.api.v1.dto.CreateVirtualDataSourceDTO) ShortUserDTO(com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO) IUser(com.odysseusinc.arachne.portal.model.IUser) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with ShortUserDTO

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;
}
Also used : ShortUserDTO(com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO)

Example 3 with ShortUserDTO

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());
}
Also used : SubmissionStatus(com.odysseusinc.arachne.portal.model.SubmissionStatus) SubmissionStatusHistoryElementDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusHistoryElementDTO) ShortUserDTO(com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO) IUser(com.odysseusinc.arachne.portal.model.IUser) SubmissionStatusDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusDTO) Date(java.util.Date)

Aggregations

ShortUserDTO (com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO)3 IUser (com.odysseusinc.arachne.portal.model.IUser)2 CreateVirtualDataSourceDTO (com.odysseusinc.arachne.portal.api.v1.dto.CreateVirtualDataSourceDTO)1 DataSourceDTO (com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO)1 SubmissionStatusDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusDTO)1 SubmissionStatusHistoryElementDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusHistoryElementDTO)1 SubmissionStatus (com.odysseusinc.arachne.portal.model.SubmissionStatus)1 ApiOperation (io.swagger.annotations.ApiOperation)1 Date (java.util.Date)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1