Author: KrisVerlaenen
Date: 2008-09-24 10:40:07 -0400 (Wed, 24 Sep 2008)
New Revision: 10456
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowWrapperBuilder.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/ConnectionImpl.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/NodeImpl.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/RuleFlowProcess.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/StartNode.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/SubProcessNode.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/EndNodeAcceptsOutgoingConnectionStrategy.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/ProcessAcceptsElementStrategy.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/SequenceNodeAcceptsIncomingConnectionStrategy.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/SequenceNodeAcceptsOutgoingConnectionStrategy.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/StartNodeAcceptsIncomingConnectionStrategy.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/XmlRuleFlowProcessDumper.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/XmlRuleFlowProcessReader.java
Removed:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/
Modified:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.classpath
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF/MANIFEST.MF
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/build.properties
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/plugin.xml
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowEditor.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowPaletteFactory.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Container.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Flow.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/registry/ElementRegistry.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/DefaultNodeWrapper.java
Log:
Updated Drools Flow plugin to use new extension points
Modified: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.classpath
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.classpath 2008-09-24 14:27:12 UTC
(rev 10455)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.classpath 2008-09-24 14:40:07 UTC
(rev 10456)
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry exported="true" kind="lib"
path="lib/antlr-runtime.jar"/>
+ <classpathentry exported="true" kind="lib"
path="lib/core-3.2.3.v_686_R32x.jar"/>
+ <classpathentry exported="true" kind="lib"
path="lib/mvel.jar"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry exported="true" kind="lib"
path="lib/drools-core.jar"
sourcepath="org.jboss.tools.process.ruleflowsrc.zip"/>
+ <classpathentry kind="lib" path="lib/drools-core.jar"/>
+ <classpathentry kind="lib" path="lib/drools-compiler.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF/MANIFEST.MF
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF/MANIFEST.MF 2008-09-24
14:27:12 UTC (rev 10455)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF/MANIFEST.MF 2008-09-24
14:40:07 UTC (rev 10456)
@@ -14,5 +14,9 @@
org.jboss.tools.flow.common
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
- lib/drools-core.jar
+ lib/drools-core.jar,
+ lib/drools-compiler.jar,
+ lib/antlr-runtime.jar,
+ lib/core-3.2.3.v_686_R32x.jar,
+ lib/mvel.jar
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/build.properties
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/build.properties 2008-09-24
14:27:12 UTC (rev 10455)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/build.properties 2008-09-24
14:40:07 UTC (rev 10456)
@@ -3,4 +3,8 @@
bin.includes = META-INF/,\
.,\
plugin.xml,\
- lib/drools-core.jar
+ lib/drools-core.jar,\
+ lib/drools-compiler.jar,\
+ lib/antlr-runtime.jar,\
+ lib/core-3.2.3.v_686_R32x.jar,\
+ lib/mvel.jar
Modified: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/plugin.xml
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/plugin.xml 2008-09-24 14:27:12 UTC
(rev 10455)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/plugin.xml 2008-09-24 14:40:07 UTC
(rev 10456)
@@ -13,4 +13,58 @@
</editor>
</extension>
+ <extension point="org.jboss.tools.flow.common.languages">
+ <language
+ editor="org.jboss.tools.flow.ruleflow.editor"
+ id="org.jboss.tools.flow.ruleflow"
+ name="Drools Flow">
+ </language>
+ </extension>
+
+ <extension point="org.jboss.tools.flow.common.elements">
+ <element
+ class="org.jboss.tools.process.ruleflow.model.RuleFlowProcess"
+ figure="icons/process.gif"
+ id="org.jboss.tools.flow.ruleflow.process"
+ language="org.jboss.tools.flow.ruleflow"
+ name="Process">
+ <flow
acceptsElementStrategy="org.jboss.tools.process.ruleflow.strategy.ProcessAcceptsElementStrategy"
/>
+ </element>
+ <element
+ class="org.jboss.tools.process.ruleflow.model.node.StartNode"
+ figure="icons/start.gif"
+ id="org.jboss.tools.flow.ruleflow.start"
+ language="org.jboss.tools.flow.ruleflow"
+ name="Start">
+ <node
acceptsIncomingConnectionStrategy="org.jboss.tools.process.ruleflow.strategy.StartNodeAcceptsIncomingConnectionStrategy"
+
acceptsOutgoingConnectionStrategy="org.jboss.tools.process.ruleflow.strategy.SequenceNodeAcceptsOutgoingConnectionStrategy">
+ <figure icon="icons/start.gif">
+ <rectangle></rectangle>
+ </figure>
+ </node>
+ </element>
+ <element
+ class="org.jboss.tools.process.ruleflow.model.node.SubProcessNode"
+ figure="icons/process.gif"
+ id="org.jboss.tools.flow.ruleflow.subProcess"
+ language="org.jboss.tools.flow.ruleflow"
+ name="SubProcess">
+ <node
acceptsIncomingConnectionStrategy="org.jboss.tools.process.ruleflow.strategy.SequenceNodeAcceptsIncomingConnectionStrategy"
+
acceptsOutgoingConnectionStrategy="org.jboss.tools.process.ruleflow.strategy.SequenceNodeAcceptsOutgoingConnectionStrategy">
+ <figure color="255,250,205"
icon="icons/process.gif">
+ <rounded-rectangle></rounded-rectangle>
+ </figure>
+ </node>
+ </element>
+ <element
+ class="org.jboss.tools.process.ruleflow.model.ConnectionImpl"
+ figure="icons/connection.gif"
+ id="org.jboss.tools.flow.ruleflow.connection"
+ language="org.jboss.tools.flow.ruleflow"
+ name="Connection">
+ <connection>
+ </connection>
+ </element>
+ </extension>
+
</plugin>
Modified:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowEditor.java
===================================================================
---
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowEditor.java 2008-09-24
14:27:12 UTC (rev 10455)
+++
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowEditor.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -18,17 +18,18 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.OutputStream;
+import java.io.OutputStreamWriter;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPartFactory;
import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.ui.IFileEditorInput;
+import org.jboss.tools.flow.common.Activator;
import org.jboss.tools.flow.common.editor.GenericModelEditor;
-import org.jboss.tools.process.ruleflow.editor.core.ProcessWrapper;
-import org.jboss.tools.process.ruleflow.editor.core.StartNodeWrapper;
-import org.jboss.tools.process.ruleflow.editor.editpart.RuleFlowEditPartFactory;
+import org.jboss.tools.flow.common.registry.ElementRegistry;
+import org.jboss.tools.flow.common.wrapper.AbstractFlowWrapper;
+import org.jboss.tools.process.ruleflow.model.RuleFlowProcess;
+import org.jboss.tools.process.ruleflow.xml.XmlRuleFlowProcessDumper;
+import org.jboss.tools.process.ruleflow.xml.XmlRuleFlowProcessReader;
/**
* Graphical editor for a RuleFlow.
@@ -37,35 +38,45 @@
*/
public class RuleFlowEditor extends GenericModelEditor {
- protected EditPartFactory createEditPartFactory() {
- return new RuleFlowEditPartFactory();
- }
-
protected PaletteRoot createPalette() {
return new RuleFlowPaletteFactory().createPalette();
}
protected Object createModel() {
- ProcessWrapper result = new ProcessWrapper();
- StartNodeWrapper start = new StartNodeWrapper();
- start.setConstraint(new Rectangle(100, 100, -1, -1));
- result.addElement(start);
- IFile file = ((IFileEditorInput) getEditorInput()).getFile();
- String name = file.getName();
- result.setName(name.substring(0, name.length() - 3));
- return result;
+ return
ElementRegistry.createWrapper("org.jboss.tools.flow.ruleflow.process");
}
- public ProcessWrapper getRuleFlowModel() {
- return (ProcessWrapper) getModel();
- }
-
protected void writeModel(OutputStream os) throws IOException {
- // TODO
+ OutputStreamWriter writer = new OutputStreamWriter(os);
+ try {
+ RuleFlowProcess process = (RuleFlowProcess) ((AbstractFlowWrapper)
getModel()).getElement();
+ String out = XmlRuleFlowProcessDumper.dump(process);
+ writer.write(out);
+ } catch (Throwable t) {
+ Activator.log(t);
+ }
+ writer.close();
}
protected void createModel(InputStream is) {
- // TODO
- setModel(createModel());
+ try {
+ InputStreamReader reader = new InputStreamReader(is);
+ XmlRuleFlowProcessReader xmlReader = new XmlRuleFlowProcessReader();
+ try {
+ RuleFlowProcess process = (RuleFlowProcess) xmlReader.read(reader);
+ if (process == null) {
+ setModel(createModel());
+ } else {
+ setModel(new RuleFlowWrapperBuilder().getProcessWrapper(process));
+ }
+ } catch (Throwable t) {
+ Activator.log(t);
+ setModel(createModel());
+ }
+ reader.close();
+ } catch (Throwable t) {
+ Activator.log(t);
+ }
}
+
}
Modified:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowPaletteFactory.java
===================================================================
---
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowPaletteFactory.java 2008-09-24
14:27:12 UTC (rev 10455)
+++
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowPaletteFactory.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -24,13 +24,10 @@
import org.eclipse.gef.palette.PaletteContainer;
import org.eclipse.gef.palette.PaletteEntry;
import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.gef.requests.SimpleFactory;
import org.eclipse.jface.resource.ImageDescriptor;
import org.jboss.tools.flow.common.editor.PaletteFactory;
+import org.jboss.tools.flow.common.registry.ElementRegistry;
import org.jboss.tools.process.ruleflow.Activator;
-import org.jboss.tools.process.ruleflow.editor.core.BaseConnectionWrapper;
-import org.jboss.tools.process.ruleflow.editor.core.StartNodeWrapper;
-import org.jboss.tools.process.ruleflow.editor.core.SubProcessWrapper;
/**
* Factory for creating a RuleFlow palette.
@@ -46,13 +43,13 @@
}
protected PaletteEntry createConnectionEntry() {
- return new ConnectionCreationToolEntry(
- "Connection Creation",
- "Creating connections",
- new SimpleFactory(BaseConnectionWrapper.class),
-
ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/connection.gif")),
-
ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/connection.gif"))
- );
+ return new ConnectionCreationToolEntry(
+ "Connection",
+ "Creating a new connection",
+
ElementRegistry.getCreationFactory("org.jboss.tools.flow.ruleflow.connection"),
+
ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/connection.gif")),
+
ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/connection.gif"))
+ );
}
protected List<PaletteEntry> createComponentEntries() {
@@ -60,9 +57,9 @@
CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
"Start",
- "Create a new Start",
- StartNodeWrapper.class,
- new SimpleFactory(StartNodeWrapper.class),
+ "Create a new start node",
+ "org.jboss.tools.flow.ruleflow.start",
+
ElementRegistry.getCreationFactory("org.jboss.tools.flow.ruleflow.start"),
ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/start.gif")),
ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/start.gif"))
);
@@ -70,14 +67,14 @@
combined = new CombinedTemplateCreationEntry(
"SubProcess",
- "Create a new sub-process",
- SubProcessWrapper.class,
- new SimpleFactory(SubProcessWrapper.class),
+ "Create a new sub process node",
+ "org.jboss.tools.flow.ruleflow.subProcess",
+
ElementRegistry.getCreationFactory("org.jboss.tools.flow.ruleflow.subProcess"),
ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/process.gif")),
ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/process.gif"))
);
entries.add(combined);
-
+
return entries;
}
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowWrapperBuilder.java
===================================================================
---
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowWrapperBuilder.java
(rev 0)
+++
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowWrapperBuilder.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -0,0 +1,68 @@
+package org.jboss.tools.process.ruleflow.editor;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Flow;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.common.wrapper.DefaultConnectionWrapper;
+import org.jboss.tools.flow.common.wrapper.DefaultFlowWrapper;
+import org.jboss.tools.flow.common.wrapper.DefaultNodeWrapper;
+import org.jboss.tools.flow.common.wrapper.NodeWrapper;
+import org.jboss.tools.process.ruleflow.model.RuleFlowProcess;
+
+public class RuleFlowWrapperBuilder {
+
+ public DefaultFlowWrapper getProcessWrapper(Flow process) {
+ if (process instanceof RuleFlowProcess) {
+ RuleFlowProcess ruleFlowProcess = (RuleFlowProcess) process;
+ DefaultFlowWrapper processWrapper = new DefaultFlowWrapper();
+ processWrapper.setElement(process);
+ Set<Node> nodes = new HashSet<Node>();
+ nodes.addAll(ruleFlowProcess.getNodes());
+ Set<Connection> connections = new HashSet<Connection>();
+ processNodes(nodes, connections, processWrapper);
+ return processWrapper;
+ }
+ return null;
+ }
+
+ public static void processNodes(Set<Node> nodes, Set<Connection>
connections, DefaultFlowWrapper container) {
+ Map<Node, NodeWrapper> nodeWrappers = new HashMap<Node,
NodeWrapper>();
+ for (Node node: nodes) {
+ NodeWrapper nodeWrapper = new DefaultNodeWrapper();
+ nodeWrapper.setElement(node);
+ nodeWrapper.setParent(container);
+ container.localAddElement(nodeWrapper);
+ nodeWrappers.put(node, nodeWrapper);
+ for (List<Connection> inConnections:
node.getIncomingConnections().values()) {
+ for (Connection connection: inConnections) {
+ connections.add(connection);
+ }
+ }
+ for (List<Connection> outConnections:
node.getOutgoingConnections().values()) {
+ for (Connection connection: outConnections) {
+ connections.add(connection);
+ }
+ }
+ }
+ for (Connection connection: connections) {
+ DefaultConnectionWrapper connectionWrapper = new DefaultConnectionWrapper();
+ connectionWrapper.setElement(connection);
+ connectionWrapper.localSetBendpoints(null);
+ NodeWrapper from = nodeWrappers.get(connection.getFrom());
+ NodeWrapper to = nodeWrappers.get(connection.getTo());
+ if (from != null && to != null) {
+ connectionWrapper.localSetSource(from);
+ from.localAddOutgoingConnection(connectionWrapper);
+ connectionWrapper.localSetTarget(to);
+ to.localAddIncomingConnection(connectionWrapper);
+ }
+ }
+ }
+
+}
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/ConnectionImpl.java
===================================================================
---
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/ConnectionImpl.java
(rev 0)
+++
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/ConnectionImpl.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -0,0 +1,98 @@
+package org.jboss.tools.process.ruleflow.model;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.common.registry.ElementRegistry;
+
+public class ConnectionImpl implements Connection {
+
+ private org.drools.workflow.core.impl.ConnectionImpl connection;
+
+ private Node from;
+ private Node to;
+ private Map<String, Object> metaData = new HashMap<String, Object>();
+
+ public ConnectionImpl() {
+ }
+
+ public ConnectionImpl(Node from, String fromType, Node to, String toType) {
+ this.from = from;
+ this.to = to;
+ this.connection = new org.drools.workflow.core.impl.ConnectionImpl(
+ ((NodeImpl) from).getNode(), fromType,
+ ((NodeImpl) to).getNode(), toType);
+ }
+
+ public ConnectionImpl(org.drools.workflow.core.Connection connection, Node from, Node
to) {
+ this.connection = (org.drools.workflow.core.impl.ConnectionImpl) connection;
+ // TODO XML should contain this meta-data
+ setMetaData("configurationElement",
+ ElementRegistry.getConfigurationElement("org.jboss.tools.flow.ruleflow.connection"));
+ this.from = from;
+ this.to = to;
+ }
+
+ public org.drools.workflow.core.Connection getConnection() {
+ return connection;
+ }
+
+ public Node getFrom() {
+ return from;
+ }
+
+ public void setFrom(Node from) {
+ if (connection != null) {
+ connection.terminate();
+ connection = null;
+ }
+ this.from = from;
+ if (from != null && to != null) {
+ connection = new org.drools.workflow.core.impl.ConnectionImpl(
+ ((NodeImpl) from).getNode(), org.drools.workflow.core.Node.CONNECTION_DEFAULT_TYPE,
+ ((NodeImpl) to).getNode(), org.drools.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
+ for (Map.Entry<String, Object> entry: metaData.entrySet()) {
+ connection.setMetaData(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+
+ public String getFromType() {
+ return connection == null ? null : connection.getFromType();
+ }
+
+ public Node getTo() {
+ return to;
+ }
+
+ public void setTo(Node to) {
+ if (connection != null) {
+ connection.terminate();
+ connection = null;
+ }
+ this.to = to;
+ if (from != null && to != null) {
+ connection = new org.drools.workflow.core.impl.ConnectionImpl(
+ ((NodeImpl) from).getNode(), org.drools.workflow.core.Node.CONNECTION_DEFAULT_TYPE,
+ ((NodeImpl) to).getNode(), org.drools.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
+ }
+ }
+
+ public String getToType() {
+ return connection == null ? null : connection.getToType();
+ }
+
+ public Object getMetaData(String name) {
+ return metaData.get(name);
+ }
+
+ public void setMetaData(String name, Object value) {
+ metaData.put(name, value);
+ if (connection != null) {
+ connection.setMetaData(name, value);
+ }
+ }
+
+}
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/NodeImpl.java
===================================================================
---
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/NodeImpl.java
(rev 0)
+++
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/NodeImpl.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -0,0 +1,126 @@
+package org.jboss.tools.process.ruleflow.model;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Container;
+import org.jboss.tools.flow.common.model.Node;
+
+public class NodeImpl implements Node {
+
+ private org.drools.workflow.core.Node node;
+
+ private Container nodeContainer;
+ private Map<String, List<Connection>> incomingConnections = new
HashMap<String, List<Connection>>();
+ private Map<String, List<Connection>> outgoingConnections = new
HashMap<String, List<Connection>>();
+
+ public NodeImpl(org.drools.workflow.core.Node node) {
+ this.node = node;
+ }
+
+ public org.drools.workflow.core.Node getNode() {
+ return node;
+ }
+
+ public void addIncomingConnection(String type, Connection connection) {
+ internalAddIncomingConnection(type, connection);
+ node.addIncomingConnection(type, ((ConnectionImpl) connection).getConnection());
+ }
+
+ public void internalAddIncomingConnection(String type, Connection connection) {
+ List<Connection> list = incomingConnections.get(type);
+ if (list == null) {
+ list = new ArrayList<Connection>();
+ incomingConnections.put(type, list);
+ }
+ list.add(connection);
+ }
+
+ public void addOutgoingConnection(String type, Connection connection) {
+ internalAddOutgoingConnection(type, connection);
+ node.addOutgoingConnection(type, ((ConnectionImpl) connection).getConnection());
+ }
+
+ public void internalAddOutgoingConnection(String type, Connection connection) {
+ List<Connection> list = outgoingConnections.get(type);
+ if (list == null) {
+ list = new ArrayList<Connection>();
+ outgoingConnections.put(type, list);
+ }
+ list.add(connection);
+ }
+
+ public long getId() {
+ return node.getId();
+ }
+
+ public Map<String, List<Connection>> getIncomingConnections() {
+ return incomingConnections;
+ }
+
+ public List<Connection> getIncomingConnections(String type) {
+ return incomingConnections.get(type);
+ }
+
+ public Object getMetaData(String name) {
+ return node.getMetaData(name);
+ }
+
+ public String getName() {
+ return node.getName();
+ }
+
+ public Container getNodeContainer() {
+ return nodeContainer;
+ }
+
+ public Map<String, List<Connection>> getOutgoingConnections() {
+ return outgoingConnections;
+ }
+
+ public List<Connection> getOutgoingConnections(String type) {
+ return outgoingConnections.get(type);
+ }
+
+ public void removeIncomingConnection(String type, Connection connection) {
+ List<Connection> list = incomingConnections.get(type);
+ if (list != null) {
+ list.remove(connection);
+ if (list.isEmpty()) {
+ incomingConnections.remove(type);
+ }
+ }
+ node.removeIncomingConnection(type, ((ConnectionImpl) connection).getConnection());
+ }
+
+ public void removeOutgoingConnection(String type, Connection connection) {
+ List<Connection> list = outgoingConnections.get(type);
+ if (list != null) {
+ list.remove(connection);
+ if (list.isEmpty()) {
+ outgoingConnections.remove(type);
+ }
+ }
+ node.removeOutgoingConnection(type, ((ConnectionImpl) connection).getConnection());
+ }
+
+ public void setId(long id) {
+ node.setId(id);
+ }
+
+ public void setMetaData(String name, Object value) {
+ node.setMetaData(name, value);
+ }
+
+ public void setName(String name) {
+ node.setName(name);
+ }
+
+ public void setNodeContainer(Container nodeContainer) {
+ this.nodeContainer = nodeContainer;
+ node.setNodeContainer(((RuleFlowProcess) nodeContainer).getRuleFlowProcess());
+ }
+}
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/RuleFlowProcess.java
===================================================================
---
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/RuleFlowProcess.java
(rev 0)
+++
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/RuleFlowProcess.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -0,0 +1,134 @@
+package org.jboss.tools.process.ruleflow.model;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.tools.flow.common.model.Flow;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.common.registry.ElementRegistry;
+import org.jboss.tools.process.ruleflow.model.node.StartNode;
+import org.jboss.tools.process.ruleflow.model.node.SubProcessNode;
+
+public class RuleFlowProcess implements Flow {
+
+ private org.drools.ruleflow.core.RuleFlowProcess process;
+
+ private Map<Long, Node> nodes = new HashMap<Long, Node>();
+
+ public RuleFlowProcess() {
+ this.process = new org.drools.ruleflow.core.RuleFlowProcess();
+ }
+
+ public RuleFlowProcess(org.drools.ruleflow.core.RuleFlowProcess process) {
+ this.process = process;
+ // TODO XML should contain this meta-data
+ setMetaData("configurationElement",
+ ElementRegistry.getConfigurationElement("org.jboss.tools.flow.ruleflow.process"));
+ List<org.drools.workflow.core.Connection> connections = new
ArrayList<org.drools.workflow.core.Connection>();
+ for (org.drools.workflow.core.Node node: process.getNodes()) {
+ Node newNode = null;
+ if (node instanceof org.drools.workflow.core.node.StartNode) {
+ newNode = new StartNode((org.drools.workflow.core.node.StartNode) node);
+ } else if (node instanceof org.drools.workflow.core.node.SubProcessNode) {
+ newNode = new SubProcessNode((org.drools.workflow.core.node.SubProcessNode) node);
+ }
+ if (newNode == null) {
+ throw new IllegalArgumentException("Could not find NodeImpl for node " +
newNode);
+ }
+ this.nodes.put(node.getId(), newNode);
+ for (List<org.drools.workflow.core.Connection> inConnections:
node.getIncomingConnections().values()) {
+ for (org.drools.workflow.core.Connection connection: inConnections) {
+ connections.add(connection);
+ }
+ }
+ }
+ for (org.drools.workflow.core.Connection connection: connections) {
+ NodeImpl from = (NodeImpl) nodes.get(connection.getFrom().getId());
+ NodeImpl to = (NodeImpl) nodes.get(connection.getTo().getId());
+ ConnectionImpl newConnection = new ConnectionImpl(connection, from, to);
+ from.internalAddOutgoingConnection(connection.getFromType(), newConnection);
+ to.internalAddIncomingConnection(connection.getToType(), newConnection);
+ }
+ }
+
+ public org.drools.ruleflow.core.RuleFlowProcess getRuleFlowProcess() {
+ return process;
+ }
+
+ public String getId() {
+ return process.getId();
+ }
+
+ public String getName() {
+ return process.getName();
+ }
+
+ public String getPackageName() {
+ return process.getPackageName();
+ }
+
+ public String getType() {
+ return process.getType();
+ }
+
+ public String getVersion() {
+ return process.getVersion();
+ }
+
+ public void setId(String id) {
+ process.setId(id);
+ }
+
+ public void setName(String name) {
+ process.setName(name);
+ }
+
+ public void setPackageName(String packageName) {
+ process.setPackageName(packageName);
+ }
+
+ public void setType(String type) {
+ process.setType(type);
+ }
+
+ public void setVersion(String version) {
+ process.setVersion(version);
+ }
+
+ public void addNode(Node node) {
+ nodes.put(node.getId(), node);
+ process.addNode(((NodeImpl) node).getNode());
+ }
+
+ public Node getNode(long id) {
+ return nodes.get(id);
+ }
+
+ public List<Node> getNodes() {
+ return new ArrayList<Node>(nodes.values());
+ }
+
+ public void removeNode(Node node) {
+ nodes.remove(node.getId());
+ process.removeNode(((NodeImpl) node).getNode());
+ }
+
+ public Object getMetaData(String name) {
+ return process.getMetaData(name);
+ }
+
+ public void setMetaData(String name, Object value) {
+ process.setMetaData(name, value);
+ }
+
+ public StartNode getStart() {
+ org.drools.workflow.core.node.StartNode start = process.getStart();
+ if (start == null) {
+ return null;
+ }
+ return (StartNode) nodes.get(start.getId());
+ }
+
+}
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/StartNode.java
===================================================================
---
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/StartNode.java
(rev 0)
+++
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/StartNode.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -0,0 +1,19 @@
+package org.jboss.tools.process.ruleflow.model.node;
+
+import org.jboss.tools.flow.common.registry.ElementRegistry;
+import org.jboss.tools.process.ruleflow.model.NodeImpl;
+
+public class StartNode extends NodeImpl {
+
+ public StartNode() {
+ super(new org.drools.workflow.core.node.StartNode());
+ }
+
+ public StartNode(org.drools.workflow.core.node.StartNode node) {
+ super(node);
+ // TODO XML should contain this meta-data
+ setMetaData("configurationElement",
+ ElementRegistry.getConfigurationElement("org.jboss.tools.flow.ruleflow.start"));
+ }
+
+}
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/SubProcessNode.java
===================================================================
---
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/SubProcessNode.java
(rev 0)
+++
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/SubProcessNode.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -0,0 +1,19 @@
+package org.jboss.tools.process.ruleflow.model.node;
+
+import org.jboss.tools.flow.common.registry.ElementRegistry;
+import org.jboss.tools.process.ruleflow.model.NodeImpl;
+
+public class SubProcessNode extends NodeImpl {
+
+ public SubProcessNode() {
+ super(new org.drools.workflow.core.node.SubProcessNode());
+ }
+
+ public SubProcessNode(org.drools.workflow.core.node.SubProcessNode node) {
+ super(node);
+ // TODO XML should contain this meta-data
+ setMetaData("configurationElement",
+ ElementRegistry.getConfigurationElement("org.jboss.tools.flow.ruleflow.subProcess"));
+ }
+
+}
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/EndNodeAcceptsOutgoingConnectionStrategy.java
===================================================================
---
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/EndNodeAcceptsOutgoingConnectionStrategy.java
(rev 0)
+++
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/EndNodeAcceptsOutgoingConnectionStrategy.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -0,0 +1,16 @@
+package org.jboss.tools.process.ruleflow.strategy;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.common.strategy.AcceptsOutgoingConnectionStrategy;
+
+public class EndNodeAcceptsOutgoingConnectionStrategy implements
AcceptsOutgoingConnectionStrategy {
+
+ public boolean acceptsOutgoingConnection(Connection connection, Node source) {
+ return false;
+ }
+
+ public void setNode(Node node) {
+ }
+
+}
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/ProcessAcceptsElementStrategy.java
===================================================================
---
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/ProcessAcceptsElementStrategy.java
(rev 0)
+++
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/ProcessAcceptsElementStrategy.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -0,0 +1,28 @@
+package org.jboss.tools.process.ruleflow.strategy;
+
+import org.jboss.tools.flow.common.model.Container;
+import org.jboss.tools.flow.common.strategy.AcceptsElementStrategy;
+import org.jboss.tools.process.ruleflow.model.RuleFlowProcess;
+import org.jboss.tools.process.ruleflow.model.node.StartNode;
+
+public class ProcessAcceptsElementStrategy implements AcceptsElementStrategy {
+
+ private RuleFlowProcess process;
+
+ public boolean acceptsElement(Object element) {
+ if (process == null) {
+ return false;
+ } else if (element instanceof StartNode) {
+ return process.getStart() == null;
+ } else {
+ return true;
+ }
+ }
+
+ public void setContainer(Container container) {
+ if (container instanceof RuleFlowProcess) {
+ this.process = (RuleFlowProcess) container;
+ }
+ }
+
+}
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/SequenceNodeAcceptsIncomingConnectionStrategy.java
===================================================================
---
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/SequenceNodeAcceptsIncomingConnectionStrategy.java
(rev 0)
+++
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/SequenceNodeAcceptsIncomingConnectionStrategy.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -0,0 +1,22 @@
+package org.jboss.tools.process.ruleflow.strategy;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.common.strategy.AcceptsIncomingConnectionStrategy;
+
+public class SequenceNodeAcceptsIncomingConnectionStrategy implements
AcceptsIncomingConnectionStrategy {
+
+ private Node node;
+
+ public boolean acceptsIncomingConnection(Connection connection, Node source) {
+ return
+ (source == null
+ || source.getNodeContainer() == node.getNodeContainer())
+ && node.getIncomingConnections().isEmpty();
+ }
+
+ public void setNode(Node node) {
+ this.node = node;
+ }
+
+}
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/SequenceNodeAcceptsOutgoingConnectionStrategy.java
===================================================================
---
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/SequenceNodeAcceptsOutgoingConnectionStrategy.java
(rev 0)
+++
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/SequenceNodeAcceptsOutgoingConnectionStrategy.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -0,0 +1,22 @@
+package org.jboss.tools.process.ruleflow.strategy;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.common.strategy.AcceptsOutgoingConnectionStrategy;
+
+public class SequenceNodeAcceptsOutgoingConnectionStrategy implements
AcceptsOutgoingConnectionStrategy {
+
+ private Node node;
+
+ public boolean acceptsOutgoingConnection(Connection connection, Node target) {
+ return
+ (target == null
+ || target.getNodeContainer() == node.getNodeContainer())
+ && node.getOutgoingConnections().isEmpty();
+ }
+
+ public void setNode(Node node) {
+ this.node = node;
+ }
+
+}
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/StartNodeAcceptsIncomingConnectionStrategy.java
===================================================================
---
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/StartNodeAcceptsIncomingConnectionStrategy.java
(rev 0)
+++
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/StartNodeAcceptsIncomingConnectionStrategy.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -0,0 +1,16 @@
+package org.jboss.tools.process.ruleflow.strategy;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.common.strategy.AcceptsIncomingConnectionStrategy;
+
+public class StartNodeAcceptsIncomingConnectionStrategy implements
AcceptsIncomingConnectionStrategy {
+
+ public boolean acceptsIncomingConnection(Connection connection, Node source) {
+ return false;
+ }
+
+ public void setNode(Node node) {
+ }
+
+}
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/XmlRuleFlowProcessDumper.java
===================================================================
---
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/XmlRuleFlowProcessDumper.java
(rev 0)
+++
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/XmlRuleFlowProcessDumper.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -0,0 +1,11 @@
+package org.jboss.tools.process.ruleflow.xml;
+
+import org.jboss.tools.process.ruleflow.model.RuleFlowProcess;
+
+public class XmlRuleFlowProcessDumper {
+
+ public static String dump(RuleFlowProcess process) {
+ return
org.drools.xml.XmlRuleFlowProcessDumper.INSTANCE.dump(process.getRuleFlowProcess(),
true);
+ }
+
+}
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/XmlRuleFlowProcessReader.java
===================================================================
---
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/XmlRuleFlowProcessReader.java
(rev 0)
+++
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/XmlRuleFlowProcessReader.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -0,0 +1,24 @@
+package org.jboss.tools.process.ruleflow.xml;
+
+import java.io.Reader;
+
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.xml.XmlProcessReader;
+import org.jboss.tools.process.ruleflow.model.RuleFlowProcess;
+
+public class XmlRuleFlowProcessReader {
+
+ private XmlProcessReader processReader;
+
+ public XmlRuleFlowProcessReader() {
+ PackageBuilderConfiguration configuration = new PackageBuilderConfiguration();
+ processReader = new XmlProcessReader(configuration.getSemanticModules());
+ }
+
+ public RuleFlowProcess read(Reader reader) throws Exception {
+ org.drools.ruleflow.core.RuleFlowProcess process =
+ (org.drools.ruleflow.core.RuleFlowProcess) processReader.read(reader);
+ return new RuleFlowProcess(process);
+ }
+
+}
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java
===================================================================
---
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java 2008-09-24
14:27:12 UTC (rev 10455)
+++
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -73,6 +73,7 @@
import org.jboss.tools.flow.common.Activator;
import org.jboss.tools.flow.common.action.HorizontalAutoLayoutAction;
import org.jboss.tools.flow.common.action.VerticalAutoLayoutAction;
+import org.jboss.tools.flow.common.editpart.DefaultEditPartFactory;
import org.jboss.tools.flow.common.registry.LanguageRegistry;
/**
@@ -203,7 +204,9 @@
getGraphicalViewer());
}
- protected abstract EditPartFactory createEditPartFactory();
+ protected EditPartFactory createEditPartFactory() {
+ return new DefaultEditPartFactory();
+ }
protected void initializeGraphicalViewer() {
getGraphicalViewer().setContents(model);
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Container.java
===================================================================
---
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Container.java 2008-09-24
14:27:12 UTC (rev 10455)
+++
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Container.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -7,7 +7,7 @@
*
* @author <a href="mailto:kris_verlaenen@hotmail.com">Kris
Verlaenen</a>
*/
-public interface Container extends Element {
+public interface Container {
/**
* Returns the nodes of this node container.
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Flow.java
===================================================================
---
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Flow.java 2008-09-24
14:27:12 UTC (rev 10455)
+++
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Flow.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -25,7 +25,7 @@
*
* @author <a href="mailto:kris_verlaenen@hotmail.com">Kris
Verlaenen</a>
*/
-public interface Flow extends Container {
+public interface Flow extends Container, Element {
/**
* Sets the id of this process.
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/registry/ElementRegistry.java
===================================================================
---
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/registry/ElementRegistry.java 2008-09-24
14:27:12 UTC (rev 10455)
+++
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/registry/ElementRegistry.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -120,7 +120,7 @@
Logger.logError(message, new RuntimeException(message));
return null;
}
- ((Container)element).setMetaData("configurationElement",
configurationElement);
+ ((Element) element).setMetaData("configurationElement",
configurationElement);
DefaultContainerWrapper result = new DefaultContainerWrapper();
result.setElement(element);
AcceptsElementStrategy acceptsElementStrategy =
createAcceptsElementStrategy(configurationElement);
@@ -182,7 +182,7 @@
Logger.logError(message, new RuntimeException(message));
return null;
}
- ((Container)element).setMetaData("configurationElement",
configurationElement);
+ ((Element) element).setMetaData("configurationElement",
configurationElement);
DefaultFlowWrapper result = new DefaultFlowWrapper();
result.setElement(element);
AcceptsElementStrategy acceptsElementStrategy =
createAcceptsElementStrategy(configurationElement);
@@ -325,6 +325,10 @@
}
}
+ public static IConfigurationElement getConfigurationElement(String elementId) {
+ return elementMap.get(elementId);
+ }
+
public static CreationFactory getCreationFactory(final String elementId) {
return new CreationFactory() {
public Object getNewObject() {
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/DefaultNodeWrapper.java
===================================================================
---
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/DefaultNodeWrapper.java 2008-09-24
14:27:12 UTC (rev 10455)
+++
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/DefaultNodeWrapper.java 2008-09-24
14:40:07 UTC (rev 10456)
@@ -84,4 +84,25 @@
return true;
}
}
+
+ protected void internalAddIncomingConnection(AbstractConnectionWrapper connection) {
+ getNode().addIncomingConnection("DROOLS_DEFAULT",
+ ((DefaultConnectionWrapper) connection).getConnection());
+ }
+
+ protected void internalRemoveIncomingConnection(AbstractConnectionWrapper connection) {
+ getNode().removeIncomingConnection("DROOLS_DEFAULT",
+ ((DefaultConnectionWrapper) connection).getConnection());
+ }
+
+ protected void internalAddOutgoingConnection(AbstractConnectionWrapper connection) {
+ getNode().addOutgoingConnection("DROOLS_DEFAULT",
+ ((DefaultConnectionWrapper) connection).getConnection());
+ }
+
+ protected void internalRemoveOutgoingConnection(AbstractConnectionWrapper connection) {
+ getNode().removeOutgoingConnection("DROOLS_DEFAULT",
+ ((DefaultConnectionWrapper) connection).getConnection());
+ }
+
}