From 37bb1907aca2a3246a7b5d759df79b7fd97c276f Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Thu, 5 Dec 2013 12:57:16 +0100 Subject: 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. --- .../com/c2kernel/lifecycle/instance/Workflow.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/main/java/com/c2kernel/lifecycle/instance/Workflow.java') 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 -- cgit v1.2.3