/** * Returns the page key for a content type listing page. * @param navigationKey Navigation key of the page. * @param contentType Content type of the page. * @return The requested key. */ public static PageKey contentType(final NavigationKey navigationKey, final ContentType contentType) { if (navigationKey == null) { return contentType(contentType); } return new ContentTypePage(navigationKey.withContentType(contentType)); }
private Device find(DeviceNameUse use, String name) { final DevicesInPortal dips = filterByUse(use); if (dips.containsName(name)) { return dips.getByName(name).getDevice(); } return null; }
/** * Returns the device represented by a first segment. * @param path Path to check. * @return The resolved device or {@code null} if no device is found. */ public final Device findDeviceByFirstSegment(PathSegments path) { if (path == null || path.isEmpty()) { return null; } return findDeviceByFirstSegment(path.get(0)); }
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; }
static Route toDevice(RenderContext context, Route route, String deviceName) { if (deviceName == null) { return route; } final DevicesInPortal dips = context.getPortal().getDevices(); if (dips.containsName(deviceName)) { final DeviceInPortal dip = dips.getByName(deviceName); return route.toDevice(dip.getDevice()); } return route; }
/** Image file. */ @FileBundle @Downloadable @Name("bundle") @Optional FileId bundle(); }
/** * @see com.isotrol.impe3.api.LocaleResolver#resolveLocale(com.isotrol.impe3.api.LocaleResolutionParams) */ public ResolvedLocale resolveLocale(LocaleResolutionParams params) { return new ResolvedLocale(params.getPath(), locale, params.getParameters()); }
/** * Returns a route to the specified destination. * @param context Request context. * @param page Destination page. * @param device Device performing the request. * @param locale Desired locale. * @return The requested route. */ public static Route of(RequestContext context, final PageKey page) { return of(context.isSecure(), page, context.getDevice(), context.getLocale()); }
/** * Returns a route to the specified destination. * @param secure Whether this route is through a secure channel, such as HTTPS. * @param context Client context. * @param page Destination page. * @return The requested route. */ public static Route of(boolean secure, ClientRequestContext context, final PageKey page) { return of(secure, page, context.getDevice(), context.getLocale()); }
/** * 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)); }
/** * Returns the device represented by a last segment. * @param path Path to check. * @return The resolved device or {@code null} if no device is found. */ public final Device findDeviceByLastSegment(PathSegments path) { if (path == null || path.isEmpty()) { return null; } return findDeviceByLastSegment(path.last()); }
/** * Returns the device represented by a last segment extension. * @param path Path to check. * @return The resolved device or {@code null} if no device is found. */ public final Device findDeviceByLastSegmentExtension(PathSegments path) { if (path == null || path.isEmpty()) { return null; } return findDeviceByLastSegmentExtension(path.last()); }
public Object apply(List<String> args) throws TemplateModelException { final ContentType contentType = getContentType(context, args, 1); if (contentType == null) { return EMPTY; } final Category category = getCategory(context, args, 0); if (category == null) { return EMPTY; } final PageKey key = PageKey.contentType(NavigationKey.category(category), contentType); return returnUri(context, key, args, 2); } };
/** * Returns the page key for a content type listing page without navegation key. * @param contentType Content type of the page. * @return The requested key. */ public static PageKey contentType(ContentType contentType) { return new ContentTypePage(NavigationKey.contentType(contentType)); }
/** * Returns the device represented by a last segment extension. * @param segment Segment to check. * @return The resolved device or {@code null} if no device is found. */ public final Device findDeviceByLastSegmentExtension(String segment) { final String extension = PathSegments.getExtension(checkSegment(segment)); if (extension != null) { return findDeviceByExtension(extension); } return null; }
/** CSS Bundle. */ @Name("bundle") @FileBundle @Downloadable @Optional FileId bundle();