Class SendMailFunction

    • Method Detail

      • 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)
        Get the subject of mail
        Parameters:
        subjectI18nKey - the i18n key to use for subject
        user - the caller
        content - the content
        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.
      • _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<StringgetRecipients​(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