Class Product
- java.lang.Object
-
- com.broadleafcommerce.search.catalog.core.domain.Product
-
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware
,com.broadleafcommerce.search.api.domain.Archiveable
,com.broadleafcommerce.search.api.domain.CatalogTrackable
,com.broadleafcommerce.search.api.domain.Indexable<String>
,com.broadleafcommerce.search.api.domain.SandboxTrackable
public class Product extends Object implements com.broadleafcommerce.search.api.domain.Indexable<String>, com.broadleafcommerce.search.api.domain.CatalogTrackable, com.broadleafcommerce.search.api.domain.SandboxTrackable, com.broadleafcommerce.search.api.domain.Archiveable
The indexable product payload received from the web request for retrieving products, to be mapped into a document for the search engine.
-
-
Constructor Summary
Constructors Constructor Description Product()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(String name, Object value)
Add a value to the JSON data.protected boolean
canEqual(Object other)
boolean
equals(Object o)
Instant
getActiveEndDate()
Instant
getActiveStartDate()
Object
getAttribute(String name)
Get a value from the JSON data.Set<String>
getCatalogOmissions()
The IDs of descendant catalogs in which this context version of the product has been omitted as a result of one or more filters.Set<String>
getCatalogOverrides()
The IDs of descendant catalogs in which this context version of the product has been overridden.com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState
getContextState()
Trackable context state information for this product.String
getId()
The context ID of the product.String
getInventoryCheckStrategy()
Indicates whether inventory should be checked, and how.String
getInventoryReservationStrategy()
Indicates whether Inventory should be reserved, and how.Map<String,Object>
getJsonMap()
JSON data for the product object which isn't already stored in other fields.Set<String>
getMarketplaceApplications()
All of the IDs of marketplace applications where this product could appear in, based on the catalog hierarchy.Set<String>
getSandboxOverrides()
The IDs of descendant sandboxes in which this context version of the product has been overridden.String
getSandboxOwner()
The user who authored this version of the product, if it's in a user sandbox state.List<com.broadleafcommerce.search.api.domain.translation.Translation>
getTranslations()
Any translations applicable to this product in all locales.com.broadleafcommerce.search.api.type.IndexableType
getType()
int
hashCode()
boolean
isArchived()
Whether this product version has been archived.boolean
isAvailableOnline()
Is this product available online? e.g.boolean
isHasRequiredOptions()
Does this product have required options?boolean
isOnline()
Whether or not this product should be visible at all in the store.boolean
isRequiredOptionsAvailable()
IfhasRequiredOptions
is true, are all required options available for purchase?boolean
isSearchable()
Whether or not this product shows up in search.void
setActiveEndDate(Instant activeEndDate)
End when this product is not longer active.void
setActiveStartDate(Instant activeStartDate)
Start of when this product should be active.void
setArchived(boolean archived)
Whether this product version has been archived.void
setAvailableOnline(boolean availableOnline)
Is this product available online? e.g.void
setCatalogOmissions(Set<String> catalogOmissions)
The IDs of descendant catalogs in which this context version of the product has been omitted as a result of one or more filters.void
setCatalogOverrides(Set<String> catalogOverrides)
The IDs of descendant catalogs in which this context version of the product has been overridden.void
setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
Trackable context state information for this product.void
setHasRequiredOptions(boolean hasRequiredOptions)
Does this product have required options?void
setId(String id)
The context ID of the product.void
setInventoryCheckStrategy(String inventoryCheckStrategy)
Indicates whether inventory should be checked, and how.void
setInventoryReservationStrategy(String inventoryReservationStrategy)
Indicates whether Inventory should be reserved, and how.void
setJsonMap(Map<String,Object> jsonMap)
JSON data for the product object which isn't already stored in other fields.void
setMarketplaceApplications(Set<String> marketplaceApplications)
All of the IDs of marketplace applications where this product could appear in, based on the catalog hierarchy.void
setOnline(boolean online)
Whether or not this product should be visible at all in the store.void
setRequiredOptionsAvailable(boolean requiredOptionsAvailable)
IfhasRequiredOptions
is true, are all required options available for purchase?void
setSandboxOverrides(Set<String> sandboxOverrides)
The IDs of descendant sandboxes in which this context version of the product has been overridden.void
setSandboxOwner(String sandboxOwner)
The user who authored this version of the product, if it's in a user sandbox state.void
setSearchable(boolean searchable)
Whether or not this product shows up in search.void
setTranslations(List<com.broadleafcommerce.search.api.domain.translation.Translation> translations)
Any translations applicable to this product in all locales.String
toString()
-
-
-
Method Detail
-
getType
public final com.broadleafcommerce.search.api.type.IndexableType getType()
- Specified by:
getType
in interfacecom.broadleafcommerce.search.api.domain.Indexable<String>
-
getActiveStartDate
public Instant getActiveStartDate()
-
getActiveEndDate
@Nullable public Instant getActiveEndDate()
-
addAttribute
public void addAttribute(String name, Object value)
Add a value to the JSON data. Necessary for populating the JSON from the payload.- Parameters:
name
- the attribute namevalue
- the attribute value
-
getAttribute
public Object getAttribute(String name)
Get a value from the JSON data. Necessary for populating the JSON from the payload.- Parameters:
name
- the attribute name
-
getJsonMap
public Map<String,Object> getJsonMap()
JSON data for the product object which isn't already stored in other fields.- Specified by:
getJsonMap
in interfacecom.broadleafcommerce.search.api.domain.Indexable<String>
- Returns:
- JSON product object data
-
getId
public String getId()
The context ID of the product.- Specified by:
getId
in interfacecom.broadleafcommerce.search.api.domain.Indexable<String>
- Returns:
- the context ID of the product
-
getTranslations
public List<com.broadleafcommerce.search.api.domain.translation.Translation> getTranslations()
Any translations applicable to this product in all locales.- Specified by:
getTranslations
in interfacecom.broadleafcommerce.search.api.domain.Indexable<String>
- Returns:
- any translations applicable to this product
-
getContextState
public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()
Trackable context state information for this product.- Specified by:
getContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Returns:
- trackable context state information
-
getSandboxOwner
public String getSandboxOwner()
The user who authored this version of the product, if it's in a user sandbox state.Will be null if this product version is not in a user sandbox.
- Specified by:
getSandboxOwner
in interfacecom.broadleafcommerce.search.api.domain.SandboxTrackable
- Returns:
- the user who authored this version, or null if not in a user sandbox
-
isArchived
public boolean isArchived()
Whether this product version has been archived.- Specified by:
isArchived
in interfacecom.broadleafcommerce.search.api.domain.Archiveable
- Returns:
- whether this product version has been archived
-
isSearchable
public boolean isSearchable()
Whether or not this product shows up in search.- Returns:
- whether or not this product shows up in search
-
getInventoryReservationStrategy
public String getInventoryReservationStrategy()
Indicates whether Inventory should be reserved, and how. Typical values are: NEVER, ADD_TO_CART, SUBMIT_ORDER If this value is anything except null or 'NEVER' then generally inventory should be reserved or decremented. What this means from a search perspective is that typically Products that have a different inventoryReservationStrategy require that the Search Services hide or bury them when no inventory is available.- Returns:
- the enumerated inventory reservation strategy, or null.
-
getInventoryCheckStrategy
public String getInventoryCheckStrategy()
Indicates whether inventory should be checked, and how. Typical values are: NEVER, ADD_TO_CART If this value is anything except null or 'NEVER' then generally inventory should be checked. What this means from a search perspective is that typically Products that have a different inventoryCheckStrategy require that the Search Services hide or bury them when no inventory is available. This is similar to inventoryReservationStrategy, except that it indicates if inventory should be checked, usually during browsing. Note that inventory reservation does an inventory check too, so these properties are similar, especially from a search perspective.- Returns:
- the enumerated inventory check strategy, or null.
-
isOnline
public boolean isOnline()
Whether or not this product should be visible at all in the store. A product that is offline is not searchable, visible, or purchasable.- Returns:
- whether or not this product is visible in the store
-
getCatalogOverrides
public Set<String> getCatalogOverrides()
The IDs of descendant catalogs in which this context version of the product has been overridden.e.g. if this product is in catalog A, and catalog B inherits this product from catalog A but contains a local change for this product, then the catalog A version product will contain "B" in its catalogOverrides.
Not automatically populated from JSON, must be processed and populated during indexing.
- Specified by:
getCatalogOverrides
in interfacecom.broadleafcommerce.search.api.domain.CatalogTrackable
- Returns:
- the IDs of any descendant catalogs in which this product has been overridden
-
getCatalogOmissions
public Set<String> getCatalogOmissions()
The IDs of descendant catalogs in which this context version of the product has been omitted as a result of one or more filters.e.g. if this product is in catalog A, and catalog B inherits this product from catalog A but contains a filter that removes it from the view of catalog B, then the catalog A version product will contain "B" in its catalogOmissions.
- Specified by:
getCatalogOmissions
in interfacecom.broadleafcommerce.search.api.domain.CatalogTrackable
- Returns:
- the IDs of any descendant catalogs in which this product has been omitted.
-
getSandboxOverrides
public Set<String> getSandboxOverrides()
The IDs of descendant sandboxes in which this context version of the product has been overridden.e.g. if this product is in sandbox A, and sandbox B inherits this product from sandbox A but contains a local change for this product, then the sandbox A version product will contain "B" in its sandboxOverrides.
Not automatically populated from JSON, must be processed and populated during indexing.
- Specified by:
getSandboxOverrides
in interfacecom.broadleafcommerce.search.api.domain.SandboxTrackable
- Returns:
- the IDs of any descendant sandboxes in which this product has been overridden
-
getMarketplaceApplications
public Set<String> getMarketplaceApplications()
All of the IDs of marketplace applications where this product could appear in, based on the catalog hierarchy.- Specified by:
getMarketplaceApplications
in interfacecom.broadleafcommerce.search.api.domain.CatalogTrackable
-
isAvailableOnline
public boolean isAvailableOnline()
Is this product available online? e.g. Will it show up in search results. The inventory availability strategy will affect usage of this flag.
-
isHasRequiredOptions
public boolean isHasRequiredOptions()
Does this product have required options?
-
isRequiredOptionsAvailable
public boolean isRequiredOptionsAvailable()
IfhasRequiredOptions
is true, are all required options available for purchase?
-
setJsonMap
public void setJsonMap(Map<String,Object> jsonMap)
JSON data for the product object which isn't already stored in other fields.- Parameters:
jsonMap
- JSON product object data
-
setId
public void setId(String id)
The context ID of the product.- Parameters:
id
- the context ID of the product
-
setTranslations
public void setTranslations(List<com.broadleafcommerce.search.api.domain.translation.Translation> translations)
Any translations applicable to this product in all locales.- Parameters:
translations
- any translations applicable to this product
-
setContextState
public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
Trackable context state information for this product.- Specified by:
setContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Parameters:
contextState
- trackable context state information
-
setSandboxOwner
public void setSandboxOwner(String sandboxOwner)
The user who authored this version of the product, if it's in a user sandbox state.Will be null if this product version is not in a user sandbox.
- Parameters:
sandboxOwner
- the user who authored this version
-
setArchived
public void setArchived(boolean archived)
Whether this product version has been archived.- Parameters:
archived
- whether this product version has been archived
-
setSearchable
public void setSearchable(boolean searchable)
Whether or not this product shows up in search.- Parameters:
searchable
- whether or not this product shows up in search
-
setInventoryReservationStrategy
public void setInventoryReservationStrategy(String inventoryReservationStrategy)
Indicates whether Inventory should be reserved, and how. Typical values are: NEVER, ADD_TO_CART, SUBMIT_ORDER If this value is anything except null or 'NEVER' then generally inventory should be reserved or decremented. What this means from a search perspective is that typically Products that have a different inventoryReservationStrategy require that the Search Services hide or bury them when no inventory is available.- Parameters:
inventoryReservationStrategy
- the prescribed strategy for reserving inventory
-
setInventoryCheckStrategy
public void setInventoryCheckStrategy(String inventoryCheckStrategy)
Indicates whether inventory should be checked, and how. Typical values are: NEVER, ADD_TO_CART If this value is anything except null or 'NEVER' then generally inventory should be checked. What this means from a search perspective is that typically Products that have a different inventoryCheckStrategy require that the Search Services hide or bury them when no inventory is available. This is similar to inventoryReservationStrategy, except that it indicates if inventory should be checked, usually during browsing. Note that inventory reservation does an inventory check too, so these properties are similar, especially from a search perspective.- Parameters:
The
- inventoryCheckStrategy prescribed for if/when inventory should be checked, usually during browsing
-
setOnline
public void setOnline(boolean online)
Whether or not this product should be visible at all in the store. A product that is offline is not searchable, visible, or purchasable.- Parameters:
online
- whether or not this product is visible in the store
-
setCatalogOverrides
public void setCatalogOverrides(Set<String> catalogOverrides)
The IDs of descendant catalogs in which this context version of the product has been overridden.e.g. if this product is in catalog A, and catalog B inherits this product from catalog A but contains a local change for this product, then the catalog A version product will contain "B" in its catalogOverrides.
Not automatically populated from JSON, must be processed and populated during indexing.
- Specified by:
setCatalogOverrides
in interfacecom.broadleafcommerce.search.api.domain.CatalogTrackable
- Parameters:
catalogOverrides
- the IDs of any descendant catalogs in which this product has been overridden
-
setCatalogOmissions
public void setCatalogOmissions(Set<String> catalogOmissions)
The IDs of descendant catalogs in which this context version of the product has been omitted as a result of one or more filters.e.g. if this product is in catalog A, and catalog B inherits this product from catalog A but contains a filter that removes it from the view of catalog B, then the catalog A version product will contain "B" in its catalogOmissions.
- Specified by:
setCatalogOmissions
in interfacecom.broadleafcommerce.search.api.domain.CatalogTrackable
- Parameters:
catalogOmissions
- the IDs of any descendant catalogs in which this product has been omitted.
-
setSandboxOverrides
public void setSandboxOverrides(Set<String> sandboxOverrides)
The IDs of descendant sandboxes in which this context version of the product has been overridden.e.g. if this product is in sandbox A, and sandbox B inherits this product from sandbox A but contains a local change for this product, then the sandbox A version product will contain "B" in its sandboxOverrides.
Not automatically populated from JSON, must be processed and populated during indexing.
- Specified by:
setSandboxOverrides
in interfacecom.broadleafcommerce.search.api.domain.SandboxTrackable
- Parameters:
catalogOverrides
- the IDs of any descendant sandboxes in which this product has been overridden
-
setMarketplaceApplications
public void setMarketplaceApplications(Set<String> marketplaceApplications)
All of the IDs of marketplace applications where this product could appear in, based on the catalog hierarchy.- Specified by:
setMarketplaceApplications
in interfacecom.broadleafcommerce.search.api.domain.CatalogTrackable
-
setActiveStartDate
public void setActiveStartDate(Instant activeStartDate)
Start of when this product should be active.- Parameters:
activeStartDate
- the date when this product should start being active
-
setActiveEndDate
public void setActiveEndDate(Instant activeEndDate)
End when this product is not longer active. Unset indicates that it is always active- Parameters:
activeEndDate
- the date when this product should no longer be active
-
setAvailableOnline
public void setAvailableOnline(boolean availableOnline)
Is this product available online? e.g. Will it show up in search results. The inventory availability strategy will affect usage of this flag.
-
setHasRequiredOptions
public void setHasRequiredOptions(boolean hasRequiredOptions)
Does this product have required options?
-
setRequiredOptionsAvailable
public void setRequiredOptionsAvailable(boolean requiredOptionsAvailable)
IfhasRequiredOptions
is true, are all required options available for purchase?
-
canEqual
protected boolean canEqual(Object other)
-
-