diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2013-12-05 12:57:16 +0100 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2013-12-05 12:57:16 +0100 |
| commit | 37bb1907aca2a3246a7b5d759df79b7fd97c276f (patch) | |
| tree | 85d4d2a5e815c799a9592c410880c132bb6cd1bb /src/main/java/com/c2kernel/lifecycle/instance/Workflow.java | |
| parent | d43164830403245353080f5d6f838ed9f56d9a35 (diff) | |
Add itemSysKey as a variable of the workflow during initialization.
Use this for creating the shared History map.
Lock event writing on the Workflow rather than the Activity to keep the
History in the transaction.
Diffstat (limited to 'src/main/java/com/c2kernel/lifecycle/instance/Workflow.java')
| -rw-r--r-- | src/main/java/com/c2kernel/lifecycle/instance/Workflow.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java b/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java index e3a6b7f..fa5e66b 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java @@ -24,6 +24,8 @@ import com.c2kernel.utils.Logger; public class Workflow extends CompositeActivity implements C2KLocalObject
{
public History history;
+ private Integer itemSysKey = null;
+
/** TypeNameAndConstructionInfo[] variables added by Steve */
private final TypeNameAndConstructionInfo[] mVertexTypeNameAndConstructionInfo =
{
@@ -54,11 +56,11 @@ public class Workflow extends CompositeActivity implements C2KLocalObject addChild(act, new GraphPoint(300, 100));
}
- public History getHistory() {
+ public History getHistory() throws InvalidDataException {
if (history == null) {
- Integer i = (Integer) (getProperties().get("ItemSystemKey"));
- if (i != null)
- history = new History(i, this);
+ if (itemSysKey == null)
+ throw new InvalidDataException("Workflow not initialized.", "");
+ history = new History(itemSysKey, this);
}
return history;
}
@@ -173,6 +175,7 @@ public class Workflow extends CompositeActivity implements C2KLocalObject */
public void initialise(int systemKey, AgentPath agent) throws InvalidDataException, InvalidTransitionException, AccessRightsException, ObjectNotFoundException
{
+ itemSysKey = systemKey;
try
{
runFirst(agent, systemKey);
@@ -186,6 +189,14 @@ public class Workflow extends CompositeActivity implements C2KLocalObject }
}
+ public Integer getItemSysKey() {
+ return itemSysKey;
+ }
+
+ public void setItemSysKey(Integer itemSysKey) {
+ this.itemSysKey = itemSysKey;
+ }
+
/**
* if type = 0 only domain steps will be queried if type = 1 only predefined steps will be queried else both will be queried
* @param agent
|
