Expand my Community achievements bar.

SOLVED

Package is not getting completely generated

Avatar

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

Avatar

Correct answer by
Employee Advisor

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

Avatar

Correct answer by
Employee Advisor

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