[jboss-svn-commits] JBL Code SVN: r21195 - labs/jbossrules/trunk/drools-core/src/main/java/org/drools/workflow/core/node.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Jul 23 11:59:08 EDT 2008


Author: KrisVerlaenen
Date: 2008-07-23 11:59:08 -0400 (Wed, 23 Jul 2008)
New Revision: 21195

Added:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/workflow/core/node/EventNode.java
Log:
JBRULES-1691: Event Node
 - added basic event node

Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/workflow/core/node/EventNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/workflow/core/node/EventNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/workflow/core/node/EventNode.java	2008-07-23 15:59:08 UTC (rev 21195)
@@ -0,0 +1,65 @@
+package org.drools.workflow.core.node;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.process.core.event.EventFilter;
+import org.drools.workflow.core.Connection;
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.impl.NodeImpl;
+
+public class EventNode extends NodeImpl {
+
+	private static final long serialVersionUID = 4L;
+	
+	private List<EventFilter> filters = new ArrayList<EventFilter>();
+	private String variableName;
+
+	public String getVariableName() {
+		return variableName;
+	}
+
+	public void setVariableName(String variableName) {
+		this.variableName = variableName;
+	}
+
+	public void addEventFilter(EventFilter eventFilter) {
+		filters.add(eventFilter);
+	}
+	
+	public void removeEventFilter(EventFilter eventFilter) {
+		filters.remove(eventFilter);
+	}
+	
+	public List<EventFilter> getEventFilters() {
+		return filters;
+	}
+		
+	public void setEventFilters(List<EventFilter> filters) {
+		this.filters = filters;
+	}
+		
+    public void validateAddIncomingConnection(final String type, final Connection connection) {
+        throw new UnsupportedOperationException(
+            "An event node does not have an incoming connection!");
+    }
+
+    public void validateRemoveIncomingConnection(final String type, final Connection connection) {
+        throw new UnsupportedOperationException(
+            "An event node does not have an incoming connection!");
+    }
+
+    public void validateAddOutgoingConnection(final String type, final Connection connection) {
+        super.validateAddOutgoingConnection(type, connection);
+        if (!Node.CONNECTION_DEFAULT_TYPE.equals(type)) {
+            throw new IllegalArgumentException(
+                "This type of node only accepts default outgoing connection type!");
+        }
+        if (getOutgoingConnections(Node.CONNECTION_DEFAULT_TYPE) != null
+                && !getOutgoingConnections(Node.CONNECTION_DEFAULT_TYPE).isEmpty()) {
+            throw new IllegalArgumentException(
+                "This type of node cannot have more than one outgoing connection!");
+        }
+    }
+
+}




More information about the jboss-svn-commits mailing list