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.
| Parameter | Description |
|---|---|
s | the title to set |
supplier(Organisation org)
Returns: ProductBuilder
Sets the organisation that supplies the product.
| Parameter | Description |
|---|---|
org | the supplying organisation |
brief(String s)
Returns: ProductBuilder
Sets the product's brief (short) description.
| Parameter | Description |
|---|---|
s | the brief description to set |
content(String s)
Returns: ProductBuilder
Sets the product's full content, saved as the product's notes.
| Parameter | Description |
|---|---|
s | the content to set |
baseCost(BigDecimal b)
Returns: ProductBuilder
Sets the product's base cost.
| Parameter | Description |
|---|---|
b | the base cost to set |
baseCost(Double b)
Returns: ProductBuilder
Sets the product's base cost from a double value.
| Parameter | Description |
|---|---|
b | the base cost to set |
freightCost(BigDecimal b)
Returns: ProductBuilder
Sets the product's freight cost.
| Parameter | Description |
|---|---|
b | the freight cost to set |
freightCost(Double b)
Returns: ProductBuilder
Sets the product's freight cost from a double value.
| Parameter | Description |
|---|---|
b | the freight cost to set |
rrp(Double b)
Returns: ProductBuilder
Sets the product's recommended retail price from a double value.
| Parameter | Description |
|---|---|
b | the recommended retail price to set |
rrp(BigDecimal b)
Returns: ProductBuilder
Sets the product's recommended retail price.
| Parameter | Description |
|---|---|
b | the recommended retail price to set |
webName(String s)
Returns: ProductBuilder
Sets the product's web name, used as its path-safe identifier.
| Parameter | Description |
|---|---|
s | the web name to set |
addCategory(Category cat)
Returns: ProductBuilder
Adds a category the product should be filed under.
| Parameter | Description |
|---|---|
cat | the category to add |
addCategory(String catCode)
Returns: ProductBuilder
Adds a category the product should be filed under, looked up by its code.
| Parameter | Description |
|---|---|
catCode | the code of the category to add |
addImage(String name, String hash, Integer ordinal)
Returns: ProductBuilder
Adds an image to the product.
| Parameter | Description |
|---|---|
name | the image's file name |
hash | the content hash identifying the stored image data |
ordinal | the 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.
| Parameter | Description |
|---|---|
name | the parameter's path-safe identifier |
title | the 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.