Class DefaultCommerceConsentService
java.lang.Object
de.hybris.platform.commerceservices.consent.impl.DefaultCommerceConsentService
- All Implemented Interfaces:
CommerceConsentService
Default implementation of
CommerceConsentService-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ConsentModelcreateConsentModel(CustomerModel customer, ConsentTemplateModel consentTemplate) getActiveConsent(CustomerModel customer, ConsentTemplateModel consentTemplate) Finds the latest consent for the specified customer and consent template.getConsent(String consentCode) Finds the consent for the specifiedconsentCodeprotected ConsentDaogetConsentTemplate(String consentTemplateId, Integer consentTemplateVersion, BaseSiteModel baseSite) Finds the consent template for the suppliedconsentTemplateId,consentTemplateVersionandbaseSite.protected ConsentTemplateDaogetConsentTemplates(BaseSiteModel baseSite) Finds all the latest versions of consent templates for the givenbaseSite.protected EventServicegetLatestConsentTemplate(String consentTemplateId, BaseSiteModel baseSite) Finds the latest version of aConsentTemplatefor the givenconsentTemplateIdandbaseSite.protected ModelServiceprotected TimeServiceprotected UserServicevoidgiveConsent(CustomerModel customer, ConsentTemplateModel consentTemplate) Gives consent for the specified customer and consent template.booleanhasEffectivelyActiveConsent(CustomerModel customer, ConsentTemplateModel consentTemplate) Checks if a customer has a consent that has not been withdrawn for the specified consent template.protected AbstractConsentEventinitializeEvent(AbstractConsentEvent event, ConsentModel consent) protected booleanisConsentGiven(ConsentModel consent) protected booleanisConsentWithdrawn(ConsentModel consent) voidsetConsentDao(ConsentDao consentDao) voidsetConsentTemplateDao(ConsentTemplateDao consentTemplateDao) voidsetEventService(EventService eventService) voidsetModelService(ModelService modelService) voidsetTimeService(TimeService timeService) voidsetUserService(UserService userService) voidwithdrawConsent(ConsentModel consent) Withdraws consent for the specified ConsentModel by updating the consentWithdrawnDate.
1.
-
Constructor Details
-
DefaultCommerceConsentService
public DefaultCommerceConsentService()
-
-
Method Details
-
getConsentTemplates
Description copied from interface:CommerceConsentServiceFinds all the latest versions of consent templates for the givenbaseSite.- Specified by:
getConsentTemplatesin interfaceCommerceConsentService- Parameters:
baseSite- the baseSite to retrieve the consent template for- Returns:
- available consent templates
-
getConsentTemplate
public ConsentTemplateModel getConsentTemplate(String consentTemplateId, Integer consentTemplateVersion, BaseSiteModel baseSite) Description copied from interface:CommerceConsentServiceFinds the consent template for the suppliedconsentTemplateId,consentTemplateVersionandbaseSite.- Specified by:
getConsentTemplatein interfaceCommerceConsentService- Parameters:
consentTemplateId- the id of the consent templateconsentTemplateVersion- the version of the consent templatebaseSite- the baseSite to retrieve the consent template for- Returns:
- the consent template
-
getLatestConsentTemplate
public ConsentTemplateModel getLatestConsentTemplate(String consentTemplateId, BaseSiteModel baseSite) Description copied from interface:CommerceConsentServiceFinds the latest version of aConsentTemplatefor the givenconsentTemplateIdandbaseSite.- Specified by:
getLatestConsentTemplatein interfaceCommerceConsentService- Parameters:
consentTemplateId- the id of the consent templatebaseSite- the baseSite to retrieve the consent template for.- Returns:
- the consent template
-
getConsent
Description copied from interface:CommerceConsentServiceFinds the consent for the specifiedconsentCode- Specified by:
getConsentin interfaceCommerceConsentService- Parameters:
consentCode- the consent code to get the consent for- Returns:
- the consent
-
getActiveConsent
Description copied from interface:CommerceConsentServiceFinds the latest consent for the specified customer and consent template.- Specified by:
getActiveConsentin interfaceCommerceConsentService- Parameters:
customer- the customer to get the consent forconsentTemplate- the consent template to get the consent for- Returns:
- the consent if found, otherwise null
-
hasEffectivelyActiveConsent
public boolean hasEffectivelyActiveConsent(CustomerModel customer, ConsentTemplateModel consentTemplate) Description copied from interface:CommerceConsentServiceChecks if a customer has a consent that has not been withdrawn for the specified consent template.- Specified by:
hasEffectivelyActiveConsentin interfaceCommerceConsentService- Parameters:
customer- the customer to check the consent forconsentTemplate- the consent template to check the consent for- Returns:
- true, if the customer has a consent that has not been withdrawn
-
giveConsent
Description copied from interface:CommerceConsentServiceGives consent for the specified customer and consent template. Creates a newConsentand sets the consentGivenDate.
1. Doesn't create a new consent if the consent is already given and active and throwsCommerceConsentGivenException- Specified by:
giveConsentin interfaceCommerceConsentService- Parameters:
customer- the customer to give the consent forconsentTemplate- the consent template to give the consent for
-
withdrawConsent
Description copied from interface:CommerceConsentServiceWithdraws consent for the specified ConsentModel by updating the consentWithdrawnDate.
1. Doesn't withdraw the consent if its already withdrawn, i.e, IfConsent.consentWithdrawnDateis already set calling this method will not overwrite the existing value.- Specified by:
withdrawConsentin interfaceCommerceConsentService- Parameters:
consent- the consent to withdraw the consent for
-
isConsentWithdrawn
-
isConsentGiven
-
createConsentModel
protected ConsentModel createConsentModel(CustomerModel customer, ConsentTemplateModel consentTemplate) -
initializeEvent
-
getModelService
-
setModelService
-
getTimeService
-
setTimeService
-
getConsentDao
-
setConsentDao
-
getConsentTemplateDao
-
setConsentTemplateDao
-
getEventService
-
setEventService
-
getUserService
-
setUserService
-