use of org.camunda.bpm.engine.impl.form.handler.TaskFormHandler in project camunda-bpm-platform by camunda.
the class GetRenderedTaskFormCmd method execute.
public Object execute(CommandContext commandContext) {
TaskManager taskManager = commandContext.getTaskManager();
TaskEntity task = taskManager.findTaskById(taskId);
ensureNotNull("Task '" + taskId + "' not found", "task", task);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadTask(task);
}
ensureNotNull("Task form definition for '" + taskId + "' not found", "task.getTaskDefinition()", task.getTaskDefinition());
TaskFormHandler taskFormHandler = task.getTaskDefinition().getTaskFormHandler();
if (taskFormHandler == null) {
return null;
}
FormEngine formEngine = Context.getProcessEngineConfiguration().getFormEngines().get(formEngineName);
ensureNotNull("No formEngine '" + formEngineName + "' defined process engine configuration", "formEngine", formEngine);
TaskFormData taskForm = taskFormHandler.createTaskForm(task);
return formEngine.renderTaskForm(taskForm);
}
use of org.camunda.bpm.engine.impl.form.handler.TaskFormHandler in project camunda-bpm-platform by camunda.
the class SubmitTaskFormCmd method execute.
public Object execute(CommandContext commandContext) {
ensureNotNull("taskId", taskId);
TaskManager taskManager = commandContext.getTaskManager();
TaskEntity task = taskManager.findTaskById(taskId);
ensureNotNull("Cannot find task with id " + taskId, "task", task);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkTaskWork(task);
}
TaskDefinition taskDefinition = task.getTaskDefinition();
if (taskDefinition != null) {
TaskFormHandler taskFormHandler = taskDefinition.getTaskFormHandler();
taskFormHandler.submitFormVariables(properties, task);
} else {
// set variables on standalone task
task.setVariables(properties);
}
// complete or resolve the task
if (DelegationState.PENDING.equals(task.getDelegationState())) {
task.resolve();
task.createHistoricTaskDetails(UserOperationLogEntry.OPERATION_TYPE_RESOLVE);
} else {
task.complete();
task.createHistoricTaskDetails(UserOperationLogEntry.OPERATION_TYPE_COMPLETE);
}
return null;
}
use of org.camunda.bpm.engine.impl.form.handler.TaskFormHandler in project camunda-bpm-platform by camunda.
the class HumanTaskItemHandler method createTaskDefinition.
protected TaskDefinition createTaskDefinition(CmmnElement element, CmmnHandlerContext context) {
// at the moment a default task form handler is only supported,
// custom task form handler are not supported.
TaskFormHandler taskFormHandler = new DefaultTaskFormHandler();
// create new taskDefinition
TaskDefinition taskDefinition = new TaskDefinition(taskFormHandler);
// the plan item id will be handled as taskDefinitionKey
String taskDefinitionKey = element.getId();
taskDefinition.setKey(taskDefinitionKey);
// name
initializeTaskDefinitionName(element, taskDefinition, context);
// dueDate
initializeTaskDefinitionDueDate(element, taskDefinition, context);
// followUp
initializeTaskDefinitionFollowUpDate(element, taskDefinition, context);
// priority
initializeTaskDefinitionPriority(element, taskDefinition, context);
// assignee
initializeTaskDefinitionAssignee(element, taskDefinition, context);
// candidateUsers
initializeTaskDefinitionCandidateUsers(element, taskDefinition, context);
// candidateGroups
initializeTaskDefinitionCandidateGroups(element, taskDefinition, context);
// formKey
initializeTaskDefinitionFormKey(element, taskDefinition, context);
// description
initializeTaskDescription(element, taskDefinition, context);
return taskDefinition;
}
use of org.camunda.bpm.engine.impl.form.handler.TaskFormHandler in project camunda-bpm-platform by camunda.
the class GetTaskFormCmd method execute.
public TaskFormData execute(CommandContext commandContext) {
TaskManager taskManager = commandContext.getTaskManager();
TaskEntity task = taskManager.findTaskById(taskId);
ensureNotNull("No task found for taskId '" + taskId + "'", "task", task);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadTask(task);
}
if (task.getTaskDefinition() != null) {
TaskFormHandler taskFormHandler = task.getTaskDefinition().getTaskFormHandler();
ensureNotNull("No taskFormHandler specified for task '" + taskId + "'", "taskFormHandler", taskFormHandler);
return taskFormHandler.createTaskForm(task);
} else {
// Standalone task, no TaskFormData available
return null;
}
}
Aggregations