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.StringPARAM_NAME_CONFIG_IDprotected static java.lang.StringPARAM_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.DatecalculateModificationDate(java.lang.Integer thresholdInDays)protected PaginatedFlexibleSearchParametercreatePageableQuery(FlexibleSearchQuery query, int pageSize, int currentPage)AbstractOrderEntryModelgetAbstractOrderEntryByConfigPk(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)ProductConfigurationModelgetByConfigId(java.lang.String configId, boolean allowNull)read theProductConfigurationModelby configIdProductConfigurationModelgetByProductCode(java.lang.String productCode)read theProductConfigurationModelassociated to the given product code for the current user.ProductConfigurationModelgetByProductCodeAndUser(java.lang.String productCode, UserModel user)read allProductConfigurationModels currently linked to the given product and userjava.util.List<ProductConfigurationModel>getByUserSessionId(java.lang.String userSessionId)read the list ofProductConfigurationModelassociated to the given user session idprotected FlexibleSearchServicegetFlexibleSearchService()AbstractOrderEntryModelgetOrderEntryByConfigId(java.lang.String configId, boolean isDraft)get the order entry to which the given config is currently assigned to.AbstractOrderEntryModelgetOrderEntryByPK(java.lang.String cartEntryKey)read theAbstractOrderEntryModelby 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 PaginatedFlexibleSearchServicegetPaginatedFlexibleSearchService()ProductConfigurationModelgetProductConfigByConfigId(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 SessionServicegetSessionService()protected intgetTotalCount(java.util.Map<java.lang.String,java.lang.String> params, java.lang.String queryString)protected UserServicegetUserService()booleanisOnlyRelatedToGivenEntry(java.lang.String configId, java.lang.String cartEntryKey)Checks whether a configuration is linked to more than the given abstract order entry.booleanisRelatedToAbstractOrderEntry(ProductConfigurationModel model)Is this model related to any abstract order entry, be it draft or not?voidsetFlexibleSearchService(FlexibleSearchService flexibleSearchService)voidsetPaginatedFlexibleSearchService(PaginatedFlexibleSearchService paginatedFlexibleSearchService)voidsetSessionService(SessionService sessionService)voidsetUserService(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:ProductConfigurationPersistenceServiceread theProductConfigurationModelby configId- Specified by:
getByConfigIdin interfaceProductConfigurationPersistenceService- Parameters:
configId- configuration idallowNull- iftruenull 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:ProductConfigurationPersistenceServiceget 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:
getOrderEntryByConfigIdin interfaceProductConfigurationPersistenceService- Parameters:
configId- product configuration idisDraft- iftruedraft 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 ofAbstractOrderEntryModelisDraft- Does PK belong to draft configuration?- Returns:
- Entry model
-
getAllOrderEntriesByConfigId
public java.util.List<AbstractOrderEntryModel> getAllOrderEntriesByConfigId(java.lang.String configId)
Description copied from interface:ProductConfigurationPersistenceServiceGet 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:
getAllOrderEntriesByConfigIdin 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:ProductConfigurationPersistenceServiceread theProductConfigurationModelassociated to the given product code for the current user. In case of an anoymous user, the user seesion id is used.- Specified by:
getByProductCodein interfaceProductConfigurationPersistenceService- Parameters:
productCode- product Code- Returns:
- product configuration persistence model
-
getByProductCodeAndUser
public ProductConfigurationModel getByProductCodeAndUser(java.lang.String productCode, UserModel user)
Description copied from interface:ProductConfigurationPersistenceServiceread allProductConfigurationModels currently linked to the given product and user- Specified by:
getByProductCodeAndUserin interfaceProductConfigurationPersistenceService- Parameters:
productCode- product Codeuser- user model- Returns:
- product configuration persistence model
-
getOrderEntryByPK
public AbstractOrderEntryModel getOrderEntryByPK(java.lang.String cartEntryKey)
Description copied from interface:ProductConfigurationPersistenceServiceread theAbstractOrderEntryModelby PK- Specified by:
getOrderEntryByPKin interfaceProductConfigurationPersistenceService- Parameters:
cartEntryKey- cart Entry PK- Returns:
- order entry
-
getByUserSessionId
public java.util.List<ProductConfigurationModel> getByUserSessionId(java.lang.String userSessionId)
Description copied from interface:ProductConfigurationPersistenceServiceread the list ofProductConfigurationModelassociated to the given user session id- Specified by:
getByUserSessionIdin 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:ProductConfigurationPersistenceServiceGets configurations that are not related to abstract order entries and have not been touched for a certain time (specified in days)- Specified by:
getProductRelatedByThresholdin 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:ProductConfigurationPersistenceServiceGets configurations that are neither related to any abstract order entry nor are related to any Product. So they are considered orphaned.- Specified by:
getOrphanedin 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:ProductConfigurationPersistenceServiceGets all configurations currently persistet- Specified by:
getAllin 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:ProductConfigurationPersistenceServiceChecks whether a configuration is linked to more than the given abstract order entry.- Specified by:
isOnlyRelatedToGivenEntryin 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:ProductConfigurationPersistenceServiceIs this model related to any abstract order entry, be it draft or not?- Specified by:
isRelatedToAbstractOrderEntryin interfaceProductConfigurationPersistenceService- Parameters:
model- ProductConfiguration representation in commerce persistence- Returns:
trueif and only if related to any abstract order entry model
-
-