Class GenerateEmailWithAttachmentAction
- java.lang.Object
-
- de.hybris.platform.processengine.action.AbstractAction<T>
-
- de.hybris.platform.processengine.action.AbstractSimpleDecisionAction
-
- de.hybris.platform.yacceleratorordermanagement.actions.email.GenerateEmailWithAttachmentAction
-
- All Implemented Interfaces:
Action
public class GenerateEmailWithAttachmentAction extends AbstractSimpleDecisionAction
A process action which generates email with attachment.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.processengine.action.AbstractSimpleDecisionAction
AbstractSimpleDecisionAction.Transition
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.processengine.action.AbstractAction
modelService, processParameterHelper
-
Fields inherited from interface de.hybris.platform.processengine.spring.Action
ERROR_RETURN_CODE, RETRY_RETURN_CODE
-
-
Constructor Summary
Constructors Constructor Description GenerateEmailWithAttachmentAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected EmailAttachmentModel
castMedialModelToEmailAttachmentModel(MediaModel mediaModel, java.lang.String attachmentName)
CreatesEmailAttachmentModel
with proper name andMediaModel
protected EmailAttachmentModel
createReturnMediaAttachment(BusinessProcessModel businessProcessModel, java.lang.String propertyName)
CreatesEmailAttachmentModel
.AbstractSimpleDecisionAction.Transition
executeAction(BusinessProcessModel businessProcessModel)
Executes thisAction
's business logic working on the givenBusinessProcessModel
.protected boolean
generateEmail(BusinessProcessModel businessProcessModel, EmailMessageModel emailMessageModel)
Generates the email or sends warning to the consoleprotected AbstractSimpleDecisionAction.Transition
generateEmailContent(BusinessProcessModel businessProcessModel, CatalogVersionModel contentCatalogVersion)
Checks whether or not the email content is to be generatedprotected CMSEmailPageService
getCmsEmailPageService()
protected ProcessContextResolutionStrategy
getContextResolutionStrategy()
protected java.lang.String
getEmailAttachmentName(java.lang.String propertyName)
Gets proper attachment name depending on givenReturnRequestModel
static field.protected EmailGenerationService
getEmailGenerationService()
protected EmailService
getEmailService()
protected java.lang.String
getFrontendTemplateName()
protected KeyGenerator
getGuidKeyGenerator()
protected MediaService
getMediaService()
protected MediaModel
getOrCreateMediaModelForProcessModel(ReturnProcessModel returnProcessModel, java.lang.String propertyName)
RetrievesMediaModel
fromReturnRequestModel.RETURNFORM
orReturnRequestModel.RETURNLABEL
for the givenReturnProcessModel
Or generates one if property is empty.protected PrintMediaService
getPrintMediaService()
protected java.lang.String
getProperDocumentTemplateName(java.lang.String documentTemplateName)
Gets proper document template name depends on given parameter.protected java.lang.String
getReturnFormAttachmentName()
protected java.lang.String
getReturnFormDocumentTemplateName()
protected java.lang.String
getReturnLabelAttachmentName()
protected java.lang.String
getReturnLabelDocumentTemplateName()
protected void
saveReturnLabelAndReturnFormAttachments(EmailAttachmentModel returnLabelAttachmentModel, EmailAttachmentModel returnFormAttachmentModel, EmailMessageModel emailMessageModel, BusinessProcessModel businessProcessModel)
Saves for givenBusinessProcessModel
.void
setCmsEmailPageService(CMSEmailPageService cmsEmailPageService)
void
setContextResolutionStrategy(ProcessContextResolutionStrategy contextResolutionStrategy)
void
setEmailGenerationService(EmailGenerationService emailGenerationService)
void
setEmailService(EmailService emailService)
void
setFrontendTemplateName(java.lang.String frontendTemplateName)
void
setGuidKeyGenerator(KeyGenerator guidKeyGenerator)
void
setMediaService(MediaService mediaService)
void
setPrintMediaService(PrintMediaService printMediaService)
void
setReturnFormAttachmentName(java.lang.String returnFormAttachmentName)
void
setReturnFormDocumentTemplateName(java.lang.String returnFormDocumentTemplateName)
void
setReturnLabelAttachmentName(java.lang.String returnLabelAttachmentName)
void
setReturnLabelDocumentTemplateName(java.lang.String returnLabelDocumentTemplateName)
protected void
validatePropertyName(java.lang.String propertyName)
Validates if passed parameter is either returnLabel or returnForm property.-
Methods inherited from class de.hybris.platform.processengine.action.AbstractSimpleDecisionAction
execute, getTransitions
-
Methods inherited from class de.hybris.platform.processengine.action.AbstractAction
createTransitions, getModelService, getProcessParameterHelper, getProcessParameterValue, refresh, save, setModelService, setOrderStatus, setProcessParameterHelper
-
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.processengine.spring.Action
getCurrentActionDefinitionContext
-
-
-
-
Method Detail
-
executeAction
public AbstractSimpleDecisionAction.Transition executeAction(BusinessProcessModel businessProcessModel) throws RetryLaterException
Description copied from class:AbstractSimpleDecisionAction
Executes thisAction
's business logic working on the givenBusinessProcessModel
.- Specified by:
executeAction
in classAbstractSimpleDecisionAction
- Parameters:
businessProcessModel
- The process context to work on.- Returns:
- OK; NOK
- Throws:
RetryLaterException
-
generateEmailContent
protected AbstractSimpleDecisionAction.Transition generateEmailContent(BusinessProcessModel businessProcessModel, CatalogVersionModel contentCatalogVersion)
Checks whether or not the email content is to be generated- Parameters:
businessProcessModel
- theBusinessProcessModel
for which to check if an email has to be generatedcontentCatalogVersion
- theCatalogVersionModel
for which to check if an email has to be generated- Returns:
- transition for the business process action
-
generateEmail
protected boolean generateEmail(BusinessProcessModel businessProcessModel, EmailMessageModel emailMessageModel)
Generates the email or sends warning to the console- Parameters:
businessProcessModel
- theBusinessProcessModel
to interact withemailMessageModel
- theEmailMessageModel
to be generated- Returns:
- true if the email has been generated. False otherwise.
-
createReturnMediaAttachment
protected EmailAttachmentModel createReturnMediaAttachment(BusinessProcessModel businessProcessModel, java.lang.String propertyName)
CreatesEmailAttachmentModel
.- Parameters:
businessProcessModel
-BusinessProcessModel
, for which attachment will be created and savedpropertyName
- property ofReturnRequestModel
, for whichMediaModel
needs to be found- Returns:
EmailAttachmentModel
with with proper media saved
-
saveReturnLabelAndReturnFormAttachments
protected void saveReturnLabelAndReturnFormAttachments(EmailAttachmentModel returnLabelAttachmentModel, EmailAttachmentModel returnFormAttachmentModel, EmailMessageModel emailMessageModel, BusinessProcessModel businessProcessModel)
Saves for givenBusinessProcessModel
.- Parameters:
returnLabelAttachmentModel
- generated asReturnRequestModel.RETURNLABEL
, with proper media filereturnFormAttachmentModel
- generated asReturnRequestModel.RETURNFORM
with proper media fileemailMessageModel
-EmailMessageModel
which will be used to send email to userbusinessProcessModel
-BusinessProcessModel
for which attachments should be saved
-
getOrCreateMediaModelForProcessModel
protected MediaModel getOrCreateMediaModelForProcessModel(ReturnProcessModel returnProcessModel, java.lang.String propertyName)
RetrievesMediaModel
fromReturnRequestModel.RETURNFORM
orReturnRequestModel.RETURNLABEL
for the givenReturnProcessModel
Or generates one if property is empty.- Parameters:
returnProcessModel
-ReturnProcessModel
propertyName
- Describes whichMediaModel
should be found. Must be eitherReturnRequestModel.RETURNFORM
orReturnRequestModel.RETURNLABEL
- Returns:
MediaModel
property if exists, generate one otherwise
-
getProperDocumentTemplateName
protected java.lang.String getProperDocumentTemplateName(java.lang.String documentTemplateName)
Gets proper document template name depends on given parameter.- Parameters:
documentTemplateName
- should be returnLabel or returnForm - static fields ofReturnRequestModel
class- Returns:
- returnLabelDocumentTemplateName or returnFormDocumentTemplateName field of
GenerateEmailWithAttachmentAction
class
-
validatePropertyName
protected void validatePropertyName(java.lang.String propertyName)
Validates if passed parameter is either returnLabel or returnForm property.- Parameters:
propertyName
- should be returnLabel or returnForm - static field ofReturnRequestModel
class
-
castMedialModelToEmailAttachmentModel
protected EmailAttachmentModel castMedialModelToEmailAttachmentModel(MediaModel mediaModel, java.lang.String attachmentName)
CreatesEmailAttachmentModel
with proper name andMediaModel
- Parameters:
mediaModel
-MediaModel
which will be attachedattachmentName
- the name for the attachedMediaModel
- Returns:
- created
EmailAttachmentModel
with proper media file and name
-
getEmailAttachmentName
protected java.lang.String getEmailAttachmentName(java.lang.String propertyName)
Gets proper attachment name depending on givenReturnRequestModel
static field.- Parameters:
propertyName
- should be one ofReturnRequestModel
static field - returnLabel or returnForm- Returns:
- proper name for attachment
-
getCmsEmailPageService
protected CMSEmailPageService getCmsEmailPageService()
-
setCmsEmailPageService
public void setCmsEmailPageService(CMSEmailPageService cmsEmailPageService)
-
getFrontendTemplateName
protected java.lang.String getFrontendTemplateName()
-
setFrontendTemplateName
public void setFrontendTemplateName(java.lang.String frontendTemplateName)
-
getContextResolutionStrategy
protected ProcessContextResolutionStrategy getContextResolutionStrategy()
-
setContextResolutionStrategy
public void setContextResolutionStrategy(ProcessContextResolutionStrategy contextResolutionStrategy)
-
getEmailGenerationService
protected EmailGenerationService getEmailGenerationService()
-
setEmailGenerationService
public void setEmailGenerationService(EmailGenerationService emailGenerationService)
-
getEmailService
protected EmailService getEmailService()
-
setEmailService
public void setEmailService(EmailService emailService)
-
getPrintMediaService
protected PrintMediaService getPrintMediaService()
-
setPrintMediaService
public void setPrintMediaService(PrintMediaService printMediaService)
-
getMediaService
protected MediaService getMediaService()
-
setMediaService
public void setMediaService(MediaService mediaService)
-
getReturnLabelDocumentTemplateName
protected java.lang.String getReturnLabelDocumentTemplateName()
-
setReturnLabelDocumentTemplateName
public void setReturnLabelDocumentTemplateName(java.lang.String returnLabelDocumentTemplateName)
-
getReturnFormDocumentTemplateName
protected java.lang.String getReturnFormDocumentTemplateName()
-
setReturnFormDocumentTemplateName
public void setReturnFormDocumentTemplateName(java.lang.String returnFormDocumentTemplateName)
-
getGuidKeyGenerator
protected KeyGenerator getGuidKeyGenerator()
-
setGuidKeyGenerator
public void setGuidKeyGenerator(KeyGenerator guidKeyGenerator)
-
getReturnFormAttachmentName
protected java.lang.String getReturnFormAttachmentName()
-
setReturnFormAttachmentName
public void setReturnFormAttachmentName(java.lang.String returnFormAttachmentName)
-
getReturnLabelAttachmentName
protected java.lang.String getReturnLabelAttachmentName()
-
setReturnLabelAttachmentName
public void setReturnLabelAttachmentName(java.lang.String returnLabelAttachmentName)
-
-