@Override public QueryResult<Interpretation> get(String studyStr, Query query, QueryOptions options, String sessionId) throws CatalogException { query = ParamUtils.defaultObject(query, Query::new); options = ParamUtils.defaultObject(options, QueryOptions::new); String userId = catalogManager.getUserManager().getUserId(sessionId); Study study = catalogManager.getStudyManager().resolveId(studyStr, userId); query.append(InterpretationDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid()); QueryResult<Interpretation> queryResult = interpretationDBAdaptor.get(query, options, userId); List<Interpretation> results = new ArrayList<>(queryResult.getResult().size()); for (Interpretation interpretation : queryResult.getResult()) { if (StringUtils.isNotEmpty(interpretation.getInterpretation().getClinicalAnalysisId())) { try { catalogManager.getClinicalAnalysisManager().smartResolutor(study.getUid(), interpretation.getInterpretation().getClinicalAnalysisId(), userId); results.add(interpretation); } catch (CatalogException e) { logger.debug("Removing interpretation " + interpretation.getUuid() + " from results. User " + userId + " does not have " + "proper permissions"); } } } queryResult.setResult(results); queryResult.setNumTotalResults(results.size()); queryResult.setNumResults(results.size()); return queryResult; }
InterpretationDBAdaptor.QueryParams.UID.key(), InterpretationDBAdaptor.QueryParams.STUDY_UID.key(), InterpretationDBAdaptor.QueryParams.ID.key(), InterpretationDBAdaptor.QueryParams.STATUS.key())); QueryResult<Interpretation> interpretationQueryResult = interpretationDBAdaptor.get(query, options, user); if (interpretationQueryResult.getNumResults() == 0) { interpretationQueryResult = interpretationDBAdaptor.get(query, options); if (interpretationQueryResult.getNumResults() == 0) { throw new CatalogException("Interpretation " + entry + " not found");