Search in sources :

Example 66 with CommandContext

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);
    }
}
Also used : CommandContext(org.activiti.engine.impl.interceptor.CommandContext)

Example 67 with CommandContext

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));
            }
        }
    }
}
Also used : CommandContext(org.activiti.engine.impl.interceptor.CommandContext)

Example 68 with CommandContext

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));
            }
        }
    }
}
Also used : CommandContext(org.activiti.engine.impl.interceptor.CommandContext)

Example 69 with CommandContext

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);
    }
}
Also used : CommandContext(org.activiti.engine.impl.interceptor.CommandContext)

Example 70 with CommandContext

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));
        }
    }
}
Also used : Task(org.activiti.engine.task.Task) CommandContext(org.activiti.engine.impl.interceptor.CommandContext)

Aggregations

CommandContext (org.activiti.engine.impl.interceptor.CommandContext)72 CommandExecutor (org.activiti.engine.impl.interceptor.CommandExecutor)18 DbSqlSession (org.activiti.engine.impl.db.DbSqlSession)13 SignalEventSubscriptionEntity (org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity)8 Date (java.util.Date)7 ActivitiException (org.activiti.engine.ActivitiException)7 CommandConfig (org.activiti.engine.impl.interceptor.CommandConfig)7 EventSubscriptionEntity (org.activiti.engine.impl.persistence.entity.EventSubscriptionEntity)7 ProcessDefinitionEntity (org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)7 MessageEventSubscriptionEntity (org.activiti.engine.impl.persistence.entity.MessageEventSubscriptionEntity)6 HashMap (java.util.HashMap)4 TimerEntity (org.activiti.engine.impl.persistence.entity.TimerEntity)4 Job (org.activiti.engine.runtime.Job)4 Deployment (org.activiti.engine.test.Deployment)4 ArrayList (java.util.ArrayList)3 GregorianCalendar (java.util.GregorianCalendar)3 List (java.util.List)3 ExtensionElement (org.activiti.bpmn.model.ExtensionElement)3 DynamicBpmnService (org.activiti.engine.DynamicBpmnService)3 JobEntity (org.activiti.engine.impl.persistence.entity.JobEntity)3