本文整理汇总了Java中org.activiti.engine.history.HistoricProcessInstance.getEndTime方法的典型用法代码示例。如果您正苦于以下问题:Java HistoricProcessInstance.getEndTime方法的具体用法?Java HistoricProcessInstance.getEndTime怎么用?Java HistoricProcessInstance.getEndTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.history.HistoricProcessInstance
的用法示例。
在下文中一共展示了HistoricProcessInstance.getEndTime方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertToInstanceAndSetVariables
import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
public WorkflowInstance convertToInstanceAndSetVariables(HistoricProcessInstance historicProcessInstance, Map<String, Object> collectedVariables)
{
String processInstanceId = historicProcessInstance.getId();
String id = processInstanceId;
ProcessDefinition procDef = activitiUtil.getProcessDefinition(historicProcessInstance.getProcessDefinitionId());
WorkflowDefinition definition = convert(procDef);
// Set process variables based on historic detail query
Map<String, Object> variables = propertyConverter.getHistoricProcessVariables(processInstanceId);
Date startDate = historicProcessInstance.getStartTime();
Date endDate = historicProcessInstance.getEndTime();
// Copy all variables to map, if not null
if(collectedVariables != null)
{
collectedVariables.putAll(variables);
}
boolean isActive = endDate == null;
return factory.createInstance(id, definition, variables, isActive, startDate, endDate);
}
示例2: getActivitiToMidpoint
import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
private Map<String, String> getActivitiToMidpoint(Set<String> activeProcessInstances, OperationResult result) {
Map<String,String> rv = new HashMap<>();
int processWithoutTaskOidCount = 0;
HistoricProcessInstanceQuery query = activitiEngine.getHistoryService().createHistoricProcessInstanceQuery()
.includeProcessVariables()
.excludeSubprocesses(true);
List<HistoricProcessInstance> processes = query.list();
for (HistoricProcessInstance process : processes) {
String taskOid = (String) process.getProcessVariables().get(CommonProcessVariableNames.VARIABLE_MIDPOINT_TASK_OID);
rv.put(process.getId(), taskOid);
if (taskOid == null) {
processWithoutTaskOidCount++;
}
if (process.getEndTime() == null) {
activeProcessInstances.add(process.getId());
}
}
LOGGER.info("Found {} processes; among these, {} have no task OID. Active processes: {}",
rv.size(), processWithoutTaskOidCount, activeProcessInstances.size());
return rv;
}
示例3: execute
import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
@Override
public Object execute(CommandContext commandContext) {
if (processInstanceId == null) {
throw new ActivitiIllegalArgumentException("processInstanceId is null");
}
// Check if process instance is still running
HistoricProcessInstance instance = commandContext
.getHistoricProcessInstanceEntityManager()
.findHistoricProcessInstance(processInstanceId);
if (instance == null) {
throw new ActivitiObjectNotFoundException("No historic process instance found with id: " + processInstanceId, HistoricProcessInstance.class);
}
if (instance.getEndTime() == null) {
throw new ActivitiException("Process instance is still running, cannot delete historic process instance: " + processInstanceId);
}
commandContext
.getHistoricProcessInstanceEntityManager()
.deleteHistoricProcessInstanceById(processInstanceId);
return null;
}
示例4: execute
import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
public Object execute(CommandContext commandContext) {
if (processInstanceId == null) {
throw new ActivitiException("processInstanceId is null");
}
// Check if process instance is still running
HistoricProcessInstance instance = commandContext
.getHistoricProcessInstanceManager()
.findHistoricProcessInstance(processInstanceId);
if(instance == null) {
throw new ActivitiException("No historic process instance found with id: " + processInstanceId);
}
if(instance.getEndTime() == null) {
throw new ActivitiException("Process instance is still running, cannot delete historic process instance: " + processInstanceId);
}
commandContext
.getHistoricProcessInstanceManager()
.deleteHistoricProcessInstanceById(processInstanceId);
return null;
}
示例5: getFinishedProcessStatus
import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
private AsyncExecutionState getFinishedProcessStatus(HistoricProcessInstance subProcess, ExecutionWrapper execution,
ErrorType errorType) throws MonitoringException {
if (subProcess.getEndTime() == null) {
return AsyncExecutionState.RUNNING;
}
if (subProcess.getDeleteReason() == null) {
return onSuccess(execution.getContext());
}
return onAbort(execution.getContext(), errorType);
}
示例6: ProcessInfo
import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
public ProcessInfo(HistoricProcessInstance processInstance)
{
this.id = processInstance.getId();
this.processDefinitionId = processInstance.getProcessDefinitionId();
this.startedAt = processInstance.getStartTime();
this.endedAt = processInstance.getEndTime();
this.durationInMs = processInstance.getDurationInMillis();
this.deleteReason = processInstance.getDeleteReason();
this.startUserId = processInstance.getStartUserId();
this.startActivityId = processInstance.getStartActivityId();
this.endActivityId = processInstance.getEndActivityId();
this.businessKey = processInstance.getBusinessKey();
this.superProcessInstanceId = processInstance.getSuperProcessInstanceId();
this.completed = (processInstance.getEndTime() != null);
}
示例7: getVirtualStartTask
import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
private WorkflowTask getVirtualStartTask(HistoricProcessInstance historicProcessInstance)
{
if(historicProcessInstance == null)
{
return null;
}
String processInstanceId = historicProcessInstance.getId();
if (!activitiUtil.isMultiTenantWorkflowDeploymentEnabled() && false == isCorrectTenantHistoric(processInstanceId))
{
return null;
}
String id = ActivitiConstants.START_TASK_PREFIX + processInstanceId;
// Since the process instance is complete the Start Task must be complete!
WorkflowTaskState state = WorkflowTaskState.COMPLETED;
// We use the process-instance ID as execution-id. It's ended anyway
WorkflowPath path = buildCompletedPath(processInstanceId, processInstanceId);
if(path == null)
{
return null;
}
// Convert start-event to start-task Node
ReadOnlyProcessDefinition procDef = activitiUtil.getDeployedProcessDefinition(historicProcessInstance.getProcessDefinitionId());
WorkflowNode startNode = convert(procDef.getInitial(), true);
String taskDefId = activitiUtil.getStartFormKey(historicProcessInstance.getProcessDefinitionId());
WorkflowTaskDefinition taskDef = factory.createTaskDefinition(taskDefId, startNode, taskDefId, true);
boolean completed = historicProcessInstance.getEndTime() != null;
Map<QName, Serializable> properties = propertyConverter.getStartTaskProperties(historicProcessInstance, taskDefId, completed);
// TODO: Figure out what name/description should be used for the start-task, start event's name?
String defaultTitle = null;
String defaultDescription = null;
return factory.createTask(id,
taskDef, taskDef.getId(), defaultTitle, defaultDescription, state, path, properties);
}
示例8: viewHistory
import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
/**
* 查看历史【包含流程跟踪、任务列表(完成和未完成)、流程变量】.
*/
@RequestMapping("workspace-viewHistory")
public String viewHistory(
@RequestParam("processInstanceId") String processInstanceId,
Model model) {
String userId = currentUserHolder.getUserId();
HistoryService historyService = processEngine.getHistoryService();
HistoricProcessInstance historicProcessInstance = historyService
.createHistoricProcessInstanceQuery()
.processInstanceId(processInstanceId).singleResult();
if (userId.equals(historicProcessInstance.getStartUserId())) {
// startForm
}
List<HistoricTaskInstance> historicTasks = historyService
.createHistoricTaskInstanceQuery()
.processInstanceId(processInstanceId).list();
// List<HistoricVariableInstance> historicVariableInstances = historyService
// .createHistoricVariableInstanceQuery()
// .processInstanceId(processInstanceId).list();
model.addAttribute("historicTasks", historicTasks);
// 获取流程对应的所有人工任务(目前还没有区分历史)
List<HumanTaskDTO> humanTasks = humanTaskConnector
.findHumanTasksByProcessInstanceId(processInstanceId);
List<HumanTaskDTO> humanTaskDtos = new ArrayList<HumanTaskDTO>();
for (HumanTaskDTO humanTaskDto : humanTasks) {
if (humanTaskDto.getParentId() != null) {
continue;
}
humanTaskDtos.add(humanTaskDto);
}
model.addAttribute("humanTasks", humanTaskDtos);
// model.addAttribute("historicVariableInstances",
// historicVariableInstances);
model.addAttribute("nodeDtos",
traceService.traceProcessInstance(processInstanceId));
model.addAttribute("historyActivities", processEngine
.getHistoryService().createHistoricActivityInstanceQuery()
.processInstanceId(processInstanceId).list());
if (historicProcessInstance.getEndTime() == null) {
model.addAttribute("currentActivities", processEngine
.getRuntimeService()
.getActiveActivityIds(processInstanceId));
} else {
model.addAttribute("currentActivities", Collections
.singletonList(historicProcessInstance.getEndActivityId()));
}
Graph graph = processEngine.getManagementService().executeCommand(
new FindHistoryGraphCmd(processInstanceId));
model.addAttribute("graph", graph);
model.addAttribute("historicProcessInstance", historicProcessInstance);
return "bpm/workspace-viewHistory";
}