From e99ed30f6cae36c5f3fa03007d991e67894a01bb Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 23 Jul 2013 09:41:43 +0200 Subject: More --- .../com/c2kernel/lifecycle/instance/WfVertex.java | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java') diff --git a/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java b/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java index b74aac8..fba00b3 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java @@ -7,7 +7,6 @@ import java.util.HashMap; import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.graph.model.GraphableVertex; -import com.c2kernel.lifecycle.instance.stateMachine.Transitions; import com.c2kernel.lifecycle.routingHelpers.ViewpointDataHelper; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.EntityPath; @@ -25,8 +24,9 @@ import com.c2kernel.utils.Logger; public abstract class WfVertex extends GraphableVertex { /**sets the activity available to be executed on start of Workflow or composite activity (when it is the first one of the - * (sub)process*/ - public abstract void runfirst(AgentPath agent) throws ScriptingEngineException; + * (sub)process + * @throws InvalidDataException */ + public abstract void runFirst(AgentPath agent, int itemSysKey) throws ScriptingEngineException, InvalidDataException; /** * @see java.lang.Object#Object() @@ -40,8 +40,9 @@ public abstract class WfVertex extends GraphableVertex /** * Method runNext. + * @throws InvalidDataException */ - public void runNext(AgentPath agent) throws ScriptingEngineException + public void runNext(AgentPath agent, int itemSysKey) throws InvalidDataException { try { @@ -57,6 +58,8 @@ public abstract class WfVertex extends GraphableVertex /** * Method reinit. * @param idLoop + * @throws InvalidDataException + * @throws ObjectNotFoundException */ public abstract void reinit( int idLoop ); @@ -74,8 +77,9 @@ public abstract class WfVertex extends GraphableVertex /** * Method run. + * @throws InvalidDataException */ - public abstract void run(AgentPath agent) throws ScriptingEngineException; + public abstract void run(AgentPath agent, int itemSysKey) throws InvalidDataException; /** * Method loop. @@ -89,12 +93,11 @@ public abstract class WfVertex extends GraphableVertex */ public abstract Next addNext(WfVertex vertex); - protected Object evaluateScript(String scriptName, String scriptVersion) throws ScriptingEngineException + protected Object evaluateScript(String scriptName, String scriptVersion, int itemSysKey) throws ScriptingEngineException { try { - EntityPath entity = ((CompositeActivity) getParent()).getWf().getItemEntityPath(); Script script = getScript(scriptName, scriptVersion); KeyValuePair[] k = getProperties().getKeyValuePairs(); @@ -109,7 +112,7 @@ public abstract class WfVertex extends GraphableVertex { value = value.substring(11); if (value.startsWith(".")) - value = entity.getSysKey() + value.substring(1); + value = itemSysKey + value.substring(1); try { inputParam = ViewpointDataHelper.get(value)[0]; } catch (ArrayIndexOutOfBoundsException ex) { @@ -120,7 +123,7 @@ public abstract class WfVertex extends GraphableVertex { value = value.substring(10); try { - inputParam = Gateway.getStorage().get(entity.getSysKey(), ClusterStorage.PROPERTY+"/"+value, null); + inputParam = Gateway.getStorage().get(itemSysKey, ClusterStorage.PROPERTY+"/"+value, null); } catch (ObjectNotFoundException ex) { inputParam = null; } @@ -131,7 +134,7 @@ public abstract class WfVertex extends GraphableVertex } if (requiredInput.containsKey("item")) { - script.setInputParamValue("item", Gateway.getProxyManager().getProxy(entity)); + script.setInputParamValue("item", Gateway.getProxyManager().getProxy(new EntityPath(itemSysKey))); } if (requiredInput.containsKey("agent")) { AgentPath systemAgent = Gateway.getLDAPLookup().getRoleManager().getAgentPath("system"); -- cgit v1.2.3