+ /**
+ * Returns a new {@link ExecutionModuleDescriptor} that can be used to build
+ * a {@link RealizedFlow}.
+ */
+ public ExecutionFlowDescriptor cloneFlowDescriptor(String name) {
+ ExecutionFlowDescriptor res = null;
+ for (ExecutionFlowDescriptor efd : executionFlows) {
+ if (efd.getName().equals(name)
+ || ("/" + efd.getName()).equals(name)) {
+ try {
+ res = (ExecutionFlowDescriptor) efd.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new SlcException("Cannot clone " + efd, e);
+ }
+ }
+ }
+ if (res == null)
+ throw new SlcException("Flow " + name + " not found.");
+ return res;
+ }
+
+ public RealizedFlow asRealizedFlow(String flow, Map<String, Object> values) {
+ RealizedFlow realizedFlow = new RealizedFlow();
+ realizedFlow.setFlowDescriptor(cloneFlowDescriptor(flow));
+ realizedFlow.setModuleName(getName());
+ realizedFlow.setModuleVersion(getVersion());
+ realizedFlow.getFlowDescriptor().getValues().putAll(values);
+ return realizedFlow;
+ }
+