@Override public LocalizedString getSlug() { return delegate.getSlug(); }
@Override public LocalizedStrings getSlug() { return delegate.getSlug(); }
@Override public LocalizedStrings getSlug() { return delegate.getSlug(); }
@Override public LocalizedString getSlug() { return delegate.getSlug(); }
@Override public LocalizedString getSlug() { return delegate.getSlug(); }
private static Map<LocaleSlugPair, Category> buildBySlugMap(final Collection<Category> categories) { final Map<LocaleSlugPair, Category> map = new HashMap<>(); for (final Category category : categories) { for (final Locale locale : category.getSlug().getLocales()) { map.put(new LocaleSlugPair(locale, category.getSlug().get(locale).get()), category); } } return map; }
private Map<LocalizedStringEntry, Category> getLocalizedStringEntryCategoryMap(final List<Category> allCategoriesAsFlatList) { final Map<LocalizedStringEntry, Category> categoriesByLocaleAndSlug = new HashMap<>(); allCategoriesAsFlatList.forEach(category -> { final Set<Locale> localesForTheCategory = category.getSlug().getLocales(); localesForTheCategory.forEach(locale -> { final LocalizedStringEntry stringsEntry = LocalizedStringEntry.of(locale, category.getSlug().get(locale)); categoriesByLocaleAndSlug.put(stringsEntry, category); }); }); return categoriesByLocaleAndSlug; }
private static Map<LocaleSlugPair, Category> buildBySlugMap(final Collection<Category> categories) { final Map<LocaleSlugPair, Category> map = new HashMap<>(); for (final Category category : categories) { for (final Locale locale : category.getSlug().getLocales()) { map.put(new LocaleSlugPair(locale, category.getSlug().get(locale).get()), category); } } return map; }
private Map<LocalizedStringEntry, Category> getLocalizedStringEntryCategoryMap(final List<Category> allCategoriesAsFlatList) { final Map<LocalizedStringEntry, Category> categoriesByLocaleAndSlug = new HashMap<>(); allCategoriesAsFlatList.forEach(category -> { final Set<Locale> localesForTheCategory = category.getSlug().getLocales(); localesForTheCategory.forEach(locale -> { final LocalizedStringEntry stringsEntry = LocalizedStringEntry.of(locale, category.getSlug().get(locale)); categoriesByLocaleAndSlug.put(stringsEntry, category); }); }); return categoriesByLocaleAndSlug; }
private static Map<LocaleSlugPair, Category> buildBySlugMap(final Collection<Category> categories) { final Map<LocaleSlugPair, Category> map = new HashMap<>(); for (final Category category : categories) { for (final Locale locale : category.getSlug().getLocales()) { map.put(new LocaleSlugPair(locale, category.getSlug().get(locale).get()), category); } } return map; }
default Optional<Call> productOverviewPageCall(final Locale locale, final Category category) { return category.getSlug().find(locale) .map(slug -> productOverviewPageCall(locale.toLanguageTag(), slug)); }
public static String toString(final Category category) { final List<String> pathInTreeIds = category.getPathInTree().stream().map(Category::getId).collect(toList()); return new ToStringBuilder(category). append("id", category.getId()). append("version", category.getVersion()). append("createdAt", category.getCreatedAt()). append("lastModifiedAt", category.getLastModifiedAt()). append("name", category.getName()). append("slug", category.getSlug()). append("description", category.getDescription()). append("ancestors", join(category.getAncestors())). append("parent", category.getParent()). append("orderHint", category.getOrderHint()). append("children", category.getChildren()). append("pathInTree", join(pathInTreeIds)).toString(); } }
@Test public void fetchAll() throws Exception { final CompletionStage<List<Category>> categoriesStage = QueryExecutionUtils.queryAll(client(), CategoryQuery.of(), 500); final List<Category> categories = SphereClientUtils.blockingWait(categoriesStage, Duration.ofMinutes(1)); assertThat(categories) .hasSize(15) .matches(cats -> cats.parallelStream().anyMatch(cat -> cat.getSlug().get(ENGLISH).equals("boots-women"))); }
@Test public void fetchAll_withMapper() throws Exception { final CompletionStage<List<Category>> categoriesStage = QueryExecutionUtils .queryAll(client(), CategoryQuery.of(), category -> category, 500); final List<Category> categories = SphereClientUtils .blockingWait(categoriesStage, Duration.ofMinutes(1)); assertThat(categories) .hasSize(15) .matches(cats -> cats.parallelStream().anyMatch(cat -> cat.getSlug().get(ENGLISH).equals("boots-women"))); }
@Test public void changeSlug() throws Exception { withCategory(client(), category -> { final LocalizedString newSug = randomSlug(); final CategoryUpdateCommand command = CategoryUpdateCommand.of(category, ChangeSlug.of(newSug)); final Category updatedCategory = client().executeBlocking(command); assertThat(updatedCategory.getSlug()).isEqualTo(newSug); }); }
public static CategoryBuilder of(final Category category) { return new CategoryBuilder(category.getId(), category.getName(), category.getSlug()). version(category.getVersion()).createdAt(category.getCreatedAt()). lastModifiedAt(category.getLastModifiedAt()). name(category.getName()).slug(category.getSlug()).description(category.getDescription()). ancestors(category.getAncestors()).parent(category.getParent()). orderHint(category.getOrderHint()).children(category.getChildren()). pathInTree(category.getPathInTree()); }
public static CategoryBuilder of(final Category category) { return new CategoryBuilder(category.getId(), category.getName(), category.getSlug()). version(category.getVersion()).createdAt(category.getCreatedAt()). lastModifiedAt(category.getLastModifiedAt()). name(category.getName()).slug(category.getSlug()).description(category.getDescription()). ancestors(category.getAncestors()).parent(category.getParent()). orderHint(category.getOrderHint()).externalId(category.getExternalId()).children(category.getChildren()). pathInTree(category.getPathInTree()); }
public static CategoryBuilder of(final Category category) { return new CategoryBuilder(category.getId(), category.getName(), category.getSlug()). version(category.getVersion()).createdAt(category.getCreatedAt()). lastModifiedAt(category.getLastModifiedAt()). name(category.getName()).slug(category.getSlug()).description(category.getDescription()). ancestors(category.getAncestors()).parent(category.getParent()). orderHint(category.getOrderHint()).externalId(category.getExternalId()).children(category.getChildren()). pathInTree(category.getPathInTree()); }
/** * Creates a new object initialized with the fields of the template parameter. * * @param template the template * @return a new object initialized from the template */ public static CategoryDraftBuilder of(final Category template) { return new CategoryDraftBuilder(copyAssets(template.getAssets()), copyCustom(template.getCustom()), template.getDescription(), template.getExternalId(), template.getKey(), template.getMetaDescription(), template.getMetaKeywords(), template.getMetaTitle(), template.getName(), template.getOrderHint(), template.getParent(), template.getSlug()); } }
public static CategoryBuilder of(final Category category) { return new CategoryBuilder(category.getId(), category.getName(), category.getSlug()). version(category.getVersion()).createdAt(category.getCreatedAt()). lastModifiedAt(category.getLastModifiedAt()). name(category.getName()).slug(category.getSlug()).description(category.getDescription()). ancestors(category.getAncestors()).parent(category.getParent()).assets(category.getAssets()). orderHint(category.getOrderHint()).externalId(category.getExternalId()); }