From 4d4cc2849855b4a80243f606399c70af52b9373c Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 18 Jun 2013 22:55:36 +0200 Subject: Errors were not stored when submitted to activities with no outcome --- .../com/c2kernel/lifecycle/instance/Activity.java | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Activity.java b/src/main/java/com/c2kernel/lifecycle/instance/Activity.java index 38ed626..952a4dd 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Activity.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Activity.java @@ -536,9 +536,12 @@ public class Activity extends WfVertex } else return null; - } /** - * Stores the request data as an outcome of the Item It does a great deal of storing outcomes in different configuration - */ //requestdata is xmlstring + } + + /** + * Stores the request data as an outcome of the Item It does a great deal of storing outcomes in different configuration + */ //requestdata is xmlstring + private String storeOutcome(int eventID, String requestData, boolean isError) throws InvalidDataException { EntityPath entityPath = getItemEntityPath(); @@ -546,7 +549,9 @@ public class Activity extends WfVertex throw new InvalidDataException("Empty outcome", ""); if (entityPath != null) { - String schemaType; int schemaVersion; + String schemaType; + int schemaVersion; + if (isError) { schemaType="Errors"; schemaVersion=0; @@ -596,12 +601,13 @@ public class Activity extends WfVertex { int eventID = -1; String schemaType = (String) getProperties().get("SchemaType"); - boolean hasOutcome = (transitionID == Transitions.DONE || transitionID == Transitions.COMPLETE || transitionID == Transitions.SUSPEND) && (schemaType != null && schemaType.length() > 0); + boolean hasOutcome = (transitionID == Transitions.DONE || transitionID == Transitions.COMPLETE) && (schemaType != null && schemaType.length() > 0); + boolean hasErrorOutcome = transitionID == Transitions.SUSPEND && requestData != null && requestData.length()>0; Event event = auditEvent(transitionID, agent, hasOutcome); if (event != null) eventID = event.getID(); - if (hasOutcome) - storeOutcome(eventID, requestData, transitionID == Transitions.SUSPEND); + if (hasOutcome || hasErrorOutcome) + storeOutcome(eventID, requestData, hasErrorOutcome); EntityPath entityPath = getItemEntityPath(); TransactionManager storage = Gateway.getStorage(); if (entityPath != null) @@ -609,6 +615,7 @@ public class Activity extends WfVertex storage.commit(this); } } + public void pushJobsToAgents() { String agentRole = getCurrentAgentRole(); -- cgit v1.2.3