/** * Given an HttpServletRequest, determine all cancer_study_ids associated with it. cancer study * identifiers can be inferred from profile_ids, case_list_ids, or case_ids. this returns the set * of ALL POSSIBLE cancer study identifiers * * @param request * @return the cancer_study_ids associated with the request, which will be empty if none can be * determined; or empty set if a problem arises. * @throws DaoException * @throws ProtocolException */ public static HashSet<String> getCancerStudyIDs(HttpServletRequest request) throws DaoException, ProtocolException { HashSet<String> cancerStudies = new HashSet<String>(); // a CANCER_STUDY_ID is explicitly provided, as in getGeneticProfiles, getCaseLists, etc. // make sure the cancer_study_id provided in the request points to a real study String studyIDstring = getCancerStudyId(request); if (studyIDstring != null) { if (DaoCancerStudy.doesCancerStudyExistByStableId(studyIDstring)) { cancerStudies.add(studyIDstring); } return cancerStudies; } // a genetic_profile_id is explicitly provided, as in getProfileData if (null != request.getParameter(WebService.GENETIC_PROFILE_ID)) { ArrayList<String> geneticProfileIds = getGeneticProfileId(request); for (String geneticProfileId : geneticProfileIds) { // that's the point of this code?? // if (geneticProfileId == null) { // return cancerStudies; // } GeneticProfile aGeneticProfile = DaoGeneticProfile.getGeneticProfileByStableId(geneticProfileId); if (aGeneticProfile != null && DaoCancerStudy.doesCancerStudyExistByInternalId( aGeneticProfile.getCancerStudyId())) { cancerStudies.add( DaoCancerStudy.getCancerStudyByInternalId(aGeneticProfile.getCancerStudyId()) .getCancerStudyStableId()); } } return cancerStudies; } // a patient_set_id is explicitly provided, as in getProfileData, getMutationData, // getClinicalData, etc. String sampleSetId = request.getParameter(WebService.CASE_SET_ID); if (sampleSetId != null) { DaoSampleList aDaoSampleList = new DaoSampleList(); SampleList aSampleList = aDaoSampleList.getSampleListByStableId(sampleSetId); if (aSampleList != null && DaoCancerStudy.doesCancerStudyExistByInternalId(aSampleList.getCancerStudyId())) { cancerStudies.add( DaoCancerStudy.getCancerStudyByInternalId(aSampleList.getCancerStudyId()) .getCancerStudyStableId()); } return cancerStudies; } return cancerStudies; }