Object dueDateObject = ScriptVariableParser.translateVariables(theResult.getDueDate(), transientVars, ps);
Object dueDateObject = variableResolver.translateVariables(theResult.getDueDate(), transientVars, ps);
    private Step createNewCurrentStep(ResultDescriptor theResult, WorkflowEntry entry, WorkflowStore store, int actionId, Step currentStep, long[] previousIds, Map transientVars, PropertySet ps) throws WorkflowException {        try {            int nextStep = theResult.getStep();            if (nextStep == -1) {                if (currentStep != null) {                    nextStep = currentStep.getStepId();                } else {                    throw new StoreException("Illegal argument: requested new current step same as current step, but current step not specified");                }            }            if (log.isDebugEnabled()) {                log.debug("Outcome: stepId=" + nextStep + ", status=" + theResult.getStatus() + ", owner=" + theResult.getOwner() + ", actionId=" + actionId + ", currentStep=" + ((currentStep != null) ? currentStep.getStepId() : 0));            }            if (previousIds == null) {                previousIds = new long[0];            }            String owner = theResult.getOwner();            if (owner != null) {                Object o = ScriptVariableParser.translateVariables(owner, transientVars, ps);                owner = (o != null) ? o.toString() : null;            }            String oldStatus = theResult.getOldStatus();            oldStatus = ScriptVariableParser.translateVariables(oldStatus, transientVars, ps).toString();            String status = theResult.getStatus();            status = ScriptVariableParser.translateVariables(status, transientVars, ps).toString();            if (currentStep != null) {                store.markFinished(currentStep, actionId, new Date(), oldStatus, context.getCaller());                store.moveToHistory(currentStep);                //store.moveToHistory(actionId, new Date(), currentStep, oldStatus, context.getCaller());            }            // construct the start date and optional due date            Date startDate = new Date();            Date dueDate = null;            if ((theResult.getDueDate() != null) && (theResult.getDueDate().length() > 0)) {                Object dueDateObject = ScriptVariableParser.translateVariables(theResult.getDueDate(), transientVars, ps);                if (dueDateObject instanceof Date) {                    dueDate = (Date) dueDateObject;                } else if (dueDateObject instanceof String) {                    long offset = 0;                    try {                        offset = Long.parseLong((String) dueDateObject);                    } catch (NumberFormatException e) {                    }                    if (offset > 0) {                        dueDate = new Date(startDate.getTime() + offset);                    }                } else if (dueDateObject instanceof Number) {                    Number num = (Number) dueDateObject;                    long offset = num.longValue();                    if (offset > 0) {                        dueDate = new Date(startDate.getTime() + offset);                    }                }            }            Step newStep = store.createCurrentStep(entry.getId(), nextStep, owner, startDate, dueDate, status, previousIds);            transientVars.put("createdStep", newStep);            if ((previousIds != null) && (previousIds.length == 0) && (currentStep == null)) {                // At this point, it must be a brand new workflow, so we'll overwrite the empty currentSteps                // with an array of just this current step                List currentSteps = new ArrayList();                currentSteps.add(newStep);                transientVars.put("currentSteps", Collections.unmodifiableCollection(currentSteps));            }            WorkflowDescriptor descriptor = (WorkflowDescriptor) transientVars.get("descriptor");            StepDescriptor step = descriptor.getStep(nextStep);            if (step == null) {                throw new WorkflowException("step #" + nextStep + " does not exist");            }            List preFunctions = step.getPreFunctions();            for (Iterator iterator = preFunctions.iterator();                    iterator.hasNext();) {                FunctionDescriptor function = (FunctionDescriptor) iterator.next();                executeFunction(function, transientVars, ps);            }            return newStep;        } catch (WorkflowException e) {            context.setRollbackOnly();            throw e;        }    }