use of org.activiti.engine.impl.interceptor.CommandContext in project Activiti by Activiti.
the class ProcessDefinitionInfoEntityManager method updateProcessDefinitionInfo.
public void updateProcessDefinitionInfo(ProcessDefinitionInfoEntity updatedProcessDefinitionInfo) {
CommandContext commandContext = Context.getCommandContext();
DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
dbSqlSession.update(updatedProcessDefinitionInfo);
if (Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_UPDATED, updatedProcessDefinitionInfo));
}
}
use of org.activiti.engine.impl.interceptor.CommandContext in project Activiti by Activiti.
the class TaskEntity method setOwner.
public void setOwner(String owner, boolean dispatchUpdateEvent) {
if (owner == null && this.owner == null) {
return;
}
// if (owner!=null && owner.equals(this.owner)) {
// return;
// }
this.owner = owner;
CommandContext commandContext = Context.getCommandContext();
if (commandContext != null) {
commandContext.getHistoryManager().recordTaskOwnerChange(id, owner);
if (owner != null && processInstanceId != null) {
getProcessInstance().involveUser(owner, IdentityLinkType.PARTICIPANT);
}
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 setDescription.
public void setDescription(String description) {
this.description = description;
CommandContext commandContext = Context.getCommandContext();
if (commandContext != null) {
commandContext.getHistoryManager().recordTaskDescriptionChange(id, description);
}
}
use of org.activiti.engine.impl.interceptor.CommandContext in project Activiti by Activiti.
the class TaskEntity method setAssignee.
public void setAssignee(String assignee, boolean dispatchAssignmentEvent, boolean dispatchUpdateEvent) {
CommandContext commandContext = Context.getCommandContext();
if (assignee == null && this.assignee == null) {
// ACT-1923: even if assignee is unmodified and null, this should be stored in history.
if (commandContext != null) {
commandContext.getHistoryManager().recordTaskAssigneeChange(id, assignee);
}
return;
}
this.assignee = assignee;
// setAssignee outside a service method. E.g. while creating a new task.
if (commandContext != null) {
commandContext.getHistoryManager().recordTaskAssigneeChange(id, assignee);
if (assignee != null && processInstanceId != null) {
getProcessInstance().involveUser(assignee, IdentityLinkType.PARTICIPANT);
}
if (!StringUtils.equals(initialAssignee, assignee)) {
fireEvent(TaskListener.EVENTNAME_ASSIGNMENT);
initialAssignee = assignee;
}
if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
if (dispatchAssignmentEvent) {
commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.TASK_ASSIGNED, this));
}
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 update.
public void update() {
// Needed to make history work: the setter will also update the historic task
setOwner(this.getOwner());
setAssignee(this.getAssignee(), true, false);
setDelegationState(this.getDelegationState());
setName(this.getName());
setDescription(this.getDescription());
setPriority(this.getPriority());
setCategory(this.getCategory());
setCreateTime(this.getCreateTime());
setDueDate(this.getDueDate());
setParentTaskId(this.getParentTaskId());
setFormKey(formKey);
CommandContext commandContext = Context.getCommandContext();
DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
dbSqlSession.update(this);
if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_UPDATED, this));
}
}
Aggregations