cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with the Workflow Submission Programitcally

opensrcguy
Champ in-the-making
Champ in-the-making
Hi All,

   I am trying to submit content to the workflow programtically using sandbox service : submitListAssets method. It shows the method is deprecated. But still when I use that method for content submission, workflow task is getting created . But in the task item, submitted content is not found under Resources.

void submitListAssets(java.lang.String sbStoreId,
                                   java.util.List relativePaths,
                                   java.lang.String workflowName,
                                   java.util.Map workflowParams,
                                   java.lang.String submitLabel,
                                   java.lang.String submitDescription,
                                   java.util.Map expirationDates,
                                   java.util.Date launchDate,
                                   boolean autoDeploy)
The reason for using this method is, I have to submit to custom created workflow. Except this method, no other method accepts workflowName as parameter.

Other issue is , when I submit the content using this method, the content file is not getting locked.

Can anyone suggest me in resolving this issue?

Attached is the code for workflow submission :

Map<QName, Serializable> workflowParams = new HashMap<QName, Serializable>(16);
Map<String,Date> expDateMap = new HashMap<String,Date>();
expDateMap.put(WCMAppModel.PROP_EXPIRATIONDATE.getLocalName(), expiryDate);
   
NodeRef workflowPackage = this.services.getWorkflowService().createPackage(AVMNodeConverter.ToNodeRef(-1, parentFolderAvmPath+"/"+fileName));
workflowParams.put(WorkflowModel.ASSOC_PACKAGE, workflowPackage);
          
            workflowParams.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, wfComment);
            workflowParams.put(WCMWorkflowModel.PROP_LABEL, wfLabel);
            workflowParams.put(WCMWorkflowModel.PROP_FROM_PATH,WCMUtil.buildStoreRootPath(KOMPSOFT));
            workflowParams.put(WCMWorkflowModel.PROP_LAUNCH_DATE, launchDate);
            workflowParams.put(WCMWorkflowModel.PROP_AUTO_DEPLOY,
                    new Boolean(false));
            workflowParams.put(WCMWorkflowModel.PROP_WEBAPP,webProjInfo.getDefaultWebApp());
            workflowParams.put(WCMWorkflowModel.ASSOC_WEBPROJECT,webProjService.getWebProjectNodeFromStore(webProjInfo.getStoreId()));
           
            workflowParams.put(WorkflowModel.PROP_WORKFLOW_DUE_DATE, launchDate);
           
            workflowParams.put(QName.createQName(NamespaceService.BPM_MODEL_1_0_URI, "groupAssignees"),findGroup("GROUP_Marketing") );
           
           
            List<String> relativePaths = new ArrayList<String>();
            relativePaths.add(AVMUtil.splitPath(parentFolderAvmPath)[1]+"/"+fileName);
   
this.services.getSandboxService().submitListAssets(userStoreID,relativePaths , "jbpm$groupwf:groupsubmit",workflowParams,  wfLabel, wfComment, expDateMap, launchDate, false,false);
1 REPLY 1

romschn
Star Collaborator
Star Collaborator
If you can just trace through the execute() method of AVMSubmitPackageHandler.java and find out what would be the destination path created for your workflow sandbox then you can submit the content to the workflow programatically using update() method of AVMSyncService.

Below is the sample code for your reference. It submits the content from user sandbox to staging sandbox. Similarly, you can submit from user sandbox to workflow sandbox.                        

                                String oldFileName = "TestFolder";
                                final List<AVMDifference> diffs = new ArrayList<AVMDifference>();
                                String oldSrcPath = webProjectDNSName + "–admin" + ":/www/avm_webapps/ROOT/" + oldFileName;
                                String oldDestPath = webProjectDNSName + ":/www/avm_webapps/ROOT/" + oldFileName;
                                diffs.add(new AVMDifference(-1, oldSrcPath, -1, oldDestPath , AVMDifference.NEWER));
                               
                                AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
                                                        {
                                                            public Object doWork() throws Exception
                                                            {
                                                                serviceRegistry.getAVMSyncService().update(diffs, null, false, false, true, true, submitLabel, submitComment);
                                                                return null;
                                                            }
                                                }, AuthenticationUtil.getSystemUserName());

Hope this helps.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.