com.elasticpath.service.catalog.impl
Class BrandServiceImpl

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

public class BrandServiceImpl
extends AbstractEpPersistenceServiceImpl
implements BrandService

This is the default implementation of BrandService.


Constructor Summary
BrandServiceImpl()
           
 
Method Summary
 Brand add(Brand brand)
          Adds the given brand.
 boolean codeExists(Brand brand)
          Check whether the given brand's code exists or not.
 boolean codeExists(java.lang.String code)
          Checks whether the given brand code exists or not.
 Brand findByCode(java.lang.String code)
          Find the brand with the given code.
 Brand get(long brandUid)
          Get the brand with the given UID.
 java.util.List getBrandCodeNameList()
          Return a list of brand code and default locale display name of all brands.
 java.util.List getBrandInUseList()
          Return a list of all brands in use.
 java.util.List getBrandInUseUidList()
          Return a list of uids for all brands in use.
 Brand getDummyBrand()
          Retrieve the dummy brand.
 java.lang.Object getObject(long uid)
          Generic get method for all persistable domain models.
 java.util.List list()
          Lists all brand stored in the database.
 void remove(Brand brand)
          Deletes the brand.
 void saveOrUpdate(Brand brand)
          Save or update the given brand.
 void update(Brand brand)
          Updates the given brand.
 
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

BrandServiceImpl

public BrandServiceImpl()
Method Detail

add

public Brand add(Brand brand)
          throws EpServiceException
Adds the given brand.

Specified by:
add in interface BrandService
Parameters:
brand - the brand to add
Returns:
the persisted instance of brand
Throws:
EpServiceException - - in case of any errors

codeExists

public boolean codeExists(Brand brand)
                   throws EpServiceException
Check whether the given brand's code exists or not.

Specified by:
codeExists in interface BrandService
Parameters:
brand - the brand to check
Returns:
true if a different brand with the given brand's code exists
Throws:
EpServiceException - - in case of any errors

codeExists

public boolean codeExists(java.lang.String code)
                   throws EpServiceException
Checks whether the given brand code exists or not.

Specified by:
codeExists in interface BrandService
Parameters:
code - the brand code.
Returns:
true if the given code exists.
Throws:
EpServiceException - - in case of any errors

findByCode

public Brand findByCode(java.lang.String code)
                 throws EpServiceException
Find the brand with the given code.

Specified by:
findByCode in interface BrandService
Parameters:
code - the brand code.
Returns:
the brand that matches the given code, otherwise null
Throws:
EpServiceException - - in case of any errors

get

public Brand get(long brandUid)
          throws EpServiceException
Get the brand with the given UID. Return a new instance if the given UID is less than 0. Return null the given UID is bigger than 0 and no matching record exists.

Specified by:
get in interface BrandService
Parameters:
brandUid - the Brand UID.
Returns:
a brand if the given UID is less than 0 or exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getBrandCodeNameList

public java.util.List getBrandCodeNameList()
Return a list of brand code and default locale display name of all brands.

Specified by:
getBrandCodeNameList in interface BrandService
Returns:
a list of brand code and default locale display name of all brands

getBrandInUseList

public java.util.List getBrandInUseList()
Return a list of all brands in use.

Specified by:
getBrandInUseList in interface BrandService
Returns:
a list of all brands in use

getBrandInUseUidList

public java.util.List getBrandInUseUidList()
Return a list of uids for all brands in use.

Specified by:
getBrandInUseUidList in interface BrandService
Returns:
a list of uids for all brands in use

getDummyBrand

public Brand getDummyBrand()
                    throws EpServiceException
Retrieve the dummy brand. The dummy brand can be used as a brand filter for those products whose brands hasn't been specified.

Returns:
the dummy brand
Throws:
EpServiceException - in case of any error

getObject

public java.lang.Object getObject(long uid)
                           throws EpServiceException
Generic get 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

list

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

Specified by:
list in interface BrandService
Returns:
a list of brand
Throws:
EpServiceException - - in case of any errors

remove

public void remove(Brand brand)
            throws EpServiceException
Deletes the brand.

Specified by:
remove in interface BrandService
Parameters:
brand - the brand to remove
Throws:
EpServiceException - in case of any errors

saveOrUpdate

public void saveOrUpdate(Brand brand)
                  throws EpServiceException
Save or update the given brand.

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

update

public void update(Brand brand)
            throws EpServiceException
Updates the given brand.

Specified by:
update in interface BrandService
Parameters:
brand - the brand to update
Throws:
EpServiceException - - in case of any errors