com.taleo.integration.client.customstep.mail
Class SendEmailPostStep

java.lang.Object
  extended by com.taleo.integration.client.step.BaseStep
      extended by com.taleo.integration.client.step.BaseCustomStep
          extended by com.taleo.integration.client.customstep.BaseCustomStep
              extended by com.taleo.integration.client.customstep.mail.SendEmailPostStep
All Implemented Interfaces:
com.taleo.integration.client.step.CustomStep, com.taleo.integration.client.step.Step

public class SendEmailPostStep
extends BaseCustomStep

Post-processing step to send the current workflow file by email.

This step takes all parameters from its base class BaseCustomStep and the following additional parameters:

The following additional parameters are required in the case of an import integration if the extra counters (success, create, update, delete, error) are to be used in the message template.

The following variables are made available to build the email template and triggering rule:

Example uses of these variables in the templates:

For import results, there is also:

For triggering rule, the $logic variable ( LogicTool) may be used:

There are also other Velocity constructs that can be used. For reference, see Velocity User Guide.

This class is dependent on:

Here are some examples of how to define this custom step in the TCC configuration file:

Author:
Romain Guay, Taleo Corporation

Field Summary
 
Fields inherited from class com.taleo.integration.client.customstep.BaseCustomStep
parameterNames
 
Fields inherited from class com.taleo.integration.client.step.BaseCustomStep
parameters
 
Fields inherited from class com.taleo.integration.client.step.BaseStep
commType, ERROR_NULL_GLOBAL_CONFIG, ERROR_NULL_PIPELINE, ERROR_NULL_STEP_CONFIG, productCode, tempFolder, type, version
 
Constructor Summary
SendEmailPostStep()
          Constructor without arguments.
 
Method Summary
protected  org.apache.velocity.VelocityContext buildVelocityContext(com.taleo.ws.integration.client.MessageFormat.Enum requestFormat, com.taleo.ws.integration.client.MessageFormat.Enum responseFormat, java.io.File file, com.taleo.ws.integration.client.Pipeline pipeline, com.taleo.ws.integration.client.GlobalConfig config)
          Build the Velocity context to render templates and triggering rule.
protected  boolean evaluateTriggeringRule(org.apache.velocity.VelocityContext context)
          Evaluate the triggering rule.
 void execute(com.taleo.ws.integration.client.Pipeline pipeline)
           
 void execute(java.lang.String message, java.io.File file, java.lang.String filename)
          Execute the step.
 java.lang.String getCc()
           
 char getCsvDelimiter()
           
 char getCsvQuoteCharacter()
           
 java.lang.String getDescription()
           
 java.lang.String getFilename()
          Get the filename.
 java.lang.String getFrom()
           
 java.lang.String getIdentifier()
           
 java.lang.String getMessageTemplate()
           
 java.lang.String getMessageTemplateFile()
           
 java.lang.String getMimeType()
          Get the Mime type of the email.
 java.lang.String getName()
           
 int getPort()
           
 java.lang.String getSmtpHost()
           
 java.lang.String getSubject()
           
 java.lang.String getTo()
           
 java.lang.String getTriggeringRule()
          Get the triggering rule.
 void init(com.taleo.ws.integration.client.GlobalConfig config)
           
 boolean isCsvHeaderPresent()
           
 boolean isFailOnError()
          Get the FailOnError flag.
 boolean isSendAttachment()
           
protected  java.lang.String prepareMessage(org.apache.velocity.VelocityContext context)
          Prepare the email message body from the message template.
 void setCc(java.lang.String cc)
           
 void setCsvDelimiter(char csvDelimiter)
           
 void setCsvHeaderPresent(boolean csvHeaderPresent)
           
 void setCsvQuoteCharacter(char csvQuoteCharacter)
           
 void setFailOnError(boolean failOnError)
          Set the FailOnError flag.
 void setFilename(java.lang.String filename)
          Set the filename.
 void setFrom(java.lang.String from)
           
 void setMessageTemplate(java.lang.String messageTemplate)
           
 void setMessageTemplateFile(java.lang.String messageTemplateFile)
           
 void setMimeType(java.lang.String mimeType)
          Set the Mime type os the email.
 void setPort(int port)
           
 void setSendAttachment(boolean sendAttachment)
           
 void setSmtpHost(java.lang.String smtpHost)
           
 void setSubject(java.lang.String subject)
           
 void setTo(java.lang.String to)
           
 void setTriggeringRule(java.lang.String triggeringRule)
          Set the triggering rule.
 
Methods inherited from class com.taleo.integration.client.customstep.BaseCustomStep
createTempFile, createTempFile, getEncoding, getTempFolder, isActive, registerParameterName, setActive, setEncoding, validateParameterNames
 
Methods inherited from class com.taleo.integration.client.step.BaseCustomStep
getSupportedPipeline, getType, init
 
Methods inherited from class com.taleo.integration.client.step.BaseStep
getAllProcessSupportPipeline, getCurrentFile, getCurrentFile, getCurrentMessage, getPostProcessSupportPipeline, getPreProcessSupportPipeline, isOriginalFile, validateLastStepType, validateMessageType, validatePipeline
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.taleo.integration.client.step.Step
validatePipeline
 

Constructor Detail

SendEmailPostStep

public SendEmailPostStep()
Constructor without arguments.

Method Detail

getIdentifier

public java.lang.String getIdentifier()
Specified by:
getIdentifier in interface com.taleo.integration.client.step.CustomStep
Specified by:
getIdentifier in interface com.taleo.integration.client.step.Step
Specified by:
getIdentifier in class com.taleo.integration.client.step.BaseCustomStep

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface com.taleo.integration.client.step.CustomStep
Specified by:
getDescription in interface com.taleo.integration.client.step.Step
Specified by:
getDescription in class com.taleo.integration.client.step.BaseCustomStep

getName

public java.lang.String getName()
Specified by:
getName in interface com.taleo.integration.client.step.CustomStep
Specified by:
getName in interface com.taleo.integration.client.step.Step
Specified by:
getName in class com.taleo.integration.client.step.BaseCustomStep

getCc

public java.lang.String getCc()
Returns:

setCc

public void setCc(java.lang.String cc)
Parameters:
cc -

getFrom

public java.lang.String getFrom()
Returns:

setFrom

public void setFrom(java.lang.String from)
Parameters:
from -

getPort

public int getPort()
Returns:

setPort

public void setPort(int port)
Parameters:
port -

isSendAttachment

public boolean isSendAttachment()
Returns:

setSendAttachment

public void setSendAttachment(boolean sendAttachment)
Parameters:
sendAttachment -

getFilename

public java.lang.String getFilename()
Get the filename.

Returns:

setFilename

public void setFilename(java.lang.String filename)
Set the filename.

Parameters:
filename -

getSmtpHost

public java.lang.String getSmtpHost()
Returns:

setSmtpHost

public void setSmtpHost(java.lang.String smtpHost)
Parameters:
smtpHost -

getSubject

public java.lang.String getSubject()
Returns:

setSubject

public void setSubject(java.lang.String subject)
Parameters:
subject -

getMessageTemplateFile

public java.lang.String getMessageTemplateFile()
Returns:

setMessageTemplateFile

public void setMessageTemplateFile(java.lang.String messageTemplateFile)
Parameters:
messageTemplateFile -

getMessageTemplate

public java.lang.String getMessageTemplate()
Returns:

setMessageTemplate

public void setMessageTemplate(java.lang.String messageTemplate)
Parameters:
messageTemplate -

getMimeType

public java.lang.String getMimeType()
Get the Mime type of the email.

Returns:

setMimeType

public void setMimeType(java.lang.String mimeType)
Set the Mime type os the email.

Parameters:
mimeType -

getTo

public java.lang.String getTo()
Returns:

setTo

public void setTo(java.lang.String to)
Parameters:
to -

isCsvHeaderPresent

public boolean isCsvHeaderPresent()
Returns:

setCsvHeaderPresent

public void setCsvHeaderPresent(boolean csvHeaderPresent)
Parameters:
csvHeaderPresent -

getCsvDelimiter

public char getCsvDelimiter()
Returns:

setCsvDelimiter

public void setCsvDelimiter(char csvDelimiter)
Parameters:
csvDelimiter -

getCsvQuoteCharacter

public char getCsvQuoteCharacter()
Returns:

setCsvQuoteCharacter

public void setCsvQuoteCharacter(char csvQuoteCharacter)
Parameters:
csvQuoteCharacter -

isFailOnError

public boolean isFailOnError()
Get the FailOnError flag.

Returns:

setFailOnError

public void setFailOnError(boolean failOnError)
Set the FailOnError flag.

Parameters:
failOnError -

getTriggeringRule

public java.lang.String getTriggeringRule()
Get the triggering rule.

Returns:

setTriggeringRule

public void setTriggeringRule(java.lang.String triggeringRule)
Set the triggering rule.

Parameters:
triggeringRule -

init

public void init(com.taleo.ws.integration.client.GlobalConfig config)
Overrides:
init in class BaseCustomStep

execute

public void execute(com.taleo.ws.integration.client.Pipeline pipeline)
             throws com.taleo.integration.client.step.StepException
Throws:
com.taleo.integration.client.step.StepException

execute

public void execute(java.lang.String message,
                    java.io.File file,
                    java.lang.String filename)
             throws javax.mail.MessagingException
Execute the step.

Parameters:
message - The email message.
file - The import or export results file.
filename - The target filename for the attachment.
Throws:
javax.mail.MessagingException

evaluateTriggeringRule

protected boolean evaluateTriggeringRule(org.apache.velocity.VelocityContext context)
Evaluate the triggering rule.

Parameters:
context - The Velocity context.
Returns:
true or false

prepareMessage

protected java.lang.String prepareMessage(org.apache.velocity.VelocityContext context)
Prepare the email message body from the message template.

Parameters:
context - The Velocity context.
Returns:
The email message.

buildVelocityContext

protected org.apache.velocity.VelocityContext buildVelocityContext(com.taleo.ws.integration.client.MessageFormat.Enum requestFormat,
                                                                   com.taleo.ws.integration.client.MessageFormat.Enum responseFormat,
                                                                   java.io.File file,
                                                                   com.taleo.ws.integration.client.Pipeline pipeline,
                                                                   com.taleo.ws.integration.client.GlobalConfig config)
Build the Velocity context to render templates and triggering rule.

Parameters:
requestFormat - The request file format.
responseFormat - The response file format.
file - The import or export results file.
pipeline - The workflow pipeline.
Returns:
The Velocity context.