/** * Obtains the resource java beans containing the requested entries. * * @param entryStr Entry id in string format. * @param studyStr Study id in string format. Could be one of [id|user@aliasProject:aliasStudy|aliasProject:aliasStudy|aliasStudy]. * @param sessionId Session id of the user logged. * @return the resource java beans containing the requested entries. * @throws CatalogException when more than one entry is found. */ public AbstractManager.MyResources<R> getUids(String entryStr, @Nullable String studyStr, String sessionId) throws CatalogException { return getUids(Arrays.asList(entryStr.split(",")), studyStr, sessionId); }
/** * Fetch all the R objects matching the query. * * @param studyStr Study id in string format. Could be one of [id|user@aliasProject:aliasStudy|aliasProject:aliasStudy|aliasStudy]. * @param entryList Comma separated list of entries to be fetched. * @param query Query object. * @param options QueryOptions object, like "include", "exclude", "limit" and "skip". * @param sessionId sessionId * @return All matching elements. * @throws CatalogException CatalogException. */ public List<QueryResult<R>> get(String studyStr, List<String> entryList, Query query, QueryOptions options, String sessionId) throws CatalogException { List<QueryResult<R>> resultList = new ArrayList<>(entryList.size()); query = ParamUtils.defaultObject(query, Query::new); MyResources<R> resource = getUids(entryList, studyStr, sessionId); List<Long> resourceIds = resource.getResourceList().stream().map(R::getUid).collect(Collectors.toList()); for (int i = 0; i < resourceIds.size(); i++) { Long entityId = resourceIds.get(i); Query queryCopy = new Query(query); queryCopy.put("uid", entityId); QueryResult<R> rQueryResult = get(studyStr, queryCopy, options, sessionId); rQueryResult.setId(entryList.get(i)); resultList.add(rQueryResult); } return resultList; }