com.elasticpath.service.catalog.impl
Class ProductTypeServiceImpl

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

public class ProductTypeServiceImpl
extends AbstractEpPersistenceServiceImpl
implements ProductTypeService

Default implementation for AttributeService.


Constructor Summary
ProductTypeServiceImpl()
           
 
Method Summary
 ProductType add(ProductType productType)
          Adds the given attribute.
 ProductType get(long uid)
          Get the productType with the given UID.
 java.lang.Object getObject(long uid)
          Generic load method for all persistable domain models.
 ProductType initialize(ProductType productType)
          Initialize (fill in) category attributes for the given ProductType.
 java.util.List list()
          Lists all ProductType stored in the database.
 java.util.List listUsedUids()
          Lists all productType uids used by categories.
 void remove(ProductType productType)
          Delete the ProductType.
 void update(ProductType productType)
          Updates the given ProductType.
 
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

ProductTypeServiceImpl

public ProductTypeServiceImpl()
Method Detail

add

public ProductType add(ProductType productType)
                throws DuplicateKeyException
Adds the given attribute.

Specified by:
add in interface ProductTypeService
Parameters:
productType - the attribute to add
Returns:
the persisted instance of ProductType
Throws:
DuplicateKeyException - - if a productType with the speicifed key already exists.

get

public ProductType get(long uid)
                throws EpServiceException
Get the productType with the given UID. Return null if no matching record exists.

Parameters:
uid - the ProductType UID
Returns:
the ProductType 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

initialize

public ProductType initialize(ProductType productType)
Initialize (fill in) category attributes for the given ProductType. DWR outbound conversion will fail on lazy load errors if the attributes themselves are not loaded also.

Specified by:
initialize in interface ProductTypeService
Parameters:
productType - productType that needs attributes filled in.
Returns:
productType with attributeGroup filled in.

list

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

Specified by:
list in interface ProductTypeService
Returns:
a list of ProductType
Throws:
EpServiceException - - in case of any errors

listUsedUids

public java.util.List listUsedUids()
Lists all productType uids used by categories.

Specified by:
listUsedUids in interface ProductTypeService
Returns:
a list of used productType uids

remove

public void remove(ProductType productType)
            throws EpServiceException
Delete the ProductType.

Specified by:
remove in interface ProductTypeService
Parameters:
productType - the ProductType to remove
Throws:
EpServiceException - - in case of any errors

update

public void update(ProductType productType)
            throws DuplicateKeyException
Updates the given ProductType. Will also remove attribute values for attributes which were removed. There is no need to update sku options since they shouldn't be able change on edit.

Specified by:
update in interface ProductTypeService
Parameters:
productType - the ProductType to update
Throws:
DuplicateKeyException - - if a productType with the speicifed key already exists.