public Object apply(List<String> args) throws TemplateModelException { final Category category = getCategory(context, args, 0); if (category == null) { return EMPTY; } final PageKey key = PageKey.navigation(category); return returnUri(context, key, args, 1); } };
public Object apply(List<String> args) throws TemplateModelException { final Category category = getCategoryByPath(context, args, 0); if (category == null) { return EMPTY; } final PageKey key = PageKey.navigation(category); return returnUri(context, key, args, 1); } };
public TemplateModel get(final PortalObjectWrapper wrapper, final NavigationKey object) throws TemplateModelException { final PageKey pk = PageKey.navigation(object); return wrapper.wrap(pk); } };
/** * Returns the page key for a category navigation page. * @param category Category. * @return The requested key. */ public static PageKey navigation(final Category category) { return navigation(NavigationKey.category(category)); }
public Object apply(List<String> args) throws TemplateModelException { final NavigationKey nk = context.getNavigationKey(); final PageKey key; if (nk == null) { key = PageKey.main(); } else { key = PageKey.navigation(nk); } return returnUri(context, key, args, 1); } };
/** * Adds items related to a category. * * @param category * Category to add. */ protected final void add(Category category) { if (category == null || !categories.containsKey(category.getId())) { return; } final List<Category> cats = newLinkedList(); Category parent; while ((parent = categories.getParent(category.getId())) != null) { cats.add(0, category); category = parent; } for (Category c : cats) { add(c.getName().get(locale).getDisplayName(), getURI(PageKey .navigation(c))); } }
private CloudItem createItem(Category category, int hits, int totalHits) { final NavigationKey nk = NavigationKey.category(category); final PageKey pk = PageKey.navigation(nk); final Route r = (route != null) ? route.toPage(pk) : Route.of(false, pk, null, null); final URI uri = uriGenerator.getURI(r); final Name name = (locale != null) ? category.getName().get(locale) : category.getDefaultName(); return new CloudItem(name.getDisplayName(), uri, Math.ceil(hits / totalHits)); } }
protected MenuItem createItem(Category category, Predicate<Category> selected) { URI uri = null; if(category.isRoutable()) { final NavigationKey nk = NavigationKey.category(category); final PageKey pk = PageKey.navigation(nk); final Route r = (route != null) ? route.toPage(pk) : Route.of(false, pk, null, null); uri = uriGenerator.getURI(r); } final Name name = (locale != null) ? category.getName().get(locale) : category.getDefaultName(); final MenuItem item = new MenuItem(name.getDisplayName(), uri, selected.apply(category)); return item; }
private CloudItem createItem(ContentType contentType, int hits, int totalHits) { final NavigationKey nk = NavigationKey.contentType(contentType); final PageKey pk = PageKey.navigation(nk); final Route r = (route != null) ? route.toPage(pk) : Route.of(false, pk, null, null); final URI uri = uriGenerator.getURI(r); final Name name = (locale != null) ? contentType.getName().get(locale) : contentType.getDefaultName(); return new CloudItem(name.getDisplayName(), uri, Math.ceil(hits / totalHits)); } }
String getA(final RenderContext context) { if (config == null) { return null; } final Category cg = config.category(); final ContentType ct = config.contentType(); PageKey pk = null; if (cg != null && ct != null) { pk = PageKey.contentType(NavigationKey.category(cg, ct)); } else if (ct != null) { pk = PageKey.contentType(ct); } else if (cg != null) { pk = PageKey.navigation(cg); } if (pk != null) { return context.getURI(pk).toASCIIString(); } return config.link(); }
/** Component execution. */ public ComponentResponse execute() { ContentType c = getDestination(); if (c == null) { // Nothing to do return ComponentResponse.OK; } NavigationKey nk = navigationKey; if (nk == null || !keepNavigationKey) { nk = NavigationKey.contentType(c); } else { nk = nk.withContentType(c); } final PageKey pk = PageKey.navigation(nk); final Route r = getRoute().toPage(pk); // External if (type != null && type.booleanValue()) { return ComponentResponse.seeOther(replaceQuery(getUriGenerator().getAbsoluteURI(r), query)); } else { return ComponentResponse.internal(r); } }
pk = PageKey.content(NavigationKey.category(c), contentKey); } else { pk = PageKey.navigation(c); contentKey = null;
pk = PageKey.navigation(cg);
protected MenuItem createItem(ContentType contentType) { final NavigationKey nk; if (config.navigation() && context.getNavigationKey() != null && context.getNavigationKey().isCategory()) { nk = NavigationKey.category(context.getNavigationKey().getCategory(), contentType); } else { nk = NavigationKey.contentType(contentType); } final PageKey pk = PageKey.navigation(nk); final Route r = (route != null) ? route.toPage(pk) : Route.of(false, pk, null, null); final URI uri = uriGenerator.getURI(r); final Name name = (locale != null) ? contentType.getName().get(locale) : contentType.getDefaultName(); final MenuItem item = new MenuItem(name.getDisplayName(), uri); return item; }