use of org.camunda.bpm.engine.impl.interceptor.CommandContext in project camunda-bpm-platform by camunda.
the class TaskEntity method createHistoricTaskDetails.
public void createHistoricTaskDetails(String operation) {
final CommandContext commandContext = Context.getCommandContext();
if (commandContext != null) {
List<PropertyChange> values = new ArrayList<PropertyChange>(propertyChanges.values());
commandContext.getOperationLogManager().logTaskOperations(operation, this, values);
fireHistoricIdentityLinks();
propertyChanges.clear();
}
}
use of org.camunda.bpm.engine.impl.interceptor.CommandContext in project camunda-bpm-platform by camunda.
the class TaskEntity method saveAuthorizations.
protected void saveAuthorizations(AuthorizationEntity[] authorizations) {
CommandContext commandContext = Context.getCommandContext();
TaskManager taskManager = commandContext.getTaskManager();
taskManager.saveDefaultAuthorizations(authorizations);
}
use of org.camunda.bpm.engine.impl.interceptor.CommandContext in project camunda-bpm-platform by camunda.
the class TaskManager method deleteTask.
public void deleteTask(TaskEntity task, String deleteReason, boolean cascade, boolean skipCustomListeners) {
if (!task.isDeleted()) {
task.setDeleted(true);
CommandContext commandContext = Context.getCommandContext();
String taskId = task.getId();
List<Task> subTasks = findTasksByParentTaskId(taskId);
for (Task subTask : subTasks) {
((TaskEntity) subTask).delete(deleteReason, cascade, skipCustomListeners);
}
task.deleteIdentityLinks(false);
commandContext.getVariableInstanceManager().deleteVariableInstanceByTask(task);
if (cascade) {
commandContext.getHistoricTaskInstanceManager().deleteHistoricTaskInstanceById(taskId);
} else {
commandContext.getHistoricTaskInstanceManager().markTaskInstanceEnded(taskId, deleteReason);
if (TaskEntity.DELETE_REASON_COMPLETED.equals(deleteReason)) {
task.createHistoricTaskDetails(UserOperationLogEntry.OPERATION_TYPE_COMPLETE);
} else {
task.createHistoricTaskDetails(UserOperationLogEntry.OPERATION_TYPE_DELETE);
}
}
deleteAuthorizations(Resources.TASK, taskId);
getDbEntityManager().delete(task);
}
}
use of org.camunda.bpm.engine.impl.interceptor.CommandContext in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceManager method deleteHistoricTaskInstancesByCaseInstanceIds.
public void deleteHistoricTaskInstancesByCaseInstanceIds(List<String> caseInstanceIds) {
CommandContext commandContext = Context.getCommandContext();
getHistoricDetailManager().deleteHistoricDetailsByTaskCaseInstanceIds(caseInstanceIds);
commandContext.getCommentManager().deleteCommentsByTaskCaseInstanceIds(caseInstanceIds);
getAttachmentManager().deleteAttachmentsByTaskCaseInstanceIds(caseInstanceIds);
getHistoricIdentityLinkManager().deleteHistoricIdentityLinksLogByTaskCaseInstanceIds(caseInstanceIds);
getDbEntityManager().deletePreserveOrder(HistoricTaskInstanceEntity.class, "deleteHistoricTaskInstanceByCaseInstanceIds", caseInstanceIds);
}
use of org.camunda.bpm.engine.impl.interceptor.CommandContext in project camunda-bpm-platform by camunda.
the class HistoricIncidentAuthorizationTest method clearDatabase.
protected void clearDatabase() {
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
commandExecutor.execute(new Command<Object>() {
public Object execute(CommandContext commandContext) {
commandContext.getHistoricJobLogManager().deleteHistoricJobLogsByHandlerType(TimerSuspendProcessDefinitionHandler.TYPE);
List<HistoricIncident> incidents = Context.getProcessEngineConfiguration().getHistoryService().createHistoricIncidentQuery().list();
for (HistoricIncident incident : incidents) {
commandContext.getHistoricIncidentManager().delete((HistoricIncidentEntity) incident);
}
return null;
}
});
}
Aggregations