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

SOLVED

Package is not getting completely generated

santhoshsrg
Level 4
Level 4

Hi,

 

I am trying to create a package in a workflow process. The package will contain filters as current payload and workflow instance. PFB the code which i have used for this.

My issue is the workflow instance is not getting built completely. I save workflow instance for history purpose like getting approval notes from participant. 

Please let me know if i am missing any step in building package.

 

Thanks in advance !!

 

        Node rootNode = getRootNode(session, siteName);
        JcrPackageManager jcrPackageManager = packaging.getPackageManager(session);
        ProgressTrackerListener listener = new DefaultProgressListener();
		JcrPackage jcrPackage = jcrPackageManager.create(rootNode, pkgName);
		JcrPackageDefinition jcrPackageDefinition = jcrPackage.getDefinition();
		DefaultWorkspaceFilter workspaceFilter = new DefaultWorkspaceFilter();
		
		for (PathFilterSet packageFilter : packageFilters) {
			workspaceFilter.add(packageFilter);
		}
		jcrPackageDefinition.setFilter(workspaceFilter, AUTO_SAVE); 
		jcrPackageDefinition.set(JcrPackageDefinition.PN_DESCRIPTION, PACKAGE_DESCRIPTION + pkgName, false);
		jcrPackageDefinition.set(JcrPackageDefinition.PN_GROUP, rootNode.getName() , false);
		jcrPackageManager.assemble(jcrPackage, listener);

  

1 Accepted Solution
surabhikatiyar
Correct answer by
Employee
Employee

Hi santhoshsrg,

 

You are trying to build the workflow which is still in running state. So you will not be able to get the complete package.

 

All the workflow steps processed after the package was created will not be included as workflow is still in RUNNING state and transition nodes are still getting added under "history" for the respective workflow instance.

 

For building up the entire workflow the process of creating the workflow should be executed once the entire workflow is completed. You can have event listener on the workflow node to check when the processing is completed, start package building. Or you can create a schedular which runs at the specific time to create packages based on the cron jobs.

 

Thanks 

 

View solution in original post

1 Reply
surabhikatiyar
Correct answer by
Employee
Employee

Hi santhoshsrg,

 

You are trying to build the workflow which is still in running state. So you will not be able to get the complete package.

 

All the workflow steps processed after the package was created will not be included as workflow is still in RUNNING state and transition nodes are still getting added under "history" for the respective workflow instance.

 

For building up the entire workflow the process of creating the workflow should be executed once the entire workflow is completed. You can have event listener on the workflow node to check when the processing is completed, start package building. Or you can create a schedular which runs at the specific time to create packages based on the cron jobs.

 

Thanks 

 

View solution in original post