public void setRuleStartTime( final ProcessInstanceIdentifier identifier, final String ruleFlowGroup, final String nodeId) { // Create the rule (one for each call). final MeasuredRule rule = em.merge(new MeasuredRule(identifier, ruleFlowGroup, nodeId)); // Add it to the corresponding process instance. final MeasuredProcessInstance processInstance = findProcessInstance(identifier); if (processInstance == null) { throw new IllegalStateException( "Rule started for process instance [" + identifier + "], which cannot be found."); } processInstance.addRule(rule); // Set the time. rule.setStartingTime(new Date()); }