本文整理了Java中org.activiti.engine.task.Task
类的一些代码示例,展示了Task
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task
类的具体详情如下:
包路径:org.activiti.engine.task.Task
类名称:Task
[英]Represents one task for a human user.
[中]表示人工用户的一个任务。
代码示例来源:origin: Activiti/Activiti
public Task from(org.activiti.engine.task.Task internalTask,
Task.TaskStatus status) {
TaskImpl task = new TaskImpl(internalTask.getId(),
internalTask.getName(),
status);
task.setProcessDefinitionId(internalTask.getProcessDefinitionId());
task.setProcessInstanceId(internalTask.getProcessInstanceId());
task.setAssignee(internalTask.getAssignee());
task.setClaimedDate(internalTask.getClaimTime());
task.setCreatedDate(internalTask.getCreateTime());
task.setDueDate(internalTask.getDueDate());
task.setDescription(internalTask.getDescription());
task.setOwner(internalTask.getOwner());
task.setParentTaskId(internalTask.getParentTaskId());
task.setPriority(internalTask.getPriority());
task.setFormKey(internalTask.getFormKey());
return task;
}
代码示例来源:origin: hs-web/hsweb-framework
target.put("taskId", t.getId());
target.put("taskName", t.getName());
target.put("activityId", t.getTaskDefinitionKey());
targetTask.add(target);
});
.processInstanceId(task.getProcessInstanceId())
.singleResult();
.processDefineId(processInstance.getProcessDefinitionId())
.processInstanceId(processInstance.getProcessInstanceId())
.taskId(task.getId())
.taskDefineKey(task.getTaskDefinitionKey())
.taskName(task.getName())
.data(data)
.build();
代码示例来源:origin: Activiti/Activiti
processDefinitionId = task.getProcessDefinitionId();
processInstanceId = task.getProcessInstanceId();
executionId = task.getExecutionId();
代码示例来源:origin: hs-web/hsweb-framework
protected void acceptTaskFormData(Task task,
Map<String, Object> formData) {
formData.put("processTaskId", task.getId());
formData.put("processTaskDefineKey", task.getTaskDefinitionKey());
formData.put("processTaskName", task.getName());
}
代码示例来源:origin: Activiti/Activiti
private int updateName(UpdateTaskPayload updateTaskPayload,
org.activiti.engine.task.Task internalTask,
int updates) {
String newValue;
if ((newValue = updateTaskPayload.getName()) != null) {
String oldValue = internalTask.getName();
if (!Objects.equals(oldValue, newValue)) {
updates++;
internalTask.setName(newValue);
}
}
return updates;
}
代码示例来源:origin: Activiti/Activiti
private Task.TaskStatus calculateStatus(org.activiti.engine.task.Task source) {
if (source instanceof TaskEntity &&
(((TaskEntity) source).isDeleted() || ((TaskEntity) source).isCanceled())) {
return Task.TaskStatus.CANCELLED;
} else if (source.isSuspended()) {
return Task.TaskStatus.SUSPENDED;
} else if (source.getAssignee() != null && !source.getAssignee().isEmpty()) {
return Task.TaskStatus.ASSIGNED;
}
return Task.TaskStatus.CREATED;
}
}
代码示例来源:origin: org.activiti/activiti-rest
public TaskResponse(Task task) {
setId(task.getId());
setOwner(task.getOwner());
setAssignee(task.getAssignee());
setDelegationState(getDelegationStateString(task.getDelegationState()));
setName(task.getName());
setDescription(task.getDescription());
setCreateTime(task.getCreateTime());
setDueDate(task.getDueDate());
setPriority(task.getPriority());
setSuspended(task.isSuspended());
setTaskDefinitionKey(task.getTaskDefinitionKey());
setParentTaskId(task.getParentTaskId());
setExecutionId(task.getExecutionId());
setCategory(task.getCategory());
setProcessInstanceId(task.getProcessInstanceId());
setProcessDefinitionId(task.getProcessDefinitionId());
setTenantId(task.getTenantId());
setFormKey(task.getFormKey());
}
代码示例来源:origin: lcw2004/one
private TaskInfoBean transToTaskInfoBean(Task task) {
TaskInfoBean taskInfoBean = new TaskInfoBean();
taskInfoBean.setTaskDefinitionKey(task.getTaskDefinitionKey());
taskInfoBean.setFormKey(task.getFormKey());
taskInfoBean.setProcessDefinitionId(task.getProcessDefinitionId());
taskInfoBean.setProcessInstanceId(task.getProcessInstanceId());
taskInfoBean.setTaskName(task.getName());
taskInfoBean.setTaskId(task.getId());
taskInfoBean.setAssigneeId(task.getAssignee());
taskInfoBean.setTaskCreateTime(task.getCreateTime());
taskInfoBean.setTaskOwner(task.getOwner());
taskInfoBean.setIsSuspended(task.isSuspended());
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult();
taskInfoBean.setItemsName(processDefinition.getName());
Map<String, Object> variables = runtimeService.getVariables(task.getProcessInstanceId());
Map<String, Object> variablesLocal = taskService.getVariablesLocal(task.getId());
variables.putAll(variablesLocal);
taskInfoBean.setVariables(variables);
return taskInfoBean;
}
代码示例来源:origin: Evolveum/midpoint
TaskExtract(Task task, Map<String, Object> processVariables, List<IdentityLink> taskIdentityLinks) {
id = task.getId();
assignee = task.getAssignee();
name = task.getName();
processInstanceId = task.getProcessInstanceId();
createTime = task.getCreateTime();
dueDate = task.getDueDate();
owner = task.getOwner();
executionId = task.getExecutionId();
variables = new HashMap<>();
if (task.getProcessVariables() != null) {
variables.putAll(task.getProcessVariables());
}
if (task.getTaskLocalVariables() != null) {
variables.putAll(task.getTaskLocalVariables());
}
candidateUsers = new ArrayList<>();
candidateGroups = new ArrayList<>();
for (IdentityLink link : taskIdentityLinks) {
if (IdentityLinkType.CANDIDATE.equals(link.getType())) {
if (link.getUserId() != null) {
candidateUsers.add(link.getUserId());
} else if (link.getGroupId() != null) {
candidateGroups.add(link.getGroupId());
}
}
}
addProcessVariables(processVariables);
this.taskIdentityLinks = taskIdentityLinks;
}
代码示例来源:origin: Activiti/Activiti
@Override
public void deleteCandidateGroups(CandidateGroupsPayload candidateGroupsPayload) {
org.activiti.engine.task.Task internalTask;
try {
internalTask = taskRuntimeHelper.getInternalTaskWithChecks(candidateGroupsPayload.getTaskId());
} catch (IllegalStateException ex) {
throw new IllegalStateException("The authenticated user cannot update the task" + candidateGroupsPayload.getTaskId() + " due it is not the current assignee");
}
String authenticatedUserId = securityManager.getAuthenticatedUserId();
// validate that you are trying to add CandidateGroups to the task where you are the assignee
if (!Objects.equals(internalTask.getAssignee(), authenticatedUserId)) {
throw new IllegalStateException("You cannot update a task where you are not the assignee");
}
if (candidateGroupsPayload.getCandidateGroups() != null && !candidateGroupsPayload.getCandidateGroups().isEmpty()) {
for (String g : candidateGroupsPayload.getCandidateGroups()) {
taskService.deleteCandidateGroup(internalTask.getId(),
g);
}
}
}
代码示例来源:origin: org.alfresco/alfresco-repository
Map<String, Object> variables = taskService.getVariables(task.getId());
Map<String, Object> localVariables = taskService.getVariablesLocal(task.getId());
properties.put(WorkflowModel.PROP_TASK_ID, task.getId());
properties.put(WorkflowModel.PROP_DESCRIPTION, task.getDescription());
properties.put(WorkflowModel.PROP_START_DATE, task.getCreateTime());
properties.put(WorkflowModel.PROP_DUE_DATE, task.getDueDate());
properties.put(WorkflowModel.PROP_PRIORITY, task.getPriority());
properties.put(ContentModel.PROP_CREATED, task.getCreateTime());
properties.put(ContentModel.PROP_OWNER, task.getAssignee());
List<IdentityLink> links = taskService.getIdentityLinksForTask(task.getId());
mapPooledActors(links, properties);
代码示例来源:origin: org.activiti/activiti-rest
protected boolean hasVariableOnScope(Task task, String variableName, RestVariableScope scope) {
boolean variableFound = false;
if (scope == RestVariableScope.GLOBAL) {
if (task.getExecutionId() != null && runtimeService.hasVariable(task.getExecutionId(), variableName)) {
variableFound = true;
}
} else if (scope == RestVariableScope.LOCAL) {
if (taskService.hasVariableLocal(task.getId(), variableName)) {
variableFound = true;
}
}
return variableFound;
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
public void setCandidate(String doingUserId, Task task) {
if (task == null) {
return;
}
if (task.getTaskDefinitionKey() != null) {
//从配置中获取候选人
List<CandidateInfo> candidateInfoList = processConfigurationService
.getActivityConfiguration(doingUserId, task.getProcessDefinitionId(), task.getTaskDefinitionKey())
.getCandidateInfo(task);
if (CollectionUtils.isEmpty(candidateInfoList)) {
logger.warn("任务:{}未能设置候选人,此任务可能无法办理!", task);
} else {
for (CandidateInfo candidateInfo : candidateInfoList) {
Authentication user = candidateInfo.user();
if (user != null) {
taskService.addCandidateUser(task.getId(), user.getUser().getId());
}
}
}
} else {
logger.warn("未能成功设置环节候选人,task:{}", task);
}
}
代码示例来源:origin: hs-web/hsweb-framework
.getDeployedProcessDefinition(task.getProcessDefinitionId());
String sourceId = task.getTaskDefinitionKey();
.processInstanceId(task.getProcessInstanceId())
.activityId(pvmTransition.getId())
.list();
taskServiceImpl.getCommandExecutor().execute(new JumpTaskCmd(task.getExecutionId(), activityId));
selectNowTask(task.getProcessInstanceId())
.forEach(t -> {
setCandidate(task.getAssignee(), t);
newTaskConsumer.accept(t);
});
代码示例来源:origin: org.aperteworkflow/activiti-context
private MutableBpmTask collectTask(Task task, ProcessInstance pi, ProcessToolContext ctx) {
MutableBpmTask t = new MutableBpmTask();
t.setProcessInstance(pi);
t.setAssignee(task.getAssignee());
UserData ud = ctx.getUserDataDAO().loadUserByLogin(task.getAssignee());
if (ud == null) {
ud = new UserData();
ud.setLogin(task.getAssignee());
}
t.setOwner(ud);
t.setTaskName(task.getName());
t.setInternalTaskId(task.getId());
t.setExecutionId(task.getExecutionId());
t.setCreateDate(task.getCreateTime());
t.setFinished(false);
return t;
}
代码示例来源:origin: com.github.hongframework/hframe-workflow
for (Task task : tasks) {
if (task.getAssignee() == null) {
String assignee = random.nextBoolean() ? "kermit" : "fozzie";
taskService.claim(task.getId(), assignee);
task.getCreateTime().getTime() + random.nextInt(60 * 60 * 1000)));
taskService.complete(task.getId());
代码示例来源:origin: Activiti/Activiti
@Override
public Task create(CreateTaskPayload createTaskPayload) {
org.activiti.engine.task.Task task = taskService.newTask();
task.setName(createTaskPayload.getName());
task.setDescription(createTaskPayload.getDescription());
task.setDueDate(createTaskPayload.getDueDate());
task.setPriority(createTaskPayload.getPriority());
if (createTaskPayload.getAssignee() != null && !createTaskPayload.getAssignee().isEmpty()) {
task.setAssignee(createTaskPayload.getAssignee());
task.setParentTaskId(createTaskPayload.getParentTaskId());
task.setFormKey(createTaskPayload.getFormKey());
task.setOwner(securityManager.getAuthenticatedUserId());
taskService.saveTask(task);
taskService.addCandidateUser(task.getId(),
securityManager.getAuthenticatedUserId());
if (createTaskPayload.getCandidateGroups() != null && !createTaskPayload.getCandidateGroups().isEmpty()) {
for (String g : createTaskPayload.getCandidateGroups()) {
taskService.addCandidateGroup(task.getId(),
g);
taskService.addCandidateUser(task.getId(),
u);
代码示例来源:origin: bill1012/AdminEAP
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
request.setAttribute("processInstanceId", task.getProcessInstanceId());
List<FormProperty> formProperties = formService.getTaskFormData(task.getId()).getFormProperties();
request.setAttribute("formProperties", formProperties);
.getProcessInstanceId()).singleResult();
String businessKey = processInstance.getBusinessKey();
String formKey = formService.getTaskFormKey(task.getProcessDefinitionId(), task.getTaskDefinitionKey());
if (StrUtil.isEmpty(formUrl) && !StrUtil.isEmpty(formKey) && !formKey.endsWith(".form")) {
formUrl = formKey;
Object formData = formService.getRenderedTaskForm(task.getId());
if (formData != null) {
request.setAttribute("formData", formData);
代码示例来源:origin: bill1012/AdminEAP
BeanUtils.copyProperties(task, vo);
if (!StrUtil.isEmpty(task.getAssignee())) {
vo.setAssigneeName(identityPageService.getUser(task.getAssignee()).getFirstName());
if (!StrUtil.isEmpty(task.getOwner())) {
String owner = identityPageService.getUser(task.getOwner()).getFirstName();
if (StrUtil.isEmpty(vo.getAssigneeName())) {
vo.setAssigneeName(owner);
Map<String, String> map = getTaskCandidateUser(task.getId());
String userNames = map.get("names");
if (!StrUtil.isEmpty(userNames))
.getProcessInstanceId()).singleResult();
vo.setProcessInstanceName(processInstance.getName());
vo.setCanUnclaim(getTaskState(task.getId()) ? "0" : "1");
vo.setStartUserId(runtimePageService.getStartUserId(task.getId()));
vo.setStartUserName(identityPageService.getUserNamesByUserIds(vo.getStartUserId()));
voList.add(vo);
代码示例来源:origin: org.activiti/activiti-explorer
public void buttonClick(ClickEvent event) {
// If no owner, make assignee owner (will go into archived then)
if (task.getOwner() == null) {
task.setOwner(task.getAssignee());
taskService.setOwner(task.getId(), task.getAssignee());
}
taskService.complete(task.getId());
notificationManager.showInformationNotification(Messages.TASK_COMPLETED, task.getName());
taskPage.refreshSelectNext();
}
});
内容来源于网络,如有侵权,请联系作者删除!