wt.workflow.definer
Class NodeTemplateLink

java.lang.Object
  extended bywt.fc.WTObject
      extended bywt.fc.ObjectToObjectLink
          extended bywt.workflow.definer.NodeTemplateLink
All Implemented Interfaces:
BinaryLink, DisplayIdentification, Externalizable, Link, NetFactor, ObjectMappable, Persistable, Serializable

public class NodeTemplateLink
extends ObjectToObjectLink
implements Externalizable

The NodeTemplateLink is the class responsible for the definition of links representing flow of control. It has a type (defined at creation time) that describes the source and destination nodes in the association and whether it is a control link or not. The type can't be changed for the lifetime of the link.

The NodeTemplateLink class also contains a mapping between events in the source node and actions at the destination node. Events in the source node can be state transitions in case of activities) or user defined events for routers. Actions in the destination node can, for example, be state transition for activities.

Use the newNodeTemplateLink static factory method(s), not the NodeTemplateLink constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.



Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
static String BACK_LOOP
          Label for the attribute; Determines if the link is used to create a "loop" or iteration.
private  boolean backLoop
           
private static String CLASSNAME
           
static String DESTINATION_ROLE
          Label for the attribute.
protected static String EVENT_ACTION_MAP
          Label for the attribute; Table that maps events in the source node to actions in the destination node.
private static int EVENT_ACTION_MAP_UPPER_LIMIT
           
private  EventActionTable eventActionMap
           
static long EXTERNALIZATION_VERSION_UID
           
static String LINK_TYPE
          Label for the attribute; Type of the link.
private static int LINK_TYPE_UPPER_LIMIT
           
private  WfTemplateLinkType linkType
           
protected static long OLD_FORMAT_VERSION_UID
           
static String PARENT_TEMPLATE
          Label for the attribute; Reference to the parent process template.
private  WfContainerTemplateReference parentTemplate
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
static String SOURCE_ROLE
          Label for the attribute.
 
Fields inherited from class wt.fc.ObjectToObjectLink
ROLE_AOBJECT_REF, ROLE_BOBJECT_REF
 
Fields inherited from class wt.fc.WTObject
CREATE_TIMESTAMP, MODIFY_TIMESTAMP
 
Fields inherited from interface wt.fc.BinaryLink
ALL_ROLES, BOTH_ROLES, ROLE_AOBJECT_ROLE, ROLE_BOBJECT_ROLE
 
Fields inherited from interface wt.fc.Persistable
IDENTITY, PERSIST_INFO, TYPE
 
Fields inherited from interface wt.identity.DisplayIdentification
DISPLAY_IDENTIFIER, DISPLAY_IDENTITY, DISPLAY_TYPE
 
Constructor Summary
NodeTemplateLink()
           
 
Method Summary
 boolean addEventActionPair(Object event, Object action)
          Adds an event-action pair to the link.
private  void checkAction(Object action)
          Checks if the destination action is valid.
private  void checkEvent(Object event)
          Checks if the source event is valid.
 NodeTemplateLink copy(WfNodeTemplate source, WfNodeTemplate destination)
          Produces a transient, shallow copy of the link template.
 WfLink createWfLink(WfContainer container, WfNode source, WfNode destination)
          Creates a workflow link using the information contained in the template.
 boolean equals(Object obj)
          Indicates whether the given object is equal to this object from a persistence perspective, by comparing the two objects ObjectIdentifiers.
 boolean fires()
          Returns if any event is mapped into the FIRE action (for connectors).
 Object getAction(Object event)
          Returns the action associated with the event passed as argument.
 Enumeration getAllActions()
          Returns an enumeration with all destination actions valid for the link.
 Enumeration getAllEvents()
          Returns an enumeration with all source events valid for the link.
 String getConceptualClassname()
          Deprecated.  
 WfNodeTemplate getDestination()
          Gets the object for the association that plays role: DESTINATION_ROLE.
protected  EventActionTable getEventActionMap()
          Gets the value of the attribute: EVENT_ACTION_MAP.
 WfTemplateLinkType getLinkType()
          Gets the value of the attribute: LINK_TYPE.
 Enumeration getMappedActions()
          Returns an enumeration with all destination actions that are mapped to by some event.
 Enumeration getMappedEvents()
          Returns an enumeration containing events that are mapped to actions.
 WfContainerTemplateReference getParentTemplate()
          Gets the value of the attribute: PARENT_TEMPLATE.
 WfNodeTemplate getSource()
          Gets the object for the association that plays role: SOURCE_ROLE.
 int hashCode()
          Returns a hash code for this object based upon its ObjectIdentifier.
protected  void initialize(WfNodeTemplate source, WfNodeTemplate destination)
          Link initialization.
 boolean isBackLoop()
          Gets the value of the attribute: BACK_LOOP.
 boolean isValid()
          Returns whether or node the link is valid.
static NodeTemplateLink newNodeTemplateLink(WfNodeTemplate source, WfNodeTemplate destination)
          Default factory for the class.
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
 void readExternal(PersistentRetrieveIfc input)
          Used by Persistent Data Service to populate the persistent attributes of this class from a persistent store.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(NodeTemplateLink thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 boolean removeEventActionPair(Object event)
          Removes an event-action pair mapping from the link, given the event.
 void replaceEventActionPair(Object event, Object action)
          Replaces an event-action pair to the link.
 void setBackLoop(boolean a_BackLoop)
          Sets the value of the attribute: BACK_LOOP.
 void setDestination(WfNodeTemplate destination)
          Sets the object for the association that plays role: DESTINATION_ROLE.
protected  void setEventActionMap(EventActionTable a_EventActionMap)
          Sets the value of the attribute: EVENT_ACTION_MAP.
 void setLinkType(WfTemplateLinkType a_LinkType)
          Sets the value of the attribute: LINK_TYPE.
 void setParentTemplate(WfContainerTemplateReference a_ParentTemplate)
          Sets the value of the attribute: PARENT_TEMPLATE.
 void setSource(WfNodeTemplate source)
          Sets the object for the association that plays role: SOURCE_ROLE.
 String toString()
          Returns string representation of the object.
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 void writeExternal(PersistentStoreIfc output)
          Used by Persistent Data Service to obtain the values of the persistent attributes of this class, so they can be written to a persistent store.
 
Methods inherited from class wt.fc.ObjectToObjectLink
appendJoinCriteria, appendRoleCriteria, duplicate, getAllObjects, getJoinValues, getLinkInfo, getObject, getOtherObject, getRemoteRoleAObjectId, getRemoteRoleBObjectId, getRole, getRoleAObject, getRoleAObjectId, getRoleAObjectRef, getRoleBObject, getRoleBObjectId, getRoleBObjectRef, getRoleIdName, getRoleObject, initialize, isRoleANonpersistentProxy, isRoleBNonpersistentProxy, readVersion, setRoleAObject, setRoleAObjectRef, setRoleBObject, setRoleBObjectRef, setRoleObject
 
Methods inherited from class wt.fc.WTObject
checkAttributes, finalize, getClassInfo, getCreateTimestamp, getDisplayIdentifier, getDisplayIdentity, getDisplayType, getIdentity, getModifyTimestamp, getPersistInfo, getType, initialize, readVersion, setPersistInfo
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface wt.fc.Persistable
checkAttributes, getIdentity, getPersistInfo, getType, setPersistInfo
 
Methods inherited from interface wt.fc.NetFactor
getClassInfo
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

SOURCE_ROLE

public static final String SOURCE_ROLE
Label for the attribute.

Supported API: false

See Also:
Constant Field Values

DESTINATION_ROLE

public static final String DESTINATION_ROLE
Label for the attribute.

Supported API: false

See Also:
Constant Field Values

LINK_TYPE

public static final String LINK_TYPE
Label for the attribute; Type of the link. Describes the classes of the source and destination nodes. Set at time of object initialization and not changed during the lifetime of the object.

Supported API: false

See Also:
Constant Field Values

LINK_TYPE_UPPER_LIMIT

private static int LINK_TYPE_UPPER_LIMIT

linkType

private WfTemplateLinkType linkType

EVENT_ACTION_MAP

protected static final String EVENT_ACTION_MAP
Label for the attribute; Table that maps events in the source node to actions in the destination node.

Supported API: false

See Also:
Constant Field Values

EVENT_ACTION_MAP_UPPER_LIMIT

private static int EVENT_ACTION_MAP_UPPER_LIMIT

eventActionMap

private EventActionTable eventActionMap

PARENT_TEMPLATE

public static final String PARENT_TEMPLATE
Label for the attribute; Reference to the parent process template.

Supported API: false

See Also:
Constant Field Values

parentTemplate

private WfContainerTemplateReference parentTemplate

BACK_LOOP

public static final String BACK_LOOP
Label for the attribute; Determines if the link is used to create a "loop" or iteration. At execution time, when links instantiated from a loop link are traversed, then all reachable activities to reset and all reachable connectors to enable.

Supported API: false

See Also:
Constant Field Values

backLoop

private boolean backLoop

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values
Constructor Detail

NodeTemplateLink

public NodeTemplateLink()
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class ObjectToObjectLink
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class ObjectToObjectLink
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(NodeTemplateLink thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(PersistentStoreIfc output)
                   throws SQLException,
                          DatastoreException
Used by Persistent Data Service to obtain the values of the persistent attributes of this class, so they can be written to a persistent store.

(Not intended for general use.)

Supported API: false

Specified by:
writeExternal in interface ObjectMappable
Overrides:
writeExternal in class ObjectToObjectLink
Parameters:
output -
Throws:
SQLException
DatastoreException

readExternal

public void readExternal(PersistentRetrieveIfc input)
                  throws SQLException,
                         DatastoreException
Used by Persistent Data Service to populate the persistent attributes of this class from a persistent store.

(Not intended for general use.)

Supported API: false

Specified by:
readExternal in interface ObjectMappable
Overrides:
readExternal in class ObjectToObjectLink
Parameters:
input -
Throws:
SQLException
DatastoreException

getSource

public WfNodeTemplate getSource()
Gets the object for the association that plays role: SOURCE_ROLE.

Supported API: false

Returns:
WfNodeTemplate

setSource

public void setSource(WfNodeTemplate source)
               throws WTPropertyVetoException
Sets the object for the association that plays role: SOURCE_ROLE.

Supported API: false

Parameters:
source -
Throws:
WTPropertyVetoException

getDestination

public WfNodeTemplate getDestination()
Gets the object for the association that plays role: DESTINATION_ROLE.

Supported API: false

Returns:
WfNodeTemplate

setDestination

public void setDestination(WfNodeTemplate destination)
                    throws WTPropertyVetoException
Sets the object for the association that plays role: DESTINATION_ROLE.

Supported API: false

Parameters:
destination -
Throws:
WTPropertyVetoException

getConceptualClassname

public String getConceptualClassname()
Deprecated.  

Returns the conceptual (modeled) name for the class.

Supported API: false

Specified by:
getConceptualClassname in interface NetFactor
Returns:
String

getLinkType

public WfTemplateLinkType getLinkType()
Gets the value of the attribute: LINK_TYPE. Type of the link. Describes the classes of the source and destination nodes. Set at time of object initialization and not changed during the lifetime of the object.

Supported API: false

Returns:
WfTemplateLinkType

setLinkType

public void setLinkType(WfTemplateLinkType a_LinkType)
Sets the value of the attribute: LINK_TYPE. Type of the link. Describes the classes of the source and destination nodes. Set at time of object initialization and not changed during the lifetime of the object.

Supported API: false

Parameters:
a_LinkType -

getEventActionMap

protected EventActionTable getEventActionMap()
Gets the value of the attribute: EVENT_ACTION_MAP. Table that maps events in the source node to actions in the destination node.

Supported API: false

Returns:
EventActionTable

setEventActionMap

protected void setEventActionMap(EventActionTable a_EventActionMap)
Sets the value of the attribute: EVENT_ACTION_MAP. Table that maps events in the source node to actions in the destination node.

Supported API: false

Parameters:
a_EventActionMap -

getParentTemplate

public WfContainerTemplateReference getParentTemplate()
Gets the value of the attribute: PARENT_TEMPLATE. Reference to the parent process template.

Supported API: false

Returns:
WfContainerTemplateReference

setParentTemplate

public void setParentTemplate(WfContainerTemplateReference a_ParentTemplate)
Sets the value of the attribute: PARENT_TEMPLATE. Reference to the parent process template.

Supported API: false

Parameters:
a_ParentTemplate -

isBackLoop

public boolean isBackLoop()
Gets the value of the attribute: BACK_LOOP. Determines if the link is used to create a "loop" or iteration. At execution time, when links instantiated from a loop link are traversed, then all reachable activities to reset and all reachable connectors to enable.

Supported API: false

Returns:
boolean

setBackLoop

public void setBackLoop(boolean a_BackLoop)
                 throws WTPropertyVetoException
Sets the value of the attribute: BACK_LOOP. Determines if the link is used to create a "loop" or iteration. At execution time, when links instantiated from a loop link are traversed, then all reachable activities to reset and all reachable connectors to enable.

Supported API: false

Parameters:
a_BackLoop -
Throws:
WTPropertyVetoException

toString

public String toString()
Returns string representation of the object. Used mostly for debugging purposes: not appropriate for GUI use.

Supported API: false

Overrides:
toString in class WTObject
Returns:
String

createWfLink

public WfLink createWfLink(WfContainer container,
                           WfNode source,
                           WfNode destination)
                    throws WTException
Creates a workflow link using the information contained in the template. The linkType is used to generate the specific link class and the appropriate attributes with their initial values.

Supported API: false

Parameters:
container -
source -
destination -
Returns:
WfLink
Throws:
WTException
See Also:
ActivityActivityLink, ActivityConnectorLink, ConnectorActivityLink, ConnectorConnectorLink

addEventActionPair

public boolean addEventActionPair(Object event,
                                  Object action)
                           throws InvalidEventException,
                                  InvalidActionException
Adds an event-action pair to the link. Returns true if there was no pair with the same event; otherwise returns false. Throws an exception 'InvalidEventException' if event is not proper for the source node of the link and a 'InvalidActionException' if the action is not a valid action for the destination.

Supported API: false

Parameters:
event -
action -
Returns:
boolean
Throws:
InvalidEventException
InvalidActionException

removeEventActionPair

public boolean removeEventActionPair(Object event)
                              throws InvalidEventException
Removes an event-action pair mapping from the link, given the event. Returns true if there was a pair with the same event; otherwise returns false. Throws an exception 'InvalidEventException' if event is not proper for the source node of the link.

Supported API: false

Parameters:
event -
Returns:
boolean
Throws:
InvalidEventException

getAction

public Object getAction(Object event)
                 throws InvalidEventException
Returns the action associated with the event passed as argument. Returns null if there was no pair with the given event. Throws an exception 'InvalidEventException' if event is not proper for the source node of the link.

Supported API: false

Parameters:
event -
Returns:
Object
Throws:
InvalidEventException

getAllEvents

public Enumeration getAllEvents()
Returns an enumeration with all source events valid for the link. This is a convenience method. The same result could be achieved by navigating to the source and reading its source events.

Supported API: false

Returns:
Enumeration

getMappedEvents

public Enumeration getMappedEvents()
Returns an enumeration containing events that are mapped to actions.

Supported API: false

Returns:
Enumeration

replaceEventActionPair

public void replaceEventActionPair(Object event,
                                   Object action)
                            throws InvalidEventException,
                                   InvalidActionException
Replaces an event-action pair to the link. If there is no pair mapped by the event, the pair is added to the link. Throws an exception 'InvalidEventException' if event is not proper for the source node of the link and a 'InvalidActionException' if the action is not a valid action for the destination.

Supported API: false

Parameters:
event -
action -
Throws:
InvalidEventException
InvalidActionException

getAllActions

public Enumeration getAllActions()
Returns an enumeration with all destination actions valid for the link. This is a convenience method. The same result could be achieved by navigating to the destination and reading its destination actions.

Supported API: false

Returns:
Enumeration

getMappedActions

public Enumeration getMappedActions()
Returns an enumeration with all destination actions that are mapped to by some event.

Supported API: false

Returns:
Enumeration

copy

public NodeTemplateLink copy(WfNodeTemplate source,
                             WfNodeTemplate destination)
                      throws WTException
Produces a transient, shallow copy of the link template. The copy is contained in the process template passed as argument.

Supported API: false

Parameters:
source -
destination -
Returns:
NodeTemplateLink
Throws:
WTException

fires

public boolean fires()
Returns if any event is mapped into the FIRE action (for connectors).

Supported API: false

Returns:
boolean

isValid

public boolean isValid()
Returns whether or node the link is valid. A valid link is one that has at least one valid event-action pair; that is the event is a source event and the destination is a destination action.

Supported API: false

Returns:
boolean

newNodeTemplateLink

public static NodeTemplateLink newNodeTemplateLink(WfNodeTemplate source,
                                                   WfNodeTemplate destination)
                                            throws WTException
Default factory for the class.

Supported API: false

Parameters:
source -
destination -
Returns:
NodeTemplateLink
Throws:
WTException

equals

public boolean equals(Object obj)
Indicates whether the given object is equal to this object from a persistence perspective, by comparing the two objects ObjectIdentifiers. Changed or stale copies are still considered equal by this method. Delegates to PersistenceHelper.equals(Persistable,Object).

Warning: Certain core Windchill operations may depend upon equals being ObjectIdentifier-based. Changes to the default implementation should be done with care, if at all.

Supported API: false

Overrides:
equals in class ObjectToObjectLink
Parameters:
obj -
Returns:
boolean

hashCode

public int hashCode()
Returns a hash code for this object based upon its ObjectIdentifier. Delegates to PersistenceHelper.hashCode(Persistable).

Warning: Certain core Windchill operations may depend upon hashCode being ObjectIdentifier-based. Changes to the default implementation should be done with care, if at all.

Supported API: false

Overrides:
hashCode in class ObjectToObjectLink
Returns:
int

initialize

protected void initialize(WfNodeTemplate source,
                          WfNodeTemplate destination)
                   throws WTException
Link initialization. Performs the following checks:

Sets the eventActionMap to the default mapping. The default mapping depends of the type of the link, as follows:

 +--------------+-----------------------------------------+
 |              |  Activity                 Connector     |
 +--------------+-----------------------------------------+
 | Activity     |  COMPLETE/START           COMPLETE/FIRE |
 +--------------+-----------------------------------------+
 | Connector    |  FIRE/START               FIRE/FIRE     |
 +--------------+-----------------------------------------+
 
If the source is also a router, the mapping is not initialized.

Parameters:
source -
destination -
Throws:
WTException

checkEvent

private void checkEvent(Object event)
                 throws InvalidEventException
Checks if the source event is valid. Throws InvalidEventException if it is not.

Parameters:
event -
Throws:
InvalidEventException

checkAction

private void checkAction(Object action)
                  throws InvalidActionException
Checks if the destination action is valid. Throws InvalidActionException if it is not.

Throws:
InvalidEventException
InvalidActionException