本文整理汇总了Java中org.activiti.engine.task.Task.getTaskDefinitionKey方法的典型用法代码示例。如果您正苦于以下问题:Java Task.getTaskDefinitionKey方法的具体用法?Java Task.getTaskDefinitionKey怎么用?Java Task.getTaskDefinitionKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.task.Task
的用法示例。
在下文中一共展示了Task.getTaskDefinitionKey方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TaskVo
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public TaskVo(Task task) {
this.id = task.getId();
this.name = task.getName();
this.title = task.getDescription();
this.priority = task.getPriority();
this.owner = task.getOwner();
this.assignee = task.getAssignee();
this.processInstanceId = task.getProcessInstanceId();
this.executionId = task.getExecutionId();
this.processDefinitionId = task.getProcessDefinitionId();
this.createTime = task.getCreateTime();
this.taskDefinitionKey = task.getTaskDefinitionKey();
this.dueDate = task.getDueDate();
this.category = task.getCategory();
this.parentTaskId = task.getParentTaskId();
this.tenantId = task.getTenantId();
this.formKey = task.getFormKey();
this.suspended = task.isSuspended();
}
示例2: showTaskView
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
/**
* 任务列表
*
* @param leave
*/
@RequestMapping(value = "task/view/{taskId}")
public ModelAndView showTaskView(@PathVariable("taskId") String taskId) {
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
String processInstanceId = task.getProcessInstanceId();
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
Leave leave = leaveManager.get(new Long(processInstance.getBusinessKey()));
ModelAndView mav = new ModelAndView("/chapter7/leave/task-" + task.getTaskDefinitionKey());
mav.addObject("leave", leave);
mav.addObject("task", task);
return mav;
}
示例3: negotiableCheck
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
/**
* Inline PEP. <br>
* Handles the Negotiable-Checks.<br>
* Creates a request which is then evaluated by the {@link PDPServer}.
*
* @param taskId
* the task to be checked
* @param userId
* the user to be checked
*/
public boolean negotiableCheck(String taskId, String userId) {
// on a returned delegation user is null but needs to be evaluated
if (userId == null) {
userId = "";
}
// get the resource
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
String resource = task.getTaskDefinitionKey();
final String action = "isNegotiable";
AuthoResult resultNegotiableCheck;
try {
// the evaluation call
resultNegotiableCheck = pdpServer.evaluate(new IdInfo(userId),
resource, action, null);
if (resultNegotiableCheck.getDecision().getMessage()
.equals("Permit")) {
return true;
}
if (resultNegotiableCheck.getDecision().getMessage().equals("Deny")) {
return false;
}
} catch (SecurityError e) {
e.printStackTrace();
}
return false;
}
示例4: findTaskForm
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
/**
* 获得任务表单,不包含表单内容.
*/
public FormDTO findTaskForm(String taskId) {
if (taskId == null) {
logger.error("taskId cannot be null");
return null;
}
Task task = processEngine.getTaskService().createTaskQuery()
.taskId(taskId).singleResult();
if (task == null) {
logger.error("cannot find task for {}", taskId);
return null;
}
String processDefinitionId = task.getProcessDefinitionId();
String activityId = task.getTaskDefinitionKey();
FormDTO formDto = new FormDTO();
formDto.setTaskId(taskId);
List<BpmConfOperation> bpmConfOperations = bpmConfOperationManager
.find("from BpmConfOperation where bpmConfNode.bpmConfBase.processDefinitionId=? and bpmConfNode.code=?",
processDefinitionId, activityId);
for (BpmConfOperation bpmConfOperation : bpmConfOperations) {
formDto.getButtons().add(bpmConfOperation.getValue());
}
formDto.setProcessDefinitionId(processDefinitionId);
formDto.setActivityId(activityId);
List<BpmConfForm> bpmConfForms = bpmConfFormManager
.find("from BpmConfForm where bpmConfNode.bpmConfBase.processDefinitionId=? and bpmConfNode.code=?",
processDefinitionId, activityId);
if (!bpmConfForms.isEmpty()) {
BpmConfForm bpmConfForm = bpmConfForms.get(0);
if (!Integer.valueOf(2).equals(bpmConfForm.getStatus())) {
// 外部表单
if (Integer.valueOf(1).equals(bpmConfForm.getType())) {
formDto.setRedirect(true);
formDto.setUrl(bpmConfForm.getValue());
} else {
formDto.setCode(bpmConfForm.getValue());
}
}
}
return formDto;
}
示例5: testHistoricTaskInstance
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
@Deployment
public void testHistoricTaskInstance() throws Exception {
String processInstanceId = runtimeService.startProcessInstanceByKey("HistoricTaskInstanceTest").getId();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
// Set priority to non-default value
Task runtimeTask = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
runtimeTask.setPriority(1234);
// Set due-date
Date dueDate = sdf.parse("01/02/2003 04:05:06");
runtimeTask.setDueDate(dueDate);
taskService.saveTask(runtimeTask);
String taskId = runtimeTask.getId();
String taskDefinitionKey = runtimeTask.getTaskDefinitionKey();
HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult();
assertEquals(taskId, historicTaskInstance.getId());
assertEquals(1234, historicTaskInstance.getPriority());
assertEquals("Clean up", historicTaskInstance.getName());
assertEquals("Schedule an engineering meeting for next week with the new hire.", historicTaskInstance.getDescription());
assertEquals(dueDate, historicTaskInstance.getDueDate());
assertEquals("kermit", historicTaskInstance.getAssignee());
assertEquals(taskDefinitionKey, historicTaskInstance.getTaskDefinitionKey());
assertNull(historicTaskInstance.getEndTime());
assertNull(historicTaskInstance.getDurationInMillis());
runtimeService.setVariable(processInstanceId, "deadline", "yesterday");
taskService.complete(taskId);
assertEquals(1, historyService.createHistoricTaskInstanceQuery().count());
historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult();
assertEquals(taskId, historicTaskInstance.getId());
assertEquals(1234, historicTaskInstance.getPriority());
assertEquals("Clean up", historicTaskInstance.getName());
assertEquals("Schedule an engineering meeting for next week with the new hire.", historicTaskInstance.getDescription());
assertEquals(dueDate, historicTaskInstance.getDueDate());
assertEquals("kermit", historicTaskInstance.getAssignee());
assertEquals(TaskEntity.DELETE_REASON_COMPLETED, historicTaskInstance.getDeleteReason());
assertEquals(taskDefinitionKey, historicTaskInstance.getTaskDefinitionKey());
assertNotNull(historicTaskInstance.getEndTime());
assertNotNull(historicTaskInstance.getDurationInMillis());
historyService.deleteHistoricTaskInstance(taskId);
assertEquals(0, historyService.createHistoricTaskInstanceQuery().count());
}
示例6: readTaskForm
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
/**
* 读取用户任务的表单字段
*/
@RequestMapping(value = "task/getform/{taskId}")
public ModelAndView readTaskForm(@PathVariable("taskId") String taskId) throws Exception {
String viewName = "chapter6/task-form";
ModelAndView mav = new ModelAndView(viewName);
TaskFormData taskFormData = formService.getTaskFormData(taskId);
Task task = null;
// 外置表单
if (taskFormData != null && taskFormData.getFormKey() != null) {
Object renderedTaskForm = formService.getRenderedTaskForm(taskId);
task = taskService.createTaskQuery().taskId(taskId).singleResult();
mav.addObject("taskFormData", renderedTaskForm);
mav.addObject("hasFormKey", true);
} else if (taskFormData != null) { // 动态表单
mav.addObject("taskFormData", taskFormData);
task = taskFormData.getTask();
} else { // 手动创建的任务(包括子任务)
task = taskService.createTaskQuery().taskId(taskId).singleResult();
mav.addObject("manualTask", true);
}
mav.addObject("task", task);
// 读取任务参与人列表
List<IdentityLink> identityLinksForTask = taskService.getIdentityLinksForTask(taskId);
mav.addObject("identityLinksForTask", identityLinksForTask);
// 读取所有人员
List<User> users = identityService.createUserQuery().list();
mav.addObject("users", users);
// 读取所有组
List<Group> groups = identityService.createGroupQuery().list();
mav.addObject("groups", groups);
// 读取子任务
List<HistoricTaskInstance> subTasks = historyService.createHistoricTaskInstanceQuery().taskParentTaskId(taskId).list();
mav.addObject("subTasks", subTasks);
// 读取上级任务
if (task != null && task.getParentTaskId() != null) {
HistoricTaskInstance parentTask = historyService.createHistoricTaskInstanceQuery().taskId(task.getParentTaskId()).singleResult();
mav.addObject("parentTask", parentTask);
}
// 读取附件
List<Attachment> attachments = null;
if (task.getTaskDefinitionKey() != null) {
attachments = taskService.getTaskAttachments(taskId);
} else {
attachments = taskService.getProcessInstanceAttachments(task.getProcessInstanceId());
}
mav.addObject("attachments", attachments);
return mav;
}