-
Bug
-
Resolution: Done
-
Major
-
jBPM 5.4.0.Beta1
-
None
A customer reports that they see wrong multiple markers for Process Instance Diagram in jBPM Console. (See attached testprocess.png)
The result of JPAProcessInstanceDbLog.findNodeInstances() are ordered by the date of NodeInstanceLog:
public static List<NodeInstanceLog> findNodeInstances(long processInstanceId) { EntityManager em = getEntityManager(); UserTransaction ut = joinTransaction(em); List<NodeInstanceLog> result = getEntityManager() .createQuery("FROM NodeInstanceLog n WHERE n.processInstanceId = :processInstanceId ORDER BY date") .setParameter("processInstanceId", processInstanceId).getResultList(); closeEntityManager(em, ut); return result; }
And GraphViewerPluginImpl.getActiveNodeInfo() assumes that an ENTER log should comes before an EXIT log.
public List<ActiveNodeInfo> getActiveNodeInfo(String instanceId) { ProcessInstanceLog processInstance = JPAProcessInstanceDbLog.findProcessInstance(new Long(instanceId)); if (processInstance == null) { throw new IllegalArgumentException("Could not find process instance " + instanceId); } Map<String, NodeInstanceLog> nodeInstances = new HashMap<String, NodeInstanceLog>(); for (NodeInstanceLog nodeInstance: JPAProcessInstanceDbLog.findNodeInstances(new Long(instanceId))) { if (nodeInstance.getType() == NodeInstanceLog.TYPE_ENTER) { nodeInstances.put(nodeInstance.getNodeInstanceId(), nodeInstance); } else { nodeInstances.remove(nodeInstance.getNodeInstanceId()); } }
But usual database timestamp has only millisecond precision (NOTE: MySQL has only second precision!) so you may get the same value for ENTER and EXIT logs. It results in the Diagram appearance.
Example from customer's Oracle 11.2
SQL> select LOG_DATE from NODEINSTANCELOG; LOG_DATE --------------------------------------------------------------------------- 12-09-29 16:48:06.870000 12-09-29 16:48:06.870000 12-09-29 16:48:06.870000 12-09-29 16:48:06.870000 12-09-29 16:48:06.886000 12-09-29 16:48:06.886000 12-09-29 16:48:06.886000 12-09-29 16:48:06.886000 12-09-29 16:48:06.886000