Skip to content

Commit

Permalink
Revert original Study View endpoints (cBioPortal#10216)
Browse files Browse the repository at this point in the history
* revert study view controller original endpoints and rename clickhouse endpoints

* add mybatiscolumnstore to test application context
  • Loading branch information
onursumer authored and jagnathan committed Nov 8, 2023
1 parent c1bdbda commit cfb6c7d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/test/resources/applicationContext-dao.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

<!-- scan for mappers and let them be autowired -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="org.mskcc.cbio.portal.persistence,org.cbioportal.persistence.mybatis" />
<property name="basePackage" value="org.mskcc.cbio.portal.persistence,org.cbioportal.persistence.mybatis,org.cbioportal.persistence.mybatiscolumnstore" />
</bean>

<!-- enable component scanning (beware that this does not enable mapper scanning!) -->
Expand Down
44 changes: 44 additions & 0 deletions web/src/main/java/org/cbioportal/web/StudyViewController.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,23 @@ public ResponseEntity<List<AlterationCountByGene>> fetchMutatedGenes(
@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);
}

@PreAuthorize("hasPermission(#involvedCancerStudies, 'Collection<CancerStudyId>', T(org.cbioportal.utils.security.AccessLevel).READ)")
@RequestMapping(value = "/column-store/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>> fetchMutatedGenesFromColumnStore(
@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
) {
return new ResponseEntity<>(
studyViewService.getMutatedGenesFromColumnstore(interceptedStudyViewFilter),
Expand Down Expand Up @@ -319,6 +336,33 @@ public ResponseEntity<List<Sample>> fetchFilteredSamples(
@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 = "/column-store/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>> fetchFilteredSamplesFromColumnStore(
@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) {

return new ResponseEntity<>(
studyViewService.getFilteredSamplesFromColumnstore(interceptedStudyViewFilter),
HttpStatus.OK
Expand Down

0 comments on commit cfb6c7d

Please sign in to comment.