Skip to content

Commit

Permalink
Use StudyViewColumnStoreController without /column-store URL prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
pvannierop committed Oct 24, 2023
1 parent bdb7f45 commit d555ccf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 98 deletions.
91 changes: 0 additions & 91 deletions web/src/main/java/org/cbioportal/web/StudyViewController.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,31 +100,6 @@ private void init() {

@Autowired
private ClinicalEventService clinicalEventService;

@PreAuthorize("hasPermission(#involvedCancerStudies, 'Collection<CancerStudyId>', T(org.cbioportal.utils.security.AccessLevel).READ)")
@RequestMapping(value = "/clinical-data-counts/fetch", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation("Fetch clinical data counts by study view filter")
public ResponseEntity<List<ClinicalDataCountItem>> fetchClinicalDataCounts(
@ApiParam(required = true, value = "Clinical data count filter")
@Valid @RequestBody(required = false) ClinicalDataCountFilter clinicalDataCountFilter,
@ApiIgnore // prevent reference to this attribute in the swagger-ui interface
@RequestAttribute(required = false, value = "involvedCancerStudies") Collection<String> involvedCancerStudies,
@ApiIgnore // prevent reference to this attribute in the swagger-ui interface. this attribute is needed for the @PreAuthorize tag above.
@Valid @RequestAttribute(required = false, value = "interceptedClinicalDataCountFilter") ClinicalDataCountFilter interceptedClinicalDataCountFilter) {

List<ClinicalDataFilter> attributes = interceptedClinicalDataCountFilter.getAttributes();
StudyViewFilter studyViewFilter = interceptedClinicalDataCountFilter.getStudyViewFilter();

if (attributes.size() == 1) {
studyViewFilterUtil.removeSelfFromFilter(attributes.get(0).getAttributeId(), studyViewFilter);
}
boolean singleStudyUnfiltered = studyViewFilterUtil.isSingleStudyUnfiltered(studyViewFilter);
List<ClinicalDataCountItem> result =
instance.cachedClinicalDataCounts(interceptedClinicalDataCountFilter,singleStudyUnfiltered);
return new ResponseEntity<>(result, HttpStatus.OK);

}

@Cacheable(
cacheResolver = "staticRepositoryCacheOneResolver",
Expand Down Expand Up @@ -153,28 +128,6 @@ public List<ClinicalDataCountItem> cachedClinicalDataCounts(
return result;
}

@PreAuthorize("hasPermission(#involvedCancerStudies, 'Collection<CancerStudyId>', T(org.cbioportal.utils.security.AccessLevel).READ)")
@RequestMapping(value = "/clinical-data-bin-counts/fetch", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation("Fetch clinical data bin counts by study view filter")
public ResponseEntity<List<ClinicalDataBin>> fetchClinicalDataBinCounts(
@ApiParam("Method for data binning")
@RequestParam(defaultValue = "DYNAMIC") DataBinMethod dataBinMethod,
@ApiParam(required = true, value = "Clinical data bin count filter")
@Valid @RequestBody(required = false) ClinicalDataBinCountFilter clinicalDataBinCountFilter,
@ApiIgnore // prevent reference to this attribute in the swagger-ui interface
@RequestAttribute(required = false, value = "involvedCancerStudies") Collection<String> involvedCancerStudies,
@ApiIgnore // prevent reference to this attribute in the swagger-ui interface. this attribute is needed for the @PreAuthorize tag above.
@Valid @RequestAttribute(required = false, value = "interceptedClinicalDataBinCountFilter") ClinicalDataBinCountFilter interceptedClinicalDataBinCountFilter
) {
StudyViewFilter studyViewFilter = clinicalDataBinUtil.removeSelfFromFilter(interceptedClinicalDataBinCountFilter);
boolean singleStudyUnfiltered = studyViewFilterUtil.isSingleStudyUnfiltered(studyViewFilter);
List<ClinicalDataBin> clinicalDataBins =
instance.cachableFetchClinicalDataBinCounts(dataBinMethod, interceptedClinicalDataBinCountFilter, singleStudyUnfiltered);

return new ResponseEntity<>(clinicalDataBins, HttpStatus.OK);
}

@Cacheable(
cacheResolver = "staticRepositoryCacheOneResolver",
condition = "@cacheEnabledConfig.getEnabled() && #singleStudyUnfiltered"
Expand All @@ -191,23 +144,6 @@ public List<ClinicalDataBin> cachableFetchClinicalDataBinCounts(
false
);
}

@PreAuthorize("hasPermission(#involvedCancerStudies, 'Collection<CancerStudyId>', T(org.cbioportal.utils.security.AccessLevel).READ)")
@RequestMapping(value = "/mutated-genes/fetch", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation("Fetch mutated genes by study view filter")
public ResponseEntity<List<AlterationCountByGene>> fetchMutatedGenes(
@ApiParam(required = true, value = "Study view filter")
@Valid @RequestBody(required = false) StudyViewFilter studyViewFilter,
@ApiIgnore // prevent reference to this attribute in the swagger-ui interface
@RequestAttribute(required = false, value = "involvedCancerStudies") Collection<String> involvedCancerStudies,
@ApiIgnore // prevent reference to this attribute in the swagger-ui interface. this attribute is needed for the @PreAuthorize tag above.
@Valid @RequestAttribute(required = false, value = "interceptedStudyViewFilter") StudyViewFilter interceptedStudyViewFilter
) throws StudyNotFoundException {
boolean singleStudyUnfiltered = studyViewFilterUtil.isSingleStudyUnfiltered(interceptedStudyViewFilter);
List<AlterationCountByGene> alterationCountByGenes = instance.cachedFetchMutatedGenes(interceptedStudyViewFilter, singleStudyUnfiltered);
return new ResponseEntity<>(alterationCountByGenes, HttpStatus.OK);
}

@Cacheable(
cacheResolver = "staticRepositoryCacheOneResolver",
Expand Down Expand Up @@ -304,33 +240,6 @@ public List<CopyNumberCountByGene> cacheableFetchCNAGenes(StudyViewFilter interc
return copyNumberCountByGenes;
}

@PreAuthorize("hasPermission(#involvedCancerStudies, 'Collection<CancerStudyId>', T(org.cbioportal.utils.security.AccessLevel).READ)")
@RequestMapping(value = "/filtered-samples/fetch", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation("Fetch sample IDs by study view filter")
public ResponseEntity<List<Sample>> fetchFilteredSamples(
@ApiParam("Whether to negate the study view filters")
@RequestParam(defaultValue = "false") Boolean negateFilters,
@ApiIgnore // prevent reference to this attribute in the swagger-ui interface
@RequestAttribute(required = false, value = "involvedCancerStudies") Collection<String> involvedCancerStudies,
@ApiIgnore // prevent reference to this attribute in the swagger-ui interface. this attribute is needed for the @PreAuthorize tag above.
@Valid @RequestAttribute(required = false, value = "interceptedStudyViewFilter") StudyViewFilter interceptedStudyViewFilter,
@ApiParam(required = true, value = "Study view filter")
@Valid @RequestBody(required = false) StudyViewFilter studyViewFilter) {

List<String> studyIds = new ArrayList<>();
List<String> sampleIds = new ArrayList<>();

studyViewFilterUtil.extractStudyAndSampleIds(
studyViewFilterApplier.apply(interceptedStudyViewFilter, negateFilters), studyIds, sampleIds);

List<Sample> result = new ArrayList<>();
if (!sampleIds.isEmpty()) {
result = sampleService.fetchSamples(studyIds, sampleIds, Projection.ID.name());
}
return new ResponseEntity<>(result, HttpStatus.OK);
}

@PreAuthorize("hasPermission(#involvedCancerStudies, 'Collection<CancerStudyId>', T(org.cbioportal.utils.security.AccessLevel).READ)")
@RequestMapping(value = "/molecular-profile-sample-counts/fetch", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,14 @@
@Validated
@Api(tags = "Study View Column Store")
public class StudyViewColumnStoreController {

private static final String COLUMN_STORE_ENDPOINT_PREFIX="/column-store";


@Autowired
private StudyViewService studyViewService;
@Autowired
private ClinicalDataBinUtil clinicalDataBinUtil;

@PreAuthorize("hasPermission(#involvedCancerStudies, 'Collection<CancerStudyId>', T(org.cbioportal.utils.security.AccessLevel).READ)")
@PostMapping(value = "/column-store/filtered-samples/fetch",
@PostMapping(value = "/filtered-samples/fetch",
consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation("Fetch sample IDs by study view filter")
public ResponseEntity<List<Sample>> fetchFilteredSamples(
Expand All @@ -72,7 +70,7 @@ public ResponseEntity<List<Sample>> fetchFilteredSamples(
}

@PreAuthorize("hasPermission(#involvedCancerStudies, 'Collection<CancerStudyId>', T(org.cbioportal.utils.security.AccessLevel).READ)")
@PostMapping(value = "/column-store/mutated-genes/fetch",
@PostMapping(value = "/mutated-genes/fetch",
consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation("Fetch mutated genes by study view filter")
public ResponseEntity<List<AlterationCountByGene>> fetchMutatedGenes(
Expand All @@ -98,7 +96,7 @@ public ResponseEntity<List<AlterationCountByGene>> fetchMutatedGenes(
}

@PreAuthorize("hasPermission(#involvedCancerStudies, 'Collection<CancerStudyId>', T(org.cbioportal.utils.security.AccessLevel).READ)")
@PostMapping(value = "/column-store/clinical-data-counts/fetch",
@PostMapping(value = "/clinical-data-counts/fetch",
consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation("Fetch clinical data counts by study view filter")
public ResponseEntity<List<ClinicalDataCountItem>> fetchClinicalDataCounts(
Expand All @@ -124,7 +122,7 @@ public ResponseEntity<List<ClinicalDataCountItem>> fetchClinicalDataCounts(
}

@PreAuthorize("hasPermission(#involvedCancerStudies, 'Collection<CancerStudyId>', T(org.cbioportal.utils.security.AccessLevel).READ)")
@RequestMapping(value = "/column-store/clinical-data-bin-counts/fetch", method = RequestMethod.POST,
@RequestMapping(value = "/clinical-data-bin-counts/fetch", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation("Fetch clinical data bin counts by study view filter")
public ResponseEntity<List<ClinicalDataBin>> fetchClinicalDataBinCounts(
Expand Down

0 comments on commit d555ccf

Please sign in to comment.