Expand my Community achievements bar.

SOLVED

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

Avatar

Level 2

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));

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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. 

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

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.