Skip navigation

AEM 6.4, SP-1 and SP-2 workflow and launcher creation

score 1
You have not voted. New Idea

Hi All,

 

We are migrating from 6.1 to 6.4 and faced multiple issues while doing this.

 

Please find out below steps to create workflow and launchers in AEM 6.4, SP-1 and SP-2.

 

Workflow class:

 

import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.adobe.granite.workflow.WorkflowException;
import com.adobe.granite.workflow.WorkflowSession;
import com.adobe.granite.workflow.exec.WorkItem;
import com.adobe.granite.workflow.exec.WorkflowProcess;
import com.adobe.granite.workflow.metadata.MetaDataMap;

@Component(service=WorkflowProcess.class, property = {"process.label=ik practise",
   org.osgi.framework.Constants.SERVICE_DESCRIPTION+"=Add opt out key to resource",
   org.osgi.framework.Constants.SERVICE_VENDOR+"=The Coca-Cola Company - FreeStyle CMS",
   "value=Add Optout Key"})

public class CustomStep implements WorkflowProcess {

   private static final Logger log = LoggerFactory.getLogger(CustomStep.class);
  public void execute(WorkItem item, WorkflowSession session, MetaDataMap args) throws WorkflowException {

        log.info("========Workflow called ========");
   }

}

 

Launcher:

In 6.4 Adobe suggested to create launchers in /conf/global/settings/workflow/launcher/config/update_page

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
   jcr:primaryType="cq:WorkflowLauncher"
   condition="jcr:content/sling:resourceType==weretail/components/structure/page"
   description="ik test practise"
   enabled="{Boolean}true"
   eventType="{Long}16"
   excludeList=""
   glob="/content"
   nodetype="cq:Page"
   runModes="author"
   workflow="/var/workflow/models/ikpractise/update_page/jcr:content/model"
/>

 

Workflow Model page:

In 6.4 Adobe suggested to create model page in /var/workflow/models/ikpractise/update_page

 

 

<?xml version="1.0" encoding="UTF-8"?>

<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"

      jcr:primaryType="cq:Page">

    <jcr:content

        cq:designPath="/etc/designs/default"

        cq:lastModified="{Date}2017-10-25T10:53:50.433+05:30"

        cq:lastModifiedBy="admin"

        cq:template="/libs/cq/workflow/templates/model"

        jcr:primaryType="cq:PageContent"

        jcr:title="LS Genomic Indexing Workflow"

        sling:resourceType="cq/workflow/components/pages/model">

        <flow

            jcr:primaryType="nt:unstructured"

            sling:resourceType="foundation/components/parsys">

            <process

                jcr:created="{Date}2017-10-25T10:53:16.696+05:30"

                jcr:createdBy="admin"

                jcr:lastModified="{Date}2017-10-25T10:53:50.428+05:30"

                jcr:lastModifiedBy="admin"

                jcr:primaryType="nt:unstructured"

                jcr:title="Genomic Indexing"

                sling:resourceType="cq/workflow/components/model/process">

                <metaData

                    jcr:primaryType="nt:unstructured"

                    PROCESS="ikpackage.core.listeners.CustomStep"

                    PROCESS_AUTO_ADVANCE="true"/>

            </process>

        </flow>

        <model/>

    </jcr:content>

</jcr:root>

 

Workflow Model page:

In 6.4 Adobe suggested to create model in /var/workflow/models/ikpractise/update_page/_jcr_content

 

<?xml version="1.0" encoding="UTF-8"?>

<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"

          jcr:isCheckedOut="{Boolean}false"

          jcr:primaryType="cq:WorkflowModel"

          jcr:uuid="fd9a69e1-a024-43dc-905e-78285cae0e01"

          sling:resourceType="cq/workflow/components/model"

          description="No Description"

          title="FOS Content Bundle Deploy Workflow">

    <metaData

            cq:lastModified="{Long}1527862148126"

            cq:lastModifiedBy="admin"

            jcr:primaryType="nt:unstructured"/>

    <nodes jcr:primaryType="nt:unstructured">

        <node0

            jcr:primaryType="cq:WorkflowNode"

            title="Start"

            type="START">

            <metaData jcr:primaryType="nt:unstructured"/>

        </node0>

        <node1

            jcr:primaryType="cq:WorkflowNode"

            title="FOS Create Bundle JSON"

            type="PROCESS">

            <metaData

                jcr:primaryType="nt:unstructured"

                PROCESS="ikpackage.core.listeners.CustomStep"

                PROCESS_AUTO_ADVANCE="true"/>

        </node1>

        <node2

            jcr:primaryType="cq:WorkflowNode"

            title="End"

            type="END">

            <metaData jcr:primaryType="nt:unstructured"/>

        </node2>

    </nodes>

    <transitions jcr:primaryType="nt:unstructured">

        <node0_x0023_node1

                jcr:primaryType="cq:WorkflowTransition"

                from="node0"

                rule=""

                to="node1">

            <metaData jcr:primaryType="nt:unstructured"/>

        </node0_x0023_node1>

        <node1_x0023_node2

                jcr:primaryType="cq:WorkflowTransition"

                from="node1"

                rule=""

                to="node2">

            <metaData jcr:primaryType="nt:unstructured"/>

        </node1_x0023_node2>

    </transitions>

</jcr:root>

 

Please find below image reference for the same.

workflo.PNG

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
      jcr:primaryType="cq:Page">
    <jcr:content
        cq:designPath="/etc/designs/default"
        cq:lastModified="{Date}2017-10-25T10:53:50.433+05:30"
        cq:lastModifiedBy="admin"
        cq:template="/libs/cq/workflow/templates/model"
        jcr:primaryType="cq:PageContent"
        jcr:title="LS Genomic Indexing Workflow"
        sling:resourceType="cq/workflow/components/pages/model">
        <flow
            jcr:primaryType="nt:unstructured"
            sling:resourceType="foundation/components/parsys">
            <process
                jcr:created="{Date}2017-10-25T10:53:16.696+05:30"
                jcr:createdBy="admin"
                jcr:lastModified="{Date}2017-10-25T10:53:50.428+05:30"
                jcr:lastModifiedBy="admin"
                jcr:primaryType="nt:unstructured"
                jcr:title="Genomic Indexing"
                sling:resourceType="cq/workflow/components/model/process">
                <metaData
                    jcr:primaryType="nt:unstructured"
                    PROCESS="ikpackage.core.listeners.CustomStep"
                    PROCESS_AUTO_ADVANCE="true"/>
            </process>
        </flow>
        <model/>
    </jcr:content>
</jcr:root>

For mor

Comments

Vote history