Package is not getting completely generated

santhoshsrg

11-06-2020

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

  

Accepted Solutions (1)

Accepted Solutions (1)

surabhikatiyar

Employee

11-06-2020

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 

 

Answers (0)