com.elasticpath.service.attribute
Interface AttributeService

All Superinterfaces:
EpPersistenceService, EpService
All Known Implementing Classes:
AttributeServiceImpl

public interface AttributeService
extends EpPersistenceService

Provide attribute related business service.


Method Summary
 Attribute add(Attribute attribute)
          Adds the given attribute.
 Attribute findByKey(java.lang.String key)
          Find the attribute with the given key.
 Attribute get(long attributeUid)
          Get the attribute with the given UID.
 java.util.List getAttributeInUseUidList()
          Return a list of uids for all attributes in use.
 java.util.List getAttributesExcludeCustomerProfile()
          Returns a list of attributes exclude customer profile attribute.
 java.util.Map getAttributeTypeMap()
          Return the map for attribute type value-description.
 java.util.Map getAttributeUsageMap()
          Return the map for attribute usage value-description.
 java.util.List getCategoryAttributes()
          Return a list of attributes used for categories.
 java.util.List getCustomerProfileAttributeInUseUidList()
          Return a list of uids for all customer profile attributes in use.
 java.util.List getCustomerProfileAttributes()
          Returns a list of all system attributes.
 java.util.Map getCustomerProfileAttributesMap()
          Returns a map of all system attributes.
 java.util.List getDistinctAttributeValueList(Attribute attribute, java.lang.String languageCode)
          For a given attribute, the set of distinct values currently existing for that attribute is returned.
 java.util.List getProductAttributes()
          Return a list of attributes used for products.
 java.util.List getSkuAttributes()
          Return a list of attributes used for skus.
 boolean keyExists(Attribute attribute)
          Check whether the given attribute's key exists or not.
 boolean keyExists(java.lang.String key)
          Checks whether the given attribute key exists or not.
 java.util.List list()
          Lists all attribute stored in the database.
 Attribute load(long attributeUid)
          Load the attribute with the given UID.
 void remove(Attribute attribute)
          Delete the attribute.
 void setDistinctAttributeValueCriterion(DistinctAttributeValueCriterion distinctAttributeValueCriterion)
          Sets the generator for criteria used to query the persistence layer for distinct lists of attribute values.
 void update(Attribute attribute)
          Updates the given attribute.
 
Methods inherited from interface com.elasticpath.service.EpPersistenceService
getObject, getPersistenceEngine, setPersistenceEngine
 
Methods inherited from interface com.elasticpath.service.EpService
getElasticPath, setElasticPath
 

Method Detail

add

Attribute add(Attribute attribute)
              throws DuplicateKeyException
Adds the given attribute.

Parameters:
attribute - the attribute to add
Returns:
the persisted instance of attribute
Throws:
DuplicateKeyException - - if the speicifed attribute key is already in use.

findByKey

Attribute findByKey(java.lang.String key)
                    throws EpServiceException
Find the attribute with the given key.

Parameters:
key - the attribute key.
Returns:
the attribute that matches the given key, otherwise null
Throws:
EpServiceException - - in case of any errors

get

Attribute get(long attributeUid)
              throws EpServiceException
Get the attribute with the given UID. Return null if no matching record exists.

Parameters:
attributeUid - the attribute UID
Returns:
the attribute if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getAttributeInUseUidList

java.util.List getAttributeInUseUidList()
Return a list of uids for all attributes in use.

Returns:
a list of uids for all attributes in use

getAttributesExcludeCustomerProfile

java.util.List getAttributesExcludeCustomerProfile()
Returns a list of attributes exclude customer profile attribute.

Returns:
a list of attributes exclude customer profile attribute

getAttributeTypeMap

java.util.Map getAttributeTypeMap()
Return the map for attribute type value-description.

Returns:
the map for attribute type value-description

getAttributeUsageMap

java.util.Map getAttributeUsageMap()
Return the map for attribute usage value-description.

Returns:
the map for attribute usage value-description

getCategoryAttributes

java.util.List getCategoryAttributes()
Return a list of attributes used for categories.

Returns:
a list of category attributes.

getCustomerProfileAttributeInUseUidList

java.util.List getCustomerProfileAttributeInUseUidList()
Return a list of uids for all customer profile attributes in use.

Returns:
a list of uids for all customer profile attributes in use

getCustomerProfileAttributes

java.util.List getCustomerProfileAttributes()
Returns a list of all system attributes.

Returns:
a list of all system attributes

getCustomerProfileAttributesMap

java.util.Map getCustomerProfileAttributesMap()
Returns a map of all system attributes.

Returns:
a map of all system attributes

getDistinctAttributeValueList

java.util.List getDistinctAttributeValueList(Attribute attribute,
                                             java.lang.String languageCode)
For a given attribute, the set of distinct values currently existing for that attribute is returned.

Parameters:
attribute - the attribute for which the distinct attribute values are to be returned
languageCode - the lower case code of the language for which attributes are to be returned.
Returns:
a List of matching AttributeValues

getProductAttributes

java.util.List getProductAttributes()
Return a list of attributes used for products.

Returns:
a list of products attributes.

getSkuAttributes

java.util.List getSkuAttributes()
Return a list of attributes used for skus.

Returns:
a list of sku attributes.

keyExists

boolean keyExists(Attribute attribute)
                  throws EpServiceException
Check whether the given attribute's key exists or not.

Parameters:
attribute - the attribute to check
Returns:
true if a different attribute with the given attribute's key exists
Throws:
EpServiceException - - in case of any errors

keyExists

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

Parameters:
key - the attribute key.
Returns:
true if the given key exists.
Throws:
EpServiceException - - in case of any errors

list

java.util.List list()
                    throws EpServiceException
Lists all attribute stored in the database.

Returns:
a list of attribute
Throws:
EpServiceException - - in case of any errors

load

Attribute load(long attributeUid)
               throws EpServiceException
Load the attribute with the given UID. Throw an unrecoverable exception if there is no matching database row.

Parameters:
attributeUid - the attribute UID
Returns:
the attribute if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

remove

void remove(Attribute attribute)
            throws EpServiceException
Delete the attribute.

Parameters:
attribute - the attribute to remove
Throws:
EpServiceException - - in case of any errors

setDistinctAttributeValueCriterion

void setDistinctAttributeValueCriterion(DistinctAttributeValueCriterion distinctAttributeValueCriterion)
Sets the generator for criteria used to query the persistence layer for distinct lists of attribute values.

Parameters:
distinctAttributeValueCriterion - the DistinctAttributeValueCriterion

update

void update(Attribute attribute)
            throws DuplicateKeyException
Updates the given attribute.

Parameters:
attribute - the attribute to update
Throws:
DuplicateKeyException - - if the speicifed attribute key is already in use.