Interface SkuDao

All Known Implementing Classes:
SkuDaoImpl

public interface SkuDao
SkuDao provides persistence access to Sku instances
Author:
Jeff Fischer
  • Method Details

    • readSkuById

      Sku readSkuById(Long skuId)
      Retrieve a Sku instance by its primary key
      Parameters:
      skuId - the primary key of the sku
      Returns:
      the sku at the primary key
    • readSkuByUpc

      Sku readSkuByUpc(String upc)
      Queries for a Sku instance by its Universal Product Code (UPC).
      Parameters:
      upc -
      Returns:
    • readSkuByExternalId

      Sku readSkuByExternalId(String externalId)
      Retrieve a Sku instance by its external id
      Parameters:
      externalId - the external id of the sku
      Returns:
      the sku with this external id
    • save

      Sku save(Sku sku)
      Persist a Sku instance to the datastore
      Parameters:
      sku - the sku to persist
      Returns:
      the saved state of the passed in sku
    • saveSkuFee

      SkuFee saveSkuFee(SkuFee fee)
    • readFirstSku

      Sku readFirstSku()
      Retrieve the Sku instance whose primary key is the smallest of all skus in the datastore
      Returns:
      the sku with the smallest primary key
    • readAllSkus

      List<Sku> readAllSkus()
      Retrieve all Sku instances from the datastore
      Returns:
      the list of all skus
    • readAllSkus

      List<Sku> readAllSkus(int offset, int limit)
      Retrieve all Sku instances from the datastore
      Parameters:
      offset - the starting offset of the query
      limit - the maximum number of Skus to gather
      Returns:
      the list of all skus in the given range
    • readSkusByIds

      List<Sku> readSkusByIds(List<Long> ids)
      Find all the Sku instances whose primary key matches one of the values from the passed in list
      Parameters:
      ids - the list of primary key values
      Returns:
      the list of skus that match the list of primary key values
    • delete

      void delete(Sku sku)
      Remove the Sku instance from the datastore
      Parameters:
      sku - the sku to remove
    • create

      Sku create()
      Create a new Sku instance. The system will use the configuration in /BroadleafCommerce/core/BroadleafCommerceFramework/src/main/resources/bl-framework-applicationContext-entity.xml to determine which polymorphic version of Sku to instantiate. To make Broadleaf instantiate your extension of Sku by default, include an entity configuration bean in your application context xml similar to:

      <bean id="blEntityConfiguration" class="org.broadleafcommerce.common.persistence.EntityConfiguration"> <property name="entityContexts"> <list> <value>classpath:myCompany-applicationContext-entity.xml</value> </list> </property> </bean>

      Declare the same key for your desired entity in your entity xml that is used in the Broadleaf entity xml, but change the value to the fully qualified classname of your entity extension.
      Returns:
      a Sku instance based on the Broadleaf entity configuration.
    • readCountAllActiveSkus

      Long readCountAllActiveSkus()
      Returns the number of Skus that are currently active.
      Returns:
      the number of currently active Skus
    • readAllActiveSkus

      List<Sku> readAllActiveSkus(int page, int pageSize)
      Reads all Skus from the database that are currently active. This method utilizes database paging.

      It will fetch results in pages. For example, if page = 3 and pageSize = 25, this method would return rows 75-99 from the database.

      Parameters:
      page - - the number of the page to get (0 indexed)
      pageSize - - the number of results per page
      Returns:
      a list of active Skus for the given page
    • readAllActiveSkus

      List<Sku> readAllActiveSkus(Integer pageSize, Long lastId)
      Reads all skus from the database that are currently active. This method utilizes efficient paging to retrieve a subset of records. This approach does not use an offset technique (like readAllActiveSkus(int, int), but rather limits the retrieved records to those greater than the given id and returns a max results of pageSize. This is more efficient that using an offset, since the database will not have to retrieve all the records from the beginning of the table and trim the offset.
      Parameters:
      pageSize - the number of results per page
      lastId - the last id from the previous page - can be null if this is the first page request
      Returns:
      a list of active skus for the given page
    • getCurrentDateResolution

      Long getCurrentDateResolution()
      Returns the number of milliseconds that the current date/time will be cached for queries before refreshing. This aids in query caching, otherwise every query that utilized current date would be different and caching would be ineffective.
      Returns:
      the milliseconds to cache the current date/time
    • setCurrentDateResolution

      void setCurrentDateResolution(Long currentDateResolution)
      Sets the number of milliseconds that the current date/time will be cached for queries before refreshing. This aids in query caching, otherwise every query that utilized current date would be different and caching would be ineffective.
      Parameters:
      currentDateResolution - the milliseconds to cache the current date/time
    • findSkuByURI

      List<Sku> findSkuByURI(String uri)
      Look up a sku that matches the given URI
      Parameters:
      uri - - the relative URL to look up the sku by
      Returns:
      List of skus that match the passed in URI.