Search in sources :

Example 1 with CommonDataNodeDTO

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

the class BaseDataNodeController method updateDataNode.

@ApiOperation("Update data node info")
@RequestMapping(value = "/api/v1/data-nodes/{dataNodeId}", method = RequestMethod.PUT)
public JsonResult<CommonDataNodeDTO> updateDataNode(@PathVariable("dataNodeId") Long dataNodeId, @RequestBody @Valid CommonDataNodeRegisterDTO commonDataNodeRegisterDTO, Principal principal) throws PermissionDeniedException, NotExistException {
    final IUser user = getUser(principal);
    final DN dataNode = conversionService.convert(commonDataNodeRegisterDTO, getDataNodeDNClass());
    dataNode.setId(dataNodeId);
    final DN updatedDataNode = baseDataNodeService.update(dataNode);
    final CommonDataNodeDTO dataNodeRegisterResponseDTO = conversionService.convert(updatedDataNode, CommonDataNodeDTO.class);
    final JsonResult<CommonDataNodeDTO> result = new JsonResult<>(JsonResult.ErrorCode.NO_ERROR);
    result.setResult(dataNodeRegisterResponseDTO);
    return result;
}
Also used : CommonDataNodeDTO(com.odysseusinc.arachne.commons.api.v1.dto.CommonDataNodeDTO) IUser(com.odysseusinc.arachne.portal.model.IUser) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with CommonDataNodeDTO

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

the class DataNodeToCommonDataNodeDTOConverter method convert.

@Override
public CommonDataNodeDTO convert(DataNode source) {
    CommonDataNodeDTO dto = new CommonDataNodeDTO();
    dto.setDataNodeUuid(source.getSid());
    dto.setName(source.getName());
    dto.setDescription(source.getDescription());
    dto.setToken(source.getToken());
    dto.setCentralId(source.getId());
    return dto;
}
Also used : CommonDataNodeDTO(com.odysseusinc.arachne.commons.api.v1.dto.CommonDataNodeDTO)

Aggregations

CommonDataNodeDTO (com.odysseusinc.arachne.commons.api.v1.dto.CommonDataNodeDTO)2 JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)1 IUser (com.odysseusinc.arachne.portal.model.IUser)1 ApiOperation (io.swagger.annotations.ApiOperation)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1