Class DefaultEmailAddressFetchStrategy
java.lang.Object
de.hybris.platform.acceleratorservices.email.strategy.impl.DefaultEmailAddressFetchStrategy
- All Implemented Interfaces:
EmailAddressFetchStrategy
Default strategy for fetching EmailAddressModel for given address. The implementation executes in a transaction which
uses fetch-create if needed-fetch approach which is important in multi threaded environment.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddisableNestedTransactions(SessionContext loclCtx) protected EmailAddressDaoprotected ModelServiceprotected EmailAddressModelhandleEmailAddressCreation(String emailAddress, String displayName, Transaction tx, boolean txRollbackOnlyBefore) protected EmailAddressModelhandleMissingEmailAfterInsertConflict(ModelSavingException e, String emailAddress, String displayName) Tries to fetch the given email address 10 times with 100 ms interval.protected booleanisIgnorableConstraintViolationException(Exception exception) protected booleanisInsertConditionException(Exception exception) protected EmailAddressModelloadEmailAddressFromDatabase(String emailAddress, String displayName) protected voidlogDebugInfo(ModelSavingException e, String message) voidsetEmailAddressDao(EmailAddressDao emailAddressDao) voidsetModelService(ModelService modelService)
-
Constructor Details
-
DefaultEmailAddressFetchStrategy
public DefaultEmailAddressFetchStrategy()
-
-
Method Details
-
fetch
- Specified by:
fetchin interfaceEmailAddressFetchStrategy- Parameters:
emailAddress- email for which the email address object should be fetcheddisplayName- display name for which the email address object should be fetched- Returns:
- email address instance
-
loadEmailAddressFromDatabase
-
handleEmailAddressCreation
protected EmailAddressModel handleEmailAddressCreation(String emailAddress, String displayName, Transaction tx, boolean txRollbackOnlyBefore) -
isIgnorableConstraintViolationException
-
isInsertConditionException
-
disableNestedTransactions
-
getEmailAddressDao
-
setEmailAddressDao
-
getModelService
-
setModelService
-
handleMissingEmailAfterInsertConflict
protected EmailAddressModel handleMissingEmailAfterInsertConflict(ModelSavingException e, String emailAddress, String displayName) Tries to fetch the given email address 10 times with 100 ms interval. It tries to recover from an exception thrown scenario where multi threads tried to insert the same row to the database.- Parameters:
e-emailAddress-displayName-- Returns:
- addr the EmailAddressModel
-
logDebugInfo
-