Howdy fellow devs 👋! In the previous post, we learned about basic stuff about AEM. In this post, we will see how can we create different steps in a workflow. We will mainly focus on two types of workflow steps - Process Step and Participant Step.
First we are going to discuss the most widely used Workflow step - the process step. This is generally used when we want our application to execute a certain logic.
It executes an ECMA script or an OSGi service to perform automatic processing. A process can be implemented using the following steps -
1. Create an OSGi service implementing the interface com.adobe.granite.workflow.exec.WorkflowProcess.
2. Set the property process.label. This is the String value by which our workflow needs to be listed.
3. Implement the execute(WorkItem, WorkflowSession, MetaDataMap) method with the implementation code.
The execute() method has three parameters -
1. WorkItem - It is the unit that is passed through a Workflow instance of a WorkflowModel. It contains the - WorkflowData. The instances act on and a reference to the 2. WorkflowNode that describes the underlying workflow step.
2. WorkflowSession - This class provides all functionality (depending on the users’ rights) for managing WorkflowModels, Workflow instances and their execution.
3. MetaDataMap - A value map for generic access to meta data values.