private ContentTypePage(final NavigationKey navigationKey) { super(navigationKey); checkArgument(navigationKey.isContentType()); }
/** * Returns the page key for a content type listing page. * @param navigationKey Navigation key of the page. * @return The requested key. */ public static PageKey contentType(final NavigationKey navigationKey) { checkNotNull(navigationKey); checkArgument(navigationKey.isContentType()); return new ContentTypePage(navigationKey); }
public NavigationKey withoutContentType() { if (!isContentType()) { return this; } if (category == null && tag == null) { return null; } return new NavigationKey(category, tag, null); }
/** * Returns the page key for a content page. * @param navigationKey Navigation key of the page. * @param contentKey Content key of the page. * @return The requested key. */ public static PageKey content(final NavigationKey navigationKey, final ContentKey contentKey) { checkNotNull(contentKey); checkArgument(navigationKey == null || !navigationKey.isContentType()); return new ContentPage(navigationKey, contentKey); }
/** * Returns the page key for a navigation page. * @param navigationKey Navigation key of the page. * @return The requested key. */ public static PageKey navigation(final NavigationKey navigationKey) { checkNotNull(navigationKey); return navigationKey.isContentType() ? new ContentTypePage(navigationKey) : new NavigationPage(navigationKey); }
private void goTo(Category category) { final boolean keepContentType = config.keepContentType().booleanValue(); if (keepContentType && navigationKey.isContentType()) { navigationKey = NavigationKey.category(category, navigationKey.getContentType()); } else if (category != null) { navigationKey = NavigationKey.category(category); } else { navigationKey = null; } }
/** Component execution. */ public ComponentResponse execute() { if (config == null) { return ComponentResponse.OK; } final Category category = config.category(); final boolean keepContentType = config.keepContentType().booleanValue(); if (navigationKey == null) { if (category != null) { navigationKey = NavigationKey.category(category); } } else { if (keepContentType && navigationKey.isContentType()) { navigationKey = NavigationKey.category(category, navigationKey.getContentType()); } else if (category != null) { navigationKey = NavigationKey.category(category); } else { navigationKey = null; } } return ComponentResponse.OK; }
/** * Adds items related to a navigation. * * @param navigationKey * Navigation to add. * @param category * True if the category navigation must be included. * @param contentType * True if the content type navigation must be included. */ protected final void add(NavigationKey navigationKey, boolean category, boolean contentType) { if (navigationKey == null || config == null) { return; } if (category && navigationKey.isCategory()) { add(navigationKey.getCategory()); } if (contentType && navigationKey.isContentType()) { add(navigationKey.getContentType(), navigationKey); } }
public ComponentResponse execute() { final ContentCriteria criteria = contentLoader.newCriteria(); pagination = loadPagination(Pagination.SIZE); if (componentConfig.navigation() && navigationKey != null) { if (navigationKey.isCategory()) { criteria.categories().apply(navigationKey.getCategory(), FilterType.REQUIRED); } if (navigationKey.isContentType()) { criteria.contentTypes().apply(navigationKey.getContentType(), FilterType.REQUIRED); } /* * if (navigationKey.isCategory() && navigationKey.isContentType()) { * criteria.category(navigationKey.getCategory()).contentType(navigationKey.getContentType()); } else if * (navigationKey.isCategory() && !navigationKey.isContentType()) { * criteria.category(navigationKey.getCategory()); } else if (!navigationKey.isCategory() && * navigationKey.isContentType()) { * * } */ } final List<String> f = fields(); if (param != null && !"".equals(param.trim()) && !f.isEmpty()) { criteria.must(NodeQueries.anyString(param, f)); } setPage(criteria.getPage(pagination)); return ComponentResponse.OK; }