Class ProductConfigurationPersistenceServiceImpl
- java.lang.Object
-
- de.hybris.platform.sap.productconfig.services.impl.ProductConfigurationPersistenceServiceImpl
-
- All Implemented Interfaces:
ProductConfigurationPersistenceService
public class ProductConfigurationPersistenceServiceImpl extends java.lang.Object implements ProductConfigurationPersistenceService
Default implementation for theProductConfigurationPersistenceService
.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
PARAM_NAME_CONFIG_ID
protected static java.lang.String
PARAM_NAME_CONFIG_PK
-
Constructor Summary
Constructors Constructor Description ProductConfigurationPersistenceServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Date
calculateModificationDate(java.lang.Integer thresholdInDays)
protected PaginatedFlexibleSearchParameter
createPageableQuery(FlexibleSearchQuery query, int pageSize, int currentPage)
AbstractOrderEntryModel
getAbstractOrderEntryByConfigPk(java.lang.String configPk, boolean isDraft)
Get an abstract order entry by a configuration ID that can either represent the current product configuration attached to it or the current configuration draft.SearchPageData<ProductConfigurationModel>
getAll(int pageSize, int currentPage)
Gets all configurations currently persistetjava.util.List<AbstractOrderEntryModel>
getAllOrderEntriesByConfigId(java.lang.String configId)
Get all order entries to which the given config is currently assigned to.protected java.util.List<AbstractOrderEntryModel>
getAllOrderEntriesByModel(ProductConfigurationModel productConfigurationModel)
ProductConfigurationModel
getByConfigId(java.lang.String configId, boolean allowNull)
read theProductConfigurationModel
by configIdProductConfigurationModel
getByProductCode(java.lang.String productCode)
read theProductConfigurationModel
associated to the given product code for the current user.ProductConfigurationModel
getByProductCodeAndUser(java.lang.String productCode, UserModel user)
read allProductConfigurationModel
s currently linked to the given product and userjava.util.List<ProductConfigurationModel>
getByUserSessionId(java.lang.String userSessionId)
read the list ofProductConfigurationModel
associated to the given user session idprotected FlexibleSearchService
getFlexibleSearchService()
AbstractOrderEntryModel
getOrderEntryByConfigId(java.lang.String configId, boolean isDraft)
get the order entry to which the given config is currently assigned to.AbstractOrderEntryModel
getOrderEntryByPK(java.lang.String cartEntryKey)
read theAbstractOrderEntryModel
by PKSearchPageData<ProductConfigurationModel>
getOrphaned(int pageSize, int currentPage)
Gets configurations that are neither related to any abstract order entry nor are related to any Product.protected PaginatedFlexibleSearchService
getPaginatedFlexibleSearchService()
ProductConfigurationModel
getProductConfigByConfigId(java.lang.String configId)
Get product configuration model by configuration identifierSearchPageData<ProductConfigurationModel>
getProductRelatedByThreshold(java.lang.Integer thresholdInDays, int pageSize, int currentPage)
Gets configurations that are not related to abstract order entries and have not been touched for a certain time (specified in days)protected SessionService
getSessionService()
protected int
getTotalCount(java.util.Map<java.lang.String,java.lang.String> params, java.lang.String queryString)
protected UserService
getUserService()
boolean
isOnlyRelatedToGivenEntry(java.lang.String configId, java.lang.String cartEntryKey)
Checks whether a configuration is linked to more than the given abstract order entry.boolean
isRelatedToAbstractOrderEntry(ProductConfigurationModel model)
Is this model related to any abstract order entry, be it draft or not?void
setFlexibleSearchService(FlexibleSearchService flexibleSearchService)
void
setPaginatedFlexibleSearchService(PaginatedFlexibleSearchService paginatedFlexibleSearchService)
void
setSessionService(SessionService sessionService)
void
setUserService(UserService userService)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.sap.productconfig.services.intf.ProductConfigurationPersistenceService
getByConfigId
-
-
-
-
Field Detail
-
PARAM_NAME_CONFIG_ID
protected static final java.lang.String PARAM_NAME_CONFIG_ID
- See Also:
- Constant Field Values
-
PARAM_NAME_CONFIG_PK
protected static final java.lang.String PARAM_NAME_CONFIG_PK
- See Also:
- Constant Field Values
-
-
Method Detail
-
getByConfigId
public ProductConfigurationModel getByConfigId(java.lang.String configId, boolean allowNull)
Description copied from interface:ProductConfigurationPersistenceService
read theProductConfigurationModel
by configId- Specified by:
getByConfigId
in interfaceProductConfigurationPersistenceService
- Parameters:
configId
- configuration idallowNull
- iftrue
null is returned if no configuration with the given id is found, otherwise an exception is thrown- Returns:
- n product configuration persistence model
-
getOrderEntryByConfigId
public AbstractOrderEntryModel getOrderEntryByConfigId(java.lang.String configId, boolean isDraft)
Description copied from interface:ProductConfigurationPersistenceService
get the order entry to which the given config is currently assigned to. throws an AmbigiousIdentifierException, if there exists more than one OrderEntry linked to the given configId.- Specified by:
getOrderEntryByConfigId
in interfaceProductConfigurationPersistenceService
- Parameters:
configId
- product configuration idisDraft
- iftrue
draft link will be checked, otherwise default link- Returns:
- order entry
-
getProductConfigByConfigId
public ProductConfigurationModel getProductConfigByConfigId(java.lang.String configId)
Get product configuration model by configuration identifier- Parameters:
configId
- External identifier of the product configuration model- Returns:
- Product configuration model
-
getAbstractOrderEntryByConfigPk
public AbstractOrderEntryModel getAbstractOrderEntryByConfigPk(java.lang.String configPk, boolean isDraft)
Get an abstract order entry by a configuration ID that can either represent the current product configuration attached to it or the current configuration draft. The latter is only possible for cart entries.- Parameters:
configPk
- PK ofAbstractOrderEntryModel
isDraft
- Does PK belong to draft configuration?- Returns:
- Entry model
-
getAllOrderEntriesByConfigId
public java.util.List<AbstractOrderEntryModel> getAllOrderEntriesByConfigId(java.lang.String configId)
Description copied from interface:ProductConfigurationPersistenceService
Get all order entries to which the given config is currently assigned to. In most scenarios this is exactly one or no entry at all.- Specified by:
getAllOrderEntriesByConfigId
in interfaceProductConfigurationPersistenceService
- Parameters:
configId
- product configuration id- Returns:
- order entry
-
getAllOrderEntriesByModel
protected java.util.List<AbstractOrderEntryModel> getAllOrderEntriesByModel(ProductConfigurationModel productConfigurationModel)
-
getByProductCode
public ProductConfigurationModel getByProductCode(java.lang.String productCode)
Description copied from interface:ProductConfigurationPersistenceService
read theProductConfigurationModel
associated to the given product code for the current user. In case of an anoymous user, the user seesion id is used.- Specified by:
getByProductCode
in interfaceProductConfigurationPersistenceService
- Parameters:
productCode
- product Code- Returns:
- product configuration persistence model
-
getByProductCodeAndUser
public ProductConfigurationModel getByProductCodeAndUser(java.lang.String productCode, UserModel user)
Description copied from interface:ProductConfigurationPersistenceService
read allProductConfigurationModel
s currently linked to the given product and user- Specified by:
getByProductCodeAndUser
in interfaceProductConfigurationPersistenceService
- Parameters:
productCode
- product Codeuser
- user model- Returns:
- product configuration persistence model
-
getOrderEntryByPK
public AbstractOrderEntryModel getOrderEntryByPK(java.lang.String cartEntryKey)
Description copied from interface:ProductConfigurationPersistenceService
read theAbstractOrderEntryModel
by PK- Specified by:
getOrderEntryByPK
in interfaceProductConfigurationPersistenceService
- Parameters:
cartEntryKey
- cart Entry PK- Returns:
- order entry
-
getByUserSessionId
public java.util.List<ProductConfigurationModel> getByUserSessionId(java.lang.String userSessionId)
Description copied from interface:ProductConfigurationPersistenceService
read the list ofProductConfigurationModel
associated to the given user session id- Specified by:
getByUserSessionId
in interfaceProductConfigurationPersistenceService
- Parameters:
userSessionId
- id of the user session- Returns:
- list of product configuration persistence models
-
getProductRelatedByThreshold
public SearchPageData<ProductConfigurationModel> getProductRelatedByThreshold(java.lang.Integer thresholdInDays, int pageSize, int currentPage)
Description copied from interface:ProductConfigurationPersistenceService
Gets configurations that are not related to abstract order entries and have not been touched for a certain time (specified in days)- Specified by:
getProductRelatedByThreshold
in interfaceProductConfigurationPersistenceService
- Parameters:
thresholdInDays
- Select entries that are older than current date - thresholdpageSize
- max number of models to be read within one invocationcurrentPage
- page idx to read- Returns:
- List of product configuration persistence models
-
getOrphaned
public SearchPageData<ProductConfigurationModel> getOrphaned(int pageSize, int currentPage)
Description copied from interface:ProductConfigurationPersistenceService
Gets configurations that are neither related to any abstract order entry nor are related to any Product. So they are considered orphaned.- Specified by:
getOrphaned
in interfaceProductConfigurationPersistenceService
- Parameters:
pageSize
- max number of models to be read within one invocationcurrentPage
- page idx to read- Returns:
- List of product configuration persistence models
-
getAll
public SearchPageData<ProductConfigurationModel> getAll(int pageSize, int currentPage)
Description copied from interface:ProductConfigurationPersistenceService
Gets all configurations currently persistet- Specified by:
getAll
in interfaceProductConfigurationPersistenceService
- Parameters:
pageSize
- max number of models to be read within one invocationcurrentPage
- page idx to read- Returns:
- List of product configuration persistence models
-
isOnlyRelatedToGivenEntry
public boolean isOnlyRelatedToGivenEntry(java.lang.String configId, java.lang.String cartEntryKey)
Description copied from interface:ProductConfigurationPersistenceService
Checks whether a configuration is linked to more than the given abstract order entry.- Specified by:
isOnlyRelatedToGivenEntry
in interfaceProductConfigurationPersistenceService
- Parameters:
configId
- config id to checkcartEntryKey
- Pk of abstract order entry- Returns:
true
, only if the given configuration id is only linked to the given abstract order entry.
-
getTotalCount
protected int getTotalCount(java.util.Map<java.lang.String,java.lang.String> params, java.lang.String queryString)
-
createPageableQuery
protected PaginatedFlexibleSearchParameter createPageableQuery(FlexibleSearchQuery query, int pageSize, int currentPage)
-
calculateModificationDate
protected java.util.Date calculateModificationDate(java.lang.Integer thresholdInDays)
-
getFlexibleSearchService
protected FlexibleSearchService getFlexibleSearchService()
-
setFlexibleSearchService
public void setFlexibleSearchService(FlexibleSearchService flexibleSearchService)
-
getUserService
protected UserService getUserService()
-
setUserService
public void setUserService(UserService userService)
-
getSessionService
protected SessionService getSessionService()
-
setSessionService
public void setSessionService(SessionService sessionService)
-
getPaginatedFlexibleSearchService
protected PaginatedFlexibleSearchService getPaginatedFlexibleSearchService()
-
setPaginatedFlexibleSearchService
public void setPaginatedFlexibleSearchService(PaginatedFlexibleSearchService paginatedFlexibleSearchService)
-
isRelatedToAbstractOrderEntry
public boolean isRelatedToAbstractOrderEntry(ProductConfigurationModel model)
Description copied from interface:ProductConfigurationPersistenceService
Is this model related to any abstract order entry, be it draft or not?- Specified by:
isRelatedToAbstractOrderEntry
in interfaceProductConfigurationPersistenceService
- Parameters:
model
- ProductConfiguration representation in commerce persistence- Returns:
true
if and only if related to any abstract order entry model
-
-