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
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, processParameterHelperFields inherited from interface de.hybris.platform.processengine.spring.Action
ERROR_RETURN_CODE, RETRY_RETURN_CODE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected EmailAttachmentModelcastMedialModelToEmailAttachmentModel(MediaModel mediaModel, String attachmentName) CreatesEmailAttachmentModelwith proper name andMediaModelprotected EmailAttachmentModelcreateReturnMediaAttachment(BusinessProcessModel businessProcessModel, String propertyName) CreatesEmailAttachmentModel.executeAction(BusinessProcessModel businessProcessModel) Executes thisAction's business logic working on the givenBusinessProcessModel.protected booleangenerateEmail(BusinessProcessModel businessProcessModel, EmailMessageModel emailMessageModel) Generates the email or sends warning to the consoleprotected AbstractSimpleDecisionAction.TransitiongenerateEmailContent(BusinessProcessModel businessProcessModel, CatalogVersionModel contentCatalogVersion) Checks whether or not the email content is to be generatedprotected CMSEmailPageServiceprotected ProcessContextResolutionStrategyprotected StringgetEmailAttachmentName(String propertyName) Gets proper attachment name depending on givenReturnRequestModelstatic field.protected EmailGenerationServiceprotected EmailServiceprotected Stringprotected KeyGeneratorprotected MediaServiceprotected MediaModelgetOrCreateMediaModelForProcessModel(ReturnProcessModel returnProcessModel, String propertyName) RetrievesMediaModelfromReturnRequestModel.RETURNFORMorReturnRequestModel.RETURNLABELfor the givenReturnProcessModel
Or generates one if property is empty.protected PrintMediaServiceprotected StringgetProperDocumentTemplateName(String documentTemplateName) Gets proper document template name depends on given parameter.protected Stringprotected Stringprotected Stringprotected Stringprotected voidsaveReturnLabelAndReturnFormAttachments(EmailAttachmentModel returnLabelAttachmentModel, EmailAttachmentModel returnFormAttachmentModel, EmailMessageModel emailMessageModel, BusinessProcessModel businessProcessModel) Saves for givenBusinessProcessModel.voidsetCmsEmailPageService(CMSEmailPageService cmsEmailPageService) voidsetContextResolutionStrategy(ProcessContextResolutionStrategy contextResolutionStrategy) voidsetEmailGenerationService(EmailGenerationService emailGenerationService) voidsetEmailService(EmailService emailService) voidsetFrontendTemplateName(String frontendTemplateName) voidsetGuidKeyGenerator(KeyGenerator guidKeyGenerator) voidsetMediaService(MediaService mediaService) voidsetPrintMediaService(PrintMediaService printMediaService) voidsetReturnFormAttachmentName(String returnFormAttachmentName) voidsetReturnFormDocumentTemplateName(String returnFormDocumentTemplateName) voidsetReturnLabelAttachmentName(String returnLabelAttachmentName) voidsetReturnLabelDocumentTemplateName(String returnLabelDocumentTemplateName) protected voidvalidatePropertyName(String propertyName) Validates if passed parameter is either returnLabel or returnForm property.Methods inherited from class de.hybris.platform.processengine.action.AbstractSimpleDecisionAction
execute, getTransitionsMethods inherited from class de.hybris.platform.processengine.action.AbstractAction
createTransitions, getModelService, getProcessParameterHelper, getProcessParameterValue, refresh, save, setModelService, setOrderStatus, setProcessParameterHelperMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.hybris.platform.processengine.spring.Action
getCurrentActionDefinitionContext
-
Constructor Details
-
GenerateEmailWithAttachmentAction
public GenerateEmailWithAttachmentAction()
-
-
Method Details
-
executeAction
public AbstractSimpleDecisionAction.Transition executeAction(BusinessProcessModel businessProcessModel) throws RetryLaterException Description copied from class:AbstractSimpleDecisionActionExecutes thisAction's business logic working on the givenBusinessProcessModel.- Specified by:
executeActionin 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- theBusinessProcessModelfor which to check if an email has to be generatedcontentCatalogVersion- theCatalogVersionModelfor 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- theBusinessProcessModelto interact withemailMessageModel- theEmailMessageModelto be generated- Returns:
- true if the email has been generated. False otherwise.
-
createReturnMediaAttachment
protected EmailAttachmentModel createReturnMediaAttachment(BusinessProcessModel businessProcessModel, String propertyName) CreatesEmailAttachmentModel.- Parameters:
businessProcessModel-BusinessProcessModel, for which attachment will be created and savedpropertyName- property ofReturnRequestModel, for whichMediaModelneeds to be found- Returns:
EmailAttachmentModelwith 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.RETURNFORMwith proper media fileemailMessageModel-EmailMessageModelwhich will be used to send email to userbusinessProcessModel-BusinessProcessModelfor which attachments should be saved
-
getOrCreateMediaModelForProcessModel
protected MediaModel getOrCreateMediaModelForProcessModel(ReturnProcessModel returnProcessModel, String propertyName) RetrievesMediaModelfromReturnRequestModel.RETURNFORMorReturnRequestModel.RETURNLABELfor the givenReturnProcessModel
Or generates one if property is empty.- Parameters:
returnProcessModel-ReturnProcessModelpropertyName- Describes whichMediaModelshould be found. Must be eitherReturnRequestModel.RETURNFORMorReturnRequestModel.RETURNLABEL- Returns:
MediaModelproperty if exists, generate one otherwise
-
getProperDocumentTemplateName
Gets proper document template name depends on given parameter.- Parameters:
documentTemplateName- should be returnLabel or returnForm - static fields ofReturnRequestModelclass- Returns:
- returnLabelDocumentTemplateName or returnFormDocumentTemplateName field of
GenerateEmailWithAttachmentActionclass
-
validatePropertyName
Validates if passed parameter is either returnLabel or returnForm property.- Parameters:
propertyName- should be returnLabel or returnForm - static field ofReturnRequestModelclass
-
castMedialModelToEmailAttachmentModel
protected EmailAttachmentModel castMedialModelToEmailAttachmentModel(MediaModel mediaModel, String attachmentName) CreatesEmailAttachmentModelwith proper name andMediaModel- Parameters:
mediaModel-MediaModelwhich will be attachedattachmentName- the name for the attachedMediaModel- Returns:
- created
EmailAttachmentModelwith proper media file and name
-
getEmailAttachmentName
Gets proper attachment name depending on givenReturnRequestModelstatic field.- Parameters:
propertyName- should be one ofReturnRequestModelstatic field - returnLabel or returnForm- Returns:
- proper name for attachment
-
getCmsEmailPageService
-
setCmsEmailPageService
-
getFrontendTemplateName
-
setFrontendTemplateName
-
getContextResolutionStrategy
-
setContextResolutionStrategy
public void setContextResolutionStrategy(ProcessContextResolutionStrategy contextResolutionStrategy) -
getEmailGenerationService
-
setEmailGenerationService
-
getEmailService
-
setEmailService
-
getPrintMediaService
-
setPrintMediaService
-
getMediaService
-
setMediaService
-
getReturnLabelDocumentTemplateName
-
setReturnLabelDocumentTemplateName
-
getReturnFormDocumentTemplateName
-
setReturnFormDocumentTemplateName
-
getGuidKeyGenerator
-
setGuidKeyGenerator
-
getReturnFormAttachmentName
-
setReturnFormAttachmentName
-
getReturnLabelAttachmentName
-
setReturnLabelAttachmentName
-