}
if (!(taskInstanceValue instanceof TaskInstance)) {
context.setError("Error updating task", "Attempted to resume something other than a task instance");
return;
}
final TaskInstance taskInstance = (TaskInstance) taskInstanceValue;
final Date start;
if (startDateExpression != null) {
final Object startDateValue = startDateExpression.getValue(elContext);
if (startDateValue == null) {
context.setError("Error updating task", "Start date value is null");
return;
}
if (startDateValue instanceof Date) {
start = (Date) startDateValue;
} else if (startDateValue instanceof Long) {
start = new Date(((Long)startDateValue).longValue());
} else {
context.setError("Error updating task", "Start date value is not a recognized type");
return;
}
} else {
start = new Date();
}
taskInstance.setStart(start);
context.getJbpmContext().getSession().flush();
} catch (Exception ex) {
context.setError("Error updating task", ex);
return;
}