use of org.activiti.engine.impl.interceptor.CommandContext in project Activiti by Activiti.
the class TaskEntity method setCategory.
public void setCategory(String category) {
this.category = category;
CommandContext commandContext = Context.getCommandContext();
if (commandContext != null) {
commandContext.getHistoryManager().recordTaskCategoryChange(id, category);
}
}
use of org.activiti.engine.impl.interceptor.CommandContext in project Activiti by Activiti.
the class TaskEntity method setPriority.
public void setPriority(int priority, boolean dispatchUpdateEvent) {
this.priority = priority;
CommandContext commandContext = Context.getCommandContext();
if (commandContext != null) {
commandContext.getHistoryManager().recordTaskPriorityChange(id, priority);
if (dispatchUpdateEvent && commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
if (dispatchUpdateEvent) {
commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_UPDATED, this));
}
}
}
}
use of org.activiti.engine.impl.interceptor.CommandContext in project Activiti by Activiti.
the class TaskEntity method setDueDate.
public void setDueDate(Date dueDate, boolean dispatchUpdateEvent) {
this.dueDate = dueDate;
CommandContext commandContext = Context.getCommandContext();
if (commandContext != null) {
commandContext.getHistoryManager().recordTaskDueDateChange(id, dueDate);
if (dispatchUpdateEvent && commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
if (dispatchUpdateEvent) {
commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_UPDATED, this));
}
}
}
}
use of org.activiti.engine.impl.interceptor.CommandContext in project Activiti by Activiti.
the class TaskEntity method setTaskDefinition.
// modified getters and setters /////////////////////////////////////////////
public void setTaskDefinition(TaskDefinition taskDefinition) {
this.taskDefinition = taskDefinition;
this.taskDefinitionKey = taskDefinition.getKey();
CommandContext commandContext = Context.getCommandContext();
if (commandContext != null) {
commandContext.getHistoryManager().recordTaskDefinitionKeyChange(this, taskDefinitionKey);
}
}
use of org.activiti.engine.impl.interceptor.CommandContext in project Activiti by Activiti.
the class TaskEntityManager method deleteTask.
public void deleteTask(TaskEntity task, String deleteReason, boolean cascade) {
if (!task.isDeleted()) {
task.fireEvent(TaskListener.EVENTNAME_DELETE);
task.setDeleted(true);
CommandContext commandContext = Context.getCommandContext();
String taskId = task.getId();
List<Task> subTasks = findTasksByParentTaskId(taskId);
for (Task subTask : subTasks) {
deleteTask((TaskEntity) subTask, deleteReason, cascade);
}
commandContext.getIdentityLinkEntityManager().deleteIdentityLinksByTaskId(taskId);
commandContext.getVariableInstanceEntityManager().deleteVariableInstanceByTask(task);
if (cascade) {
commandContext.getHistoricTaskInstanceEntityManager().deleteHistoricTaskInstanceById(taskId);
} else {
commandContext.getHistoryManager().recordTaskEnd(taskId, deleteReason);
}
getDbSqlSession().delete(task);
if (commandContext.getEventDispatcher().isEnabled()) {
commandContext.getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_DELETED, task));
}
}
}
Aggregations