diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2012-07-12 14:52:36 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2012-07-12 14:52:36 +0200 |
| commit | 20c81748688547c1b13686f15c65fbb1d60d81a0 (patch) | |
| tree | 59dc2b94c47ed30b8bc93c07cab42e96904d1146 /src/main/java/com/c2kernel/lifecycle/instance | |
| parent | 61559eef9369dbdbb027bec7c571d7f770b2e7a3 (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/instance')
| -rw-r--r-- | src/main/java/com/c2kernel/lifecycle/instance/Activity.java | 41 |
1 files changed, 23 insertions, 18 deletions
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)
|
