Daisy documentation
8.7.5 Process cleanupBook Index8.9 Workflow HTTP interface

8.8 Workflow Java API

The reference documentation of the Daisy workflow Java API is available as javadocs, see the following package:


Using the workflow API it is simple to automate everything workflow-related. In contrast to the API of the core repository server, the workflow API is "flatter", that is, there is one service interface (WorkflowManager) through which all operations are performed. The returned objects are pure value objects without active behavior.

As an example, here is a bit of code I used to fill up the workflow system with some process instances for testing purposes.

This code is written as Javascript, see the instructions on how to run this.


var repositoryManager = new RemoteRepositoryManager("http://localhost:9263",
                                                    new Credentials("guest", "guest"));

// Add the WorkflowManager extension
    new Packages.org.outerj.daisy.workflow.clientimpl.RemoteWorkflowManagerProvider());

var repository = repositoryManager.getRepository(new Credentials("testuser", "testuser"));

var wfManager = repository.getExtension("WorkflowManager");

var locale = java.util.Locale.US;
var userId = repository.getUserManager().getPublicUserInfo("testuser").getId();
var processDef = wfManager.getLatestProcessDefinition("review", locale);

var taskUpdateData = new TaskUpdateData();

taskUpdateData.setVariable("daisy_document", VariableScope.GLOBAL,
                           WfValueType.DAISY_LINK, new WfVersionKey("1-DSY", 1, 1, "last"));

taskUpdateData.setVariable("reviewer", VariableScope.GLOBAL,
                           WfValueType.ACTOR, new WfActorKey(userId));

taskUpdateData.setVariable("taskPriority", VariableScope.GLOBAL,
                           WfValueType.LONG, new java.lang.Long(3)); // 3 is 'normal'

for (var i = 0; i < 100; i++) {

  taskUpdateData.setVariable("daisy_description", VariableScope.GLOBAL,
                             WfValueType.STRING, "review process " + i);

  wfManager.startProcess(processDef.getId(), taskUpdateData,
                         null /* default transition */, locale);
8.7.5 Process cleanup8.9 Workflow HTTP interface