@Override public Date getStartTime() { return historicProcessInstance.getStartTime(); }
.processInstanceId(processInstanceId).singleResult(); assertEquals(processInstanceId, historicProcessInstance.getId()); assertNotNull("Historic process instance has no start time", historicProcessInstance.getStartTime()); assertNotNull("Historic process instance has no end time", historicProcessInstance.getEndTime());
assertNotNull("Historic process instance has no process definition key", historicProcessInstance.getDeploymentId()); assertNotNull("Historic process instance has no start activiti id", historicProcessInstance.getStartActivityId()); assertNotNull("Historic process instance has no start time", historicProcessInstance.getStartTime()); assertNotNull("Historic process instance has no end time", historicProcessInstance.getEndTime());
@Override public Date getStartTime() { return historicProcessInstance.getStartTime(); }
@Override public Date getStartTime() { return historicProcessInstance.getStartTime(); }
@Override public Date getProcessStartTime() { return processInstance.getStartTime(); }
@Override public void handle(SimulationEvent event) { // // determine next process instance start // // transform simulation time to the playback interval long playBackTime = playBackEnd.getTime() - playBackStart.getTime(); long simulationTimeDelta = ClockUtil.getCurrentTime().getTime() - simulationRunStart.getTime(); long playbackRepeated = simulationTimeDelta/ playBackTime; // only for performance reasons if (!repeatPlayback && playbackRepeated > 0) return; long timeDelta = simulationTimeDelta - playbackRepeated * playBackTime ; Date playbackPositionDate = new Date( playBackStart.getTime() + timeDelta ); // determine new process instances to start from playback List<HistoricProcessInstance> processInstances = getPlaybackProcessInstances(playbackPositionDate); // schedule new process instance start now if (!processInstances.isEmpty()) for (HistoricProcessInstance processInstance : processInstances) scheduleNextProcessStart(simulationRunStart.getTime() + playbackRepeated * playBackTime + (processInstance.getStartTime().getTime() - playBackStart.getTime() ), processInstance.getId() ); }
@Override public void init() { // initialise simulation start simulationRunStart = ClockUtil.getCurrentTime(); // determine when to start new process List<HistoricProcessInstance> processInstances = getPlaybackProcessInstances( playBackStart); if (!processInstances.isEmpty()) { // schedule new process instance start now for (HistoricProcessInstance processInstance : processInstances ) scheduleNextProcessStart(simulationRunStart.getTime() + getSimulationTimeDelta(processInstance.getStartTime()), processInstance.getId()); } }
protected void printProcessInstanceInfo(HistoricProcessInstance hpi) { LinkedHashMap<String, String> nvMap = new LinkedHashMap<String, String>(); nvMap.put("Instance ID", hpi.getId()); nvMap.put("Start Activity", hpi.getStartActivityId()); nvMap.put("End Activity", hpi.getEndActivityId()); nvMap.put("Start Time", Commands.UTIL.formatDate(hpi.getStartTime())); nvMap.put("End Time", Commands.UTIL.formatDate(hpi.getEndTime())); if (!this.isQuiet()) { nvMap.put("Duration", Commands.UTIL.formatDuration(hpi.getDurationInMillis())); } PrintWriter out = new PrintWriter(out(), true); Commands.UTIL.printNameValues(out, nvMap); // print instance data this.getPrintHandler().printInstanceData(out, this.isVerbose(), this.isQuiet(), hpi); }
protected void refreshInstancesTable() { instancesTable.removeAllItems(); for (HistoricProcessInstance instance : selectedManagementDefinition.runningInstances) { instancesTable.addItem(new String[]{instance.getId(), instance.getBusinessKey(), instance.getStartUserId(), instance.getStartActivityId(), instance.getStartTime().toString()}, instance.getId()); } }
protected void printProcessInstanceInfo(HistoricProcessInstance hpi) { LinkedHashMap<String, String> nvMap = new LinkedHashMap<String, String>(); nvMap.put("Instance ID", hpi.getId()); nvMap.put("Start Activity", hpi.getStartActivityId()); nvMap.put("End Activity", hpi.getEndActivityId()); nvMap.put("Start Time", Commands.UTIL.formatDate(hpi.getStartTime())); nvMap.put("End Time", Commands.UTIL.formatDate(hpi.getEndTime())); if (!this.isQuiet()) { nvMap.put("Duration", Commands.UTIL.formatDuration(hpi.getDurationInMillis())); } PrintWriter out = new PrintWriter(out(), true); Commands.UTIL.printNameValues(out, nvMap); // print instance data this.getPrintHandler().printInstanceData(out, this.isVerbose(), this.isQuiet(), hpi); }
protected void refreshInstancesTable() { instancesTable.removeAllItems(); for (HistoricProcessInstance instance : selectedManagementDefinition.runningInstances) { instancesTable.addItem(new String[]{instance.getId(), instance.getBusinessKey(), instance.getStartUserId(), instance.getStartActivityId(), instance.getStartTime().toString(), instance.getEndTime() != null ? instance.getEndTime().toString() : "", instance.getDurationInMillis() != null ? instance.getDurationInMillis().toString() : ""}, instance.getId()); } }
protected void fillInstanceValues() { for (HistoricProcessInstance processInstance : instanceList) { ProcessDefinition definition = definitionMap.get(processInstance.getProcessDefinitionId()); String definitionName = ""; if (definition != null) { if (definition.getName() != null) { definitionName = definition.getName(); } else { definitionName = definition.getId(); } definitionName += " (v" + definition.getVersion() + ")"; } instanceTable.addItem(new String[]{ processInstance.getId(), definitionName, processInstance.getStartTime().toString(), processInstance.getEndTime() != null ? processInstance.getEndTime().toString() : ""}, processInstance.getId()); } }
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); }
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); }
private void printHistoricProcessInstances(PrintWriter out, HistoryService his, boolean printActive) { List<HistoricProcessInstance> hpiList = his.createHistoricProcessInstanceQuery() .orderByProcessDefinitionId().asc().list(); out.println(); out.println("History of Activiti Process Instances"); out.println("-------------------------------------"); if (hpiList.isEmpty()) { out.println("No History on Activiti Processes."); return; } TextTable txtTable = new TextTable(4); txtTable.addHeaders("Definition ID", "Instance ID", "Start Time", "End Time"); for (HistoricProcessInstance hpi : hpiList) { Date endTime = hpi.getEndTime(); if (endTime == null && !printActive) { continue; // don't print active instance history if printActive is false - default. } txtTable.addRow(hpi.getProcessDefinitionId(), hpi.getId(), formatDate(hpi.getStartTime()), formatDate(hpi.getEndTime())); } txtTable.print(out); } }
private void printHistoricProcessInstances(PrintWriter out, HistoryService his, boolean printActive) { List<HistoricProcessInstance> hpiList = his.createHistoricProcessInstanceQuery() .orderByProcessDefinitionId().asc().list(); out.println(); out.println("History of Activiti Process Instances"); out.println("-------------------------------------"); if (hpiList.isEmpty()) { out.println("No History on Activiti Processes."); return; } TextTable txtTable = new TextTable(4); txtTable.addHeaders("Definition ID", "Instance ID", "Start Time", "End Time"); for (HistoricProcessInstance hpi : hpiList) { Date endTime = hpi.getEndTime(); if (endTime == null && !printActive) { continue; // don't print active instance history if printActive is false - default. } txtTable.addRow(hpi.getProcessDefinitionId(), hpi.getId(), formatDate(hpi.getStartTime()), formatDate(hpi.getEndTime())); } txtTable.print(out); } }
.processInstanceId(processInstanceId).singleResult(); assertEquals(processInstanceId, historicProcessInstance.getId()); assertNotNull("Historic process instance has no start time", historicProcessInstance.getStartTime()); assertNotNull("Historic process instance has no end time", historicProcessInstance.getEndTime());
protected void addHeader() { GridLayout header = new GridLayout(3, 2); header.setWidth(100, UNITS_PERCENTAGE); header.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); header.setSpacing(true); header.setMargin(false, false, true, false); // Add image Embedded image = new Embedded(null, Images.PROCESS_50); header.addComponent(image, 0, 0, 0, 1); // Add task name Label nameLabel = new Label(getProcessDisplayName(processDefinition, processInstance)); nameLabel.addStyleName(Reindeer.LABEL_H2); header.addComponent(nameLabel, 1, 0, 2, 0); // Add start time PrettyTimeLabel startTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.PROCESS_START_TIME), historicProcessInstance.getStartTime(), null, true); startTimeLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_START_TIME); header.addComponent(startTimeLabel, 1, 1); header.setColumnExpandRatio(1, 1.0f); header.setColumnExpandRatio(2, 1.0f); panelLayout.addComponent(header); }
@SuppressWarnings("deprecation") public HistoricProcessInstanceResponse createHistoricProcessInstanceResponse(HistoricProcessInstance processInstance, RestUrlBuilder urlBuilder) { HistoricProcessInstanceResponse result = new HistoricProcessInstanceResponse(); result.setBusinessKey(processInstance.getBusinessKey()); result.setDeleteReason(processInstance.getDeleteReason()); result.setDurationInMillis(processInstance.getDurationInMillis()); result.setEndActivityId(processInstance.getEndActivityId()); result.setEndTime(processInstance.getEndTime()); result.setId(processInstance.getId()); result.setName(processInstance.getName()); result.setProcessDefinitionId(processInstance.getProcessDefinitionId()); result.setProcessDefinitionUrl(urlBuilder.buildUrl(RestUrls.URL_PROCESS_DEFINITION, processInstance.getProcessDefinitionId())); result.setStartActivityId(processInstance.getStartActivityId()); result.setStartTime(processInstance.getStartTime()); result.setStartUserId(processInstance.getStartUserId()); result.setSuperProcessInstanceId(processInstance.getSuperProcessInstanceId()); result.setUrl(urlBuilder.buildUrl(RestUrls.URL_HISTORIC_PROCESS_INSTANCE, processInstance.getId())); if (processInstance.getProcessVariables() != null) { Map<String, Object> variableMap = processInstance.getProcessVariables(); for (String name : variableMap.keySet()) { result.addVariable(createRestVariable(name, variableMap.get(name), RestVariableScope.LOCAL, processInstance.getId(), VARIABLE_HISTORY_PROCESS, false, urlBuilder)); } } result.setTenantId(processInstance.getTenantId()); return result; }