Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Workflow Delay until rollout is complete (MSM)

Avatar

Level 10

Is there a way to trigger workflow on rollout, but after the rollout is complete?, thus delay my workflow untill rollout is completely done.? I see that my workflow runs for every chapter and path, which is not what it should be. I would want the rollout complete, generate new site Test2 with languages en_US and fr_CA and then trigger workflow to pick the sites /content/Test2/en_US and /content/Test2/fr_CA alone, and not all the chapters,

Also what i see is, since rollout is not complete and i have attached the workflow to rollout configuration, it triggers workflow for every path , /content/Test2, /content/Test2/en_US and all the chapters selected during rollout, but since copy(rollout) wasn't complete and my workflow was triggered i don't seem to retrieve nodes

Appreciate help.

Regards,

Nicole

1 Accepted Solution

Avatar

Correct answer by
Level 10

Have you tried writing  you own Java method to retrieve and modify the JCR to get exactly what you need. If OOTB stuff does not work - create your own using the JCR API. See if you can use this API to pick up CCC instead of BBB.  

View solution in original post

7 Replies

Avatar

Level 10

Workflows are essentially Java orchestrations that you can include within AEM. Even if a workflow step is not there to meet your need out of the box, you can create custom workflow steps using Java. So having said that -- when you are trying to do something that is not out of the box, you can custom a step by creating a customize a workflow step and then use that step within a workflow. I recommend exploring using custom steps to fine tune your workflow. To learn how to create a custom workflow step, see http://scottsdigitalcommunity.blogspot.ca/2012/09/developing-cq-custom-workflow-steps.html.

Avatar

Level 10

Managed to make progress here but i still have issues with workflow session, and i see that although i create Livecopy BBB(success), and delete it, and recreate a new livecopy CCCC, it still picks BBB as payload, and later picks up CCCC as payload. Iam wondering if it is cause of session.


Would Need some help here please scott.

Regards,

Nicole

Avatar

Correct answer by
Level 10

Have you tried writing  you own Java method to retrieve and modify the JCR to get exactly what you need. If OOTB stuff does not work - create your own using the JCR API. See if you can use this API to pick up CCC instead of BBB.  

Avatar

Level 10

This is what i have implemented custom process step.Initially i create a livecopy BBB, on rollout a workflow gets triggered and It generates an XLIFF, successfully.

Again now, if i create another livecopy CCC with same rolloutconfig and workflow, it shows BBB, as payload path and here and there CCC, I wonder if it is something to do with session.

 

public void execute(WorkItem item, WorkflowSession session, MetaDataMap args)
            throws WorkflowException {
        // TODO Auto-generated method stub
        WorkflowData workflowData = item.getWorkflowData();
        System.out.println(workflowData.getPayload().toString());
        String path = workflowData.getPayload().toString();
        arrList.add(path);
        Set<String> labelNames = new HashSet<String>();
        String languageLabel;
        for (int i = 1; i < arrList.size(); i++) {
            System.out.println(arrList.get(i));
            String handle = arrList.get(i);
             languageLabel = (handle != null && handle.split("/").length > languageHierarchyLevel) ? handle
                    .split("/")[languageHierarchyLevel] : defaultLanguageLabel;
            System.out.println("executing for handle '" + handle
                    + "' and actual language '" + languageLabel + "'");
            labelNames.add(languageLabel);
        }
    
        List<String> values = new ArrayList<String>(labelNames);
        List<String> paths = new ArrayList<String>();
        for (String val : values) {
            System.out.println(arrList);
            System.out.println("Path To be sent:"+arrList.get(0)+"/"+val); // arrList.get(0) retrieves /content/BBB instead of /content/CCC,
            paths.add(arrList.get(0)+"/"+val);
        }
        
        
        Session sess = session.getSession();        
        try {
            HashMap<String, String> map =new HashMap<String, String>();
            for (String path1 : paths) {
                System.out.println("Before Search:"+path1); // retrieves BBB instead of actual payload CCC
                map= searchCQForContent(sess,path1);
                generateXLIFF(path1, session, item, map);
            }
             sess.save();
             sess.logout();
             session.logout();

        } catch (RepositoryException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
    }

Avatar

Former Community Member

NitroHazeDev,

What was the issue and final solution?  I am faced with the same challenge.

Thanks,

RKB.