Search in sources :

Example 1 with OrganizationDTO

use of com.odysseusinc.arachne.commons.api.v1.dto.OrganizationDTO in project ArachneCentralAPI by OHDSI.

the class DataNodeToDataNodeDTOConverter method convert.

@Override
public DataNodeDTO convert(DataNode dataNode) {
    final DataNodeDTO dataNodeDTO = new DataNodeDTO();
    dataNodeDTO.setId(dataNode.getId());
    dataNodeDTO.setName(dataNode.getName());
    dataNodeDTO.setDescription(dataNode.getDescription());
    dataNodeDTO.setVirtual(dataNode.getVirtual());
    dataNodeDTO.setPublished(dataNode.getPublished());
    dataNodeDTO.setAtlasVersion(dataNode.getAtlasVersion());
    dataNodeDTO.setPermissions(conversionService.convert(dataNode, PermissionsDTO.class));
    CommonHealthStatus healthStatus = baseDataNodeService.getHealthStatus(dataNode);
    dataNodeDTO.setHealthStatus(healthStatus);
    dataNodeDTO.setHealthStatusTitle(healthStatus.toString());
    final Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    final Long loggedUserId = ((ArachneUser) principal).getId();
    final User loggedUser = new User();
    loggedUser.setId(loggedUserId);
    dataNodeDTO.setCurrentUserDataOwner(DataNodeUtils.isDataNodeOwner(dataNode, loggedUser));
    final OrganizationDTO organizationDTO = conversionService.convert(dataNode.getOrganization(), OrganizationDTO.class);
    dataNodeDTO.setOrganization(organizationDTO);
    return dataNodeDTO;
}
Also used : CommonHealthStatus(com.odysseusinc.arachne.commons.api.v1.dto.CommonHealthStatus) ArachneUser(com.odysseusinc.arachne.portal.model.security.ArachneUser) User(com.odysseusinc.arachne.portal.model.User) DataNodeDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataNodeDTO) PermissionsDTO(com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO) ArachneUser(com.odysseusinc.arachne.portal.model.security.ArachneUser) OrganizationDTO(com.odysseusinc.arachne.commons.api.v1.dto.OrganizationDTO)

Example 2 with OrganizationDTO

use of com.odysseusinc.arachne.commons.api.v1.dto.OrganizationDTO in project ArachneCentralAPI by OHDSI.

the class OrganizationToOrganizationDTOConverter method convert.

@Override
public OrganizationDTO convert(Organization source) {
    final OrganizationDTO organizationDTO = new OrganizationDTO();
    organizationDTO.setId(source.getId());
    organizationDTO.setName(source.getName());
    return organizationDTO;
}
Also used : OrganizationDTO(com.odysseusinc.arachne.commons.api.v1.dto.OrganizationDTO)

Aggregations

OrganizationDTO (com.odysseusinc.arachne.commons.api.v1.dto.OrganizationDTO)2 CommonHealthStatus (com.odysseusinc.arachne.commons.api.v1.dto.CommonHealthStatus)1 DataNodeDTO (com.odysseusinc.arachne.portal.api.v1.dto.DataNodeDTO)1 PermissionsDTO (com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO)1 User (com.odysseusinc.arachne.portal.model.User)1 ArachneUser (com.odysseusinc.arachne.portal.model.security.ArachneUser)1