}
if (!(taskInstanceValue instanceof TaskInstance)) {
context.setError("Error assigning task", "Attempted to assigning something other than a task instance");
return;
}
final TaskInstance taskInstance = (TaskInstance) taskInstanceValue;
if (actorIdExpression == null) {
context.setError("Error assigning task", "Actor ID expression is null");
return;
}
final Object actorIdValue = actorIdExpression.getValue(elContext);
if (actorIdValue == null) {
context.setError("Error assigning task", "Actor ID expression resolved to null");
return;
}
final String actorId = actorIdValue.toString();
if (overwriteSwimlaneExpression != null) {
final Object overwriteSwimlaneValue = overwriteSwimlaneExpression.getValue(elContext);
if (overwriteSwimlaneValue == null) {
context.setError("Error assigning task", "Overwrite swimlane expression resolved to null");
return;
}
final Boolean overwriteSwimlane;
if (overwriteSwimlaneValue instanceof Boolean) {
overwriteSwimlane = (Boolean) overwriteSwimlaneValue;
} else {
overwriteSwimlane = Boolean.valueOf(overwriteSwimlaneValue.toString());
}
taskInstance.setActorId(actorId, overwriteSwimlane.booleanValue());
} else {
taskInstance.setActorId(actorId);
}
context.addSuccessMessage("Task assigned");
context.getJbpmContext().getSession().flush();
context.selectOutcome("success");
} catch (Exception ex) {