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
ConstructorDescriptionOptionTemplate
(String id) Convenience constructor, primarily for testing to populate with an id. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState
A subset ofTracking
information 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 managesint
hashCode()
boolean
Determines whether theProduct.getOptions()
generated from this template will reference the template.void
setContextState
(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTracking
information to expose the context state for this object.void
void
Admin management name for this template, used to help narrow down individual templatesvoid
setOption
(ProductOption option) The option that this template actually managesvoid
setPreferAddTemplateByReference
(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
ProductOption
to reflect changes made to theOptionTemplate
, false for the generatedProductOption
to 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 ofTracking
information to expose the context state for this object.- Specified by:
getContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Returns:
- a subset of
Tracking
information 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 theProductOption
to reflect changes made to theOptionTemplate
, false for the generatedProductOption
to 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 ofTracking
information to expose the context state for this object.- Specified by:
setContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Parameters:
contextState
- a subset ofTracking
information to expose the context state for this object
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-