Search in sources :

Example 1 with UserInfoDTO

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

the class ArachneFileMetaToFileDTOConverter method convert.

@Override
public FileDTO convert(ArachneFileMeta source) {
    FileDTO fileDTO = new FileDTO();
    fileDTO.setUuid(source.getUuid());
    fileDTO.setPath(source.getPath());
    fileDTO.setName(source.getName());
    fileDTO.setCreated(source.getCreated());
    fileDTO.setUpdated(source.getUpdated());
    fileDTO.setDocType(source.getContentType());
    fileDTO.setAuthor(new UserInfoDTO(UserIdUtils.idToUuid(source.getCreatedBy())));
    return fileDTO;
}
Also used : FileDTO(com.odysseusinc.arachne.portal.api.v1.dto.FileDTO) UserInfoDTO(com.odysseusinc.arachne.portal.api.v1.dto.UserInfoDTO)

Example 2 with UserInfoDTO

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

the class PaperFileToPaperFileDTOConverter method convert.

@Override
public PaperFileDTO convert(AbstractPaperFile paperFile) {
    final PaperFileDTO paperFileDTO = new PaperFileDTO();
    paperFileDTO.setUuid(paperFile.getUuid());
    paperFileDTO.setName(paperFile.getRealName());
    paperFileDTO.setLabel(paperFile.getLabel());
    paperFileDTO.setCreated(paperFile.getCreated());
    paperFileDTO.setUpdated(paperFile.getUpdated());
    paperFileDTO.setDocType(paperFile.getContentType());
    final UserInfoDTO authorDTO = conversionService.convert(paperFile.getAuthor(), UserInfoDTO.class);
    paperFileDTO.setAuthor(authorDTO);
    paperFileDTO.setLink(paperFile.getLink());
    paperFileDTO.setAntivirusStatus(paperFile.getAntivirusStatus());
    paperFileDTO.setAntivirusDescription(paperFile.getAntivirusDescription());
    paperFileDTO.setInsightId(paperFile.getPaper().getId());
    return paperFileDTO;
}
Also used : PaperFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.PaperFileDTO) UserInfoDTO(com.odysseusinc.arachne.portal.api.v1.dto.UserInfoDTO)

Example 3 with UserInfoDTO

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

the class BaseAuthenticationController method info.

@ApiOperation("Get information about current user.")
@RequestMapping(value = "/api/v1/auth/me", method = RequestMethod.GET)
public JsonResult<UserInfoDTO> info(Principal principal) {
    final JsonResult<UserInfoDTO> result;
    IUser user = userService.getByEmailInAnyTenant(principal.getName());
    final UserInfoDTO userInfo = conversionService.convert(user, UserInfoDTO.class);
    result = new JsonResult<>(JsonResult.ErrorCode.NO_ERROR);
    result.setResult(userInfo);
    return result;
}
Also used : UserInfoDTO(com.odysseusinc.arachne.portal.api.v1.dto.UserInfoDTO) IUser(com.odysseusinc.arachne.portal.model.IUser) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

UserInfoDTO (com.odysseusinc.arachne.portal.api.v1.dto.UserInfoDTO)3 FileDTO (com.odysseusinc.arachne.portal.api.v1.dto.FileDTO)1 PaperFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.PaperFileDTO)1 IUser (com.odysseusinc.arachne.portal.model.IUser)1 ApiOperation (io.swagger.annotations.ApiOperation)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1