08-01-2011 12:41 PM
ProcessDefinitionBuilder processDefinitionBuilder = new ProcessDefinitionBuilder(someName);
processDefinitionBuilder = processDefinitionBuilder.createActivity(top.getName())
.initial()
.behavior(new BaseServiceTaskHandler("start node"))
.transition(startName)
.endActivity();
for (int i = 0; i < myChecklist.size(); i++) {
if(i<myChecklist.size() - 1) {
processDefinitionBuilder = processDefinitionBuilder.createActivity(myChecklist.get(i).getName())
.behavior(new ReminderActivityHandler())
.transition(myChecklist.get(i + 1).getName())
.endActivity();
} else {
processDefinitionBuilder = processDefinitionBuilder.createActivity(top.getRoutine().get(i).getName())
.endActivity();
}
}
PvmProcessDefinition processDefinition = processDefinitionBuilder.buildProcessDefinition();
08-02-2011 12:26 PM
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.setVariable("userId", "myTest");
processInstance.start();
List activeIds = processInstance.findActiveActivityIds();
Assert.assertNotNull(activeIds);
PvmActivity activity = processInstance.getActivity();
08-02-2011 01:47 PM
08-03-2011 01:19 PM
08-03-2011 05:40 PM
10-03-2011 06:21 AM
@Test
public void createProcessDefinition() {
ProcessDefinitionBuilder processDefinitionBuilder = new ProcessDefinitionBuilder();
//a map with tasks descriptions
List<Map<String, String>> activities = new ArrayList<Map<String, String>>();
Map<String, String> activity;
activity = new HashMap<String, String>();
activity.put("id", "UT1");
activity.put("name", "User task 1");
activities.add(activity);
activity = new HashMap<String, String>();
activity.put("id", "UT2");
activity.put("name", "User task 2");
activities.add(activity);
activity = new HashMap<String, String>();
activity.put("id", "UT3");
activity.put("name", "User task 3");
activities.add(activity);
// creating process definition
int len = activities.size();
for (int i = 0; i < len; i++) {
processDefinitionBuilder.createActivity(activities.get(i).get("id"));
if (i == 0) {
processDefinitionBuilder.initial();
}
processDefinitionBuilder.behavior(new ActivitiWaitState());
if (i + 1 < len) {
processDefinitionBuilder.transition(activities.get(i+1).get("id"));
}
}
PvmProcessDefinition processDefinition = processDefinitionBuilder.buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
TaskQuery taskQuery = activitiTaskService.createTaskQuery();
List<Task> tasks = taskQuery.list();
Assert.assertTrue(tasks.size() > 0);
}
10-03-2011 03:45 PM
10-03-2011 04:44 PM
10-04-2011 02:03 AM
10-04-2011 02:12 AM
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.