cancel
Showing results for 
Search instead for 
Did you mean: 

use workflow defined in java

gokceng
Champ in-the-making
Champ in-the-making
Hi everyone,
It is the first time I'm using workflow. Before, I've created my own but now I need to use built-in workflow capabilities of Alfresco. That is the scenario:
1. After I've started Alfresco server, I will run a Java class. That class includes space creation, group creation and permission settings of these groups on these spaces. They are all done.
2. Now I need to define a simple workflow in Java. I couldn't find any example. I want to create something like that:
Whenever a document uploaded/created in a space -let's call it as Sapce1-, assign that document to a group. That is it for the java part.
3. I've seen on the web-client part of the Alfresco that if we have defined Approve/Reject like workflow for the document, after assigned user selects Approve or Reject that document automatically acts according to defined workflow. Here's my problem: How can i make the decision on the javascript side? I mean via a GUI like Flex, user sends approve message, how can I execute 'approve' on the document? With which command/function?
Thanks a lot…
7 REPLIES 7

stevegreenbaum
Champ in-the-making
Champ in-the-making
The Workflow JavaScript API provides a command (signal) to cause the workflow to take a predefined transition path.  The path is described in the processdefinition.xml file you configure.  You can use a webscript to signal the transition from any web application.

http://wiki.alfresco.com/wiki/Workflow_JavaScript_API#Overview

gokceng
Champ in-the-making
Champ in-the-making
Thanks for your reply but i need a Java example,tutorial, code snippet etc. I want to describe a worklow that consists back/forward (approve/reject) mechanism only. It must be 10 lines of code but I couldn't do it.

norgan
Champ in-the-making
Champ in-the-making
there is no lowlevel workflow API to run your own workflow. YOu have to define it in JPDL and deploy it. Then, you can trigger the actions from java.

Norgan

gokceng
Champ in-the-making
Champ in-the-making
Thanks Norgan. I've been reading Alfresco Developer Guide for 2 3 days and I've seen a code snippet:

Map<QName, Serializable> workflowParameters = new HashMap<QName,Serializable>();
workflowParameters.put(QName.createQName("bpm", "assignee"),"tuser1");
workflowParameters.put(QName.createQName("bpm", "description"),"Started from Foundation");
workflowService.startWorkflow("jbpm$wf:adhoc", workflowParameters);

That's way I've asked that question. I want to learn what can be the workflowParameters. Why is this code not enough for defining a new workflow?

mrogers
Star Contributor
Star Contributor
workflow parameters is an arbitary map of values given to start an instance of your workflow.     The analogy in Java would be the list of properties you pass into a constructor to create a new instance of a class.

The api you are looking at creates a new instance of a workflow.  

It does not define what the workflow is.   To define a workflow you need to create a workflow definition which is an XML file containing JBPM.

jayjayecl
Confirmed Champ
Confirmed Champ
workflow parameters is an arbitary map of values given to start an instance of your workflow.     The analogy in Java would be the list of properties you pass into a constructor to create a new instance of a class.

The api you are looking at creates a new instance of a workflow.  

It does not define what the workflow is.   To define a workflow you need to create a workflow definition which is an XML file containing JBPM.


to emphasize what you said : The api you are looking at creates a new instance of a specific type of workflow, which may not match your requirements.

gokceng
Champ in-the-making
Champ in-the-making
Thank you a lot guys…