2014-10-05 46 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)。您是否可以看到有關您的工作流程和特定事件類型的條目?請注意,您也可以使用工作流程頁面來驗證是否運行了工作流程。祝你好運。