private Set<String> getPortletCategories(IPortletDefinition pdef) { Set<PortletCategory> categories = portletCategoryRegistry.getParentCategories(pdef); Set<String> rslt = new HashSet<String>(); for (PortletCategory category : categories) { rslt.add(StringUtils.capitalize(category.getName().toLowerCase())); } return rslt; }
/** * Initialize related portlets. This must be called lazily so that MarketplacePortletDefinitions * instantiated as related portlets off of a MarketplacePortletDefinition do not always * instantiate their related MarketplacePortletDefinitions, ad infinitem. */ private void initRelatedPortlets() { final Set<MarketplacePortletDefinition> allRelatedPortlets = new HashSet<>(); for (PortletCategory parentCategory : this.portletCategoryRegistry.getParentCategories(this)) { final Set<IPortletDefinition> portletsInCategory = this.portletCategoryRegistry.getAllChildPortlets(parentCategory); for (IPortletDefinition portletDefinition : portletsInCategory) { allRelatedPortlets.add( new MarketplacePortletDefinition( portletDefinition, this.marketplaceService, this.portletCategoryRegistry)); } } allRelatedPortlets.remove(this); this.relatedPortlets = allRelatedPortlets; }
/** * private method that sets the parentCategories field and the categories field This will ensure * that the public methods {@link #getParentCategories() getParentCategories()} and {@link * #getCategories() getCategories()} will not return null. Empty sets are allowed */ private void initCategories() { Set<PortletCategory> allCategories = new HashSet<PortletCategory>(); this.setParentCategories(this.portletCategoryRegistry.getParentCategories(this)); for (PortletCategory childCategory : this.parentCategories) { allCategories.add(childCategory); allCategories.addAll( this.portletCategoryRegistry.getAllParentCategories(childCategory)); } this.setCategories(allCategories); }
Set<PortletCategory> categories = portletCategoryRegistry.getParentCategories(def); SortedSet<JsonEntityBean> categoryBeans = new TreeSet<>(); for (PortletCategory cat : categories) { String id = category.getId(); String iCatID = id.startsWith("cat") ? id.substring(3) : id; categories.add(portletCategoryRegistry.getPortletCategory(iCatID));
portletCategoryRegistry.getTopLevelPortletCategory(); // default if (StringUtils.isNotBlank(categoryId)) { rootCategory = portletCategoryRegistry.getPortletCategory(categoryId); includeUncategorizedPortlets = false; } else if (StringUtils.isNotBlank(categoryName)) { rootCategory = portletCategoryRegistry.getPortletCategoryByName(categoryName); includeUncategorizedPortlets = false;
if (cats != null && cats.length > 0) { PortletCategory pc = portletCategoryRegistry.getPortletCategory(cats[0].getKey()); if (pc != null) { portletCategories.add(pc);
categoryList.remove(this.portletCategoryRegistry.getTopLevelPortletCategory());
/** Called recursively to gather all specified categories and descendants */ private void collectSpecifiedAndDescendantCategories( PortletCategory specified, Set<PortletCategory> gathered) { final Set<PortletCategory> children = portletCategoryRegistry.getAllChildCategories(specified); for (PortletCategory child : children) { collectSpecifiedAndDescendantCategories(child, gathered); } gathered.add(specified); }
category = portletCategoryRegistry.getPortletCategory(cats[0].getKey()); } else { category = portletCategoryRegistry.getPortletCategory(categoryName);
final PortletCategory rootCategory = portletCategoryRegistry.getTopLevelPortletCategory(); final Locale locale = getUserLocale(user); categories.add(
@Override public Set<MarketplaceEntry> featuredEntriesForUser( final IPerson user, final Set<PortletCategory> categories) { Validate.notNull(user, "Cannot determine relevant featured portlets for null user."); final Set<MarketplaceEntry> browseablePortlets = browseableMarketplaceEntriesFor(user, categories); final Set<MarketplaceEntry> featuredPortlets = new HashSet<>(); for (final MarketplaceEntry entry : browseablePortlets) { final IPortletDefinition portletDefinition = entry.getMarketplacePortletDefinition(); for (final PortletCategory category : this.portletCategoryRegistry.getParentCategories(portletDefinition)) { if (FEATURED_CATEGORY_NAME.equalsIgnoreCase(category.getName())) { featuredPortlets.add(entry); } } } return featuredPortlets; }
/** * private method that sets the parentCategories field and the categories field This will ensure * that the public methods {@link #getParentCategories() getParentCategories()} and {@link * #getCategories() getCategories()} will not return null. Empty sets are allowed */ private void initCategories() { Set<PortletCategory> allCategories = new HashSet<PortletCategory>(); this.setParentCategories(this.portletCategoryRegistry.getParentCategories(this)); for (PortletCategory childCategory : this.parentCategories) { allCategories.add(childCategory); allCategories.addAll( this.portletCategoryRegistry.getAllParentCategories(childCategory)); } this.setCategories(allCategories); }
/** * Initialize related portlets. This must be called lazily so that MarketplacePortletDefinitions * instantiated as related portlets off of a MarketplacePortletDefinition do not always * instantiate their related MarketplacePortletDefinitions, ad infinitem. */ private void initRelatedPortlets() { final Set<MarketplacePortletDefinition> allRelatedPortlets = new HashSet<>(); for (PortletCategory parentCategory : this.portletCategoryRegistry.getParentCategories(this)) { final Set<IPortletDefinition> portletsInCategory = this.portletCategoryRegistry.getAllChildPortlets(parentCategory); for (IPortletDefinition portletDefinition : portletsInCategory) { allRelatedPortlets.add( new MarketplacePortletDefinition( portletDefinition, this.marketplaceService, this.portletCategoryRegistry)); } } allRelatedPortlets.remove(this); this.relatedPortlets = allRelatedPortlets; }
IPortletDefinition portletDefinition = entry.getMarketplacePortletDefinition(); for (final PortletCategory category : this.portletCategoryRegistry.getParentCategories(portletDefinition)) {
allDisplayablePortletDefinitions) { final Set<PortletCategory> parents = portletCategoryRegistry.getParentCategories(portletDefinition); for (final PortletCategory parent : parents) { if (allSpecifiedAndDecendantCategories.contains(parent)) {
Set<PortletCategory> categories = portletCategoryRegistry.getParentCategories(def); for (PortletCategory cat : categories) { form.addCategory(new JsonEntityBean(cat));