xflow.common
Class Node

java.lang.Object
  |
  +--xflow.common.Node
All Implemented Interfaces:
java.io.Serializable

public class Node
extends java.lang.Object
implements java.io.Serializable

The Node class represents a node in a directed graph. A directed graph is used to represent a workflow model.

See Also:
Serialized Form

Field Summary
static java.lang.String AND
           
static java.lang.String CONTAINER
           
static java.lang.String END
           
static java.lang.String OR
           
static java.lang.String PROCESS
           
static java.lang.String START
           
 
Constructor Summary
Node(int nodeId)
          Constructs a new node
Node(java.lang.String nodeName, java.lang.String nodeType)
          Constructs a new node
 
Method Summary
 void addDestination(xflow.common.Node node, java.lang.String rule)
          Adds a destination and a rule to evaluate a workflowobject's transition to this destination.
 void addFromNode(xflow.common.Node n)
          Adds a fromNode to this node
 boolean detectCycle()
          Detects if the graph contains cycles.
 void expand(int gid, java.sql.Connection con)
          Recursively loads this node and all nodes reachable from this node from database.
 java.lang.String getContainee()
          Returns the node's containee graph name.
 int getContaineeVersion()
          Returns the node's containee graph version.
 java.lang.String getDescription()
          Returns node description
 java.util.Vector getDestinations()
           
 java.util.Vector getFromNodes()
           
 xflow.common.Node getNode(int nodeId)
          Finds and returns a node within a graph given a node ID
 xflow.common.Node getNode(java.lang.String name)
          Finds and returns a node within a graph given a node name
 int getNodeId()
          Returns the node ID
 java.lang.Integer getNodeIdAsInteger()
          Returns the node ID
 java.lang.String getNodeName()
          Returns the node name
 java.util.Vector getNodes()
           
 java.util.Vector getNodes(java.lang.String nodeType)
           
 java.lang.String getNodeType()
          Returns the node type
 java.lang.Object getProperty(java.lang.String key)
          Gets a node's property
 java.lang.String getTimeoutHandler()
          Gets the timeout handler for a Process node
 int getTimeoutMinutes()
          Gets the timeout for a Process node
 void print()
          Prints out node id and description of node.
 void saveDB(int gid, java.sql.Connection con)
          Recursively saves a node, its destinations and all links between nodes to the database.
 void setContainee(java.lang.String graphName)
          Sets the node's containee graph name.
 void setContaineeVersion(int i)
          Sets the node's containee graph version.
 void setDescription(java.lang.String d)
          Sets the node description
 void setProperty(java.lang.String key, java.lang.Object value)
          Sets a property on a node
 void setTimeoutHandler(java.lang.String handler)
          Sets the timeout handler for a Process node
 void setTimeoutMinutes(int tout)
          Sets the timeout value for a Process node
 void traverse()
          Recursively traverses all the nodes of a graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROCESS

public static final java.lang.String PROCESS
See Also:
Constant Field Values

AND

public static final java.lang.String AND
See Also:
Constant Field Values

OR

public static final java.lang.String OR
See Also:
Constant Field Values

START

public static final java.lang.String START
See Also:
Constant Field Values

END

public static final java.lang.String END
See Also:
Constant Field Values

CONTAINER

public static final java.lang.String CONTAINER
See Also:
Constant Field Values
Constructor Detail

Node

public Node(java.lang.String nodeName,
            java.lang.String nodeType)
Constructs a new node


Node

public Node(int nodeId)
Constructs a new node

Method Detail

getNodeId

public int getNodeId()
Returns the node ID

Returns:
int nodeId

getNodeIdAsInteger

public java.lang.Integer getNodeIdAsInteger()
Returns the node ID

Returns:
Integer nodeId

getNodeName

public java.lang.String getNodeName()
Returns the node name

Returns:
String node name

getNodeType

public java.lang.String getNodeType()
Returns the node type

Returns:
String node type

getDescription

public java.lang.String getDescription()
Returns node description

Returns:
description

setDescription

public void setDescription(java.lang.String d)
Sets the node description


getContainee

public java.lang.String getContainee()
Returns the node's containee graph name. Only valid if node's type is CONTAINER

Returns:
containee

setContainee

public void setContainee(java.lang.String graphName)
Sets the node's containee graph name. Only valid if node's type is CONTAINER


getContaineeVersion

public int getContaineeVersion()
Returns the node's containee graph version. Only valid if node's type is CONTAINER

Returns:
containeeVersion

setContaineeVersion

public void setContaineeVersion(int i)
Sets the node's containee graph version. Only valid if node's type is CONTAINER


expand

public void expand(int gid,
                   java.sql.Connection con)
Recursively loads this node and all nodes reachable from this node from database.


saveDB

public void saveDB(int gid,
                   java.sql.Connection con)
Recursively saves a node, its destinations and all links between nodes to the database.


detectCycle

public boolean detectCycle()
Detects if the graph contains cycles.


traverse

public void traverse()
Recursively traverses all the nodes of a graph. Useful for debugging.


print

public void print()
Prints out node id and description of node. Useful for debugging.


getNode

public xflow.common.Node getNode(int nodeId)
Finds and returns a node within a graph given a node ID

Returns:
Node the result, null if not found

getNode

public xflow.common.Node getNode(java.lang.String name)
Finds and returns a node within a graph given a node name

Returns:
Node the result, null if not found

addDestination

public void addDestination(xflow.common.Node node,
                           java.lang.String rule)
Adds a destination and a rule to evaluate a workflowobject's transition to this destination.


getDestinations

public java.util.Vector getDestinations()
Returns:
Vector - this node's list of destinations

addFromNode

public void addFromNode(xflow.common.Node n)
Adds a fromNode to this node


getFromNodes

public java.util.Vector getFromNodes()
Returns:
Vector - this node's list of from nodes

getNodes

public java.util.Vector getNodes(java.lang.String nodeType)
Returns:
Vector - all descendant nodes of specified type

getNodes

public java.util.Vector getNodes()
Returns:
Vector - all descendant nodes

setProperty

public void setProperty(java.lang.String key,
                        java.lang.Object value)
Sets a property on a node

Parameters:
key - the property name
value - the property value - must be serializable

getProperty

public java.lang.Object getProperty(java.lang.String key)
Gets a node's property

Parameters:
key - the property name
Returns:
the property value

setTimeoutMinutes

public void setTimeoutMinutes(int tout)
Sets the timeout value for a Process node


getTimeoutMinutes

public int getTimeoutMinutes()
Gets the timeout for a Process node

Returns:
the timeout in minutes

setTimeoutHandler

public void setTimeoutHandler(java.lang.String handler)
Sets the timeout handler for a Process node


getTimeoutHandler

public java.lang.String getTimeoutHandler()
Gets the timeout handler for a Process node

Returns:
the timeout handler name