/** * Returns the subcategories of a facet field, given CategoryDrillDownRequestBean * * @param drillDownRequest The category drilldown object which contains the category drilldown * information * @return SubCategoriesBean instance that contains the immediate category information * @throws AnalyticsWebServiceException */ public SubCategoriesBean drillDownCategories(CategoryDrillDownRequestBean drillDownRequest) throws AnalyticsWebServiceException { SubCategoriesBean subCategoriesBean = new SubCategoriesBean(); try { SubCategories subCategories = analyticsDataAPI.drillDownCategories( getUsername(), getCategoryDrillDownRequest(drillDownRequest)); subCategoriesBean.setPath(subCategories.getPath()); if (subCategories.getCategories() != null) { subCategoriesBean.setCategories(getSearchResultEntryBeans(subCategories)); } } catch (Exception e) { logger.error( "Unable to get drill down category information for table[" + drillDownRequest.getTableName() + "] and " + "field[" + drillDownRequest.getFieldName() + "] due to " + e.getMessage(), e); throw new AnalyticsWebServiceException( "Unable to get drill down category information for " + "table[" + drillDownRequest.getTableName() + "] and " + "field[" + drillDownRequest.getFieldName() + "] due to " + e.getMessage(), e); } return subCategoriesBean; }
private CategorySearchResultEntryBean[] getSearchResultEntryBeans(SubCategories subCategories) { CategorySearchResultEntryBean[] searchResultEntryBeans = new CategorySearchResultEntryBean[subCategories.getCategories().size()]; int i = 0; for (CategorySearchResultEntry searchResultEntry : subCategories.getCategories()) { CategorySearchResultEntryBean resultEntryBean = new CategorySearchResultEntryBean(); resultEntryBean.setCategoryName(searchResultEntry.getCategoryValue()); resultEntryBean.setScore(searchResultEntry.getScore()); searchResultEntryBeans[i++] = resultEntryBean; } return searchResultEntryBeans; }