本文整理汇总了Java中org.jbpm.graph.exe.ExecutionContext.setTaskInstance方法的典型用法代码示例。如果您正苦于以下问题:Java ExecutionContext.setTaskInstance方法的具体用法?Java ExecutionContext.setTaskInstance怎么用?Java ExecutionContext.setTaskInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jbpm.graph.exe.ExecutionContext
的用法示例。
在下文中一共展示了ExecutionContext.setTaskInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import org.jbpm.graph.exe.ExecutionContext; //导入方法依赖的package包/类
public void create(ExecutionContext executionContext) {
if (create != null) {
throw new IllegalStateException("task instance '" + id
+ "' was already created");
}
create = Clock.getCurrentTime();
// if this task instance is associated with a task...
if ((task != null) && (executionContext != null)) {
// the TASK_CREATE event is fired
executionContext.setTaskInstance(this);
executionContext.setTask(task);
task.fireEvent(Event.EVENTTYPE_TASK_CREATE, executionContext);
Jbpm3HeliumBridge.getInstanceService().createDadesTasca(id);
}
// WARNING: The events create and assign are fired in the right order,
// but
// the logs are still not ordered properly.
// See also: TaskMgmtInstance.createTaskInstance
}
示例2: execute
import org.jbpm.graph.exe.ExecutionContext; //导入方法依赖的package包/类
public Object execute(JbpmContext jbpmContext) throws Exception {
Action action = null;
TaskInstance ti = null;
ProcessInstance pi = null;
if (isTaskInstance) {
ti = jbpmContext.getTaskInstance(id);
action = ti.getTaskMgmtInstance().getProcessInstance().getProcessDefinition().getAction(actionName);
} else {
pi = jbpmContext.getProcessInstance(id);
action = pi.getProcessDefinition().getAction(actionName);
}
if (!goBack) {
if (isTaskInstance) {
ExecutionContext ec = new ExecutionContext(ti.getToken());
ec.setTaskInstance(ti);
ti.getTask().executeAction(action, ec);
} else {
pi.getProcessDefinition().executeAction(
action,
new ExecutionContext(pi.getRootToken()));
}
} else {
executeGoBack(action, new ExecutionContext(pi.getRootToken()));
}
return null;
}
示例3: execute
import org.jbpm.graph.exe.ExecutionContext; //导入方法依赖的package包/类
public Object execute(JbpmContext jbpmContext) throws Exception {
ProcessInstance pi = jbpmContext.getProcessInstance(pid);
ExecutionContext ec = new ExecutionContext(pi.getRootToken());
if (tid != -1)
ec.setTaskInstance(jbpmContext.getTaskInstance(tid));
if (valors == null || valors.size() == 0) {
return JbpmExpressionEvaluator.evaluate(
expression,
ec);
} else {
return JbpmExpressionEvaluator.evaluate(
expression,
ec,
new HeliumVariableResolver(valors),
JbpmExpressionEvaluator.getUsedFunctionMapper());
}
}
示例4: setActorId
import org.jbpm.graph.exe.ExecutionContext; //导入方法依赖的package包/类
/**
* (re)assign this task to the given actor.
*
* @param actorId
* is reference to the person that is assigned to this task.
* @param overwriteSwimlane
* specifies if the related swimlane should be overwritten with
* the given swimlaneActorId.
* @param ignorarReassignacio
* indica si hem d'ignorar la reassignació entre usuaris
*/
public void setActorId(String actorId, boolean overwriteSwimlane, boolean ignorarReassignacio) {
// do the actual assignment
this.previousActorId = this.actorId;
this.actorId = actorId;
String actor = actorId;
if (!ignorarReassignacio) {
ReassignacioDto reassignacio = Jbpm3HeliumBridge.getInstanceService().findReassignacioActivaPerUsuariOrigen(actor);
if (reassignacio != null) {
actor = reassignacio.getUsuariDesti();
this.actorId = actor;
}
}
if ((swimlaneInstance != null) && (overwriteSwimlane)) {
log.debug("assigning task '" + name + "' to '" + actor + "'");
swimlaneInstance.setActorId(actor);
}
// fire the event
if ((task != null) && (token != null)) {
ExecutionContext executionContext = new ExecutionContext(token);
executionContext.setTask(task);
executionContext.setTaskInstance(this);
// WARNING: The events create and assign are fired in the right
// order, but
// the logs are still not ordered properly.
// See also: TaskMgmtInstance.createTaskInstance
task.fireEvent(Event.EVENTTYPE_TASK_ASSIGN, executionContext);
}
// add the log
if (token != null) {
// log this assignment
token.addLog(new TaskAssignLog(this, previousActorId, actor));
}
}
示例5: start
import org.jbpm.graph.exe.ExecutionContext; //导入方法依赖的package包/类
/**
* can optionally be used to indicate that the actor is starting to work on
* this task instance.
*/
public void start() {
if (start != null) {
throw new IllegalStateException("task instance '" + id
+ "' is already started");
}
start = Clock.getCurrentTime();
if ((task != null) && (token != null)) {
ExecutionContext executionContext = new ExecutionContext(token);
executionContext.setTask(task);
executionContext.setTaskInstance(this);
task.fireEvent(Event.EVENTTYPE_TASK_START, executionContext);
}
}
示例6: end
import org.jbpm.graph.exe.ExecutionContext; //导入方法依赖的package包/类
/**
* marks this task as done and specifies a transition leaving the task-node
* for the case that the completion of this task instances triggers a signal
* on the token. If this task leads to a signal on the token, the given
* transition name will be used in the signal. If this task completion does
* not trigger execution to move on, the transition is ignored.
*/
public void end(Transition transition) {
if (this.end != null) {
throw new IllegalStateException("task instance '" + id
+ "' is already ended");
}
if (this.isSuspended) {
throw new JbpmException("task instance '" + id + "' is suspended");
}
// mark the end of this task instance
this.end = Clock.getCurrentTime();
this.isOpen = false;
// fire the task instance end event
if ((task != null) && (token != null)) {
ExecutionContext executionContext = new ExecutionContext(token);
executionContext.setTask(task);
executionContext.setTaskInstance(this);
task.fireEvent(Event.EVENTTYPE_TASK_END, executionContext);
}
// log this assignment
if (token != null) {
token.addLog(new TaskEndLog(this));
}
// submit the variables
submitVariables();
// verify if the end of this task triggers continuation of execution
if (isSignalling) {
this.isSignalling = false;
if (this.isStartTaskInstance() // ending start tasks always leads to
// a signal
|| ((task != null) && (token != null)
&& (task.getTaskNode() != null) && (task
.getTaskNode().completionTriggersSignal(this)))) {
if (transition == null) {
log.debug("completion of task '" + task.getName()
+ "' results in taking the default transition");
token.signal();
} else {
log.debug("completion of task '" + task.getName()
+ "' results in taking transition '" + transition
+ "'");
token.signal(transition);
}
}
}
try {
Jbpm3HeliumBridge.getInstanceService().alertaEsborrarAmbTaskInstanceId(this.getId());
} catch (NoTrobatException ex) {
log.error("No s'ha trobat la taskInstance (id=" + this.getId() + ")", ex);
}
}