org.broadleafcommerce.core.catalog.dao
Class SkuDaoImpl

java.lang.Object
  extended by org.broadleafcommerce.core.catalog.dao.SkuDaoImpl
All Implemented Interfaces:
SkuDao

@Repository(value="blSkuDao")
public class SkuDaoImpl
extends Object
implements SkuDao

Author:
Jeff Fischer

Field Summary
protected  javax.persistence.EntityManager em
           
protected  EntityConfiguration entityConfiguration
           
 
Constructor Summary
SkuDaoImpl()
           
 
Method Summary
 Sku create()
          Create a new Sku instance.
 void delete(Sku sku)
          Remove the Sku instance from the datastore
 List<Sku> readAllSkus()
          Retrieve all Sku instances from the datastore
 Sku readFirstSku()
          Retrieve the Sku instance whose primary key is the smallest of all skus in the datastore
 Sku readSkuById(Long skuId)
          Retrieve a Sku instance by its primary key
 List<Sku> readSkusById(List<Long> ids)
          Find all the Sku instances whose primary key matches one of the values from the passed in list
 Sku save(Sku sku)
          Persist a Sku instance to the datastore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

em

protected javax.persistence.EntityManager em

entityConfiguration

protected EntityConfiguration entityConfiguration
Constructor Detail

SkuDaoImpl

public SkuDaoImpl()
Method Detail

save

public Sku save(Sku sku)
Description copied from interface: SkuDao
Persist a Sku instance to the datastore

Specified by:
save in interface SkuDao
Parameters:
sku - the sku to persist
Returns:
the saved state of the passed in sku

readSkuById

public Sku readSkuById(Long skuId)
Description copied from interface: SkuDao
Retrieve a Sku instance by its primary key

Specified by:
readSkuById in interface SkuDao
Parameters:
skuId - the primary key of the sku
Returns:
the sku at the primary key

readFirstSku

public Sku readFirstSku()
Description copied from interface: SkuDao
Retrieve the Sku instance whose primary key is the smallest of all skus in the datastore

Specified by:
readFirstSku in interface SkuDao
Returns:
the sku with the smallest primary key

readAllSkus

public List<Sku> readAllSkus()
Description copied from interface: SkuDao
Retrieve all Sku instances from the datastore

Specified by:
readAllSkus in interface SkuDao
Returns:
the list of all skus

readSkusById

public List<Sku> readSkusById(List<Long> ids)
Description copied from interface: SkuDao
Find all the Sku instances whose primary key matches one of the values from the passed in list

Specified by:
readSkusById in interface SkuDao
Parameters:
ids - the list of primary key values
Returns:
the list of skus that match the list of primary key values

delete

public void delete(Sku sku)
Description copied from interface: SkuDao
Remove the Sku instance from the datastore

Specified by:
delete in interface SkuDao
Parameters:
sku - the sku to remove

create

public Sku create()
Description copied from interface: SkuDao
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.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.

Specified by:
create in interface SkuDao
Returns:
a Sku instance based on the Broadleaf entity configuration.


Copyright © 2012. All Rights Reserved.