public String apply(PortalObject from) { return from.getName().getDisplayName(); } });
public NamePB apply(Name from) { NamePB.Builder b = NamePB.newBuilder(); b.setDisplayName(from.getDisplayName()); if (from.getPath() != null) { b.setPath(from.getPath()); } return b.build(); } }
/** * Returns a new content type with specified id and localized name. * @param displayName Display name. * @param path Path segment. * @return The requested content type. */ public static Name of(final String displayName, final String path) { Preconditions.checkNotNull(displayName); return new Name(displayName, path); }
public TemplateModel get(final PortalObjectWrapper wrapper, final NamedIdentifiable object) { return new SimpleScalar(n(wrapper, object).getPath()); } },
public static Name value2name(NameValue value) { return Name.of(value.getName(), value.getPath()); }
public TemplateModel get(final PortalObjectWrapper wrapper, final NamedIdentifiable object) { return new SimpleScalar(object.getName().get().getPath()); } };
public TemplateModel get(final PortalObjectWrapper wrapper, final NamedIdentifiable object) { return new SimpleScalar(n(wrapper, object).getDisplayName()); } },
public NameDTO apply(Name from) { if (from == null) { return null; } final NameDTO dto = new NameDTO(); dto.setDisplayName(from.getDisplayName()); dto.setPath(from.getPath()); return dto; } };
@Override public String toString() { return String.format("CT[%s:%s]", getStringId(), getDefaultName().getDisplayName()); }
@Override public String toString() { return String.format("CG[%s:%s]", getStringId(), getDefaultName().getDisplayName()); }
/** Returns the category path using the display name as segments. */ public String getDisplayPath(UUID id) { CategoryObject c = hierarchy.get(id); checkArgument(c != null, "Category [%s] not found", id); StringBuilder b = new StringBuilder("/"); List<String> list = Lists.newLinkedList(); CategoryObject p = hierarchy.getParent(id); while (p != null) { list.add(0, c.getDefaultName().getDisplayName()); c = p; p = hierarchy.getParent(c.getId()); } JOINER.appendTo(b, list); return b.toString(); }
public static SyndCategory category(Category category) { final SyndCategory c = new SyndCategoryImpl(); c.setName(category.getDefaultName().getDisplayName()); return c; }
public TemplateModel get(final PortalObjectWrapper wrapper, final NamedIdentifiable object) { return new SimpleScalar(object.getName().get().getDisplayName()); } },
/** * Adds an item related to a content type. * * @param contentType * Content type to add. * @param navigation * Navigation to use. */ protected final void add(ContentType contentType, NavigationKey navigationKey) { if (contentType == null) { return; } final PageKey pk = PageKey.contentType(navigationKey, contentType); add(contentType.getName().get(locale).getDisplayName(), pk); }
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)); } }
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)); } }
/** * 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))); } }
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; }
/** * Transforms the object to a selection DTO. * @return The selection DTO. */ public PortalSelDTO toSelDTO() { final PortalSelDTO dto = new PortalSelDTO(); dto.setId(getStringId()); dto.setState(getState()); dto.setName(name.getDisplayName()); dto.setDescription(description); return dto; }
Set<DeviceInPortal> dm = ImmutableSet.copyOf(Iterables.transform(devices.get().devices.values(), u2d)); Portal.Builder b = Portal.builder().setId(getId()).setMode(model.getMode()).setDevice(defaultDevice) .setName(name.getDisplayName()).setContentTypes(model.getContentTypes()) .setCategories(model.getCategories()).setBases(ubases).setProperties(getActiveProperties(portals)) .setUncategorized(isUncategorized(portals)).setDue(isDue(portals))