summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lifecycle
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2012-07-12 14:52:36 +0200
committerAndrew Branson <andrew.branson@cern.ch>2012-07-12 14:52:36 +0200
commit20c81748688547c1b13686f15c65fbb1d60d81a0 (patch)
tree59dc2b94c47ed30b8bc93c07cab42e96904d1146 /src/main/java/com/c2kernel/lifecycle
parent61559eef9369dbdbb027bec7c571d7f770b2e7a3 (diff)
Suspend transition now can carry an optional 'Errors' outcome where
client processes can record the reason for the suspension. Errors XML is marshalled ErrorInfo. UserCodeProcess automatically sends fatal ErrorInfos through suspend jobs. Job API added to to support all this. fixes #23
Diffstat (limited to 'src/main/java/com/c2kernel/lifecycle')
-rw-r--r--src/main/java/com/c2kernel/lifecycle/WfCastorHashMap.java1
-rw-r--r--src/main/java/com/c2kernel/lifecycle/instance/Activity.java41
2 files changed, 23 insertions, 19 deletions
diff --git a/src/main/java/com/c2kernel/lifecycle/WfCastorHashMap.java b/src/main/java/com/c2kernel/lifecycle/WfCastorHashMap.java
index 7d88ea9..176f22e 100644
--- a/src/main/java/com/c2kernel/lifecycle/WfCastorHashMap.java
+++ b/src/main/java/com/c2kernel/lifecycle/WfCastorHashMap.java
@@ -16,7 +16,6 @@ public class WfCastorHashMap extends CastorHashMap
put(StateMachine.SKIPPABLE, new Boolean(true));
put(StateMachine.REPEATABLE, new Boolean(true));
put(StateMachine.IGNORABLE, new Boolean(false));
- put("AlwaysUseOutcome", new Boolean(false));
put("Viewpoint", "");
put("Show time", new Boolean(true));
put("Description", "");
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Activity.java b/src/main/java/com/c2kernel/lifecycle/instance/Activity.java
index 8d92522..8dc6b9d 100644
--- a/src/main/java/com/c2kernel/lifecycle/instance/Activity.java
+++ b/src/main/java/com/c2kernel/lifecycle/instance/Activity.java
@@ -543,26 +543,28 @@ public class Activity extends WfVertex
} /**
* 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)
+ private String storeOutcome(int eventID, String requestData, boolean isError) throws InvalidDataException
{
EntityPath entityPath = getItemEntityPath();
if (entityPath != null)
{
- String schemaType = (String) getProperties().get("SchemaType");
- if (schemaType == null || schemaType.length() == 0) // no
- // outcome
- // required
- return null;
- int schemaVersion = 0;
- String versionString = (String) getProperties().get("SchemaVersion");
- try
- {
- schemaVersion = Integer.parseInt(versionString);
+ String schemaType; int schemaVersion;
+ if (isError) {
+ schemaType="Errors";
+ schemaVersion=0;
}
- catch (Exception e)
- {
- Logger.error("Activity.storeOutcome() - invalid schemaVersion " + versionString);
+ else {
+ schemaType = (String) getProperties().get("SchemaType");
+ if (schemaType == null || schemaType.length() == 0) return null;
+ String versionString = (String) getProperties().get("SchemaVersion");
+ try
+ {
+ schemaVersion = Integer.parseInt(versionString);
+ } catch (Exception e) {
+ throw new InvalidDataException("Activity.storeOutcome() - invalid schemaVersion " + versionString, "");
+ }
}
+
Logger.msg(5, "Activity::storeOutcome() - type:" + schemaType + " version:" + schemaVersion);
try
{
@@ -588,16 +590,19 @@ public class Activity extends WfVertex
}
else
return null;
- } /** the method to be called by the requestAction() method */
- public void sendEventStoreOutcome(int transitionID, String requestData, AgentPath agent)
+ }
+
+ /** the method to be called by the requestAction() method
+ * @throws InvalidDataException */
+ public void sendEventStoreOutcome(int transitionID, String requestData, AgentPath agent) throws InvalidDataException
{
int eventID = -1;
Event event = null;
event = auditEvent(transitionID, agent);
if (event != null)
eventID = event.getID();
- if (transitionID == Transitions.DONE || transitionID == Transitions.COMPLETE)
- storeOutcome(eventID, requestData);
+ if ((transitionID == Transitions.DONE || transitionID == Transitions.COMPLETE || transitionID == Transitions.SUSPEND) && requestData != null && requestData.length() > 0)
+ storeOutcome(eventID, requestData, transitionID == Transitions.SUSPEND);
EntityPath entityPath = getItemEntityPath();
TransactionManager storage = Gateway.getStorage();
if (entityPath != null)