com.elasticpath.service.catalog
Interface CategoryService

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

public interface CategoryService
extends EpPersistenceService

Provide category-related business service.


Method Summary
 Category add(Category category)
          Adds the given category.
 java.util.List findAllUids()
          Returns all category uids as a list.
 java.util.Set findAncestorCategoryUidsByCategoryUid(long categoryUid)
          Returns the set of category uids, which are ancestors of the given category uid.
 java.util.Set findAncestorCategoryUidsByProductUid(long productUid)
          Returns the set of category uids, which are ancestors of the given product uid.
 java.util.List findAvailableUids()
          Returns all available category uids as a list.
 Category findByGuid(java.lang.String guid)
          Retrieve the category with the given guid.
 java.util.List findByUids(java.util.Collection categoryUids, CategoryLoadTuner loadTuner)
          Returns a list of Category based on the given uids.
 java.util.List findCategoryByCriteria(CategorySearchCriteria categorySearchCriteria)
          Retrieve the list of categories, whose specified property contain the given criteria value.
 java.util.List findCategoryLike(java.lang.String propertyName, java.lang.String criteriaValue)
          Retrieve the list of categories, whose specified property contain the given criteria value.
 java.util.List findDecendantCategoryUids(java.util.List categoryUids)
          Retrieve all decendant category uids of the given category uids.
 java.util.List findDecendantCategoryUids(long categoryUid)
          Retrieve all decendant category uids of the given category uid.
 java.util.List findFeaturedProductUidList(long categoryUid)
          Get a list of featured product uid by the category uid.
 long findUidById(java.lang.String categoryId)
          Get the category UID of the given category identifier.
 java.util.List findUidsByDeletedDate(java.util.Date date)
          Retrieves list of category uids where the deleted date is later than the specified date.
 java.util.List findUidsByModifiedDate(java.util.Date date)
          Retrieves list of Category uids where the last modified date is later than the specified date.
 Category get(long categoryUid)
          Get the category with the given UID.
 Category getCategoryWithAttribute(long categoryUid)
          Get the category with the given UID.
 Category getCategoryWithSubCategories(long categoryUid)
          Get the category with the given UID.
 java.util.List getFeaturedProductsList(long categoryUid)
          Get a list of featured product by the category uid.
 java.util.List getSubCategories(long categoryUid)
          Retrieve the list of sub-categories of the current category.
 boolean guidExists(java.lang.String guid)
          Checks whether the given category guid exists or not, for category, i.e.
 boolean hasProduct(long categoryUid)
          Check if the category has product.
 boolean isProductInCategory(long productUid, long categoryUid)
          Return true if the product with the given productuid is in the category with the given categoryuid.
 java.util.List listRootCategories(boolean availableOnly)
          Retrieve a list of root categories.
 java.util.List listRootCategoriesWithTree(boolean availableOnly)
          Retrieve root categories with the entire tree of children loaded.
 Category load(long categoryUid)
          Load the category with the given UID.
 void removeCategoryTree(long categoryUid)
          Deletes the category and all sub categories and products with the default category set.
 void saveOrUpdate(Category category)
          Save or update the given category.
 void update(Category category)
          Updates the given category.
 void updateOrder(long uidOne, long uidTwo)
          Re orders (swaps the ordering field) of the two parameter categories.
 void updatePosition(long uidPk, long oldParentUid, long newParentUid, java.lang.Long newPreviousCategoryUid)
          Updates the position (parent category) and ordering of category after a drag and drop.
 
Methods inherited from interface com.elasticpath.service.EpPersistenceService
getObject, getPersistenceEngine, setPersistenceEngine
 
Methods inherited from interface com.elasticpath.service.EpService
getElasticPath, setElasticPath
 

Method Detail

add

Category add(Category category)
             throws EpServiceException
Adds the given category.

Parameters:
category - the category to add
Returns:
the persisted instance of category
Throws:
EpServiceException - - in case of any errors

findAllUids

java.util.List findAllUids()
Returns all category uids as a list.

Returns:
all category uids as a list

findAncestorCategoryUidsByCategoryUid

java.util.Set findAncestorCategoryUidsByCategoryUid(long categoryUid)
Returns the set of category uids, which are ancestors of the given category uid.

Parameters:
categoryUid - the category uid
Returns:
a set of category uids

findAncestorCategoryUidsByProductUid

java.util.Set findAncestorCategoryUidsByProductUid(long productUid)
Returns the set of category uids, which are ancestors of the given product uid.

Parameters:
productUid - the product uid
Returns:
a set of category uids

findAvailableUids

java.util.List findAvailableUids()
Returns all available category uids as a list.

Returns:
all available category uids as a list

findByGuid

Category findByGuid(java.lang.String guid)
                    throws EpServiceException
Retrieve the category with the given guid.

Parameters:
guid - the guid of the category
Returns:
the category with the given guid
Throws:
EpServiceException - in case of any error

findByUids

java.util.List findByUids(java.util.Collection categoryUids,
                          CategoryLoadTuner loadTuner)
Returns a list of Category based on the given uids. The returned category will be populated based on the given load tuner.

Parameters:
categoryUids - a collection of category uids
loadTuner - the load tuner
Returns:
a list of Categorys

findCategoryByCriteria

java.util.List findCategoryByCriteria(CategorySearchCriteria categorySearchCriteria)
Retrieve the list of categories, whose specified property contain the given criteria value.

Parameters:
categorySearchCriteria - criteria for category search.
Returns:
list of categories matching the given criteria.

findCategoryLike

java.util.List findCategoryLike(java.lang.String propertyName,
                                java.lang.String criteriaValue)
                                throws EpServiceException
Retrieve the list of categories, whose specified property contain the given criteria value.

Parameters:
propertyName - category property to search on.
criteriaValue - criteria value to be used for searching.
Returns:
list of categories matching the given criteria.
Throws:
EpServiceException - in case of any error

findDecendantCategoryUids

java.util.List findDecendantCategoryUids(java.util.List categoryUids)
Retrieve all decendant category uids of the given category uids.

Parameters:
categoryUids - the category uids.
Returns:
the list of uids of the direct and indirct subcategories of the given start category uids.

findDecendantCategoryUids

java.util.List findDecendantCategoryUids(long categoryUid)
Retrieve all decendant category uids of the given category uid.

Parameters:
categoryUid - the category uid.
Returns:
the list of uids of the direct and indirct subcategories of the given start category.

findFeaturedProductUidList

java.util.List findFeaturedProductUidList(long categoryUid)
Get a list of featured product uid by the category uid.

Parameters:
categoryUid - the category uid.
Returns:
a list of product uid.

findUidById

long findUidById(java.lang.String categoryId)
                 throws EpServiceException
Get the category UID of the given category identifier. The given category identifier will frist be dealt as a guid to try to find a category UID. It no category UID is found and the given identifier is a long value, itself will be dealt as UID.

Parameters:
categoryId - the category Guid or UID.
Returns:
the category UID if the given ID exists, otherwise 0
Throws:
EpServiceException - - in case of any errors

findUidsByDeletedDate

java.util.List findUidsByDeletedDate(java.util.Date date)
Retrieves list of category uids where the deleted date is later than the specified date.

Parameters:
date - date to compare with the deleted date
Returns:
list of category uids whose deleted date is later than the specified date

findUidsByModifiedDate

java.util.List findUidsByModifiedDate(java.util.Date date)
Retrieves list of Category uids where the last modified date is later than the specified date.

Parameters:
date - date to compare with the last modified date
Returns:
list of Category whose last modified date is later than the specified date

get

Category get(long categoryUid)
             throws EpServiceException
Get the category with the given UID. Return null if no matching record exists.

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

getCategoryWithAttribute

Category getCategoryWithAttribute(long categoryUid)
                                  throws EpServiceException
Get the category with the given UID. Return null if no matching record exists.

Parameters:
categoryUid - the category UID
Returns:
the category with attribute populated if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getCategoryWithSubCategories

Category getCategoryWithSubCategories(long categoryUid)
                                      throws EpServiceException
Get the category with the given UID. Return null if no matching record exists. All sub-categories will also be poplulated.

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

getFeaturedProductsList

java.util.List getFeaturedProductsList(long categoryUid)
Get a list of featured product by the category uid.

Parameters:
categoryUid - the category uidPk.
Returns:
a list of Product

getSubCategories

java.util.List getSubCategories(long categoryUid)
Retrieve the list of sub-categories of the current category.

Parameters:
categoryUid - the current category
Returns:
the list of sub-categories of the current category.

guidExists

boolean guidExists(java.lang.String guid)
                   throws EpServiceException
Checks whether the given category guid exists or not, for category, i.e. category code.

Parameters:
guid - the category code.
Returns:
true if the given guid(code) exists.
Throws:
EpServiceException - - in case of any errors

hasProduct

boolean hasProduct(long categoryUid)
                   throws EpServiceException
Check if the category has product.

Parameters:
categoryUid - the Uid of the category to be checked.
Returns:
true if the category has products
Throws:
EpServiceException - in case of any error

isProductInCategory

boolean isProductInCategory(long productUid,
                            long categoryUid)
Return true if the product with the given productuid is in the category with the given categoryuid. Otherwise, false

Parameters:
productUid - the product uid
categoryUid - the category uid
Returns:
true if the product with the given productuid is in the category with the given categoryuid. Otherwise, false

listRootCategories

java.util.List listRootCategories(boolean availableOnly)
Retrieve a list of root categories.

Parameters:
availableOnly - set it to true to only list available root categories
Returns:
return a list root categories

listRootCategoriesWithTree

java.util.List listRootCategoriesWithTree(boolean availableOnly)
Retrieve root categories with the entire tree of children loaded.

Parameters:
availableOnly - set it to true to only list available categories
Returns:
root categories with the entrie tree of children categories loaded

load

Category load(long categoryUid)
              throws EpServiceException
Load the category with the given UID. Throw an unrecoverable exception if there is no matching database row.

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

removeCategoryTree

void removeCategoryTree(long categoryUid)
                        throws EpServiceException
Deletes the category and all sub categories and products with the default category set.

Parameters:
categoryUid - the uid of the category to remove
Throws:
EpServiceException - - in case of any errors

saveOrUpdate

void saveOrUpdate(Category category)
                  throws EpServiceException
Save or update the given category.

Parameters:
category - the category to save or update
Throws:
EpServiceException - - in case of any errors

update

void update(Category category)
            throws EpServiceException
Updates the given category.

Parameters:
category - the category to update
Throws:
EpServiceException - - in case of any errors

updateOrder

void updateOrder(long uidOne,
                 long uidTwo)
Re orders (swaps the ordering field) of the two parameter categories.

Parameters:
uidOne - uid of a category to reorder
uidTwo - uid of a category to reorder

updatePosition

void updatePosition(long uidPk,
                    long oldParentUid,
                    long newParentUid,
                    java.lang.Long newPreviousCategoryUid)
Updates the position (parent category) and ordering of category after a drag and drop.

Parameters:
uidPk - uid of category
oldParentUid - uid of old parent
newParentUid - uid of new parent
newPreviousCategoryUid - uid of category directly in front of category (ordering-wise).