本文整理汇总了Java中org.jbpm.taskmgmt.def.Task类的典型用法代码示例。如果您正苦于以下问题:Java Task类的具体用法?Java Task怎么用?Java Task使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Task类属于org.jbpm.taskmgmt.def包,在下文中一共展示了Task类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifySwimlaneAssignments
import org.jbpm.taskmgmt.def.Task; //导入依赖的package包/类
public void verifySwimlaneAssignments() {
TaskMgmtDefinition taskMgmtDefinition = processDefinition.getTaskMgmtDefinition();
if ( (taskMgmtDefinition!=null)
&& (taskMgmtDefinition.getSwimlanes()!=null)
) {
Iterator iter = taskMgmtDefinition.getSwimlanes().values().iterator();
while (iter.hasNext()) {
Swimlane swimlane = (Swimlane) iter.next();
Task startTask = taskMgmtDefinition.getStartTask();
Swimlane startTaskSwimlane = (startTask!=null ? startTask.getSwimlane() : null);
if ( (swimlane.getAssignmentDelegation()==null)
&& (swimlane!=startTaskSwimlane)
) {
addWarning("swimlane '"+swimlane.getName()+"' does not have an assignment");
}
}
}
}
示例2: execute
import org.jbpm.taskmgmt.def.Task; //导入依赖的package包/类
public Object execute(JbpmContext jbpmContext) throws Exception
{
Object object = super.execute(jbpmContext);
if (object instanceof ProcessInstance) {
ProcessInstance processInstance = (ProcessInstance)object;
Task startTask = processInstance.getProcessDefinition().getTaskMgmtDefinition().getStartTask();
if (startTask != null && startTask.getSwimlane() != null) {
SwimlaneInstance si = new SwimlaneInstance(startTask.getSwimlane());
si.setActorId(getActorId());
processInstance.getTaskMgmtInstance().addSwimlaneInstance(si);
}
ExpedientDto expedientIniciant = Jbpm3HeliumBridge.getInstanceService().getExpedientIniciant();
if (expedientIniciant != null)
expedientIniciant.setProcessInstanceId(new Long(processInstance.getId()).toString());
/*if (startTransitionName == null || startTransitionName.length() == 0)
processInstance.signal();
else
processInstance.signal(startTransitionName);*/
}
return object;
}
示例3: getTaskNamesFromDeployedProcessDefinition
import org.jbpm.taskmgmt.def.Task; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<String> getTaskNamesFromDeployedProcessDefinition(JbpmProcessDefinition dpd) {
//adminService.mesuraIniciar("jBPM getTaskNamesFromDeployedProcessDefinition", "jbpmDao");
List<String> taskNames = new ArrayList<String>();
ProcessDefinition pd = dpd.getProcessDefinition();
Map<String,Object> tasks = pd.getTaskMgmtDefinition().getTasks();
if (tasks != null) {
taskNames.addAll(tasks.keySet());
}
// Si la tasca del start-state no té name no surt llistada a pd.getTaskMgmtDefinition().getTasks()
// Però en realitat sí que té name (el del start-state) i s'ha d'agafar de la següent forma:
Task startTask = pd.getTaskMgmtDefinition().getStartTask();
if (startTask != null && !taskNames.contains(startTask.getName())) {
taskNames.add(startTask.getName());
}
//adminService.mesuraCalcular("jBPM getTaskNamesFromDeployedProcessDefinition", "jbpmDao");
return taskNames;
}
示例4: execute
import org.jbpm.taskmgmt.def.Task; //导入依赖的package包/类
public Object execute(JbpmContext jbpmContext) throws Exception {
Object object = super.execute(jbpmContext);
if (object instanceof ProcessInstance) {
ProcessInstance processInstance = (ProcessInstance) object;
Task startTask = processInstance.getProcessDefinition().getTaskMgmtDefinition().getStartTask();
if (startTask != null && startTask.getSwimlane() != null) {
SwimlaneInstance si = new SwimlaneInstance(startTask.getSwimlane());
si.setActorId(getActorId());
processInstance.getTaskMgmtInstance().addSwimlaneInstance(si);
}
ExpedientDto expedientIniciant = Jbpm3HeliumBridge.getInstanceService().getExpedientIniciant();
if (expedientIniciant != null) {
expedientIniciant.setProcessInstanceId(new Long(processInstance.getId()).toString());
// if (expedientIniciant.getTipus().isAmbRetroaccio())
if (expedientIniciant.isAmbRetroaccio())
jbpmContext.addAutoSaveProcessInstance(processInstance);
}
}
return object;
}
示例5: toTaskInfo
import org.jbpm.taskmgmt.def.Task; //导入依赖的package包/类
public static TaskInfo toTaskInfo(Task task) {
if (task == null)
return null;
return new TaskInfo(
task.getId(),
task.getName(),
task.getDescription(),
task.getProcessDefinition(),
task.isBlocking(),
task.isSignalling(),
task.getCondition(),
task.getDueDate(),
task.getPriority(),
task.getTaskNode(),
task.getStartState(),
task.getSwimlane(),
task.getActorIdExpression(),
task.getPooledActorsExpression());
}
示例6: createTaskInstance
import org.jbpm.taskmgmt.def.Task; //导入依赖的package包/类
/**
* creates a new task instance on the given token, for the given task.
*/
public TaskInstance createTaskInstance(Task task, Token token)
{
ExecutionContext executionContext = new ExecutionContext(token);
executionContext.setTask(task);
return createTaskInstance(task, executionContext);
}
示例7: createStartTaskInstance
import org.jbpm.taskmgmt.def.Task; //导入依赖的package包/类
/**
* creates a task instance on the rootToken, and assigns it to the currently authenticated user.
*/
public TaskInstance createStartTaskInstance()
{
TaskInstance taskInstance = null;
Task startTask = taskMgmtDefinition.getStartTask();
if (startTask != null)
{
Token rootToken = processInstance.getRootToken();
ExecutionContext executionContext = new ExecutionContext(rootToken);
taskInstance = createTaskInstance(startTask, executionContext);
taskInstance.setActorId(SecurityHelper.getAuthenticatedActorId());
}
return taskInstance;
}
示例8: setTask
import org.jbpm.taskmgmt.def.Task; //导入依赖的package包/类
public void setTask(Task task) {
this.name = task.getName();
this.description = task.getDescription();
this.task = task;
this.isBlocking = task.isBlocking();
this.priority = task.getPriority();
this.isSignalling = task.isSignalling();
}
示例9: findReferencedTask
import org.jbpm.taskmgmt.def.Task; //导入依赖的package包/类
protected List<Task> findReferencedTask(Long processDefinitionId) {
Query q = session.createQuery(
"from org.jbpm.taskmgmt.def.Task t "
+ "where t.processDefinition.id = :processDefinitionId");
q.setLong("processDefinitionId", processDefinitionId);
return (List<Task>)q.list();
}
示例10: findReferencingStartStates
import org.jbpm.taskmgmt.def.Task; //导入依赖的package包/类
protected List<Task> findReferencingStartStates(Long processDefinitionId) {
Query query = session.createQuery(
" from org.jbpm.taskmgmt.def.Task t "
+ "where t.processDefinition.id = :processDefinitionId "
+ " and t.startState is not null");
query.setLong("processDefinitionId", processDefinitionId);
return (List<Task>)query.list();
}
示例11: readSwimlanes
import org.jbpm.taskmgmt.def.Task; //导入依赖的package包/类
protected void readSwimlanes(Element processDefinitionElement) {
Iterator iter = processDefinitionElement.elementIterator("swimlane");
TaskMgmtDefinition taskMgmtDefinition = processDefinition.getTaskMgmtDefinition();
while (iter.hasNext()) {
Element swimlaneElement = (Element) iter.next();
String swimlaneName = swimlaneElement.attributeValue("name");
if (swimlaneName==null) {
addWarning("there's a swimlane without a name");
} else {
Swimlane swimlane = new Swimlane(swimlaneName);
Element assignmentElement = swimlaneElement.element("assignment");
if (assignmentElement!=null) {
if ( (assignmentElement.attribute("actor-id")!=null)
|| (assignmentElement.attribute("pooled-actors")!=null)
) {
swimlane.setActorIdExpression(assignmentElement.attributeValue("actor-id"));
swimlane.setPooledActorsExpression(assignmentElement.attributeValue("pooled-actors"));
} else {
Delegation assignmentDelegation = readAssignmentDelegation(assignmentElement);
swimlane.setAssignmentDelegation(assignmentDelegation);
}
} else {
Task startTask = taskMgmtDefinition.getStartTask();
if ( (startTask==null)
|| (startTask.getSwimlane()!=swimlane)
) {
addWarning("swimlane '"+swimlaneName+"' does not have an assignment");
}
}
taskMgmtDefinition.addSwimlane(swimlane);
}
}
}
示例12: readStartStateTask
import org.jbpm.taskmgmt.def.Task; //导入依赖的package包/类
public void readStartStateTask(Element startTaskElement, StartState startState) {
TaskMgmtDefinition taskMgmtDefinition = processDefinition.getTaskMgmtDefinition();
Task startTask = readTask(startTaskElement, taskMgmtDefinition, null);
startTask.setStartState(startState);
if (startTask.getName()==null) {
startTask.setName(startState.getName());
}
taskMgmtDefinition.setStartTask(startTask);
}
示例13: readTaskTimers
import org.jbpm.taskmgmt.def.Task; //导入依赖的package包/类
protected void readTaskTimers(Element taskElement, Task task) {
Iterator iter = taskElement.elementIterator();
while (iter.hasNext()) {
Element element = (Element) iter.next();
if ( ("timer".equals(element.getName()))
|| ("reminder".equals(element.getName()))
) {
readTaskTimer(element, task);
}
}
}
示例14: adjustTaskInstancesForToken
import org.jbpm.taskmgmt.def.Task; //导入依赖的package包/类
private void adjustTaskInstancesForToken(Token token) {
ProcessDefinition newDef = getNewProcessDefinition(token);
Iterator<TaskInstance> iter = getTasksForToken(token).iterator();
while (iter.hasNext()) {
TaskInstance ti = iter.next();
// find new task
Task oldTask = ti.getTask();
Node oldNode = oldTask.getTaskNode();
Task newTask = findReplacementTask(newDef, oldNode, oldTask);
ti.setTask(newTask);
// Canviam el TaskMngmtInstance per a associar-lo a la nova definició de procés
ti.getTaskMgmtInstance().setTaskMgmtDefinition(newDef.getTaskMgmtDefinition());
log.debug("change dependent task-instance with id " + oldTask.getId());
// // Canviam el processDefinition dels tasksMgmtInstance dels tasksInstance de la versió que s'intenta esborrar a la de la tasca.
// TaskMgmtDefinition tmd = ti.getTaskMgmtInstance().getTaskMgmtDefinition();
// tmd.setProcessDefinition(newDef);
// if (tmd.getStartTask() != null) {
// tmd.setStartTask(newDef.getTaskMgmtDefinition().getStartTask());
// }
// getJbpmContext().getSession().save(tmd);
}
}
示例15: findReplacementTask
import org.jbpm.taskmgmt.def.Task; //导入依赖的package包/类
private Task findReplacementTask(ProcessDefinition newDef, Node oldNode, Task oldTask) {
String replacementTaskName = getReplacementTaskName(oldTask);
Node newTaskNode = findReplacementNode(newDef, oldNode);
Query q = getJbpmContext().getSession().getNamedQuery("TaskMgmtSession.findTaskForNode");
q.setString("taskName", replacementTaskName);
q.setLong("taskNodeId", newTaskNode.getId());
Task newTask = (Task) q.uniqueResult();
if (newTask == null) {
throw new JbpmException("Task '" + replacementTaskName + "' for node '" + newTaskNode.getName()
+ "' not found in new process definition");
}
return newTask;
}