com.elasticpath.service.catalog.impl
Class SkuOptionServiceImpl

java.lang.Object
  extended by com.elasticpath.service.impl.AbstractEpServiceImpl
      extended by com.elasticpath.service.impl.AbstractEpPersistenceServiceImpl
          extended by com.elasticpath.service.catalog.impl.SkuOptionServiceImpl
All Implemented Interfaces:
SkuOptionService, EpPersistenceService, EpService

public class SkuOptionServiceImpl
extends AbstractEpPersistenceServiceImpl
implements SkuOptionService

Default implementation for SkuOptionService.


Constructor Summary
SkuOptionServiceImpl()
           
 
Method Summary
 SkuOption add(SkuOption skuOption)
          Adds the given sku option.
 SkuOption addOptionValue(SkuOptionValue skuOptionValue, SkuOption skuOption)
          Add the sku option value.
 SkuOption findByKey(java.lang.String key)
          Find the sku option with the given key.
 long findOptionValueUidPkByKey(java.lang.String key)
          Find the sku option value with the given key.
 long findUidPkByKey(java.lang.String key)
          Find the sku option with the given key.
 SkuOption get(long skuOptionUid)
          Get the sku option with the given UID.
 java.lang.Object getObject(long uid)
          Generic load method for all persistable domain models.
 java.util.List getSkuOptionInUseUidList()
          Return a list of uids for all sku options in use.
 java.util.List getSkuOptionValueInUseUidList()
          Return a list of uids for all sku options value in use.
 boolean keyExists(SkuOption skuOption)
          Check whether the given sku option's key exists or not.
 boolean keyExists(java.lang.String key)
          Checks whether the given sku option key exists or not.
 java.util.List list()
          Lists all sku option stored in the database.
 SkuOption load(long skuOptionUid)
          Load the sku option with the given UID.
 void remove(SkuOption skuOption)
          Delete the sku option.
 SkuOption removeOptionValue(SkuOptionValue skuOptionValue, SkuOption skuOption)
          Delete the sku option value.
 void saveOrUpdate(SkuOption skuOption)
          Save or update the given skuOption.
 SkuOption update(SkuOption skuOption)
          Updates the given sku option.
 
Methods inherited from class com.elasticpath.service.impl.AbstractEpPersistenceServiceImpl
getPersistenceEngine, setPersistenceEngine
 
Methods inherited from class com.elasticpath.service.impl.AbstractEpServiceImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.service.EpPersistenceService
getPersistenceEngine, setPersistenceEngine
 
Methods inherited from interface com.elasticpath.service.EpService
getElasticPath, setElasticPath
 

Constructor Detail

SkuOptionServiceImpl

public SkuOptionServiceImpl()
Method Detail

add

public SkuOption add(SkuOption skuOption)
              throws SkuOptionKeyExistException
Adds the given sku option.

Specified by:
add in interface SkuOptionService
Parameters:
skuOption - the sku option to add
Returns:
the persisted instance of sku option
Throws:
SkuOptionKeyExistException - - if the sepcified skuOptionKey is already in use.

addOptionValue

public SkuOption addOptionValue(SkuOptionValue skuOptionValue,
                                SkuOption skuOption)
                         throws SkuOptionKeyExistException
Add the sku option value.

Specified by:
addOptionValue in interface SkuOptionService
Parameters:
skuOptionValue - the sku option value to add
skuOption - the sku option to update
Returns:
skuOtion as SkuOption
Throws:
SkuOptionKeyExistException - - if the sepcified skuOptionKey is already in use.

findByKey

public SkuOption findByKey(java.lang.String key)
                    throws EpServiceException
Find the sku option with the given key.

Specified by:
findByKey in interface SkuOptionService
Parameters:
key - the sku option key.
Returns:
the sku option that matches the given key, otherwise null
Throws:
EpServiceException - - in case of any errors

findOptionValueUidPkByKey

public long findOptionValueUidPkByKey(java.lang.String key)
                               throws EpServiceException
Find the sku option value with the given key.

Parameters:
key - the sku option value key.
Returns:
the sku option value uid that matches the given key, otherwise return -1
Throws:
EpServiceException - - in case of any errors

findUidPkByKey

public long findUidPkByKey(java.lang.String key)
                    throws EpServiceException
Find the sku option with the given key.

Specified by:
findUidPkByKey in interface SkuOptionService
Parameters:
key - the sku option key.
Returns:
the sku option uid that matches the given key, otherwise return -1
Throws:
EpServiceException - - in case of any errors

get

public SkuOption get(long skuOptionUid)
              throws EpServiceException
Get the sku option with the given UID. Return null if no matching record exists.

Specified by:
get in interface SkuOptionService
Parameters:
skuOptionUid - the sku option UID
Returns:
the sku option if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getObject

public java.lang.Object getObject(long uid)
                           throws EpServiceException
Generic load method for all persistable domain models.

Specified by:
getObject in interface EpPersistenceService
Parameters:
uid - the persisted instance uid
Returns:
the persisted instance if exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getSkuOptionInUseUidList

public java.util.List getSkuOptionInUseUidList()
Return a list of uids for all sku options in use.

Specified by:
getSkuOptionInUseUidList in interface SkuOptionService
Returns:
a list of uids for all sku options in use

getSkuOptionValueInUseUidList

public java.util.List getSkuOptionValueInUseUidList()
Return a list of uids for all sku options value in use.

Specified by:
getSkuOptionValueInUseUidList in interface SkuOptionService
Returns:
a list of uids for all sku options value in use

keyExists

public boolean keyExists(SkuOption skuOption)
                  throws EpServiceException
Check whether the given sku option's key exists or not.

Specified by:
keyExists in interface SkuOptionService
Parameters:
skuOption - the sku option to check
Returns:
true if a different sku option with the given sku option's key exists
Throws:
EpServiceException - - in case of any errors

keyExists

public boolean keyExists(java.lang.String key)
                  throws EpServiceException
Checks whether the given sku option key exists or not.

Specified by:
keyExists in interface SkuOptionService
Parameters:
key - the sku option key.
Returns:
true if the given key exists.
Throws:
EpServiceException - - in case of any errors

list

public java.util.List list()
                    throws EpServiceException
Lists all sku option stored in the database.

Specified by:
list in interface SkuOptionService
Returns:
a list of sku option
Throws:
EpServiceException - - in case of any errors

load

public SkuOption load(long skuOptionUid)
               throws EpServiceException
Load the sku option with the given UID. Throw an unrecoverable exception if there is no matching database row.

Specified by:
load in interface SkuOptionService
Parameters:
skuOptionUid - the sku option UID
Returns:
the sku option if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

remove

public void remove(SkuOption skuOption)
            throws EpServiceException
Delete the sku option.

Specified by:
remove in interface SkuOptionService
Parameters:
skuOption - the sku option to remove
Throws:
EpServiceException - - in case of any errors

removeOptionValue

public SkuOption removeOptionValue(SkuOptionValue skuOptionValue,
                                   SkuOption skuOption)
                            throws EpServiceException
Delete the sku option value.

Specified by:
removeOptionValue in interface SkuOptionService
Parameters:
skuOptionValue - the sku option value to remove
skuOption - the sku option to update
Returns:
skuOtion as SkuOption
Throws:
EpServiceException - - in case of any errors

saveOrUpdate

public void saveOrUpdate(SkuOption skuOption)
                  throws EpServiceException
Save or update the given skuOption.

Specified by:
saveOrUpdate in interface SkuOptionService
Parameters:
skuOption - the brand to save or update
Throws:
EpServiceException - - in case of any errors

update

public SkuOption update(SkuOption skuOption)
                 throws SkuOptionKeyExistException
Updates the given sku option.

Specified by:
update in interface SkuOptionService
Parameters:
skuOption - the sku option to update
Returns:
skuOtion as SkuOption
Throws:
SkuOptionKeyExistException - - if the sepcified skuOptionKey is already in use.