Class 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 Detail

      • Product

        public Product()
    • Method Detail

      • getType

        public final com.broadleafcommerce.search.api.type.IndexableType getType()
        Specified by:
        getType in interface com.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 name
        value - 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 interface com.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 interface com.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 interface com.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 interface com.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 interface com.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 interface com.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 interface com.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 interface com.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 interface com.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 interface com.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()
        If hasRequiredOptions 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 interface com.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 interface com.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 interface com.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 interface com.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 interface com.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)
        If hasRequiredOptions is true, are all required options available for purchase?
      • canEqual

        protected boolean canEqual​(Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object