use of org.activiti.engine.impl.persistence.entity.TaskEntity in project Activiti by Activiti.
the class JuelFormEngine method renderTaskForm.
public Object renderTaskForm(TaskFormData taskForm) {
if (taskForm.getFormKey() == null) {
return null;
}
String formTemplateString = getFormTemplateString(taskForm, taskForm.getFormKey());
ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines();
TaskEntity task = (TaskEntity) taskForm.getTask();
return scriptingEngines.evaluate(formTemplateString, ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE, task.getExecution());
}
use of org.activiti.engine.impl.persistence.entity.TaskEntity in project Activiti by Activiti.
the class GetTaskVariableCmd method execute.
public Object execute(CommandContext commandContext) {
if (taskId == null) {
throw new ActivitiIllegalArgumentException("taskId is null");
}
if (variableName == null) {
throw new ActivitiIllegalArgumentException("variableName is null");
}
TaskEntity task = commandContext.getTaskEntityManager().findTaskById(taskId);
if (task == null) {
throw new ActivitiObjectNotFoundException("task " + taskId + " doesn't exist", Task.class);
}
Object value;
if (isLocal) {
value = task.getVariableLocal(variableName, false);
} else {
value = task.getVariable(variableName, false);
}
return value;
}
use of org.activiti.engine.impl.persistence.entity.TaskEntity in project Activiti by Activiti.
the class HasTaskVariableCmd method execute.
public Boolean execute(CommandContext commandContext) {
if (taskId == null) {
throw new ActivitiIllegalArgumentException("taskId is null");
}
if (variableName == null) {
throw new ActivitiIllegalArgumentException("variableName is null");
}
TaskEntity task = commandContext.getTaskEntityManager().findTaskById(taskId);
if (task == null) {
throw new ActivitiObjectNotFoundException("task " + taskId + " doesn't exist", Task.class);
}
boolean hasVariable = false;
if (isLocal) {
hasVariable = task.hasVariableLocal(variableName);
} else {
hasVariable = task.hasVariable(variableName);
}
return hasVariable;
}
use of org.activiti.engine.impl.persistence.entity.TaskEntity in project Activiti by Activiti.
the class NewTaskCmd method execute.
public Task execute(CommandContext commandContext) {
Date currentTime = commandContext.getProcessEngineConfiguration().getClock().getCurrentTime();
TaskEntity task = TaskEntity.create(currentTime);
task.setId(taskId);
return task;
}
use of org.activiti.engine.impl.persistence.entity.TaskEntity in project Activiti by Activiti.
the class SetProcessDefinitionVersionCmd method validateAndSwitchVersionOfExecution.
protected void validateAndSwitchVersionOfExecution(CommandContext commandContext, ExecutionEntity execution, ProcessDefinitionEntity newProcessDefinition) {
// check that the new process definition version contains the current activity
if (execution.getActivity() != null && !newProcessDefinition.contains(execution.getActivity())) {
throw new ActivitiException("The new process definition " + "(key = '" + newProcessDefinition.getKey() + "') " + "does not contain the current activity " + "(id = '" + execution.getActivity().getId() + "') " + "of the process instance " + "(id = '" + processInstanceId + "').");
}
// switch the process instance to the new process definition version
execution.setProcessDefinition(newProcessDefinition);
// and change possible existing tasks (as the process definition id is stored there too)
List<TaskEntity> tasks = commandContext.getTaskEntityManager().findTasksByExecutionId(execution.getId());
for (TaskEntity taskEntity : tasks) {
taskEntity.setProcessDefinitionId(newProcessDefinition.getId());
commandContext.getHistoryManager().recordTaskProcessDefinitionChange(taskEntity.getId(), newProcessDefinition.getId());
}
}
Aggregations