*/
public static WorkflowTask getWorkflowTask(Node node, HashMap conditions) {
Element taskNode = (Element) node;
String taskClassName = taskNode.getAttribute("class");
WorkflowTask task = new WorkflowTask();
task.setTaskInstanceClassName(taskClassName);
task.setTaskId(taskNode.getAttribute("id"));
task.setTaskName(taskNode.getAttribute("name"));
// get the list of condition IDs for this task and then get the
// conditions for them
Element conditionRoot = getFirstElement("conditions", taskNode);
if (conditionRoot != null) {
NodeList conditionNodes = conditionRoot
.getElementsByTagName("condition");
if (conditionNodes != null && conditionNodes.getLength() > 0) {
List conditionList = new Vector(conditionNodes.getLength());
for (int i = 0; i < conditionNodes.getLength(); i++) {
Element conditionNode = (Element) conditionNodes.item(i);
WorkflowCondition condition = (WorkflowCondition) conditions
.get(conditionNode.getAttribute("id"));
if (condition != null) {
WorkflowCondition workflowCondition = new WorkflowCondition();
workflowCondition
.setConditionInstanceClassName(condition
.getConditionInstanceClassName());
workflowCondition.setConditionId(condition
.getConditionId());
workflowCondition.setConditionName(condition
.getConditionName());
workflowCondition.setOrder(i + 1);
workflowCondition.setCondConfig(condition.getTaskConfig());
conditionList.add(workflowCondition);
}
}
task.setConditions(conditionList);
}
}
Element reqMetFieldsElem = getFirstElement("requiredMetFields",
taskNode);
if (reqMetFieldsElem != null) {
task.setRequiredMetFields(getRequiredMetFields(reqMetFieldsElem));
}
// load its configuration
Element configElement = getFirstElement("configuration", taskNode);
if (configElement != null) {
task.setTaskConfig(new WorkflowTaskConfiguration(getConfiguration(configElement)));
}
return task;
}