本文整理了Java中org.activiti.engine.task.Task.getId()
方法的一些代码示例,展示了Task.getId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.getId()
方法的具体详情如下:
包路径:org.activiti.engine.task.Task
类名称:Task
方法名:getId
[英]DB id of the task.
[中]任务的DB id。
代码示例来源: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
@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: Activiti/Activiti
@Override
public void addCandidateUsers(CandidateUsersPayload candidateUsersPayload) {
org.activiti.engine.task.Task internalTask;
try {
internalTask = taskRuntimeHelper.getInternalTaskWithChecks(candidateUsersPayload.getTaskId());
} catch (IllegalStateException ex) {
throw new IllegalStateException("The authenticated user cannot update the task" + candidateUsersPayload.getTaskId() + " due it is not the current assignee");
}
String authenticatedUserId = securityManager.getAuthenticatedUserId();
// validate that you are trying to add CandidateUsers 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 (candidateUsersPayload.getCandidateUsers() != null && !candidateUsersPayload.getCandidateUsers().isEmpty()) {
for (String u : candidateUsersPayload.getCandidateUsers()) {
taskService.addCandidateUser(internalTask.getId(),
u);
}
}
}
代码示例来源:origin: Activiti/Activiti
@Override
public void deleteCandidateUsers(CandidateUsersPayload candidateUsersPayload) {
org.activiti.engine.task.Task internalTask;
try {
internalTask = taskRuntimeHelper.getInternalTaskWithChecks(candidateUsersPayload.getTaskId());
} catch (IllegalStateException ex) {
throw new IllegalStateException("The authenticated user cannot update the task" + candidateUsersPayload.getTaskId() + " due it is not the current assignee");
}
String authenticatedUserId = securityManager.getAuthenticatedUserId();
// validate that you are trying to add CandidateUsers 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 (candidateUsersPayload.getCandidateUsers() != null && !candidateUsersPayload.getCandidateUsers().isEmpty()) {
for (String u : candidateUsersPayload.getCandidateUsers()) {
taskService.deleteCandidateUser(internalTask.getId(),
u);
}
}
}
代码示例来源:origin: Activiti/Activiti
@Override
public void addCandidateGroups(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.addCandidateGroup(internalTask.getId(),
g);
}
}
}
代码示例来源: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
target.put("taskId", t.getId());
target.put("taskName", t.getName());
target.put("activityId", t.getTaskDefinitionKey());
.processDefineId(processInstance.getProcessDefinitionId())
.processInstanceId(processInstance.getProcessInstanceId())
.taskId(task.getId())
.taskDefineKey(task.getTaskDefinitionKey())
.taskName(task.getName())
代码示例来源:origin: Activiti/Activiti
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: hs-web/hsweb-framework
variable.put("preTaskId", task.getId());
Map<String, Object> transientVariables = new HashMap<>();
taskService.complete(task.getId(), null, transientVariables);
setVariablesLocal(next.getId(), variable);
if (!StringUtils.isNullOrEmpty(request.getNextClaimUserId())) {
taskService.addCandidateUser(next.getId(), request.getNextClaimUserId());
} else {
setCandidate(request.getCompleteUserId(), next);
.processDefineId(instance.getProcessDefinitionId())
.processInstanceId(instance.getProcessInstanceId())
.taskId(task.getId())
.taskDefineKey(task.getTaskDefinitionKey())
.taskName(task.getName())
代码示例来源: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
taskService.addCandidateUser(task.getId(), request.getNextClaimUserId());
} else {
bpmTaskService.setCandidate(request.getCreatorId(), task);
代码示例来源:origin: bluejoe2008/openwebflow
for (IdentityLink link : taskService.getIdentityLinksForTask(task.getId()))
代码示例来源:origin: bluejoe2008/openwebflow
private void checkAndNotify() throws Exception
{
//检查即将过期的task
Date dueDate = DateTime.now().minus(_parsedPeriodInAdvance).toDate();
for (Task task : _processEngine.getTaskService().createTaskQuery().active().dueAfter(dueDate).list())
{
//是否已经通知?
if (!_taskNotificationManager.isNotified(task.getId()))
{
//没有通知则现在通知
List<UserDetailsEntity> involvedUsers = IdentityUtils.getUserDetailsFromIds(
IdentityUtils.getInvolvedUsers(_processEngine.getTaskService(), task, _membershipManager),
_userDetailsManager);
if (!involvedUsers.isEmpty())
{
_messageNotifier.notify(involvedUsers.toArray(new UserDetailsEntity[0]), task);
}
//设置标志
_taskNotificationManager.setNotified(task.getId());
Logger.getLogger(getClass()).debug(String.format("notified %s", involvedUsers));
}
}
}
代码示例来源:origin: bill1012/AdminEAP
if (!StrUtil.isEmpty(task.getAssignee()) && needDelegate(taskEntity, moduleId)) {
taskService.delegateTask(task.getId(), attorney);
volist.add(vo);
} else {
taskService.claim(task.getId(), candidateUser);
taskService.delegateTask(task.getId(), attorney);
volist.add(vo);
代码示例来源:origin: bill1012/AdminEAP
System.out.println("通过taskId获取流程启动人:" + runtimePageService.getStartUserId(task.getId()));
vactionVars.put("startDate", new Date());
vactionVars.put("motivation", "不想上班了,就是这么任性");
taskService.setVariables(task.getId(), vactionVars);
taskService.complete(task.getId(), vactionVars);
taskService.claim(task1.getId(), approver);
List<FormProperty> list = formService.getTaskFormData(task1.getId()).getFormProperties();
if (!list.isEmpty()) {
for (FormProperty formProperty : list) {
vars.put("suggestion", "拒绝");
taskService.complete(task1.getId(), vars);
代码示例来源:origin: bill1012/AdminEAP
List<FormProperty> formProperties = formService.getTaskFormData(task.getId()).getFormProperties();
request.setAttribute("formProperties", formProperties);
Object formData = formService.getRenderedTaskForm(task.getId());
if (formData != null) {
request.setAttribute("formData", formData);
代码示例来源:origin: bill1012/AdminEAP
if (renderForm != null) {
taskService.setVariablesLocal(task.getId(), formData);
} else {
List<FormProperty> formProperties = formService.getTaskFormData(task.getId()).getFormProperties();
Map<String, Object> taskVariables = runtimePageService.getTaskVariables(formProperties, formData);
代码示例来源:origin: bill1012/AdminEAP
Map<String, String> map = getTaskCandidateUser(task.getId());
String userNames = map.get("names");
if (!StrUtil.isEmpty(userNames))
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-rest
protected void addLocalVariables(Task task, Map<String, RestVariable> variableMap) {
Map<String, Object> rawVariables = taskService.getVariablesLocal(task.getId());
List<RestVariable> localVariables = restResponseFactory.createRestVariables(rawVariables, task.getId(), RestResponseFactory.VARIABLE_TASK, RestVariableScope.LOCAL);
for (RestVariable var : localVariables) {
variableMap.put(var.getName(), var);
}
}
}
代码示例来源:origin: bill1012/AdminEAP
public Result deleteCurrentTaskInstance(String taskId, HistoricTaskInstance taskInstance) {
//删除正在执行的任务
//删除HistoricTaskInstance
String sql_task = "delete from " + managementService.getTableName(HistoricTaskInstance.class) + " where " +
"ID_='" + taskId + "' or ID_='" + taskInstance.getId() + "'";
this.executeSql(sql_task);
//删除HistoricActivityInstance
String sql_activity = "delete from " + managementService.getTableName(HistoricActivityInstance.class) + " where " +
"TASK_ID_='" + taskId + "' or TASK_ID_='" + taskInstance.getId() + "'";
this.executeSql(sql_activity);
//获取当前的任务,保存签收人
Task task = taskService.createTaskQuery().executionId(taskInstance.getExecutionId()).singleResult();
task.setAssignee(taskInstance.getAssignee());
task.setOwner(taskInstance.getOwner());
taskService.saveTask(task);
//解决HistoricActivityInstance的Assignee为空的现象
if (!StrUtil.isEmpty(taskInstance.getAssignee())) {
String sql_update = "update " + managementService.getTableName(HistoricActivityInstance.class) + " set " +
"ASSIGNEE_='" + taskInstance.getAssignee() + "' where TASK_ID_='" + task.getId() + "'";
this.executeSql(sql_update);
}
String sql_update_execution = "update " + managementService.getTableName(Execution.class) + " set " +
"ACT_ID_='" + taskInstance.getTaskDefinitionKey() + "' where ID_='" + taskInstance.getExecutionId() + "'";
this.executeSql(sql_update_execution);
return new Result(true);
}
内容来源于网络,如有侵权,请联系作者删除!