From 0ec8481c10cd8277d84c7c1a785483a0a739e5a0 Mon Sep 17 00:00:00 2001 From: abranson Date: Thu, 4 Aug 2011 00:42:34 +0200 Subject: More code cleanup: Refactored Entity Proxy Subscription to handle generics better Rewrote RemoteMap to use TreeMap instead of the internal array for order. It now sorts its keys by number if they parse, else as strings. Removed a no-longer-in-progress outcome form class --- .../com/c2kernel/lifecycle/instance/WfVertex.java | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) mode change 100755 => 100644 source/com/c2kernel/lifecycle/instance/WfVertex.java (limited to 'source/com/c2kernel/lifecycle/instance/WfVertex.java') diff --git a/source/com/c2kernel/lifecycle/instance/WfVertex.java b/source/com/c2kernel/lifecycle/instance/WfVertex.java old mode 100755 new mode 100644 index 7285916..f6cec33 --- a/source/com/c2kernel/lifecycle/instance/WfVertex.java +++ b/source/com/c2kernel/lifecycle/instance/WfVertex.java @@ -27,7 +27,7 @@ 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; - + /** * @see java.lang.Object#Object() */ @@ -88,7 +88,7 @@ public abstract class WfVertex extends GraphableVertex * @param vertex */ public abstract Next addNext(WfVertex vertex); - + protected Object evaluateScript(String scriptName, String scriptVersion) throws ScriptingEngineException { @@ -98,12 +98,11 @@ public abstract class WfVertex extends GraphableVertex Script script = getScript(scriptName, scriptVersion); KeyValuePair[] k = getProperties().getKeyValuePairs(); - HashMap requiredInput = script.getAllInputParams(); - for (int i = 0; i < k.length; i++) - { - if (requiredInput.containsKey(k[i].getKey())) + HashMap requiredInput = script.getAllInputParams(); + for (KeyValuePair element : k) { + if (requiredInput.containsKey(element.getKey())) { - String value = k[i].getStringValue(); + String value = element.getStringValue(); Object inputParam = value; if (value.startsWith("viewpoint//")) @@ -126,11 +125,11 @@ public abstract class WfVertex extends GraphableVertex inputParam = null; } } - Logger.msg(5, "Split.evaluateScript() - Setting param " + k[i].getKey() + " to " + inputParam.toString()); - script.setInputParamValue(k[i].getKey(), inputParam); + Logger.msg(5, "Split.evaluateScript() - Setting param " + element.getKey() + " to " + inputParam.toString()); + script.setInputParamValue(element.getKey(), inputParam); } } - + if (requiredInput.containsKey("item")) { script.setInputParamValue("item", Gateway.getProxyManager().getProxy(entity)); } @@ -150,8 +149,8 @@ public abstract class WfVertex extends GraphableVertex throw new ScriptingEngineException(); } } - - private Script getScript(String name, String version) throws ScriptingEngineException + + private static Script getScript(String name, String version) throws ScriptingEngineException { Script script; try @@ -171,8 +170,8 @@ public abstract class WfVertex extends GraphableVertex return script; } - - + + public Workflow getWf() { return ((CompositeActivity)getParent()).getWf(); -- cgit v1.2.3