Hi everyone,
I came across a sling job requirement of checking if any of the pages in a list (this list will come from a TSV or CSV file stored in DAM) is in workflow or not and then do the further processing. What are the ways we can try ? And Is there any way of checking that efficiently? (there are going to be around tens of thousands of pages).
What I have tried : (Please correct me if I'm in the wrong direction)
I was trying Payload Map, but it is returning null in the first line itself. Resource Resolver is working fine.
PayloadMap payloadMap = resourceResolver.adaptTo(PayloadMap.class);
payloadMap.isInWorkflow(resource.getPath(), true/false);
Thank You
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Jangra98,
I think using WorkflowStatus class will be the best option. In general you can iterate over the list of pages and get Resource or Page object of each item from the list, and simply adapt it to WorkflowStatus to get information if given page is subject of the workflow.
// for Resource object
WorkflowStatus ws = resource.adaptTo(WorkflowStatus.class);
// gives you information if given resource is subject of workflow
ws.isInRunningWorkflow(false);
// gives you list of workflows that current resource is part of
ws.getWorkflows(false);
// the same code for Page object
WorkflowStatus ws = page.adaptTo(WorkflowStatus.class);
ws.isInRunningWorkflow(false);
ws.getWorkflows(false);
Hi @Jangra98,
I think using WorkflowStatus class will be the best option. In general you can iterate over the list of pages and get Resource or Page object of each item from the list, and simply adapt it to WorkflowStatus to get information if given page is subject of the workflow.
// for Resource object
WorkflowStatus ws = resource.adaptTo(WorkflowStatus.class);
// gives you information if given resource is subject of workflow
ws.isInRunningWorkflow(false);
// gives you list of workflows that current resource is part of
ws.getWorkflows(false);
// the same code for Page object
WorkflowStatus ws = page.adaptTo(WorkflowStatus.class);
ws.isInRunningWorkflow(false);
ws.getWorkflows(false);
Views
Likes
Replies