本文整理匯總了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";
}