public interface ProductDraft extends WithLocalizedSlug, MetaAttributes, WithKey
Product
.ProductDraftBuilder
,
ProductCreateCommand
Modifier and Type | Method and Description |
---|---|
Set<ResourceIdentifier<Category>> |
getCategories() |
CategoryOrderHints |
getCategoryOrderHints() |
LocalizedString |
getDescription() |
String |
getKey() |
ProductVariantDraft |
getMasterVariant() |
LocalizedString |
getMetaDescription() |
LocalizedString |
getMetaKeywords() |
LocalizedString |
getMetaTitle() |
LocalizedString |
getName() |
ResourceIdentifier<ProductType> |
getProductType() |
SearchKeywords |
getSearchKeywords() |
LocalizedString |
getSlug() |
ResourceIdentifier<State> |
getState() |
ResourceIdentifier<TaxCategory> |
getTaxCategory() |
List<ProductVariantDraft> |
getVariants() |
Boolean |
isPublish()
Flag for publishing the product immediately.
|
metaAttributesOf, metaAttributesOf
LocalizedString getName()
ResourceIdentifier<ProductType> getProductType()
LocalizedString getSlug()
getSlug
in interface WithLocalizedSlug
@Nullable LocalizedString getDescription()
Set<ResourceIdentifier<Category>> getCategories()
@Nullable LocalizedString getMetaTitle()
getMetaTitle
in interface MetaAttributes
@Nullable LocalizedString getMetaDescription()
getMetaDescription
in interface MetaAttributes
@Nullable LocalizedString getMetaKeywords()
getMetaKeywords
in interface MetaAttributes
@Nullable ProductVariantDraft getMasterVariant()
List<ProductVariantDraft> getVariants()
@Nullable ResourceIdentifier<TaxCategory> getTaxCategory()
SearchKeywords getSearchKeywords()
@Nullable CategoryOrderHints getCategoryOrderHints()
@Nullable ResourceIdentifier<State> getState()
@Nullable Boolean isPublish()
withEmptyProductType(client(), randomKey(), productType -> { final ProductVariantDraft masterVariant = ProductVariantDraftBuilder.of().build(); final LocalizedString name = randomSlug(); final LocalizedString slug = randomSlug(); final ProductDraft productDraft = ProductDraftBuilder.of(productType, name, slug, masterVariant) .publish(true) .build(); final Product product = client().executeBlocking(ProductCreateCommand.of(productDraft)); assertThat(product.getMasterData().isPublished()).isTrue(); assertThat(product.getMasterData().getCurrent().getSlug()).isEqualTo(slug); try { assertEventually(Duration.ofSeconds(120), Duration.ofMillis(200), () -> { final ProductProjectionSearch search = ProductProjectionSearch.ofCurrent() .withQueryFilters(m -> m.id().is(product.getId())); final PagedSearchResult<ProductProjection> searchResult = client().executeBlocking(search); assertThat(searchResult.getResults()).hasSize(1); }); } catch (AssertionError e) { logger.error(e.getMessage()); } unpublishAndDelete(product); });
See the test code.