use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.
the class BoundaryErrorEventTest method testDeeplyNestedErrorThrownOnlyAutomaticSteps.
@Deployment
public void testDeeplyNestedErrorThrownOnlyAutomaticSteps() {
// input == 1 -> error2 is thrown -> caught on subprocess2 -> end event in subprocess -> proc inst end 1
String procId = runtimeService.startProcessInstanceByKey("deeplyNestedErrorThrown", CollectionUtil.singletonMap("input", 1)).getId();
assertProcessEnded(procId);
HistoricProcessInstance hip;
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
hip = historyService.createHistoricProcessInstanceQuery().processInstanceId(procId).singleResult();
assertEquals("processEnd1", hip.getEndActivityId());
}
// input == 2 -> error2 is thrown -> caught on subprocess1 -> proc inst end 2
procId = runtimeService.startProcessInstanceByKey("deeplyNestedErrorThrown", CollectionUtil.singletonMap("input", 1)).getId();
assertProcessEnded(procId);
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
hip = historyService.createHistoricProcessInstanceQuery().processInstanceId(procId).singleResult();
assertEquals("processEnd1", hip.getEndActivityId());
}
}
use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.
the class TerminateEndEventTest method assertHistoricProcessInstanceDetails.
protected void assertHistoricProcessInstanceDetails(ProcessInstance pi) {
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(pi.getId()).singleResult();
assertHistoricProcessInstance(historicProcessInstance);
}
}
use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.
the class AdminCompletedInstancesPanel method initInstancesTable.
protected void initInstancesTable() {
instancesTable = new Table();
instancesTable.setWidth(100, UNITS_PERCENTAGE);
instancesTable.setHeight(250, UNITS_PIXELS);
instancesTable.setEditable(false);
instancesTable.setImmediate(true);
instancesTable.setSelectable(true);
instancesTable.setSortDisabled(false);
instancesTable.addContainerProperty("id", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_ID), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("business key", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_BUSINESSKEY), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("start user id", String.class, null, i18nManager.getMessage(Messages.ADMIN_STARTED_BY), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("start activity id", String.class, null, i18nManager.getMessage(Messages.ADMIN_START_ACTIVITY), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("start time", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_STARTED), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("end time", String.class, null, i18nManager.getMessage(Messages.TASK_COMPLETE_TIME), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("duration", String.class, null, i18nManager.getMessage(Messages.TASK_DURATION), null, Table.ALIGN_LEFT);
instancesTable.addListener(new Property.ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
// the value of the property is the itemId of the table entry
Item item = instancesTable.getItem(event.getProperty().getValue());
if (item != null) {
String instanceId = (String) item.getItemProperty("id").getValue();
HistoricProcessInstance processInstance = null;
for (HistoricProcessInstance instance : selectedManagementDefinition.runningInstances) {
if (instance.getId().equals(instanceId)) {
processInstance = instance;
break;
}
}
if (processInstance != null)
addProcessImage(selectedManagementDefinition.processDefinition, processInstance);
addTasks(processInstance);
addVariables(processInstance);
}
}
});
instancesLayout.addComponent(instancesTable);
}
use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.
the class AdminRunningInstancesPanel method initDefinitionsTable.
protected void initDefinitionsTable() {
if (instanceList == null || instanceList.isEmpty()) {
noMembersTable = new Label(i18nManager.getMessage(Messages.ADMIN_RUNNING_NONE_FOUND));
definitionsLayout.addComponent(noMembersTable);
} else {
runningDefinitions = new HashMap<String, ManagementProcessDefinition>();
for (HistoricProcessInstance instance : instanceList) {
String processDefinitionId = instance.getProcessDefinitionId();
ManagementProcessDefinition managementDefinition = null;
if (runningDefinitions.containsKey(processDefinitionId)) {
managementDefinition = runningDefinitions.get(processDefinitionId);
} else {
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
if (definition == null) {
// this process has a missing definition - skip
continue;
}
managementDefinition = new ManagementProcessDefinition();
managementDefinition.processDefinition = definition;
managementDefinition.runningInstances = new ArrayList<HistoricProcessInstance>();
runningDefinitions.put(definition.getId(), managementDefinition);
}
managementDefinition.runningInstances.add(instance);
}
definitionsTable = new Table();
definitionsTable.setWidth(100, UNITS_PERCENTAGE);
definitionsTable.setHeight(250, UNITS_PIXELS);
definitionsTable.setEditable(false);
definitionsTable.setImmediate(true);
definitionsTable.setSelectable(true);
definitionsTable.setSortDisabled(false);
definitionsTable.addContainerProperty("id", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_ID), null, Table.ALIGN_LEFT);
definitionsTable.addContainerProperty("name", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_NAME), null, Table.ALIGN_LEFT);
definitionsTable.addContainerProperty("nr of instances", String.class, null, i18nManager.getMessage(Messages.ADMIN_NR_INSTANCES), null, Table.ALIGN_LEFT);
for (ManagementProcessDefinition managementDefinition : runningDefinitions.values()) {
definitionsTable.addItem(new String[] { managementDefinition.processDefinition.getId(), managementDefinition.processDefinition.getName(), String.valueOf(managementDefinition.runningInstances.size()) }, managementDefinition.processDefinition.getId());
}
definitionsTable.addListener(new Property.ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
// the value of the property is the itemId of the table entry
Item item = definitionsTable.getItem(event.getProperty().getValue());
if (item != null) {
String definitionId = (String) item.getItemProperty("id").getValue();
selectedManagementDefinition = runningDefinitions.get(definitionId);
refreshInstancesTable();
}
}
});
definitionsLayout.addComponent(definitionsTable);
}
}
use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.
the class AdminRunningInstancesPanel method initInstancesTable.
protected void initInstancesTable() {
instancesTable = new Table();
instancesTable.setWidth(100, UNITS_PERCENTAGE);
instancesTable.setHeight(250, UNITS_PIXELS);
instancesTable.setEditable(false);
instancesTable.setImmediate(true);
instancesTable.setSelectable(true);
instancesTable.setSortDisabled(false);
instancesTable.addContainerProperty("id", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_ID), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("business key", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_BUSINESSKEY), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("start user id", String.class, null, i18nManager.getMessage(Messages.ADMIN_STARTED_BY), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("start activity id", String.class, null, i18nManager.getMessage(Messages.ADMIN_START_ACTIVITY), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("start time", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_STARTED), null, Table.ALIGN_LEFT);
instancesTable.addListener(new Property.ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
// the value of the property is the itemId of the table entry
Item item = instancesTable.getItem(event.getProperty().getValue());
if (item != null) {
String instanceId = (String) item.getItemProperty("id").getValue();
HistoricProcessInstance processInstance = null;
for (HistoricProcessInstance instance : selectedManagementDefinition.runningInstances) {
if (instance.getId().equals(instanceId)) {
processInstance = instance;
break;
}
}
if (processInstance != null)
addProcessImage(selectedManagementDefinition.processDefinition, processInstance);
addTasks(processInstance);
addVariables(processInstance);
}
}
});
instancesLayout.addComponent(instancesTable);
}
Aggregations