Class SendMailFunction

All Implemented Interfaces:
com.opensymphony.workflow.FunctionProvider, EnhancedFunction, PluginAware, Initializable, Contextualizable, LogEnabled, Serviceable
Direct Known Subclasses:
SendMailFunction, SendMailToUserFunction

OS workflow function to send mail after an action is triggered.
  • Field Details

  • Constructor Details

  • Method Details

    • initialize

      public void initialize() throws Exception
      Specified by:
      initialize in interface Initializable
      Throws:
      Exception
    • contextualize

      public void contextualize(Context context) throws ContextException
      Specified by:
      contextualize in interface Contextualizable
      Throws:
      ContextException
    • setPluginInfo

      public void setPluginInfo(String pluginName, String featureName, String id)
      Description copied from interface: PluginAware
      Sets the plugin info relative to the current component.
      Note : The feature name may be null if the targeted component in declared at plugin level.
      Specified by:
      setPluginInfo in interface PluginAware
      Parameters:
      pluginName - Unique identifier for the plugin hosting the extension
      featureName - Unique feature identifier (unique for a given pluginName)
      id - Unique identifier of this component
    • execute

      public void execute(Map transientVars, Map args, com.opensymphony.module.propertyset.PropertySet ps) throws com.opensymphony.workflow.WorkflowException
      Specified by:
      execute in interface com.opensymphony.workflow.FunctionProvider
      Throws:
      com.opensymphony.workflow.WorkflowException
    • getMailSubject

      protected String getMailSubject(String subjectI18nKey, User user, WorkflowAwareContent content, Map transientVars)
      Get the subject of mail
      Parameters:
      subjectI18nKey - the i18n key to use for subject
      user - the caller
      content - the content
      transientVars - the transient variables
      Returns:
      the subject
    • getMailBody

      protected String getMailBody(String bodyI18nKey, User user, WorkflowAwareContent content, Map transientVars)
      Get the text body of mail
      Parameters:
      bodyI18nKey - the i18n key to use for body
      user - the caller
      content - the content
      transientVars - the transient variables
      Returns:
      the text body
    • _sendMails

      protected void _sendMails(String subject, String body, Set<String> recipients, String from)
      Send the notification emails.
      Parameters:
      subject - the e-mail subject.
      body - the e-mail body.
      recipients - the recipients emails address.
      from - the address sending the e-mail.
    • getSubjectI18nParams

      Get the i18n parameters of mail subject
      Parameters:
      user - the caller
      content - the content
      Returns:
      the i18n parameters
    • getBodyI18nParams

      protected List<String> getBodyI18nParams(User user, WorkflowAwareContent content)
      Get the i18n parameters of mail body text
      Parameters:
      user - the caller
      content - the content
      Returns:
      the i18n parameters
    • _getContentUri

      Get the content uri
      Parameters:
      content - the content
      Returns:
      the content uri
    • _getRequestUri

      protected String _getRequestUri()
      Get the request URI.
      Returns:
      the full request URI.
    • _getRequest

      public Request _getRequest()
      Retrieve the request from which this component is called.
      Returns:
      the request or null.
    • getCaller

      public User getCaller(Map transientVars, WorkflowAwareContent content) throws com.opensymphony.workflow.WorkflowException
      Get the caller of the workflow action
      Parameters:
      transientVars - the transient variables
      content - content the content
      Returns:
      caller the caller if the workflow function
      Throws:
      com.opensymphony.workflow.WorkflowException - if failed to get caller
    • getSender

      protected String getSender(Map transientVars, WorkflowAwareContent content) throws com.opensymphony.workflow.WorkflowException
      Get the sender for mail
      Parameters:
      transientVars - the transient variables
      content - the content
      Returns:
      the sender email address
      Throws:
      com.opensymphony.workflow.WorkflowException - if failed to get email for sender
    • getRecipients

      protected Set<String> getRecipients(Map transientVars, WorkflowAwareContent content, Set<String> rights) throws com.opensymphony.workflow.WorkflowException
      Get the recipients
      Parameters:
      transientVars - the transient variables
      content - the content.
      rights - the set of rights to check.
      Returns:
      the recipients.
      Throws:
      com.opensymphony.workflow.WorkflowException - If failed to get recipients
    • _getUsers

      protected Set<UserIdentity> _getUsers(WorkflowAwareContent content, Set<String> rights) throws com.opensymphony.workflow.WorkflowException
      Get the user logins.
      Parameters:
      content - the content.
      rights - the set of rights to check.
      Returns:
      the users.
      Throws:
      com.opensymphony.workflow.WorkflowException - If an error occurred
    • getArguments

      Description copied from interface: EnhancedFunction
      Get the list of accepted arguments for this function
      Specified by:
      getArguments in interface EnhancedFunction
      Returns:
      a List of argument names and associated description
    • getDescription

      public I18nizableText getDescription(Map<String,String> argumentsValues)
      Description copied from interface: EnhancedFunction
      Get the function descriptions depending on arguments values
      Specified by:
      getDescription in interface EnhancedFunction
      Parameters:
      argumentsValues - a map of the arguments with their values in current workflow
      Returns:
      a description to display in workflow editor vue