cancel
Showing results for 
Search instead for 
Did you mean: 

Invocation of jbpm workflow by java program

ruchi3
Champ in-the-making
Champ in-the-making
Hi! All

We hava a business requirement to invoke/instantiate  the alfresco jbpm workflow using a custom java class, which will be used to send emails through workfolow, providing email ids from that particular jaav class.

Please help us in this regard. Any clue or guidance is appreciated. Thanks in advance.

Ruchi
1 REPLY 1

jayjayecl
Confirmed Champ
Confirmed Champ
Hi,
Here is a java snippet about starting a workflow


String wfDefinitionName = "jbpm$MyPrefix:MyWorkflowName";

// workflow properties
        Map<QName, Serializable> properties = new HashMap<QName, Serializable>();

        properties.put(ContentModel.PROP_OWNER, "admin");
        properties.put( etc …

       // add empty workflow package to properties
        NodeRef workflowPackage = serviceRegistry.getWorkflowService()
                .createPackage(null);

        properties.put(WorkflowModel.ASSOC_PACKAGE, workflowPackage);

        WorkflowDefinition wfDefinition = serviceRegistry.getWorkflowService()
                .getDefinitionByName(wfDefinitionName);

        WorkflowPath path = serviceRegistry.getWorkflowService().startWorkflow(
                wfDefinition.id, properties);

Hope this helps