String taskId = wInst.getCurrentTaskId();
WorkflowTask task = getTaskById(wInst.getWorkflow(), taskId);
List conditionList = task.getConditions();
for (Iterator i = conditionList.iterator(); i.hasNext();) {
WorkflowCondition c = (WorkflowCondition) i.next();
WorkflowConditionInstance cInst = null;
// see if we've already cached this condition instance
if (CONDITION_CACHE.get(taskId) != null) {
HashMap conditionMap = (HashMap) CONDITION_CACHE.get(taskId);
/*
* okay we have some conditions cached for this task, see if we
* have the one we need
*/
if (conditionMap.get(c.getConditionId()) != null) {
cInst = (WorkflowConditionInstance) conditionMap.get(c
.getConditionId());
}
/* if not, then go ahead and create it and cache it */
else {
cInst = GenericWorkflowObjectFactory
.getConditionObjectFromClassName(c
.getConditionInstanceClassName());
conditionMap.put(c.getConditionId(), cInst);
}
}
/* no conditions cached yet, so set everything up */
else {
HashMap conditionMap = new HashMap();
cInst = GenericWorkflowObjectFactory
.getConditionObjectFromClassName(c
.getConditionInstanceClassName());
conditionMap.put(c.getConditionId(), cInst);
CONDITION_CACHE.put(taskId, conditionMap);
}
// actually perform the evaluation
if (!cInst.evaluate(wInst.getSharedContext(), c.getTaskConfig())) {
return false;
}
}
return true;