我想创建一个工作流程,当拖动新的employee_profile组件时会触发电子邮件。在配置文件页面中放入了parsys。我已经创建了一个工作流程,它不会被拖动和触发我必须从sidekick选项卡手动启动它。在发射器中,我给了路径。
path : /content/demo/en/profile/jcr:content
eventType : modified
contentType : cq:pageContent
我以某种方式创建了一个工作流程,使用包含代码的Java类CustomStep将电子邮件发送到我的Gmail帐户:
@Component
@Service
@Properties({
@Property(name = Constants.SERVICE_DESCRIPTION, value = "Test Email workflow process implementation."),
@Property(name = Constants.SERVICE_VENDOR, value = "Adobe"),
@Property(name = "process.label", value = "Test Email Workflow Process") })
public class CustomStep implements com.day.cq.workflow.exec.WorkflowProcess {
/** Default log. */
protected final Logger log = LoggerFactory.getLogger(this.getClass());
//Inject a MessageGatewayService
@Reference
private MessageGatewayService messageGatewayService;
public void execute(WorkItem item, WorkflowSession wfsession,MetaDataMap args) throws WorkflowException {
try
{
log.info("Here in execute method"); //ensure that the execute method is invoked
//Declare a MessageGateway service
MessageGateway<Email> messageGateway;
//Set up the Email message
Email email = new SimpleEmail();
//Set the mail values
String emailToRecipients = "monendra80@gmail.com";
String emailCcRecipients = "monendra.senger@gmail.com";
email.addTo(emailToRecipients);
email.addCc(emailCcRecipients);
email.setSubject("AEM Custom Step");
email.setFrom("monendra80@gmail.com");
email.setMsg("This message is to inform you that a new profile has been added. To find out about the new profile please visit our site.");
//Inject a MessageGateway Service and send the message
messageGateway = messageGatewayService.getGateway(Email.class);
// Check the logs to see that messageGateway is not null
messageGateway.send((Email) email);
}
catch (Exception e)
{
e.printStackTrace() ;
}
}
}
我是否需要提供路径直到/ content / demo / en / profile / jcr:content / par1&amp;更改内容类型? 请建议一下当我拖动时,我的工作流程可以自动化。将我的组件放入parsys中。 提前谢谢。
答案 0 :(得分:0)
您确实在启动器页面中验证了您的设置吗?转到localhost:4502 / libs / cq / workflow / content / console.html并选择第4个选项卡(Launcher)。您能看到包含工作流程和特定事件类型的条目吗?请注意,您也可以使用工作流程页面来验证工作流程是否已运行。祝好运。