@Generated(value="io.sphere.sdk.annotations.processors.generators.ResourceDraftValueGenerator", comments="Generated from: io.sphere.sdk.products.ProductDraft") public final class ProductDraftDsl extends Base implements ProductDraft
ProductDraft.clone, finalize, getClass, notify, notifyAll, wait, wait, waitmetaAttributesOf, metaAttributesOfpublic Set<ResourceIdentifier<Category>> getCategories()
getCategories in interface ProductDraft@Nullable public CategoryOrderHints getCategoryOrderHints()
getCategoryOrderHints in interface ProductDraft@Nullable public LocalizedString getDescription()
getDescription in interface ProductDraft@Nullable public String getKey()
getKey in interface WithKeygetKey in interface ProductDraft@Nullable public ProductVariantDraft getMasterVariant()
getMasterVariant in interface ProductDraft@Nullable public LocalizedString getMetaDescription()
getMetaDescription in interface MetaAttributesgetMetaDescription in interface ProductDraft@Nullable public LocalizedString getMetaKeywords()
getMetaKeywords in interface MetaAttributesgetMetaKeywords in interface ProductDraft@Nullable public LocalizedString getMetaTitle()
getMetaTitle in interface MetaAttributesgetMetaTitle in interface ProductDraftpublic LocalizedString getName()
getName in interface ProductDraftpublic ResourceIdentifier<ProductType> getProductType()
getProductType in interface ProductDraft@Nullable public Boolean isPublish()
ProductDraft
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.
isPublish in interface ProductDraftpublic SearchKeywords getSearchKeywords()
getSearchKeywords in interface ProductDraftpublic LocalizedString getSlug()
getSlug in interface WithLocalizedSluggetSlug in interface ProductDraft@Nullable public ResourceIdentifier<State> getState()
getState in interface ProductDraft@Nullable public ResourceIdentifier<TaxCategory> getTaxCategory()
getTaxCategory in interface ProductDraftpublic List<ProductVariantDraft> getVariants()
getVariants in interface ProductDraftpublic ProductDraftBuilder newBuilder()
public ProductDraftDsl withCategories(Set<ResourceIdentifier<Category>> categories)
public ProductDraftDsl withCategoryOrderHints(@Nullable CategoryOrderHints categoryOrderHints)
public ProductDraftDsl withDescription(@Nullable LocalizedString description)
public ProductDraftDsl withKey(@Nullable String key)
public ProductDraftDsl withMasterVariant(@Nullable ProductVariantDraft masterVariant)
public ProductDraftDsl withMetaDescription(@Nullable LocalizedString metaDescription)
public ProductDraftDsl withMetaKeywords(@Nullable LocalizedString metaKeywords)
public ProductDraftDsl withMetaTitle(@Nullable LocalizedString metaTitle)
public ProductDraftDsl withName(LocalizedString name)
public ProductDraftDsl withProductType(ResourceIdentifier<ProductType> productType)
public ProductDraftDsl withPublish(@Nullable Boolean publish)
public ProductDraftDsl withSearchKeywords(SearchKeywords searchKeywords)
public ProductDraftDsl withSlug(LocalizedString slug)
public ProductDraftDsl withState(@Nullable ResourceIdentifier<State> state)
public ProductDraftDsl withTaxCategory(@Nullable ResourceIdentifier<TaxCategory> taxCategory)
public ProductDraftDsl withVariants(List<ProductVariantDraft> variants)
public static ProductDraftDsl of(ResourceIdentifier<ProductType> productType, LocalizedString name, LocalizedString slug, @Nullable ProductVariantDraft masterVariant)
productType - initial value for the ProductDraft.getProductType() propertyname - initial value for the ProductDraft.getName() propertyslug - initial value for the ProductDraft.getSlug() propertymasterVariant - initial value for the ProductDraft.getMasterVariant() propertypublic static ProductDraftDsl of(ProductDraft template)
template - the template