Search in sources :

Example 1 with DataReferenceDTO

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

the class BaseAnalysisController method updateCommonEntityInAnalysis.

@ApiOperation("update common entity in analysis")
@RequestMapping(value = "/api/v1/analysis-management/analyses/{analysisId}/entities/{fileUuid}", method = PUT)
public JsonResult updateCommonEntityInAnalysis(@PathVariable("analysisId") Long analysisId, @PathVariable("fileUuid") String fileUuid, @RequestParam(value = "type", required = false, defaultValue = "COHORT") CommonAnalysisType analysisType, Principal principal) throws IOException, JMSException, PermissionDeniedException, URISyntaxException {
    final IUser user = getUser(principal);
    final AnalysisFile analysisFile = analysisService.getAnalysisFile(analysisId, fileUuid);
    T analysis = (T) analysisFile.getAnalysis();
    final DataReference dataReference = analysisFile.getDataReference();
    final DataReferenceDTO entityReference = new DataReferenceDTO(dataReference.getDataNode().getId(), dataReference.getGuid());
    final List<MultipartFile> entityFiles = getEntityFiles(entityReference, dataReference.getDataNode(), analysisType);
    analysisService.findAnalysisFilesByDataReference(analysis, dataReference).forEach(af -> {
        analysisService.deleteAnalysisFile(analysis, af);
        analysis.getFiles().remove(af);
    });
    doAddCommonEntityToAnalysis(analysis, dataReference, user, analysisType, entityFiles);
    return new JsonResult(NO_ERROR);
}
Also used : MockMultipartFile(org.springframework.mock.web.MockMultipartFile) MultipartFile(org.springframework.web.multipart.MultipartFile) DataReferenceDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataReferenceDTO) PUT(org.springframework.web.bind.annotation.RequestMethod.PUT) GET(org.springframework.web.bind.annotation.RequestMethod.GET) POST(org.springframework.web.bind.annotation.RequestMethod.POST) AnalysisFile(com.odysseusinc.arachne.portal.model.AnalysisFile) IUser(com.odysseusinc.arachne.portal.model.IUser) DataReference(com.odysseusinc.arachne.portal.model.DataReference) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)1 DataReferenceDTO (com.odysseusinc.arachne.portal.api.v1.dto.DataReferenceDTO)1 AnalysisFile (com.odysseusinc.arachne.portal.model.AnalysisFile)1 DataReference (com.odysseusinc.arachne.portal.model.DataReference)1 IUser (com.odysseusinc.arachne.portal.model.IUser)1 ApiOperation (io.swagger.annotations.ApiOperation)1 MockMultipartFile (org.springframework.mock.web.MockMultipartFile)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 GET (org.springframework.web.bind.annotation.RequestMethod.GET)1 POST (org.springframework.web.bind.annotation.RequestMethod.POST)1 PUT (org.springframework.web.bind.annotation.RequestMethod.PUT)1 MultipartFile (org.springframework.web.multipart.MultipartFile)1