All Superinterfaces:
Indexable, org.broadleafcommerce.common.copy.MultiTenantCloneable<Sku>, Serializable
All Known Implementing Classes:
SkuImpl

public interface Sku extends Serializable, org.broadleafcommerce.common.copy.MultiTenantCloneable<Sku>, Indexable
Implementations of this interface are used to hold data about a SKU. A SKU is a specific item that can be sold including any specific attributes of the item such as color or size.

You should implement this class if you want to make significant changes to how the class is persisted. If you just want to add additional fields then you should extend SkuImpl.
Author:
btaylor
  • Method Details

    • getId

      Long getId()
      Returns the id of this sku
      Specified by:
      getId in interface Indexable
    • setId

      void setId(Long id)
      Sets the id of this sku
    • getUrlKey

      String getUrlKey()
      Returns the sku specific portion of a full url used for a sku info page.
    • setUrlKey

      void setUrlKey(String url)
      Sets the sku specific portion of a full url used for a sku info page.
      Parameters:
      url -
    • getDisplayTemplate

      String getDisplayTemplate()
      Returns the name of a display template that is used to render this sku. Most implementations have a default template for all skus. This allows for the user to define a specific template to be used by this sku.
      Returns:
    • setDisplayTemplate

      void setDisplayTemplate(String displayTemplate)
      Sets the name of a display template that is used to render this sku. Most implementations have a default template for all skus. This allows for the user to define a specific template to be used by this sku.
      Parameters:
      displayTemplate -
    • getProductOptionValueAdjustments

      org.broadleafcommerce.common.money.Money getProductOptionValueAdjustments()
      This is the sum total of the priceAdjustments from the associated ProductOptionValues
      Returns:
      null if there are no ProductOptionValues associated with this Sku or all of their priceAdjustments are null. Otherwise this will be the sum total of those price adjustments
    • getSalePrice

      org.broadleafcommerce.common.money.Money getSalePrice()
      Returns the Sale Price of the Sku. The Sale Price is the standard price the vendor sells this item for. If SkuPricingConsiderationContext is set, this uses the DynamicSkuPricingService to calculate what this should actually be rather than use the property itself
    • setSalePrice

      void setSalePrice(org.broadleafcommerce.common.money.Money salePrice)
      Sets the the Sale Price of the Sku. The Sale Price is the standard price the vendor sells this item for. This price will automatically be overridden if your system is utilizing the DynamicSkuPricingService.
    • hasSalePrice

      boolean hasSalePrice()
      Determines if there is a sale price. In other words, determines whether salePrice is null. Returns true if salePrice is not null. Returns false otherwise.
      Returns:
    • getRetailPrice

      org.broadleafcommerce.common.money.Money getRetailPrice()
      Returns the Retail Price of the Sku. The Retail Price is the MSRP of the sku. If SkuPricingConsiderationContext is set, this uses the DynamicSkuPricingService to calculate what this should actually be rather than use the property itself.
      Throws:
      IllegalStateException - if retail price is null.
    • setRetailPrice

      void setRetailPrice(org.broadleafcommerce.common.money.Money retailPrice)
      Sets the retail price for the Sku. This price will automatically be overridden if your system is utilizing the DynamicSkuPricingService.
      Parameters:
      retailPrice - price for the Sku
    • getBaseRetailPrice

      org.broadleafcommerce.common.money.Money getBaseRetailPrice()
      Returns the basic retail price of the Sku. This price does not include any dynamic pricing, including PriceList modification.
      Returns:
    • getBaseSalePrice

      org.broadleafcommerce.common.money.Money getBaseSalePrice()
      Returns the basic sale price of the Sku. This price does not include any dynamic pricing, including PriceList modification.
      Returns:
    • hasRetailPrice

      boolean hasRetailPrice()
      Provides a way of determining if a Sku has a retail price without getting an IllegalStateException. Returns true if retailPrice is not null. Returns false otherwise.
      Returns:
      See Also:
    • getPrice

      org.broadleafcommerce.common.money.Money getPrice()
      Resolves the price of the Sku. If the Sku is on sale (that is, isOnSale() returns true), the return value will be the result of getSalePrice(). Otherwise, the return value will be the result of getRetailPrice().
      Returns:
      the price of the Sku
    • getListPrice

      @Deprecated org.broadleafcommerce.common.money.Money getListPrice()
      Deprecated.
      Returns the List Price of the Sku. The List Price is the MSRP of the sku.
    • setListPrice

      @Deprecated void setListPrice(org.broadleafcommerce.common.money.Money listPrice)
      Deprecated.
      Sets the the List Price of the Sku. The List Price is the MSRP of the sku.
    • getCost

      org.broadleafcommerce.common.money.Money getCost()
      Returns the purchase cost of this Sku.
      Returns:
      the purchase cost of this Sku
    • setCost

      void setCost(org.broadleafcommerce.common.money.Money cost)
      Sets the purchase cost for this Sku.
      Parameters:
      cost -
    • getMargin

      org.broadleafcommerce.common.money.Money getMargin()
      Returns the margin of the Sku. This is the value of getPrice() - getCost()
      Returns:
      the margin of this Sku
    • getName

      String getName()
      Returns the name of the Sku. The name is a label used to show when displaying the sku.
    • setName

      void setName(String name)
      Sets the the name of the Sku. The name is a label used to show when displaying the sku.
    • getDescription

      String getDescription()
      Returns the brief description of the Sku.
    • setDescription

      void setDescription(String description)
      Sets the brief description of the Sku.
    • getLongDescription

      String getLongDescription()
      Returns the long description of the sku.
    • setLongDescription

      void setLongDescription(String longDescription)
      Sets the long description of the sku.
    • isTaxable

      Boolean isTaxable()
      Returns whether the Sku qualifies for taxes or not. This field is used by the pricing engine to calculate taxes.
    • getTaxable

      Boolean getTaxable()
      Convenience that passes through to isTaxable
    • setTaxable

      void setTaxable(Boolean taxable)
      Sets the whether the Sku qualifies for taxes or not. This field is used by the pricing engine to calculate taxes.
    • isDiscountable

      Boolean isDiscountable()
      Returns whether the Sku qualifies for discounts or not. This field is used by the pricing engine to apply offers.
    • setDiscountable

      void setDiscountable(Boolean discountable)
      Sets the whether the Sku qualifies for discounts or not. This field is used by the pricing engine to apply offers.
    • isAvailable

      @Deprecated Boolean isAvailable()

      Availability is really a concern of inventory vs a concern of the Sku being active or not. A Sku could be marked as unavailable but still be considered 'active' where you still want to show the Sku on the site but not actually sell it. This defaults to true

      This method only checks that this Sku is not marked as InventoryType.UNAVAILABLE. If getInventoryType() is set to InventoryType.CHECK_QUANTITY then this will return true.

    • getAvailable

      @Deprecated Boolean getAvailable()
      Deprecated.
      use getInventoryType() instead
      Convenience that passes through to isAvailable
    • setAvailable

      @Deprecated void setAvailable(Boolean available)
      Deprecated.
      Availability is really a concern of inventory vs a concern of the Sku being active or not. A Sku could be marked as unavailable but still be considered 'active' where you still want to show the Sku on the site but not actually sell it. This defaults to true
    • getActiveStartDate

      Date getActiveStartDate()
      Returns the first date that the Sku should be available for sale. This field is used to determine whether a user can add the sku to their cart.
    • setActiveStartDate

      void setActiveStartDate(Date activeStartDate)
      Sets the the first date that the Sku should be available for sale. This field is used to determine whether a user can add the sku to their cart.
    • getActiveEndDate

      Date getActiveEndDate()
      Returns the the last date that the Sku should be available for sale. This field is used to determine whether a user can add the sku to their cart.
    • setActiveEndDate

      void setActiveEndDate(Date activeEndDate)
      Sets the the last date that the Sku should be available for sale. This field is used to determine whether a user can add the sku to their cart.
    • getDimension

      Dimension getDimension()
      Get the dimensions for this Sku
      Returns:
      this Sku's embedded Weight
    • setDimension

      void setDimension(Dimension dimension)
      Sets the embedded Dimension for this Sku
      Parameters:
      dimension -
    • getWeight

      Weight getWeight()
      Gets the embedded Weight for this Sku
      Returns:
      this Sku's embedded Weight
    • setWeight

      void setWeight(Weight weight)
      Sets the embedded Weight for this Sku
      Parameters:
      weight -
    • isActive

      boolean isActive()
      Returns a boolean indicating whether this sku is active. This is used to determine whether a user the sku can add the sku to their cart.
    • getSkuMedia

      @Deprecated Map<String,org.broadleafcommerce.common.media.domain.Media> getSkuMedia()
      Deprecated.
      use getSkuMediaXref() instead
      Returns a map of key/value pairs where the key is a string for the name of a media object and the value is a media object.
    • setSkuMedia

      @Deprecated void setSkuMedia(Map<String,org.broadleafcommerce.common.media.domain.Media> skuMedia)
      Deprecated.
      Sets a map of key/value pairs where the key is a string for the name of a media object and the value is an object of type Media.
    • getSkuMediaXref

      Map<String,SkuMediaXref> getSkuMediaXref()
      Returns a map of key/value pairs where the key is a string for the name of a media object and the value is a cross-reference to a media object.
    • setSkuMediaXref

      void setSkuMediaXref(Map<String,SkuMediaXref> skuMediaXref)
      Sets a map of key/value pairs where the key is a string for the name of a media object and the value is a cross-reference object to type Media.
    • getSkuMediaXrefIgnoreDefaultSku

      Map<String,SkuMediaXref> getSkuMediaXrefIgnoreDefaultSku()
      Returns a map of key/value pairs where the key is a string for the name of a media object and the value is a cross-reference to a media object. This is intended to be used when cloning Skus and does not check the defaultSku unlike getSkuMediaXref().
    • getPrimarySkuMedia

      org.broadleafcommerce.common.media.domain.Media getPrimarySkuMedia()
      Returns the primary Media for this Sku
    • isActive

      boolean isActive(Product product, Category category)
      Returns whether or not this Sku, the given Product and the given Category are all active
      Parameters:
      product - - Product that should be active
      category - - Category that should be active
      Returns:
      true if this Sku, product and category are all active false otherwise
    • getSkuAttributes

      @Deprecated Map<String,SkuAttribute> getSkuAttributes()
      Deprecated.
      Denormalized set of key-value pairs to attach to a Sku. If you are looking for setting up a ProductOption scenario (like colors, sizes, etc) see getProductOptionValues() and setProductOptionValues(List)
      Returns:
      the attributes for this Sku
    • setSkuAttributes

      void setSkuAttributes(Map<String,SkuAttribute> skuAttributes)
      Sets the denormalized set of key-value pairs on a Sku
      Parameters:
      skuAttributes -
    • getMultiValueSkuAttributes

      Map<String,Collection<SkuAttribute>> getMultiValueSkuAttributes()
      Returns multivalued SkuAttributes associated with this sku using MultiValueMap. For example, the key of Color could have SkuAttributes of Red and Blue values.
      Returns:
      the multivalued attributes for this Sku
    • getProductOptionValues

      @Deprecated List<ProductOptionValue> getProductOptionValues()
      Deprecated.
      Gets the ProductOptionValues used to map to this Sku. For instance, this Sku could hold specific inventory, price and image information for a "Blue" "Extra-Large" shirt
      Returns:
      the ProductOptionValues for this Sku
    • setProductOptionValues

      @Deprecated void setProductOptionValues(List<ProductOptionValue> productOptionValues)
      Sets the ProductOptionValues that should be mapped to this Sku
      Parameters:
      productOptionValues -
    • getProductOptionValuesCollection

      @Deprecated Set<ProductOptionValue> getProductOptionValuesCollection()
      Deprecated.
      Gets the ProductOptionValues used to map to this Sku. For instance, this Sku could hold specific inventory, price and image information for a "Blue" "Extra-Large" shirt
      Returns:
      the ProductOptionValues for this Sku
    • setProductOptionValuesCollection

      @Deprecated void setProductOptionValuesCollection(Set<ProductOptionValue> productOptionValues)
      Deprecated.
      Sets the ProductOptionValues that should be mapped to this Sku
      Parameters:
      productOptionValues -
    • getProductOptionValueXrefs

      Set<SkuProductOptionValueXref> getProductOptionValueXrefs()
      Returns the ProductOptionValues that should be mapped to this Sku using the middle XREF entity, SkuProductOptionValueXref
      Returns:
      the Set of SkuProductOptionValueXrefs
    • setProductOptionValueXrefs

      void setProductOptionValueXrefs(Set<SkuProductOptionValueXref> productOptionValueXrefs)
      Sets the ProductOptionValues that should be mapped to this Sku using the middle XREF entity, SkuProductOptionValueXref
    • getDefaultProduct

      Product getDefaultProduct()
      This will be a value if and only if this Sku is the defaultSku of a Product (and thus has a @OneToOne relationship with a Product). The mapping for this is actually done at the Product level with a foreign key to Sku; this exists for convenience to get the reverse relationship
      Returns:
      The associated Product if this Sku is a defaultSku, null otherwise
      See Also:
    • setDefaultProduct

      void setDefaultProduct(Product product)
      The relationship for a Product's default Sku (and thus a Sku's default Product) is actually maintained on the Product entity as a foreign key to Sku. Because of this, there are probably very few circumstances that you would actually want to change this from the Sku perspective instead of the Product perspective.

      If you are looking for a way to simply associate a Sku to a Product, the correct way would be to call setProduct(Product) or Product.setAdditionalSkus(List) which would then cause this Sku to show up in the list of Skus for the given Product
      Parameters:
      product -
    • getProduct

      Product getProduct()
      This will return the correct Product association that is being used on the Sku. If this Sku is a default Sku for a Product (as in, getDefaultProduct() != null) than this will return getDefaultProduct(). If this is not a default Sku for a Product, this will return the @ManyToOne Product relationship created by adding this Sku to a Product's list of Skus, or using setProduct(Product).

      In some implementations, it might make sense to have both the @OneToOne association set (Product.setDefaultSku(Sku)) as well as the @ManyToOne association set (setProduct(Product)). In this case, This method would only return the result of getDefaultProduct(). However, the @OneToOne and @ManyToOne association should never actually refer to different Products, and would represent an error state. If you require this, consider subclassing and using your own @ManyToMany relationship between Product and Sku. If you are trying to model bundles, consider using a ProductBundle and subsequent SkuBundleItems.
      Returns:
      getDefaultProduct() if getDefaultProduct() is non-null, the @ManyToOne Product association otherwise. If no relationship is set, returns null
    • setProduct

      void setProduct(Product product)
      Associates a Sku to a given Product. This will then show up in the list returned by Product.getSkus()
      Parameters:
      product - - Product to associate this Sku to
      See Also:
    • isOnSale

      boolean isOnSale()
      A product is on sale provided the sale price is not null, non-zero, and less than the retail price.

      Note that this flag should always be checked before showing or using a sale price as it is possible for a sale price to be greater than the retail price from a purely data perspective.

      Returns:
      whether or not the product is on sale
    • isMachineSortable

      @Deprecated Boolean isMachineSortable()
      Deprecated.
      use getIsMachineSortable() instead since that is the correct bean notation
      Whether this Sku can be sorted by a machine
      Returns:
      true if this Sku can be sorted by a machine
    • getIsMachineSortable

      Boolean getIsMachineSortable()
      Whether this Sku can be sorted by a machine
    • setIsMachineSortable

      void setIsMachineSortable(Boolean isMachineSortable)
      Sets whether or not this Sku can be sorted by a machine
      Parameters:
      isMachineSortable -
    • setMachineSortable

      @Deprecated void setMachineSortable(Boolean isMachineSortable)
      Deprecated.
      use setIsMachineSortable(Boolean) instead since that is the correct bean notation
      Sets whether or not this Sku can be sorted by a machine
      Parameters:
      isMachineSortable -
    • getFees

      List<SkuFee> getFees()
      Gets all the extra fees for this particular Sku. If the fee type is FULFILLMENT, these are stored on FulfillmentGroup.getFulfillmentGroupFees() for an Order
      Returns:
      the SkuFees for this Sku
    • setFees

      void setFees(List<SkuFee> fees)
      Sets the extra fees for this particular Sku
      Parameters:
      fees -
    • getFulfillmentFlatRates

      Map<FulfillmentOption,BigDecimal> getFulfillmentFlatRates()
      Gets the flat rate for fulfilling this Sku for a particular FulfillmentOption. Depending on the result of FulfillmentOption.getUseFlatRates(), this flat rate will be used in calculating the cost of fulfilling this Sku.
      Returns:
      the flat rates for this Sku
    • setFulfillmentFlatRates

      void setFulfillmentFlatRates(Map<FulfillmentOption,BigDecimal> fulfillmentFlatRates)
      Sets the flat rates for fulfilling this Sku for a particular FulfillmentOption. Depending on the result of FulfillmentOption.getUseFlatRates(), this flat rate will be used in calculating the cost of fulfilling this Sku.
      Parameters:
      fulfillmentFlatRates -
    • getExcludedFulfillmentOptions

      List<FulfillmentOption> getExcludedFulfillmentOptions()
      Gets the FulfillmentOptions that this Sku should be excluded from. For instance, some Skus might not be available to be fulfilled next-day
      Returns:
    • setExcludedFulfillmentOptions

      void setExcludedFulfillmentOptions(List<FulfillmentOption> excludedFulfillmentOptions)
      Sets the FulfillmentOptions that this Sku should be excluded from being apart of
      Parameters:
      excludedFulfillmentOptions -
    • getInventoryType

      InventoryType getInventoryType()
      Returns the type of inventory for this sku
      Returns:
      the InventoryType for this sku
    • setInventoryType

      void setInventoryType(InventoryType inventoryType)
      Sets the type of inventory for this sku
      Parameters:
      inventoryType - the InventoryType for this sku
    • getQuantityAvailable

      Integer getQuantityAvailable()

      Used in conjuction with InventoryType.CHECK_QUANTITY within the blAddItemWorkflow and blUpdateItemWorkflow. This field is checked within the CheckAddAvailabilityActivity to determine if inventory is actually available for this Sku.

    • setQuantityAvailable

      void setQuantityAvailable(Integer quantityAvailable)

      Used in conjunction with InventoryType.CHECK_QUANTITY from getInventoryType(). This sets how much inventory is available for this Sku.

      Parameters:
      quantityAvailable - the quantity available for this sku
    • getFulfillmentType

      FulfillmentType getFulfillmentType()
      Returns the fulfillment type for this sku. May be null.
      Returns:
    • setFulfillmentType

      void setFulfillmentType(FulfillmentType fulfillmentType)
      Sets the fulfillment type for this sku. May return null.
      Parameters:
      fulfillmentType -
    • clearDynamicPrices

      void clearDynamicPrices()
      Clears any currently stored dynamic pricing
    • getCurrency

      org.broadleafcommerce.common.currency.domain.BroadleafCurrency getCurrency()
      Note: When using dynamic pricing, this method is unreliable and should not be called outside of the Broadleaf admin Instead, you should rely on the BroadleafRequestContext.getBroadleafCurrency() instead of storing at the SKU level.

      As such, for supported, enterprise installations, this method should always return null.

      This method was not deprecated as it may have some use in non-standard Broadleaf installations but using its use is not suggested for most implementations.

      Returns:
      the currency for this sku
    • setCurrency

      void setCurrency(org.broadleafcommerce.common.currency.domain.BroadleafCurrency currency)
      Sets the currency for this Sku

      Note: Currency is ignored when using dynamic pricing

      Parameters:
      currency -
    • getTaxCode

      String getTaxCode()
      Returns the Tax Code for this particular Entity.

      If the current Tax Code on the Sku is null, the Product tax code will be returned.

      Returns:
      taxCode
    • setTaxCode

      void setTaxCode(String taxCode)
      Sets the tax code for this SKU
      Parameters:
      taxCode -
    • getUpc

      String getUpc()
      Gets the Universal Product Code (UPC)
      Returns:
    • setUpc

      void setUpc(String upc)
      Sets the Universal Product Code (UPC)
      Parameters:
      upc -
    • getExternalId

      String getExternalId()
      Intended to hold any unique identifier not tied to the Broadleaf Database Sequence Identifier. For example, many implementations may integrate or import/export data from other systems that manage their own unique identifiers.
      Returns:
      external ID
    • setExternalId

      void setExternalId(String externalId)
      Sets a unique external ID
      Parameters:
      externalId -
    • getPriceData

      DynamicSkuPrices getPriceData()
      If a DynamicPricingService is being used, this method will return the dynamic Sku prices. Otherwise, it will return an instance of DynamicSkuPrices with the retail and sale price from the underlying record.
      Returns: