本文整理汇总了Java中org.activiti.engine.impl.persistence.entity.TaskEntity.getProcessDefinitionId方法的典型用法代码示例。如果您正苦于以下问题:Java TaskEntity.getProcessDefinitionId方法的具体用法?Java TaskEntity.getProcessDefinitionId怎么用?Java TaskEntity.getProcessDefinitionId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.persistence.entity.TaskEntity
的用法示例。
在下文中一共展示了TaskEntity.getProcessDefinitionId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findTargetActivity
import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
/**
* 查找回退的目的节点.
*/
public ActivityImpl findTargetActivity(CommandContext commandContext,
TaskEntity taskEntity) {
if (activityId == null) {
String historyTaskId = this.findNearestUserTask(commandContext);
HistoricTaskInstanceEntity historicTaskInstanceEntity = commandContext
.getHistoricTaskInstanceEntityManager()
.findHistoricTaskInstanceById(historyTaskId);
this.activityId = historicTaskInstanceEntity.getTaskDefinitionKey();
}
String processDefinitionId = taskEntity.getProcessDefinitionId();
ProcessDefinitionEntity processDefinitionEntity = new GetDeploymentProcessDefinitionCmd(
processDefinitionId).execute(commandContext);
return processDefinitionEntity.findActivity(activityId);
}
示例2: toJsonObject
import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
public JSONObject toJsonObject(Task task) {
TaskEntity taskEntity = (TaskEntity) task;
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", taskEntity.getId());
jsonObject.put("dbversion", taskEntity.getRevision());
jsonObject.put("assignee", taskEntity.getAssignee());
jsonObject.put("name", taskEntity.getName());
jsonObject.put("priority", taskEntity.getPriority());
jsonObject.put("createTime", taskEntity.getCreateTime());
if (taskEntity.getExecutionId()!=null) {
jsonObject.put("activityInstance", taskEntity.getExecutionId());
}
if (taskEntity.getProcessDefinitionId()!=null) {
jsonObject.put("processDefinition", taskEntity.getProcessDefinitionId());
}
return jsonObject;
}
示例3: rollbackStartEvent
import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
/**
* 回退到startEvent.
*/
public Integer rollbackStartEvent(CommandContext commandContext) {
// 获得任务
TaskEntity taskEntity = this.findTask(commandContext);
// 找到想要回退到的节点
ActivityImpl targetActivity = this.findTargetActivity(commandContext,
taskEntity);
if (taskEntity.getExecutionId().equals(
taskEntity.getProcessInstanceId())) {
// 如果退回的目标节点的executionId与当前task的executionId一样,说明是同一个分支
// 只删除当前分支的task
TaskEntity targetTaskEntity = Context.getCommandContext()
.getTaskEntityManager().findTaskById(this.taskId);
this.deleteActiveTask(targetTaskEntity);
} else {
// 否则认为是从分支跳回主干
// 删除所有活动中的task
this.deleteActiveTasks(taskEntity.getProcessInstanceId());
}
// 把流程指向任务对应的节点
ExecutionEntity executionEntity = Context.getCommandContext()
.getExecutionEntityManager()
.findExecutionById(taskEntity.getExecutionId());
executionEntity.setActivity(targetActivity);
// 创建HistoricActivityInstance
Context.getCommandContext().getHistoryManager()
.recordActivityStart(executionEntity);
String processDefinitionId = taskEntity.getProcessDefinitionId();
GetStartFormCmd getStartFormCmd = new GetStartFormCmd(
processDefinitionId);
StartFormData startFormData = getStartFormCmd.execute(commandContext);
try {
logger.info("{}", targetActivity.getProperties());
// humanTask
HumanTaskConnector humanTaskConnector = ApplicationContextHelper
.getBean(HumanTaskConnector.class);
HumanTaskDTO humanTaskDto = humanTaskConnector.createHumanTask();
humanTaskDto.setName((String) targetActivity.getProperty("name"));
humanTaskDto.setDescription((String) targetActivity
.getProperty("description"));
humanTaskDto.setCode(targetActivity.getId());
humanTaskDto.setAssignee(this.userId);
humanTaskDto.setOwner(null);
humanTaskDto.setDelegateStatus("none");
humanTaskDto.setPriority(50);
humanTaskDto.setCreateTime(new Date());
humanTaskDto.setDuration(null);
humanTaskDto.setSuspendStatus("none");
humanTaskDto.setCategory("startEvent");
humanTaskDto.setForm(startFormData.getFormKey());
humanTaskDto.setTaskId(null);
humanTaskDto.setExecutionId(taskEntity.getExecutionId());
humanTaskDto
.setProcessInstanceId(taskEntity.getProcessInstanceId());
humanTaskDto.setProcessDefinitionId(taskEntity
.getProcessDefinitionId());
humanTaskDto.setTenantId(taskEntity.getTenantId());
humanTaskDto.setStatus("active");
humanTaskDto = humanTaskConnector.saveHumanTask(humanTaskDto);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
// 处理多实例
this.processMultiInstance();
return 0;
}