diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2013-01-31 21:02:47 +0100 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2013-01-31 21:02:47 +0100 |
| commit | 9dbce79cb5798feb92c4862e694ceeb8799ba284 (patch) | |
| tree | c10e8c3fe3c0032051a0810a08eb0a742c0c9889 /src/main/java/com/c2kernel/lifecycle/instance/Activity.java | |
| parent | 1047226fc3fe1bf42dced7c8afc2ccc6f441657a (diff) | |
Added ViewName field to Event. Filled in with the Viewpoint name if
specified in the Activity properties, making it possible to derive
previous states of the Viewpoint. Closes #96
Cleanup outcome storing code. Throw an exception if SchemaType filled in
and outcome is empty.
Diffstat (limited to 'src/main/java/com/c2kernel/lifecycle/instance/Activity.java')
| -rw-r--r-- | src/main/java/com/c2kernel/lifecycle/instance/Activity.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Activity.java b/src/main/java/com/c2kernel/lifecycle/instance/Activity.java index c91a270..38ed626 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Activity.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Activity.java @@ -510,21 +510,21 @@ public class Activity extends WfVertex } // empty joblist then
return jobs;
}
- //
- //methods written by kovax
- //
+
+
/** Adds an event to the AuditTrail of the Item if any */
- private Event auditEvent(int transitionID, AgentPath agent)
+ private Event auditEvent(int transitionID, AgentPath agent, boolean hasOutcome)
{
EntityPath entityPath = getItemEntityPath();
if (entityPath != null)
{
Event event = null;
History hist = null;
+ String viewName = hasOutcome?(String)getProperties().get("Viewpoint"):null;
try
{
hist = (History) Gateway.getStorage().get(entityPath.getSysKey(), ClusterStorage.HISTORY, this);
- event = hist.addEvent(agent.getAgentName(), getCurrentAgentRole(), transitionID, getName(), getPath(), getType(), getCurrentState());
+ event = hist.addEvent(agent.getAgentName(), getCurrentAgentRole(), transitionID, getName(), getPath(), getType(), viewName, getCurrentState());
Logger.msg(7, "Activity::auditEvent() - Event:" + event.getName() + " was added to the AuditTrail");
}
catch (Exception ex)
@@ -542,6 +542,8 @@ public class Activity extends WfVertex private String storeOutcome(int eventID, String requestData, boolean isError) throws InvalidDataException
{
EntityPath entityPath = getItemEntityPath();
+ if (requestData == null || requestData.length() == 0)
+ throw new InvalidDataException("Empty outcome", "");
if (entityPath != null)
{
String schemaType; int schemaVersion;
@@ -593,11 +595,12 @@ public class Activity extends WfVertex public void sendEventStoreOutcome(int transitionID, String requestData, AgentPath agent) throws InvalidDataException
{
int eventID = -1;
- Event event = null;
- event = auditEvent(transitionID, agent);
+ String schemaType = (String) getProperties().get("SchemaType");
+ boolean hasOutcome = (transitionID == Transitions.DONE || transitionID == Transitions.COMPLETE || transitionID == Transitions.SUSPEND) && (schemaType != null && schemaType.length() > 0);
+ Event event = auditEvent(transitionID, agent, hasOutcome);
if (event != null)
eventID = event.getID();
- if ((transitionID == Transitions.DONE || transitionID == Transitions.COMPLETE || transitionID == Transitions.SUSPEND) && requestData != null && requestData.length() > 0)
+ if (hasOutcome)
storeOutcome(eventID, requestData, transitionID == Transitions.SUSPEND);
EntityPath entityPath = getItemEntityPath();
TransactionManager storage = Gateway.getStorage();
|
