X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.execution%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fexecution%2FSimpleExecutionFlow.java;h=79f900d023e9b3ef4a070ce8407c2e2f0ae0df6f;hb=618d5c6b4736835ce6b727f2644debc20d00158d;hp=34018ee9b5ba076b5b193f3419cfc0bb3b0ca619;hpb=dfdce3de968e09ed7d4cf443a6bfcbc9c5e819f2;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/SimpleExecutionFlow.java b/runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/SimpleExecutionFlow.java index 34018ee9b..79f900d02 100644 --- a/runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/SimpleExecutionFlow.java +++ b/runtime/org.argeo.slc.execution/src/main/java/org/argeo/slc/execution/SimpleExecutionFlow.java @@ -21,7 +21,13 @@ public class SimpleExecutionFlow implements ExecutionFlow, InitializingBean, private Map parameters = new HashMap(); private List executables = new ArrayList(); - private final String uuid = UUID.randomUUID().toString(); + public SimpleExecutionFlow() { + + } + + public SimpleExecutionFlow(Map parameters) { + this.parameters.putAll(parameters); + } public void execute() { for (Executable executable : executables) { @@ -35,7 +41,7 @@ public class SimpleExecutionFlow implements ExecutionFlow, InitializingBean, return; MapBindingResult errors = new MapBindingResult(parameters, "execution#" - + getUuid()); + + getName()); for (String key : executionSpec.getAttributes().keySet()) { ExecutionSpecAttribute executionSpecAttr = executionSpec .getAttributes().get(key); @@ -49,6 +55,7 @@ public class SimpleExecutionFlow implements ExecutionFlow, InitializingBean, Object obj = parameters.get(key); if (executionSpecAttr instanceof RefSpecAttribute) { RefSpecAttribute rsa = (RefSpecAttribute) executionSpecAttr; + // TODO: make sure this will not cause pb with OSGi Class targetClass = rsa.getTargetClass(); if (!targetClass.isAssignableFrom(obj.getClass())) { errors.reject(key @@ -80,8 +87,8 @@ public class SimpleExecutionFlow implements ExecutionFlow, InitializingBean, this.parameters = attributes; } - public String getUuid() { - return uuid; + public String getName() { + return name; } public ExecutionSpec getExecutionSpec() { @@ -99,7 +106,7 @@ public class SimpleExecutionFlow implements ExecutionFlow, InitializingBean, return esa.getValue(); } else { throw new SlcException("Key " + name - + " is not define in the specifications of " + + " is not defined in the specifications of " + toString()); } } @@ -108,7 +115,10 @@ public class SimpleExecutionFlow implements ExecutionFlow, InitializingBean, } public String toString() { - return new StringBuffer("Flow ").append(name).toString();// .append(" [#") - // .append(uuid).append(']').toString(); + return new StringBuffer("Flow ").append(name).toString(); + } + + public boolean equals(Object obj) { + return ((ExecutionFlow) obj).getName().equals(name); } }