Class DefaultEmailAddressFetchStrategy
- java.lang.Object
-
- de.hybris.platform.acceleratorservices.email.strategy.impl.DefaultEmailAddressFetchStrategy
-
- All Implemented Interfaces:
EmailAddressFetchStrategy
public class DefaultEmailAddressFetchStrategy extends java.lang.Object implements 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:
EmailAddressModel
-
-
Constructor Summary
Constructors Constructor Description DefaultEmailAddressFetchStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddisableNestedTransactions(SessionContext loclCtx)EmailAddressModelfetch(java.lang.String emailAddress, java.lang.String displayName)protected EmailAddressDaogetEmailAddressDao()protected ModelServicegetModelService()protected EmailAddressModelhandleEmailAddressCreation(java.lang.String emailAddress, java.lang.String displayName, Transaction tx, boolean txRollbackOnlyBefore)protected EmailAddressModelhandleMissingEmailAfterInsertConflict(ModelSavingException e, java.lang.String emailAddress, java.lang.String displayName)Tries to fetch the given email address 10 times with 10 ms interval.protected booleanisIgnorableConstraintViolationException(java.lang.Exception exception)protected booleanisInsertConditionException(java.lang.Exception exception)protected EmailAddressModelloadEmailAddressFromDatabase(java.lang.String emailAddress, java.lang.String displayName)protected voidlogDebugInfo(ModelSavingException e, java.lang.String message)voidsetEmailAddressDao(EmailAddressDao emailAddressDao)voidsetModelService(ModelService modelService)
-
-
-
Method Detail
-
fetch
public EmailAddressModel fetch(java.lang.String emailAddress, java.lang.String displayName)
- 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
protected EmailAddressModel loadEmailAddressFromDatabase(java.lang.String emailAddress, java.lang.String displayName)
-
handleEmailAddressCreation
protected EmailAddressModel handleEmailAddressCreation(java.lang.String emailAddress, java.lang.String displayName, Transaction tx, boolean txRollbackOnlyBefore)
-
isIgnorableConstraintViolationException
protected boolean isIgnorableConstraintViolationException(java.lang.Exception exception)
-
isInsertConditionException
protected boolean isInsertConditionException(java.lang.Exception exception)
-
disableNestedTransactions
protected void disableNestedTransactions(SessionContext loclCtx)
-
getEmailAddressDao
protected EmailAddressDao getEmailAddressDao()
-
setEmailAddressDao
public void setEmailAddressDao(EmailAddressDao emailAddressDao)
-
getModelService
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
handleMissingEmailAfterInsertConflict
protected EmailAddressModel handleMissingEmailAfterInsertConflict(ModelSavingException e, java.lang.String emailAddress, java.lang.String displayName)
Tries to fetch the given email address 10 times with 10 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
protected void logDebugInfo(ModelSavingException e, java.lang.String message)
-
-