Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Programmatically create workflow packages

Avatar

Avatar
Validate 1
Level 1
AshishSPanwar-a
Level 1

Likes

0 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
AshishSPanwar-a
Level 1

Likes

0 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile
AshishSPanwar-a
Level 1

15-10-2015

Hi All,

For one of my requirements I have had to create a custom console from where authors can select pages and initiate a workflow. Since authors can select multiple pages, I need to be able to pass multiple payload to the workflow. I know this could be done via Workflow packages but the documentation around it seems rather limited. I need to create Workflow package on the fly. I'm aware of a ResourceCollection and ResourceCollectionManager service that could be used but somehow it doesn't work. I'm using the following code:- 

ResourceCollection resourceCollection = resourceCollectionManager.createCollection(session.getNode(workflowPkgPage.getPath())); logger.debug("resourceCollection node created = {}", resourceCollection.getPath());

and I get the following logged in my logs (INFO):-

"com.adobe.granite.workflow.core.collection.ResourceCollectionManagerImpl Resource collection at /etc/workflow/packages/mypackage2 is not a package."

Followed by a NPE in the second line of code above. "/etc/workflow/packages/mypackage2" does indeed exist in CRX. This is a node I am creating first and passing to the above code.

To add to confusion, there are two set of workflow APIs in CQ with following namespace:

  • com.adobe.granite.workflow.*
  • com.day.cq.workflow.*

I am using the first package, as I believe it to be the "latest and greatest" (Possibly because I thought that Adobe will gradually move to granite packaging namespace). Although most classes and methods do seem identical between the two namespaces.

Which one among the two should be used ?

To summarize there are two questions:

  1. Which package to use for Workflow implementation?
  2. How to create workflow packages programmatically?

 

Thanks

Ashish

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 50
Level 10
Sham_HC
Level 10

Likes

160 likes

Total Posts

2,114 posts

Correct Reply

1,204 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 100
View profile

Avatar
Boost 50
Level 10
Sham_HC
Level 10

Likes

160 likes

Total Posts

2,114 posts

Correct Reply

1,204 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 100
View profile
Sham_HC
Level 10

15-10-2015

1)   Use granite one

2)    AFAIK there is no direct api. You might need to do form submission for each resource.

For your use case is each payload will be using same workflow or different one ?

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Level 1
AshishSPanwar-a
Level 1

Likes

0 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
AshishSPanwar-a
Level 1

Likes

0 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile
AshishSPanwar-a
Level 1

15-10-2015

Thanks Sham,

I am using the Granite workflow API. I think the official documentation needs to be updated. Every workflow documentation I came across used the "com.day.cq.." API.

In the end I created the required Workflow Package Page via Node API.

For my usecase I need to launch a workflow with multiple payloads. With the above approach my issue is now resolved.

 

Thanks
Ashish