@Override
public QueryResult<AnnotationSet> getAnnotationSet(long id, @Nullable String annotationSetName) throws CatalogDBException {
QueryOptions queryOptions = new QueryOptions();
List<String> includeList = new ArrayList<>();
if (StringUtils.isNotEmpty(annotationSetName)) {
includeList.add(Constants.ANNOTATION_SET_NAME + "." + annotationSetName);
} else {
includeList.add(QueryParams.ANNOTATION_SETS.key());
}
queryOptions.put(QueryOptions.INCLUDE, includeList);
QueryResult<Cohort> cohortQueryResult = get(id, queryOptions);
if (cohortQueryResult.first().getAnnotationSets().isEmpty()) {
return new QueryResult<>("Get annotation set", cohortQueryResult.getDbTime(), 0, 0, cohortQueryResult.getWarningMsg(),
cohortQueryResult.getErrorMsg(), Collections.emptyList());
} else {
List<AnnotationSet> annotationSets = cohortQueryResult.first().getAnnotationSets();
int size = annotationSets.size();
return new QueryResult<>("Get annotation set", cohortQueryResult.getDbTime(), size, size, cohortQueryResult.getWarningMsg(),
cohortQueryResult.getErrorMsg(), annotationSets);
}
}