Fluent builder for creating a new catalogue Product, letting callers set its pricing, categories, images and parameters before persisting it in one call. Obtained from CatalogManager.newProductBuilder, configured via its chained setter methods, then finalised with build, which creates and saves the product along with any categories, images and parameters that were added.

Group: Builders


Methods

title(String s) · supplier(Organisation org) · brief(String s) · content(String s) · baseCost(BigDecimal b) · baseCost(Double b) · freightCost(BigDecimal b) · freightCost(Double b) · rrp(Double b) · rrp(BigDecimal b) · webName(String s) · addCategory(Category cat) · addCategory(String catCode) · addImage(String name, String hash, Integer ordinal) · newProductParameterBuilder(String name, String title) · build()

title(String s)

Returns: ProductBuilder

Sets the product's display title.

ParameterDescription
sthe title to set

supplier(Organisation org)

Returns: ProductBuilder

Sets the organisation that supplies the product.

ParameterDescription
orgthe supplying organisation

brief(String s)

Returns: ProductBuilder

Sets the product's brief (short) description.

ParameterDescription
sthe brief description to set

content(String s)

Returns: ProductBuilder

Sets the product's full content, saved as the product's notes.

ParameterDescription
sthe content to set

baseCost(BigDecimal b)

Returns: ProductBuilder

Sets the product's base cost.

ParameterDescription
bthe base cost to set

baseCost(Double b)

Returns: ProductBuilder

Sets the product's base cost from a double value.

ParameterDescription
bthe base cost to set

freightCost(BigDecimal b)

Returns: ProductBuilder

Sets the product's freight cost.

ParameterDescription
bthe freight cost to set

freightCost(Double b)

Returns: ProductBuilder

Sets the product's freight cost from a double value.

ParameterDescription
bthe freight cost to set

rrp(Double b)

Returns: ProductBuilder

Sets the product's recommended retail price from a double value.

ParameterDescription
bthe recommended retail price to set

rrp(BigDecimal b)

Returns: ProductBuilder

Sets the product's recommended retail price.

ParameterDescription
bthe recommended retail price to set

webName(String s)

Returns: ProductBuilder

Sets the product's web name, used as its path-safe identifier.

ParameterDescription
sthe web name to set

addCategory(Category cat)

Returns: ProductBuilder

Adds a category the product should be filed under.

ParameterDescription
catthe category to add

addCategory(String catCode)

Returns: ProductBuilder

Adds a category the product should be filed under, looked up by its code.

ParameterDescription
catCodethe code of the category to add

addImage(String name, String hash, Integer ordinal)

Returns: ProductBuilder

Adds an image to the product.

ParameterDescription
namethe image's file name
hashthe content hash identifying the stored image data
ordinalthe image's display order relative to the product's other images

newProductParameterBuilder(String name, String title)

Returns: ProductParameterBuilder

Creates a new parameter builder for a variant parameter of the product being built, such as size or colour, and queues it to be built along with the product.

ParameterDescription
namethe parameter's path-safe identifier
titlethe parameter's display title

build()

Returns: Product

Creates and persists the product with the properties configured on this builder, along with any categories, images and parameters that were added. Involves database writes so is not a cheap call.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.