2014-10-05 100 views
0

我想创建一个工作流程,当拖动新的employee_profile组件时,会触发一个电子邮件,&拖放到配置文件页面的缓冲区中。我已经创建了一个不会被拖动的工作流程,我必须从sidekick选项卡手动启动它。在发射器中,我已经给出了路径。CQ5电子邮件工作流不会触发组件拖放到从组件拖到组件拖动

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 = "[email protected]"; 
    String emailCcRecipients = "[email protected]"; 
    email.addTo(emailToRecipients); 
    email.addCc(emailCcRecipients); 
    email.setSubject("AEM Custom Step"); 
    email.setFrom("[email protected]"); 
    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() ; 
    } 
} 
} 

我需要给路径,直到/内容/演示/ EN/profile/jcr:content/par1 &更改内容类型? 请推荐一些所以当我拖动我的组件到解析器中时,我的工作流程可以自动执行。 在此先感谢。

+0

您是否未在启动器中设置工作流程? – 2014-10-05 11:24:36

回答

0

您是否确实在启动页面中验证了您的设置?转到localhost:4502/libs/cq/workflow/content/console.html并选择第4个选项卡(Launcher)。您是否可以看到有关您的工作流程和特定事件类型的条目?请注意,您也可以使用工作流程页面来验证是否运行了工作流程。祝你好运。