本文整理汇总了Java中org.activiti.engine.runtime.ProcessInstance.getBusinessKey方法的典型用法代码示例。如果您正苦于以下问题:Java ProcessInstance.getBusinessKey方法的具体用法?Java ProcessInstance.getBusinessKey怎么用?Java ProcessInstance.getBusinessKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.runtime.ProcessInstance
的用法示例。
在下文中一共展示了ProcessInstance.getBusinessKey方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findTodoTasks
import org.activiti.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
/**
* 查询待办任务
* @param userId 用户ID
* @return
*/
public List<Leave> findTodoTasks(String userId) {
List<Leave> results = new ArrayList<Leave>();
List<Task> tasks = new ArrayList<Task>();
// 根据当前人的ID查询
List<Task> todoList = taskService.createTaskQuery().processDefinitionKey(ActUtils.PD_LEAVE[0]).taskAssignee(userId).active().orderByTaskPriority().desc().orderByTaskCreateTime().desc().list();
// 根据当前人未签收的任务
List<Task> unsignedTasks = taskService.createTaskQuery().processDefinitionKey(ActUtils.PD_LEAVE[0]).taskCandidateUser(userId).active().orderByTaskPriority().desc().orderByTaskCreateTime().desc().list();
// 合并
tasks.addAll(todoList);
tasks.addAll(unsignedTasks);
// 根据流程的业务ID查询实体并关联
for (Task task : tasks) {
String processInstanceId = task.getProcessInstanceId();
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).active().singleResult();
String businessKey = processInstance.getBusinessKey();
Leave leave = leaveDao.get(businessKey);
leave.setTask(task);
leave.setProcessInstance(processInstance);
leave.setProcessDefinition(repositoryService.createProcessDefinitionQuery().processDefinitionId((processInstance.getProcessDefinitionId())).singleResult());
results.add(leave);
}
return results;
}
示例2: setProcIns
import org.activiti.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
public void setProcIns(ProcessInstance procIns) {
this.procIns = procIns;
if (procIns != null && procIns.getBusinessKey() != null){
String[] ss = procIns.getBusinessKey().split(":");
setBusinessTable(ss[0]);
setBusinessId(ss[1]);
}
}
示例3: notify
import org.activiti.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
public void notify(DelegateTask delegateTask) {
String processInstanceId = delegateTask.getProcessInstanceId();
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
Leave leave = new Leave(processInstance.getBusinessKey());
leave.setLeaveType((String) delegateTask.getVariable("leaveType"));
leave.setStartTime((Date) delegateTask.getVariable("startTime"));
leave.setEndTime((Date) delegateTask.getVariable("endTime"));
leave.setReason((String) delegateTask.getVariable("reason"));
leave.preUpdate();
leaveDao.update(leave);
}
示例4: notify
import org.activiti.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
/**
* 销假完成后执行,保存实际开始和结束时间
*/
public void notify(DelegateTask delegateTask) {
String processInstanceId = delegateTask.getProcessInstanceId();
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
Leave leave = new Leave(processInstance.getBusinessKey());
leave.setRealityStartTime((Date) delegateTask.getVariable("realityStartTime"));
leave.setRealityEndTime((Date) delegateTask.getVariable("realityEndTime"));
leave.preUpdate();
leaveDao.updateRealityTime(leave);
}
示例5: dealTask
import org.activiti.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
/**
* 办理任务 TODO 考虑撤回
*/
@RequestMapping(value = "/task/deal/{taskId}", method = RequestMethod.GET)
public String dealTask(@PathVariable("taskId") String taskId, HttpServletRequest request) {
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
//流程实例ID
request.setAttribute("processInstanceId", task.getProcessInstanceId());
//流程内置表单变量,因为这种方式,在页面展示困难,所以这里只存储相关变量
//页面展示的内容从formKey中.form获取,以减少流程模型的配置工作量
List<FormProperty> formProperties = formService.getTaskFormData(task.getId()).getFormProperties();
request.setAttribute("formProperties", formProperties);
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(task
.getProcessInstanceId()).singleResult();
String businessKey = processInstance.getBusinessKey();
String formUrl = null;
//获取业务url,外嵌表单展示,注入业务url 可通过local_form_url 设置,也可设置在formKey中
for (FormProperty formProperty : formProperties) {
if (formProperty.getId().equals(Constants.VAR_FORM_URL)) {
formUrl = formProperty.getValue();
if (!StrUtil.isEmpty(formUrl)) {
if (!formUrl.endsWith(businessKey)) {
formUrl = formUrl + businessKey;
}
}
}
}
String formKey = formService.getTaskFormKey(task.getProcessDefinitionId(), task.getTaskDefinitionKey());
if (StrUtil.isEmpty(formUrl) && !StrUtil.isEmpty(formKey) && !formKey.endsWith(".form")) {
formUrl = formKey;
if (!formUrl.endsWith(businessKey)) {
formUrl = formUrl + businessKey;
}
}
if (!StrUtil.isEmpty(formUrl)) {
request.setAttribute("formUrl", formUrl);
}
request.setAttribute("formName", processInstance.getName());
//通过formKey获取通用审批字段(审批结果、审批意见) 适用于通用审批表单
if (!StrUtil.isEmpty(formKey) && formKey.endsWith(".form")) {
Object formData = formService.getRenderedTaskForm(task.getId());
if (formData != null) {
request.setAttribute("formData", formData);
}
}
request.setAttribute("taskId", taskId);
return "activiti/task_todo";
}