-
Notifications
You must be signed in to change notification settings - Fork 0
Workflows
bartoszWesolowski edited this page Apr 28, 2020
·
4 revisions
- Implement bushiness processes
- Performed desired action on assets and pages (workflow payload) - for example creating asset rendition
- Each workflow consist of multiple steps executed after each other
Workflow execution - workflow instance is created and running (workflow was started):
- First step of workflow is executed
- Workflow engine determines which step to run next (based on workflow model)
- Next step is executed
- After all steps were executed workflow instance ends and is archived.
Executing a workflow instance generates a history that includes information about each step that has been executed for that instance - this can be useful for investigating errors.
Participant step
- Requires a user action
- Can be assigned to group of users or particular user
- User will get item in his Inbox which he needs to complete manually
- Workflow instance will progress only when user step is finished
Process step
- Service perform a step
- Workflow instance will progress automatically
@Component(immediate = true,
property = {
Constants.SERVICE_DESCRIPTION + "=Example workflow process",
Constants.SERVICE_VENDOR + "=Vendor",
WorkflowConstants.PROCESS_LABEL_PROPERTY_KEY + "=Example process step"
})
public class CreateTaskForAssetCollaborators implements WorkflowProcess {
@Reference
private ResourceResolverFactory factory;
@Override
public void execute(WorkItem item, WorkflowSession session, MetaDataMap args) throws WorkflowException {
try (ResourceResolver rr = factory.getServiceResourceResolver(null)) {
if (PayloadMap.TYPE_JCR_PATH.equals(item.getWorkflowData().getPayloadType())) {
String payloadPath = workItem.getWorkflowData().getPayload().toString();
Resource payloadResource = Optional.ofNullable(resourceResolver.getResource(payloadPath))
.orElseThrow(() -> new WorkflowException("Can not get workflow payload resource for path: " + payloadPath));
// ....
} else {
throw new WorkflowException("Unsupported payload - only resource path is supported.");
}
} catch (LoginException e) {
// handle exception
}
}
- Tools -> Workflow -> Models
- Create new workflow
- Add
Process Stepto the workflow parsys - Open step properties and select desired implementation to be invoked in this process
- Workflow model stored in
/confdirectory - Runtime stored in
/vardirectory - deploying changes through package will modify model definition in/conf, then in can be synced manually to update the runtime definition when other executions of the workflow are done