use of com.odysseusinc.arachne.commons.api.v1.dto.CommonAnalysisType 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(existingAnalysisFile -> {
analysisService.deleteAnalysisFile(analysis, existingAnalysisFile);
analysis.getFiles().remove(existingAnalysisFile);
});
final String description = doAddCommonEntityToAnalysis(analysis, dataReference, user, analysisType, entityFiles);
return new JsonResult(NO_ERROR, description);
}
Aggregations