本文整理汇总了Java中org.jbpm.api.task.Task类的典型用法代码示例。如果您正苦于以下问题:Java Task类的具体用法?Java Task怎么用?Java Task使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Task类属于org.jbpm.api.task包,在下文中一共展示了Task类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadJumpTaskNodes
import org.jbpm.api.task.Task; //导入依赖的package包/类
@DataProvider
public Collection<Map<String,Object>> loadJumpTaskNodes(String taskId){
List<Map<String,Object>> list=new ArrayList<Map<String,Object>>();
Task task=bpmService.findTaskById(taskId);
if(task==null){
return list;
}
String processDefinitionId=bpmService.findExecutionById(task.getExecutionId()).getProcessDefinitionId();
ProcessDefinitionImpl pd = (ProcessDefinitionImpl) bpmService.findProcessDefinitionById(processDefinitionId);
List<? extends Activity> activityList = pd.getActivities();
for (Activity ac : activityList) {
String type=ac.getType();
String name=ac.getName();
if (!name.equals(task.getActivityName()) && (type.equals("task"))) {
Map<String,Object> map=new HashMap<String,Object>();
map.put("name",name);
list.add(map);
}
}
return list;
}
示例2: onInit
import org.jbpm.api.task.Task; //导入依赖的package包/类
@Override
public void onInit(View view) throws Exception {
String taskId=ContextHolder.getRequest().getParameter("taskId");
if(StringUtils.isEmpty(taskId)){
return;
}
Task task=bpmService.getTaskService().getTask(taskId);
if(task==null)return;
String taskName=task.getName();
String processDefinitionId=bpmService.getExecutionService().findExecutionById(task.getExecutionId()).getProcessDefinitionId();
Collection<ComponentControl> componentControls=componentControlService.getComponentControls(processDefinitionId,taskName);
if(componentControls.size()==0)return;
for(ViewElement ve:view.getInnerElements()){
if(ve==null || !(ve instanceof Component)){
continue;
}
Component component=(Component)ve;
this.filterComponent(component, componentControls);
}
}
示例3: createTaskReminder
import org.jbpm.api.task.Task; //导入依赖的package包/类
public void createTaskReminder(Task task, String cronExpression, String messageTemplateId, String taskReminderId) {
Session session = this.getSessionFactory().openSession();
try {
ReminderJob job = new ReminderJob();
job.setId(UUID.randomUUID().toString());
job.setCronExpression(cronExpression);
job.setExecutionId(task.getExecutionId());
job.setTaskId(task.getId());
job.setState(ReminderJobState.running);
job.setMessageTemplateId(messageTemplateId);
job.setTaskName(task.getName());
job.setTaskReminderId(taskReminderId);
session.save(job);
} finally {
session.flush();
session.close();
}
}
示例4: retrieveTask
import org.jbpm.api.task.Task; //导入依赖的package包/类
public void retrieveTask(String executionId) {
List<Task> list = getTaskService().createTaskQuery().processInstanceId(executionId).list();
if (list.size() > 0) {
HistoryTaskInstanceImpl hisTask = this.findLastHistoryActiviyInstance(executionId);
if (hisTask == null) {
this.invaildProcess(list.get(0).getId());
} else {
Map<String, Object> variables = new HashMap<String, Object>();
HashSet<String> userSet = new HashSet<String>();
userSet.add(hisTask.getHistoryTask().getAssignee());
Execution execution = this.findExecutionById(list.get(0).getExecutionId());
String transitionName = this.findTransitionNameFromSourceToDest(hisTask.getActivityName(), list.get(0), execution);
this.completeTask(list.get(0), transitionName, variables);
}
}
}
示例5: invaildProcess
import org.jbpm.api.task.Task; //导入依赖的package包/类
public void invaildProcess(String taskId) {
Map<String, Object> variables = new HashMap<String, Object>();
Task task = this.findTaskById(taskId);
Execution execution = this.findExecutionById(task.getExecutionId());
ProcessDefinitionImpl pd = (ProcessDefinitionImpl) this.getRepositoryService().createProcessDefinitionQuery().processDefinitionId(execution.getProcessDefinitionId()).uniqueResult();
List<?> activities = pd.getActivities();
ActivityImpl ac = null;
for (int i = 0; i < activities.size(); i++) {
ac = (ActivityImpl) activities.get(i);
if (ac.getType().equals("end")) {
break;
}
}
String transitionName = this.findTransitionNameFromSourceToDest(ac.getName(), task, execution);
this.completeTask(task, transitionName, variables);
}
示例6: buildTodoTask
import org.jbpm.api.task.Task; //导入依赖的package包/类
private TodoTask buildTodoTask(Task t, String owner, TodoTaskType type) {
TodoTask todo = new TodoTask();
todo.setId(t.getId());
todo.setName(t.getName());
todo.setPrincipal(owner);
todo.setType(type);
todo.setCreateDate(t.getCreateTime());
todo.setExecutionId(t.getExecutionId());
todo.setDesc(t.getDescription());
todo.setTask(t);
todo.setBusinessId((String)executionService.getVariable(t.getExecutionId(), BUSINESS_ID));
String processDefinitionId = executionService.findExecutionById(t.getExecutionId()).getProcessDefinitionId();
String taskName = t.getName();
String hql = "from " + TaskConfig.class.getName() + " where processDefinitionId=:processDefinitionId and taskName=:taskName";
Map<String, Object> map = new HashMap<String, Object>();
map.put("processDefinitionId", processDefinitionId);
map.put("taskName", taskName);
List<TaskConfig> configs = this.query(hql, map);
if (configs.size() > 0) {
todo.setUrl(configs.get(0).getUrl());
}
return todo;
}
示例7: cascadeExecutionSuspend
import org.jbpm.api.task.Task; //导入依赖的package包/类
public void cascadeExecutionSuspend(ExecutionImpl execution) {
// cascade suspend to jobs
Query query = session.createQuery("select job " + "from " + JobImpl.class.getName() + " as job "
+ "where job.execution = :execution " + " and job.state != '" + JobImpl.STATE_SUSPENDED + "' ");
query.setEntity("execution", execution);
query.setLockMode("job", LockMode.NONE);
List<JobImpl> jobs = query.list();
for (JobImpl job : jobs) {
job.suspend();
}
// cascade suspend to tasks
query = session.createQuery("select task " + "from " + TaskImpl.class.getName() + " as task "
+ "where task.execution = :execution " + " and task.state != '" + Task.STATE_SUSPENDED + "' ");
query.setEntity("execution", execution);
query.setLockMode("task", LockMode.NONE);
List<TaskImpl> tasks = query.list();
for (TaskImpl task : tasks) {
task.suspend();
}
}
示例8: cascadeExecutionResume
import org.jbpm.api.task.Task; //导入依赖的package包/类
public void cascadeExecutionResume(ExecutionImpl execution) {
// cascade suspend to jobs
Query query = session.createQuery("select job " + "from " + JobImpl.class.getName() + " as job "
+ "where job.execution = :execution " + " and job.state = '" + Task.STATE_SUSPENDED + "' ");
query.setEntity("execution", execution);
query.setLockMode("job", LockMode.NONE);
List<JobImpl> jobs = query.list();
for (JobImpl job : jobs) {
job.resume();
}
// cascade suspend to tasks
query = session.createQuery("select task " + "from " + TaskImpl.class.getName() + " as task "
+ "where task.execution = :execution " + " and task.state = '" + Task.STATE_SUSPENDED + "' ");
query.setEntity("execution", execution);
query.setLockMode("task", LockMode.NONE);
List<TaskImpl> tasks = query.list();
for (TaskImpl task : tasks) {
task.resume();
}
}
示例9: showPersonDesk
import org.jbpm.api.task.Task; //导入依赖的package包/类
/**
* 获得个人工作台
* @return
*/
public String showPersonDesk(){
//发布的流程定义列表
List<ProcessDefinition> definitionList=jbpmService.findProcessDefinitionList();
//流程实例列表
List<ProcessInstance> instanceList=jbpmService.findProcessInstanceList();
//获得用户待办任务
List<Task> taskList=null;
String userName = getSessionUser();
taskList=jbpmService.findPersonTasktoList(userName);
request.put("userHelperBean", userHelperBean);
request.put("dList", definitionList);
request.put("iList", instanceList);
request.put("tList", taskList);
return "personIndex";
}
示例10: viewPersonTask
import org.jbpm.api.task.Task; //导入依赖的package包/类
/**
* 显示任务详细
* @return
*/
public String viewPersonTask(){
String taskId=userHelperBean.getTaskId();
Task task=jbpmService.findTaskById(taskId);
String activityName=task.getActivityName();
if(activityName.equals(CONSTANT.ACTIVITYNAMEJL) || activityName.equals(CONSTANT.ACTIVITYNAMEBOSS)){
Map map=jbpmService.getVariablestoMap(taskId);
request.put("userMap", map);
}
request.put("taskId", taskId);
request.put("activityName", activityName);
return "viewTask";
}
示例11: processPersonTaskModify
import org.jbpm.api.task.Task; //导入依赖的package包/类
/**
* 经办人修改过后提交
* @return
*/
public String processPersonTaskModify(){
String taskId=userHelperBean.getTaskId();
//得到此任务
Task task=jbpmService.findTaskById(taskId);
//获取流程变量
Map map=jbpmService.getVariablesByTaskIdtoMap(taskId, jbpmService.getVariablesByTaskIdtoSet(taskId));
//修改流程天数
map.put("day", userHelperBean.getDay());
userHelperBean.setLeaveId((String)map.get("LID"));
//userHelperBean.setExecutionId(task.getExecutionId());
//修改请假条数据
//jbpmService.updateViewPersonTask(userHelperBean);
jbpmService.updateViewPersonTaskbyId(userHelperBean);
//完成任务
jbpmService.processTask(taskId, CONSTANT.OUTCOMETJ,map);
return "backPersonIndex";
}
示例12: onInit
import org.jbpm.api.task.Task; //导入依赖的package包/类
@Override
public void onInit(Component component) throws Exception {
String executionId = DoradoContext.getAttachedRequest().getParameter("executionId");
String taskId = DoradoContext.getAttachedRequest().getParameter("taskId");
if (executionId != null && taskId != null) {
Task task = bpmService.findTaskById(taskId);
if (task != null) {
Execution execution = bpmService.findExecutionByTaskId(taskId);
String taskName = task.getActivityName();
String processDefinitionId = execution.getProcessDefinitionId();
componentFilter.filter(processDefinitionId, taskName, component, null);
}
}
}
示例13: findTaskByExecutionId
import org.jbpm.api.task.Task; //导入依赖的package包/类
@DataProvider
public Collection<Task> findTaskByExecutionId(String executionId) throws Exception {
List<Task> list =bpmService.getTaskService().createTaskQuery()
.processInstanceId(executionId)
.list();
return list;
}
示例14: findAllTaskActivitys
import org.jbpm.api.task.Task; //导入依赖的package包/类
@DataProvider
public Collection<? extends Activity> findAllTaskActivitys(String taskId,
String processDefinitionId) {
Task task = bpmService.findTaskById(taskId);
ProcessDefinitionImpl pd = (ProcessDefinitionImpl) bpmService.findProcessDefinitionById(processDefinitionId);
List<? extends Activity> activityList = pd.getActivities();
List<Activity> result = new ArrayList<Activity>();
for (Activity ac : activityList) {
if (!ac.getName().equals(task.getActivityName())
&& (ac.getType().equals("task") || ac.getType().equals("end"))) {
result.add(ac);
}
}
return result;
}
示例15: findOutgoings
import org.jbpm.api.task.Task; //导入依赖的package包/类
@DataProvider
public Collection<Map<String, String>> findOutgoings(String taskId)
throws Exception {
Task task =bpmService.findTaskById(taskId);
String executionId = task.getExecutionId();
Execution execution = bpmService.findExecutionById(executionId);
if (execution.findActiveActivityNames().size() > 0) {
String activityName = execution.findActiveActivityNames().iterator().next();
return this.findActivityInstance(activityName, execution.getProcessDefinitionId());
}
return null;
}