Class ProductDetailsContext

java.lang.Object
com.broadleafcommerce.catalog.domain.product.commerce.ProductDetailsContext
All Implemented Interfaces:
Serializable

public class ProductDetailsContext extends Object implements Serializable
Information required to build ProductDetails for a commerce-facing product details page. This contains important context information for determining which product to gather details for and, potentially, the extent of the details.
Author:
Nathan Moore (nathandmoore)
See Also:
  • Constructor Details

  • Method Details

    • getRequest

      public ProductDetailsRequest getRequest()
      The ProductDetailsRequest made that initiated the ProductDetails build process.
      Returns:
      The ProductDetailsRequest made that initiated the ProductDetails build process.
    • getResolvedProduct

      public Product getResolvedProduct()
      The resolved product for the request.
      Returns:
      The resolved product for the request.
    • getSpecificCategoryChoices

      public Map<String,ItemChoiceCategory> getSpecificCategoryChoices()
      An aggregation of all of the Categories related to the resolvedProduct. This includes the Categories used by ItemChoices.

      This allows the DB to be queried fewer times during the build process.

      Returns:
      An aggregation of all of the Categories related to the resolvedProduct.
    • getRelatedProducts

      public Map<String,ProductDetails> getRelatedProducts()
      An aggregation of all of the Products related to the resolvedProduct. This includes the Products used by ItemChoices and IncludedProducts.

      This allows the DB to be queried fewer times during the build process.

      Returns:
      An aggregation of all of the Products related to the resolvedProduct
    • getRelatedPromotionalProducts

      public List<PromotionalProductSummary> getRelatedPromotionalProducts()
      An aggregation of all of the PromotionalProducts related to the resolvedProduct.

      This allows the DB to be queried fewer times during the build process.

      Returns:
      An aggregation of all of the PromotionalProducts related to the resolvedProduct.
    • getRelatedProductAssets

      public Map<String,List<ProductAsset>> getRelatedProductAssets()
      An aggregation of all of the ProductAssets related to the resolvedProduct. This includes only direct Product assets since SpecificItemChoice assets and IncludedProduct assets will already be populated.

      The key is the ID of the parent product.

      This allows the DB to be queried fewer times during the build process.

      Returns:
      An aggregation of all of the ProductAssets related to the resolvedProduct
    • getRelatedDataDrivenEnums

      public List<DataDrivenEnum> getRelatedDataDrivenEnums()
      An aggregation of all of the DataDrivenEnums related to the resolvedProduct.

      This allows the DB to be queried fewer times during the build process.

      Returns:
      An aggregation of all of the DataDrivenEnums related to the resolvedProduct
    • getRelatedCategoryProducts

      public Map<String,Set<ProductDetails>> getRelatedCategoryProducts()
      An aggregation of all of the Products belonging to related Categories mapped by the category's ID.
      Returns:
      An aggregation of all of the Products belonging to related Categories mapped by the category's ID.
    • getRelatedVariants

      public Map<String,VariantDetail> getRelatedVariants()
      An aggregation of all of the Variants related to the resolvedProduct. This includes the Variants used by ItemChoices and IncludedProducts.

      This allows the DB to be queried fewer times during the build process.

      Returns:
      An aggregation of all of the Variants related to the resolvedProduct
    • getParentCategories

      public Set<CategoryRef> getParentCategories()
      Set of all Categories that include resolvedProduct.
      Returns:
      Set of all Categories that include resolvedProduct.
    • getCategoryIdsWithParents

      public List<String> getCategoryIdsWithParents()
      List of all hierarchical parent category ids for the product.

      This is different from parentCategories as parentCategories represents the categories that are directly assigned to the product, where as categoryIdsWithParents contains a hierarchical list of all parent category ids.

      For example, if we have a category setup of: Top -> Level2 -> Level3 and the product is assigned to Level3, the list would be {Top, Level2, Level3}.

      Returns:
      List of all hierarchical parent category ids for the product.
      Since:
      Catalog Service 2.2.0 / Release Train 2.2.0, this will also include any relevant rule-based category memberships that this resolvedProduct belongs to ONLY if the overall applicable product details request also contains an item choice rule-based category and it qualifies as being a member. This is particularly useful for cart catalog item requests that contain dependent items that need to validate and verify rule-based category membership eligibility. See RelatedCategoriesProductContextContributor

    • getRelatedProductTags

      public Map<String,List<ProductTag>> getRelatedProductTags()
      Map of all ProductTags of the relatedProducts. Mapped by the parent product's ID. The ProductTag.getTag() should be hydrated before adding to this map.
      Returns:
      Map of all ProductTags of the relatedProducts.
    • getRelatedOptionTemplates

      public Map<String,OptionTemplate> getRelatedOptionTemplates()
      An aggregation of all Option Templates related to the resolvedProduct. This includes the Option Templates used by ItemChoices. The key is the ID of the template to enable quick lookup when hydrating option referencing them.
      Returns:
      relatedOptionTemplates List of all OptionTemplates of the resolvedProduct
    • getRelatedCharacteristics

      public List<Characteristic> getRelatedCharacteristics()
      An aggregation of all of the Characteristics related to the resolved product.
      Since:
      Catalog Service 2.2.0, Release Train 2.2.0
    • setRequest

      public void setRequest(ProductDetailsRequest request)
      The ProductDetailsRequest made that initiated the ProductDetails build process.
      Parameters:
      request - The ProductDetailsRequest made that initiated the ProductDetails build process.
    • setResolvedProduct

      public void setResolvedProduct(Product resolvedProduct)
      The resolved product for the request.
      Parameters:
      resolvedProduct - The resolved product for the request.
    • setSpecificCategoryChoices

      public void setSpecificCategoryChoices(Map<String,ItemChoiceCategory> specificCategoryChoices)
      An aggregation of all of the Categories related to the resolvedProduct. This includes the Categories used by ItemChoices.

      This allows the DB to be queried fewer times during the build process.

      Parameters:
      specificCategoryChoices - An aggregation of all of the Categories related to the resolvedProduct.
    • setRelatedProducts

      public void setRelatedProducts(Map<String,ProductDetails> relatedProducts)
      An aggregation of all of the Products related to the resolvedProduct. This includes the Products used by ItemChoices and IncludedProducts.

      This allows the DB to be queried fewer times during the build process.

      Parameters:
      relatedProducts - aggregation of all of the Products related to the resolvedProduct
    • setRelatedPromotionalProducts

      public void setRelatedPromotionalProducts(List<PromotionalProductSummary> relatedPromotionalProducts)
      An aggregation of all of the PromotionalProducts related to the resolvedProduct.

      This allows the DB to be queried fewer times during the build process.

      Parameters:
      relatedPromotionalProducts - An aggregation of all of the PromotionalProducts related to the resolvedProduct.
    • setRelatedProductAssets

      public void setRelatedProductAssets(Map<String,List<ProductAsset>> relatedProductAssets)
      An aggregation of all of the ProductAssets related to the resolvedProduct. This includes only direct Product assets since SpecificItemChoice assets and IncludedProduct assets will already be populated.

      The key is the ID of the parent product.

      This allows the DB to be queried fewer times during the build process.

      Parameters:
      relatedProductAssets - An aggregation of all of the ProductAssets related to the resolvedProduct
    • setRelatedDataDrivenEnums

      public void setRelatedDataDrivenEnums(List<DataDrivenEnum> relatedDataDrivenEnums)
      An aggregation of all of the DataDrivenEnums related to the resolvedProduct.

      This allows the DB to be queried fewer times during the build process.

      Parameters:
      relatedDataDrivenEnums - An aggregation of all of the DataDrivenEnums related to the resolvedProduct
    • setRelatedCategoryProducts

      public void setRelatedCategoryProducts(Map<String,Set<ProductDetails>> relatedCategoryProducts)
      An aggregation of all of the Products belonging to related Categories mapped by the category's ID.
      Parameters:
      relatedCategoryProducts - An aggregation of all of the Products belonging to related Categories mapped by the category's ID.
    • setRelatedVariants

      public void setRelatedVariants(Map<String,VariantDetail> relatedVariants)
      An aggregation of all of the Variants related to the resolvedProduct. This includes the Variants used by ItemChoices and IncludedProducts.

      This allows the DB to be queried fewer times during the build process.

      Parameters:
      relatedVariants - An aggregation of all of the Variants related to the resolvedProduct
    • setParentCategories

      public void setParentCategories(Set<CategoryRef> parentCategories)
      Set of all Categories that include resolvedProduct.
      Parameters:
      relatedCategories - Set of all Categories that include resolvedProduct.
    • setCategoryIdsWithParents

      public void setCategoryIdsWithParents(List<String> categoryIdsWithParents)
      List of all hierarchical parent category ids for the product.

      This is different from parentCategories as parentCategories represents the categories that are directly assigned to the product, where as categoryIdsWithParents contains a hierarchical list of all parent category ids.

      For example, if we have a category setup of: Top -> Level2 -> Level3 and the product is assigned to Level3, the list would be {Top, Level2, Level3}.

      Parameters:
      parentCategoryIds - List of all hierarchical parent category ids for the product.
      Since:
      Catalog Service 2.2.0 / Release Train 2.2.0, this will also include any relevant rule-based category memberships that this resolvedProduct belongs to ONLY if the overall applicable product details request also contains an item choice rule-based category and it qualifies as being a member. This is particularly useful for cart catalog item requests that contain dependent items that need to validate and verify rule-based category membership eligibility. See RelatedCategoriesProductContextContributor

    • setRelatedProductTags

      public void setRelatedProductTags(Map<String,List<ProductTag>> relatedProductTags)
      Map of all ProductTags of the relatedProducts. Mapped by the parent product's ID. The ProductTag.getTag() should be hydrated before adding to this map.
    • setRelatedOptionTemplates

      public void setRelatedOptionTemplates(Map<String,OptionTemplate> relatedOptionTemplates)
      An aggregation of all Option Templates related to the resolvedProduct. This includes the Option Templates used by ItemChoices. The key is the ID of the template to enable quick lookup when hydrating option referencing them.
      Parameters:
      relatedOptionTemplates - List of all OptionTemplates of the resolvedProduct
    • setRelatedCharacteristics

      public void setRelatedCharacteristics(List<Characteristic> relatedCharacteristics)
      An aggregation of all of the Characteristics related to the resolved product.
      Since:
      Catalog Service 2.2.0, Release Train 2.2.0
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object