Class OptionTemplate
java.lang.Object
com.broadleafcommerce.catalog.domain.option.OptionTemplate
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware,Serializable
public class OptionTemplate
extends Object
implements Serializable, com.broadleafcommerce.data.tracking.core.ContextStateAware
Allows the creation of a
ProductOption from this template, allowing users to avoid
recreating the same option for multiple products over and over again.
Often, these are grouped into an OptionTemplateGroup to provide a sort of product type.
For instance if you are selling T-Shirts, all of the T-shirts might have a product option "size"
and "color", but they all have the same sizes and same colors. This might be configured with an
OptionTemplateGroup of "Tshirts", that contain a 'Size' and 'Color' template, used to
create products off of.
Note that by default the options generated from a template are not kept in sync with changes to the template.
- Author:
- Phillip Verheyden (phillipuniverse)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOptionTemplate(String id) Convenience constructor, primarily for testing to populate with an id. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleancom.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextStateA subset ofTrackinginformation to expose the context state for this object.getId()getName()Admin management name for this template, used to help narrow down individual templatesThe option that this template actually managesinthashCode()booleanDetermines whether theProduct.getOptions()generated from this template will reference the template.voidsetContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTrackinginformation to expose the context state for this object.voidvoidAdmin management name for this template, used to help narrow down individual templatesvoidsetOption(ProductOption option) The option that this template actually managesvoidsetPreferAddTemplateByReference(boolean preferAddTemplateByReference) Determines whether theProduct.getOptions()generated from this template will reference the template.toString()
-
Constructor Details
-
OptionTemplate
Convenience constructor, primarily for testing to populate with an id.- Parameters:
id-
-
OptionTemplate
public OptionTemplate()
-
-
Method Details
-
getId
- Returns:
- the context ID of this product option
-
getName
Admin management name for this template, used to help narrow down individual templates -
isPreferAddTemplateByReference
public boolean isPreferAddTemplateByReference()Determines whether theProduct.getOptions()generated from this template will reference the template. Default is embedded.- Returns:
- true for the
ProductOptionto reflect changes made to theOptionTemplate, false for the generatedProductOptionto hold its own copy of the template
-
getOption
The option that this template actually manages -
getContextState
public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()A subset ofTrackinginformation to expose the context state for this object.- Specified by:
getContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Returns:
- a subset of
Trackinginformation to expose the context state for this object
-
setId
- Parameters:
id- the context ID of this product option
-
setName
Admin management name for this template, used to help narrow down individual templates -
setPreferAddTemplateByReference
public void setPreferAddTemplateByReference(boolean preferAddTemplateByReference) Determines whether theProduct.getOptions()generated from this template will reference the template. Default is embedded.- Parameters:
preferAddTemplateByReference- true for theProductOptionto reflect changes made to theOptionTemplate, false for the generatedProductOptionto hold its own copy of the template
-
setOption
The option that this template actually manages -
setContextState
public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTrackinginformation to expose the context state for this object.- Specified by:
setContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Parameters:
contextState- a subset ofTrackinginformation to expose the context state for this object
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-