diff --git a/src/main/java/org/cbioportal/application/rest/vcolumnstore/ColumnarStoreStudyViewController.java b/src/main/java/org/cbioportal/application/rest/vcolumnstore/ColumnarStoreStudyViewController.java index deeb6f7e8bd..c4efe2a8c10 100644 --- a/src/main/java/org/cbioportal/application/rest/vcolumnstore/ColumnarStoreStudyViewController.java +++ b/src/main/java/org/cbioportal/application/rest/vcolumnstore/ColumnarStoreStudyViewController.java @@ -116,7 +116,6 @@ public ResponseEntity> fetchFilteredSamples( SampleMapper.INSTANCE.toDtos(studyViewService.getFilteredSamples(studyViewFilter))); } - @Hidden // should unhide when we remove legacy controller @PostMapping( value = "/mutated-genes/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, @@ -129,7 +128,6 @@ public ResponseEntity> fetchMutatedGenes( return ResponseEntity.ok(studyViewService.getMutatedGenes(studyViewFilter)); } - @Hidden // should unhide when we remove legacy controller @PostMapping( value = "/molecular-profile-sample-counts/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, @@ -151,7 +149,6 @@ public ResponseEntity> fetchMolecularProfileSampleCounts( return ResponseEntity.ok(studyViewService.getMolecularProfileSampleCounts(studyViewFilter)); } - @Hidden // should unhide when we remove legacy controller @PostMapping( value = "/cna-genes/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, @@ -164,7 +161,6 @@ public ResponseEntity> fetchCnaGenes( return ResponseEntity.ok(studyViewService.getCnaGenes(studyViewFilter)); } - @Hidden // should unhide when we remove legacy controller @PostMapping( value = "/structuralvariant-genes/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, @@ -187,7 +183,6 @@ public ResponseEntity> fetchStructuralVariantGenes( return ResponseEntity.ok(studyViewService.getStructuralVariantGenes(studyViewFilter)); } - @Hidden // should unhide when we remove legacy controller @PostMapping( value = "/clinical-data-counts/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, @@ -210,7 +205,6 @@ public ResponseEntity> fetchClinicalDataCounts( return ResponseEntity.ok(result); } - @Hidden // should unhide when we remove legacy controller @PostMapping( value = "/sample-lists-counts/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, @@ -227,7 +221,6 @@ public List fetchCaseListCounts( return studyViewService.getCaseListDataCounts(studyViewFilter); } - @Hidden // should unhide when we remove legacy controller @PostMapping( value = "/clinical-data-bin-counts/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, @@ -243,7 +236,6 @@ public ResponseEntity> fetchClinicalDataBinCounts( return new ResponseEntity<>(clinicalDataBins, HttpStatus.OK); } - @Hidden // should unhide when we remove legacy controller @PostMapping( value = "/clinical-data-density-plot/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, @@ -312,7 +304,6 @@ public ResponseEntity fetchClinicalDataDensityPlot( return new ResponseEntity<>(result, HttpStatus.OK); } - @Hidden // should unhide when we remove legacy controller @PreAuthorize( "hasPermission(#studyViewFilter, 'StudyViewFilter', T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @PostMapping( @@ -365,7 +356,8 @@ public ResponseEntity fetchClinicalDataViolinPlots( // this new modified filter is used to fetch sample and patient clinical data. // this is required to get the complete violin plot data. // filteredSamples reflects only the original unmodified study view filter. - // we will need to fetch samples again to get the samples corresponding to this modified filter, + // we will need to fetch samples again to get the samples corresponding to this + // modified filter, // otherwise patient to sample mapping may be incomplete. if (studyViewFilter.getClinicalDataFilters() != null) { studyViewFilter.getClinicalDataFilters().stream() @@ -402,7 +394,6 @@ public ResponseEntity fetchClinicalDataViolinPlots( return new ResponseEntity<>(result, HttpStatus.OK); } - @Hidden // should unhide when we remove legacy controller @PostMapping( value = "/genomic-data-counts/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, @@ -424,9 +415,11 @@ public ResponseEntity> fetchGenomicDataCounts( throws StudyNotFoundException { List genomicDataFilters = genomicDataCountFilter.getGenomicDataFilters(); StudyViewFilter studyViewFilter = genomicDataCountFilter.getStudyViewFilter(); - // when there is only one filter, it means study view is doing a single chart filter operation + // when there is only one filter, it means study view is doing a single chart + // filter operation // remove filter from studyViewFilter to return all data counts - // the reason we do this is to make sure after chart get filtered, user can still see unselected + // the reason we do this is to make sure after chart get filtered, user can + // still see unselected // portion of the chart if (genomicDataFilters.size() == 1) { NewStudyViewFilterUtil.removeSelfFromGenomicDataFilter( @@ -435,7 +428,8 @@ public ResponseEntity> fetchGenomicDataCounts( studyViewFilter); } - // This endpoint is CNA specific. The name choice of "genomic data" does not imply it support + // This endpoint is CNA specific. The name choice of "genomic data" does not + // imply it support // other genomic data types List result = studyViewService.getCNACountsByGeneSpecific(studyViewFilter, genomicDataFilters); @@ -443,7 +437,6 @@ public ResponseEntity> fetchGenomicDataCounts( return new ResponseEntity<>(result, HttpStatus.OK); } - @Hidden // should unhide when we remove legacy controller @PostMapping( value = "/generic-assay-data-counts/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, @@ -467,9 +460,11 @@ public ResponseEntity> fetchGenericAssayDataCoun List gaFilters = genericAssayDataCountFilter.getGenericAssayDataFilters(); StudyViewFilter studyViewFilter = genericAssayDataCountFilter.getStudyViewFilter(); - // when there is only one filter, it means study view is doing a single chart filter operation + // when there is only one filter, it means study view is doing a single chart + // filter operation // remove filter from studyViewFilter to return all data counts - // the reason we do this is to make sure after chart get filtered, user can still see unselected + // the reason we do this is to make sure after chart get filtered, user can + // still see unselected // portion of the chart if (gaFilters.size() == 1) { @@ -481,7 +476,6 @@ public ResponseEntity> fetchGenericAssayDataCoun studyViewService.getGenericAssayDataCounts(studyViewFilter, gaFilters)); } - @Hidden // should unhide when we remove legacy controller @PostMapping( value = "/mutation-data-counts/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, @@ -499,9 +493,11 @@ public ResponseEntity> fetchMutationDataCounts( GenomicDataCountFilter genomicDataCountFilter) { List genomicDataFilters = genomicDataCountFilter.getGenomicDataFilters(); StudyViewFilter studyViewFilter = genomicDataCountFilter.getStudyViewFilter(); - // when there is only one filter, it means study view is doing a single chart filter operation + // when there is only one filter, it means study view is doing a single chart + // filter operation // remove filter from studyViewFilter to return all data counts - // the reason we do this is to make sure after chart get filtered, user can still see unselected + // the reason we do this is to make sure after chart get filtered, user can + // still see unselected // portion of the chart if (genomicDataFilters.size() == 1 && projection == Projection.SUMMARY) { NewStudyViewFilterUtil.removeSelfFromMutationDataFilter( @@ -520,7 +516,6 @@ public ResponseEntity> fetchMutationDataCounts( return ResponseEntity.ok(result); } - @Hidden // should unhide when we remove legacy controller @PostMapping( value = "/clinical-event-type-counts/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, @@ -588,7 +583,6 @@ public ResponseEntity fetchSampleTreatmentCounts( studyViewService.getSampleTreatmentReport(studyViewFilter, projection)); } - @Hidden // should unhide when we remove legacy controller @PostMapping( value = "/custom-data-counts/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, @@ -638,7 +632,6 @@ public ResponseEntity> fetchCustomDataCounts( return new ResponseEntity<>(result, HttpStatus.OK); } - @Hidden // should unhide when we remove legacy controller @PostMapping( value = "/custom-data-bin-counts/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, @@ -663,7 +656,6 @@ public ResponseEntity> fetchCustomDataBinCounts( return ResponseEntity.ok(customDataBins); } - @Hidden // should unhide when we remove legacy controller @PostMapping( value = "/genomic-data-bin-counts/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, @@ -683,7 +675,6 @@ public ResponseEntity> fetchGenomicDataBinCounts( return ResponseEntity.ok(genomicDataBins); } - @Hidden // should unhide when we remove legacy controller @PostMapping( value = "/generic-assay-data-bin-counts/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, diff --git a/src/main/java/org/cbioportal/legacy/web/StudyViewController.java b/src/main/java/org/cbioportal/legacy/web/StudyViewController.java index 5bdabf11192..ea33288b642 100644 --- a/src/main/java/org/cbioportal/legacy/web/StudyViewController.java +++ b/src/main/java/org/cbioportal/legacy/web/StudyViewController.java @@ -2,6 +2,7 @@ import static java.util.stream.Collectors.toSet; +import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.ArraySchema; @@ -137,6 +138,7 @@ private StudyViewController getInstance() { return instance; } + @Hidden @PreAuthorize( "hasPermission(#involvedCancerStudies, 'Collection', T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @RequestMapping( @@ -209,6 +211,7 @@ public List cachedClinicalDataCounts( return result; } + @Hidden @PreAuthorize( "hasPermission(#involvedCancerStudies, 'Collection', T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @RequestMapping( @@ -260,10 +263,12 @@ public List cachableFetchClinicalDataBinCounts( return clinicalDataBinUtil.fetchClinicalDataBinCounts( dataBinMethod, interceptedClinicalDataBinCountFilter, - // we don't need to remove filter again since we already did it in the previous step + // we don't need to remove filter again since we already did it in the previous + // step false); } + @Hidden @PreAuthorize( "hasPermission(#involvedCancerStudies, 'Collection', T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @RequestMapping( @@ -315,6 +320,7 @@ public ResponseEntity> fetchCustomDataBinCounts( return new ResponseEntity<>(clinicalDataBins, HttpStatus.OK); } + @Hidden @PreAuthorize( "hasPermission(#involvedCancerStudies, 'Collection',T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @RequestMapping( @@ -373,6 +379,7 @@ public List cachedFetchMutatedGenes( return alterationCountByGenes; } + @Hidden @PreAuthorize( "hasPermission(#involvedCancerStudies, 'Collection', T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @RequestMapping( @@ -491,6 +498,7 @@ public List cacheableFetchStructuralVariantC return new ArrayList<>(); } + @Hidden @PreAuthorize( "hasPermission(#involvedCancerStudies, 'Collection', T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @RequestMapping( @@ -594,6 +602,7 @@ public ResponseEntity> fetchFilteredSamples( return new ResponseEntity<>(result, HttpStatus.OK); } + @Hidden @PreAuthorize( "hasPermission(#involvedCancerStudies, 'Collection', T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @RequestMapping( @@ -663,6 +672,7 @@ private static double parseValueLinear(ClinicalData c) { return Double.parseDouble(c.getAttrValue()); } + @Hidden @PreAuthorize( "hasPermission(#involvedCancerStudies, 'Collection', T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @RequestMapping( @@ -772,7 +782,7 @@ public ResponseEntity fetchClinicalDataDensityPlot( for (ClinicalData d : clinicalDataList) { if (d.getSampleId() == null) { // null sample id means its a patient data, - // we need to distribute the value to samples + // we need to distribute the value to samples List samplesForPatient = patientToSamples.get(d.getPatientId()).get(d.getStudyId()); if (samplesForPatient != null) { @@ -787,7 +797,7 @@ public ResponseEntity fetchClinicalDataDensityPlot( } } else { // patient has no samples - this shouldn't happen and could affect the integrity - // of the data analysis + // of the data analysis return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR); } } else { @@ -953,6 +963,7 @@ public ResponseEntity fetchClinicalDataDensityPlot( return new ResponseEntity<>(result, HttpStatus.OK); } + @Hidden @PreAuthorize( "hasPermission(#involvedCancerStudies, 'Collection', T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @RequestMapping( @@ -1014,8 +1025,9 @@ public ResponseEntity fetchClinicalDataViolinPlots( List studyIds = new ArrayList<>(); List sampleIds = new ArrayList<>(); - // first get samples that are filtered by all current filters - this will give us - // the by-row sample counts + // first get samples that are filtered by all current filters - this will give + // us + // the by-row sample counts studyViewFilterUtil.extractStudyAndSampleIds( studyViewFilterApplier.apply(interceptedStudyViewFilter), studyIds, sampleIds); List filteredSamples = @@ -1024,7 +1036,7 @@ public ResponseEntity fetchClinicalDataViolinPlots( List studyIdsWithoutNumericalFilter = new ArrayList<>(); List sampleIdsWithoutNumericalFilter = new ArrayList<>(); // next, get samples that are filtered without the numerical filter - this will - // give us the violin plot data + // give us the violin plot data if (interceptedStudyViewFilter.getClinicalDataFilters() != null) { // Remove numerical clinical data filter, if there is one interceptedStudyViewFilter.getClinicalDataFilters().stream() @@ -1091,7 +1103,7 @@ public ResponseEntity fetchClinicalDataViolinPlots( for (ClinicalData d : clinicalDataList) { if (d.getSampleId() == null) { // null sample id means its a patient data, - // we need to distribute the value to samples + // we need to distribute the value to samples List samplesForPatient = patientToSamples.get(d.getPatientId()).get(d.getStudyId()); if (samplesForPatient != null) { @@ -1107,7 +1119,7 @@ public ResponseEntity fetchClinicalDataViolinPlots( } } else { // patient has no samples - this shouldn't happen and could affect the integrity - // of the data analysis + // of the data analysis return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR); } } else { @@ -1138,6 +1150,7 @@ public ResponseEntity fetchClinicalDataViolinPlots( return new ResponseEntity<>(result, HttpStatus.OK); } + @Hidden @PreAuthorize( "hasPermission(#involvedCancerStudies, 'Collection', T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @RequestMapping( @@ -1216,6 +1229,7 @@ public List fetchCaseListCounts( .toList(); } + @Hidden @PreAuthorize( "hasPermission(#involvedCancerStudies, 'Collection', T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @RequestMapping( @@ -1252,6 +1266,7 @@ public ResponseEntity> fetchGenomicDataBinCounts( HttpStatus.OK); } + @Hidden @PreAuthorize( "hasPermission(#involvedCancerStudies, 'Collection', T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @RequestMapping( @@ -1282,9 +1297,11 @@ public ResponseEntity> fetchGenomicDataCounts( List genomicDataFilters = interceptedGenomicDataCountFilter.getGenomicDataFilters(); StudyViewFilter studyViewFilter = interceptedGenomicDataCountFilter.getStudyViewFilter(); - // when there is only one filter, it means study view is doing a single chart filter operation + // when there is only one filter, it means study view is doing a single chart + // filter operation // remove filter from studyViewFilter to return all data counts - // the reason we do this is to make sure after chart get filtered, user can still see unselected + // the reason we do this is to make sure after chart get filtered, user can + // still see unselected // portion of the chart if (genomicDataFilters.size() == 1) { studyViewFilterUtil.removeSelfFromGenomicDataFilter( @@ -1318,6 +1335,7 @@ public ResponseEntity> fetchGenomicDataCounts( return new ResponseEntity<>(result, HttpStatus.OK); } + @Hidden @PreAuthorize( "hasPermission(#involvedCancerStudies, 'Collection', T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @RequestMapping( @@ -1352,9 +1370,11 @@ public ResponseEntity> fetchGenericAssayDataCoun List gaFilters = interceptedGenericAssayDataCountFilter.getGenericAssayDataFilters(); StudyViewFilter studyViewFilter = interceptedGenericAssayDataCountFilter.getStudyViewFilter(); - // when there is only one filter, it means study view is doing a single chart filter operation + // when there is only one filter, it means study view is doing a single chart + // filter operation // remove filter from studyViewFilter to return all data counts - // the reason we do this is to make sure after chart get filtered, user can still see unselected + // the reason we do this is to make sure after chart get filtered, user can + // still see unselected // portion of the chart if (gaFilters.size() == 1) { studyViewFilterUtil.removeSelfFromGenericAssayFilter( @@ -1383,6 +1403,7 @@ public ResponseEntity> fetchGenericAssayDataCoun return new ResponseEntity<>(result, HttpStatus.OK); } + @Hidden @PreAuthorize( "hasPermission(#involvedCancerStudies, 'Collection', T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @RequestMapping( @@ -1481,7 +1502,8 @@ public ResponseEntity fetchClinicalDataClinicalTab searchTerm, direction.name()); - // Because of pagination, the total number of sample matches can be larger than the items in the + // Because of pagination, the total number of sample matches can be larger than + // the items in the // requested page. SampleClinicalDataCollection aggregatedClinicalDataByUniqueSampleKey = sampleClinicalData.getLeft(); @@ -1521,6 +1543,7 @@ public ImmutablePair cachedClinicalDataTa sampleStudyIds, sampleIds, pageSize, pageNumber, searchTerm, sortBy, sortDirection); } + @Hidden @PreAuthorize( "hasPermission(#involvedCancerStudies, 'Collection', T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @RequestMapping( @@ -1571,6 +1594,7 @@ public List cachedClinicalEventTypeCounts( return clinicalEventService.getClinicalEventTypeCounts(studyIds, sampleIds); } + @Hidden @PreAuthorize( "hasPermission(#involvedCancerStudies, 'Collection', T(org.cbioportal.legacy.utils.security.AccessLevel).READ)") @RequestMapping( @@ -1603,9 +1627,11 @@ public ResponseEntity> fetchMutationDataCounts( List genomicDataFilters = interceptedGenomicDataCountFilter.getGenomicDataFilters(); StudyViewFilter studyViewFilter = interceptedGenomicDataCountFilter.getStudyViewFilter(); - // when there is only one filter, it means study view is doing a single chart filter operation + // when there is only one filter, it means study view is doing a single chart + // filter operation // remove filter from studyViewFilter to return all data counts - // the reason we do this is to make sure after chart get filtered, user can still see unselected + // the reason we do this is to make sure after chart get filtered, user can + // still see unselected // portion of the chart if (genomicDataFilters.size() == 1 && projection == Projection.SUMMARY) { studyViewFilterUtil.removeSelfFromMutationDataFilter(