How to access com.day.cq.workflow.WorkflowSession.getModels() or getAllWorkflows()

RobertBailey1

03-02-2020

Hi All,

In the Java code shown below , what should serviceParams be set to , or how should serviceParams be set up , to allow access to getModels() or getAllWorkflows() ?

Thank you for your time.

 

resourceResolver = resourceResolverFactory.getServiceResourceResolver(serviceParams);
session = resourceResolver.adaptTo(Session.class);
WorkflowSession wfSession = workflowService.getWorkflowSession(session);

WorkflowModel wfModels[] = wfSession.getModels();
resultLog.add(new ResultLog.Entry(Result.Status.OK, "wfModels.length: " + wfModels.length));
Workflow flows[] = wfSession.getAllWorkflows();
resultLog.add(new ResultLog.Entry(Result.Status.OK, "flows.length: " + flows.length));

 

Accepted Solutions (1)

Accepted Solutions (1)

Vijayalakshmi_S

MVP

04-02-2020

Hi,

 

serviceParams in the snippet shared should be a map object with value being ResourceResolverFactory's subservice details in which Service user configured should have permission related to workflow paths.

(OSGI config named - Service User mapper Service amendment should be configured accordingly)

Eg. If it is about reading/getting workflow models then read permission on workflow related paths like /var/workflow/* and /conf/global/settings/workflow/* should be set for the configured service user. 

Answers (0)