@Override
public final void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaData)
throws WorkflowException {
final WorkflowData workflowData = workItem.getWorkflowData();
final String type = workflowData.getPayloadType();
// Check if the payload is a path in the JCR
if (!StringUtils.equals(type, "JCR_PATH")) {
return;
}
String[] args = buildArguments(metaData);
// process arguments
String emailTemplate = getValueFromArgs(Arguments.TEMPLATE.getArgumentName(), args);
if (emailTemplate == null) {
log.warn("Invalid process arguments, returning");
return;
}
// set date format to be used in emails
String sdfParam = getValueFromArgs(Arguments.DATE_FORMAT.getArgumentName(), args);
SimpleDateFormat sdf = getSimpleDateFormat(sdfParam);
// Get the path to the JCR resource from the payload
final String payloadPath = workflowData.getPayload().toString();
// Get ResourceResolver
final Map<String, Object> authInfo = new HashMap<String, Object>();
authInfo.put(JcrResourceConstants.AUTHENTICATION_INFO_SESSION, workflowSession.getSession());
final ResourceResolver resourceResolver;