wt.workflow.definer
Class WfExpression

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

public class WfExpression
extends WTObject
implements Externalizable

The WfExpression class represents expressions that are associated to some workflow node objects. These expressions are executed during workflow enactment either for state transition("transition expressions') or to route the flow ('router expressions").

The expression is a sequence of Java statements. Transition expresions return a boolean value when executed. Router expressions return an object that is interpreted as an event. For both transition and router expressions the value is returned in a variable called "result." .

Use the newWfExpression static factory method(s), not the WfExpression 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 BLOCK_EXPRESSION
          Constant string that characterizes block expressions.
private static String CLASS_PREFFIX
           
private static String CLASSNAME
           
static String COMPILATION_MESSAGE
          Label for the attribute; Message resulting from the compilation command.
private  String compilationMessage
           
private  boolean compiled
           
static String COMPILED
          Label for the attribute; Records if the expression has been successfully compiled and loaded.
private static String CONTEXT_ARG_NAME
           
private static boolean DELETE_EXPR_FILE
           
private static String EVENT_ARG_NAME
           
private static String EVENT_KEY_ARG_NAME
           
static String EXPR_BODY
          Label for the attribute; Body of the expression.
private static int EXPR_BODY_UPPER_LIMIT
           
private static String EXPR_FILE_DIR
          Directory where the file coresponding to the expression is placed to be compiled by the java compiler.
private static String EXPR_PACKAGE
          Name of the package of the classes associated with expressions.
private  String exprBody
           
static long EXTERNALIZATION_VERSION_UID
           
static String INITIAL_SYNCH_EXPRESSION
          Constant string that characterizes initial synchronization expressions.
private static String JAVA_COMMAND
          Constant string with the java command used to compile the file associated with the expression.
(package private)  Object lock
           
private static int MESSAGE_SIZE
           
private static String METHOD_PREFFIX
           
protected static long OLD_FORMAT_VERSION_UID
           
private static String RESOURCE
           
private static String RESULT_VAR_NAME
           
static String ROBOT_EXPRESSION
          Constant string that characterizes robot expressions.
static String ROUTER_EXPRESSION
          Constant string that characterizes router expressions.
private static String ROUTER_METHOD
           
(package private) static long serialVersionUID
           
static String SYNCH_EXPRESSION
          Constant string that characterizes filter expressions.
private static String TARGET_ID_ARG_NAME
           
static String TEMPLATE_REF
          Label for the attribute; Reference to the template object which provides the variables used in the expression.
private  ObjectReference templateRef
           
private  String transition
           
static String TRANSITION
          Label for the attribute; Transition or event to which the expressionis associated.
private static int TRANSITION_UPPER_LIMIT
           
private static String USER_EVENTS_ARG_NAME
           
private static int varNumber
           
private static boolean VERBOSE
           
private static boolean VERBOSE_DEFINE
           
private static boolean VERBOSE_EXECUTE
           
 
Fields inherited from class wt.fc.WTObject
CREATE_TIMESTAMP, MODIFY_TIMESTAMP
 
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
WfExpression()
           
 
Method Summary
private  void appendEventCheckMethod(StringBuffer buf)
          Appends code to create a method that checks whether a returned event is valid.
private  void appendResultCheck(StringBuffer buf)
          Appends code to check if expression returns a valid event or a set of valid events.
protected  void checkConsistency(WfNodeTemplate template, Object expr_type)
          Throws exception if type is not consistent with template.
 WfExpression compile()
          Compiles and, if no errors are detected, loads the class generated from the expression.
 WfExpression compile(ProcessDataInfo signature)
          Compiles expression with the given context signature.
 WfExpression copy(WfNodeTemplate template)
          Returns a transient copy of the expression but associated with the template passed as argument.
private  void createFile(ProcessDataInfo signature)
          Creates and writes expression file.
private  void deleteFile()
          Deletes expression file.
 boolean equals(Object obj)
          Indicates whether the given object is equal to this object from a persistence perspective, by comparing the two objects ObjectIdentifiers.
 Object execute(Object[] args)
          Method used to execute the expression given an array of values.
 Object execute(Object[] args, Object event)
          Method used to execute the expression given an array of values and an event object.
 Object execute(Object[] args, ObjectIdentifier target_id, String event_key)
          Method used to execute the expression given an array of values, the object identifier of a target object and an event key.
private  Object executeFilter(Class target_cls, Object[] values, Object[] user_events, Object event)
          Executes filter expression.
private  Object executeFilter(Class target_cls, Object[] values, Object[] user_events, ObjectIdentifier target_id, String event_key)
          Executes filter expression.
private  Object executeRouter(Class target_cls, Object[] values, Object[] user_events)
          Executes router expression.
private  Object executeTransition(Class target_cls, Object[] values)
          Executes transition expression.
 String getClassName()
          Returns the name of the class associated with the expression.
 String getCompilationMessage()
          Gets the value of the attribute: COMPILATION_MESSAGE.
 String getConceptualClassname()
          Deprecated.  
private  String getContextAssignment(ProcessDataInfo signature)
          Returns a String containing assignments of the local variables to input argument elements.
protected  ProcessDataInfo getContextSignature()
          Returns the contextSignature (ProcessDataInfo object) of the associated template if this is not a connector.
 String getExprBody()
          Gets the value of the attribute: EXPR_BODY.
protected  String getExprMethod(ProcessDataInfo signature)
          Returns a String containing the code for the expression method.
 String getFileName()
          Returns the name of the file that corresponds to the expression.
private  String getImportStmts(ProcessDataInfo signature)
          Returns String containing the import statements.
private  String getLastName(Class var_class)
          Returns the non-qualified name of the class.
private  String getMessage(InputStream stream)
          Returns message from input stream passed as argument
private  String getMethodName()
          Returns String containing the name of the expression method.
protected  String getMethods(ObjectReference template_ref, ProcessDataInfo signature)
          Returns a String containing the code for all methods associated with the given template (given its reference).
private  String getRouterMethod(ProcessDataInfo signature)
          Returns the execution method for router expressions.
private  String getSynchMethod(ProcessDataInfo signature)
          Returns the execution method for synchronization expressions.
 ObjectReference getTemplateRef()
          Gets the value of the attribute: TEMPLATE_REF.
 String getTransition()
          Gets the value of the attribute: TRANSITION.
private  String getVariableAssignment(ProcessDataInfo signature)
          Returns String containing assignments of the input argument elements to local variables.
private  String getVarName()
          Returns String containing the name of a variable used by a router or transition method.
private  String getWorkMethod(ProcessDataInfo signature)
          Returns the execution method for expressions that have as input only the object's context.
private  String getWrapperClassName(Class var_class)
          Returns the name of the wrapper class.
 int hashCode()
          Returns a hash code for this object based upon its ObjectIdentifier.
protected  void initialize(WfNodeTemplate template)
          Supports initialization, following construction of an instance.
protected  void initialize(WfNodeTemplate template, Object expr_type)
          Supports initialization, following construction of an instance.
 boolean isCompiled()
          Gets the value of the attribute: COMPILED.
static WfExpression newWfExpression(WfNodeTemplate template)
          Deprecated. Use instead WfExpression.newWfExpression (WfNodeTemplate, WfExpression.ROUTER_EXPRESSION)
static WfExpression newWfExpression(WfNodeTemplate template, Object expr_type)
          Constructs a transition expression given the associated template and transition.
 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(WfExpression thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
protected  void setCompilationMessage(String a_CompilationMessage)
          Sets the value of the attribute: COMPILATION_MESSAGE.
 void setCompiled(boolean a_Compiled)
          Sets the value of the attribute: COMPILED.
 void setExprBody(String a_ExprBody)
          Sets the value of the attribute: EXPR_BODY.
protected  void setTemplateRef(ObjectReference a_TemplateRef)
          Sets the value of the attribute: TEMPLATE_REF.
protected  void setTransition(String a_Transition)
          Sets the value of the attribute: TRANSITION.
 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.WTObject
checkAttributes, duplicate, 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
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

TRANSITION

public static final String TRANSITION
Label for the attribute; Transition or event to which the expressionis associated. This attribute is null if and only if the expression is associated to a conditional router.

Supported API: false

See Also:
Constant Field Values

TRANSITION_UPPER_LIMIT

private static int TRANSITION_UPPER_LIMIT

transition

private String transition

TEMPLATE_REF

public static final String TEMPLATE_REF
Label for the attribute; Reference to the template object which provides the variables used in the expression. In case of state transitions the is the template of the object subject to state tarnsition; for conditionals, this is the template of the object that precedes the router.

Supported API: false

See Also:
Constant Field Values

templateRef

private ObjectReference templateRef

EXPR_BODY

public static final String EXPR_BODY
Label for the attribute; Body of the expression. Consists of a sequence of Java statements separated by semicolon and ending in a semi-colon. May reference the variables occurring in the context signature of the associated template object. May also contain references to arbitrary Java classes and methods, as long as: .

Supported API: false

See Also:
Constant Field Values

EXPR_BODY_UPPER_LIMIT

private static int EXPR_BODY_UPPER_LIMIT

exprBody

private String exprBody

COMPILATION_MESSAGE

public static final String COMPILATION_MESSAGE
Label for the attribute; Message resulting from the compilation command. This attribute is not stored in the database and can't be set externally. This is a transient attribute.

Supported API: false

See Also:
Constant Field Values

compilationMessage

private String compilationMessage

COMPILED

public static final String COMPILED
Label for the attribute; Records if the expression has been successfully compiled and loaded. This is a transient attribute.

Supported API: false

See Also:
Constant Field Values

compiled

private boolean compiled

EXPR_PACKAGE

private static final String EXPR_PACKAGE
Name of the package of the classes associated with expressions.


EXPR_FILE_DIR

private static final String EXPR_FILE_DIR
Directory where the file coresponding to the expression is placed to be compiled by the java compiler.


JAVA_COMMAND

private static final String JAVA_COMMAND
Constant string with the java command used to compile the file associated with the expression.


ROBOT_EXPRESSION

public static final String ROBOT_EXPRESSION
Constant string that characterizes robot expressions.

Supported API: false

See Also:
Constant Field Values

SYNCH_EXPRESSION

public static final String SYNCH_EXPRESSION
Constant string that characterizes filter expressions. Filter expressions are used in synchronization robots.

Supported API: false

See Also:
Constant Field Values

INITIAL_SYNCH_EXPRESSION

public static final String INITIAL_SYNCH_EXPRESSION
Constant string that characterizes initial synchronization expressions. This expression is executed when the synch robot starts. It can be used to check if the synchronization event hasn't already happened. The initial expression might return a null value, a Vector object and a non-null, non-Vector object. In the latter two cases the robot completes. If a Vector is returned, this Vector is interpreted as containing local events that are propagated; if a non-null. non-Vector object is returned the COMPLETE event is propagated.

Supported API: false

See Also:
Constant Field Values

ROUTER_EXPRESSION

public static final String ROUTER_EXPRESSION
Constant string that characterizes router expressions.

Supported API: false

See Also:
Constant Field Values

BLOCK_EXPRESSION

public static final String BLOCK_EXPRESSION
Constant string that characterizes block expressions.

Supported API: false

See Also:
Constant Field Values

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

CLASS_PREFFIX

private static final String CLASS_PREFFIX
See Also:
Constant Field Values

METHOD_PREFFIX

private static final String METHOD_PREFFIX
See Also:
Constant Field Values

ROUTER_METHOD

private static final String ROUTER_METHOD
See Also:
Constant Field Values

RESULT_VAR_NAME

private static final String RESULT_VAR_NAME
See Also:
Constant Field Values

CONTEXT_ARG_NAME

private static final String CONTEXT_ARG_NAME
See Also:
Constant Field Values

USER_EVENTS_ARG_NAME

private static final String USER_EVENTS_ARG_NAME
See Also:
Constant Field Values

EVENT_ARG_NAME

private static final String EVENT_ARG_NAME
See Also:
Constant Field Values

TARGET_ID_ARG_NAME

private static final String TARGET_ID_ARG_NAME
See Also:
Constant Field Values

EVENT_KEY_ARG_NAME

private static final String EVENT_KEY_ARG_NAME
See Also:
Constant Field Values

MESSAGE_SIZE

private static final int MESSAGE_SIZE
See Also:
Constant Field Values

DELETE_EXPR_FILE

private static boolean DELETE_EXPR_FILE

VERBOSE_DEFINE

private static boolean VERBOSE_DEFINE

VERBOSE_EXECUTE

private static boolean VERBOSE_EXECUTE

VERBOSE

private static boolean VERBOSE

varNumber

private static int varNumber

lock

Object lock
Constructor Detail

WfExpression

public WfExpression()
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 WTObject
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 WTObject
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(WfExpression 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 WTObject
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 WTObject
Parameters:
input -
Throws:
SQLException
DatastoreException

getConceptualClassname

public String getConceptualClassname()
Deprecated.  

Returns the conceptual (modeled) name for the class.

Supported API: false

Specified by:
getConceptualClassname in interface NetFactor
Returns:
String

getTransition

public String getTransition()
Gets the value of the attribute: TRANSITION. Transition or event to which the expressionis associated. This attribute is null if and only if the expression is associated to a conditional router.

Supported API: false

Returns:
String

setTransition

protected void setTransition(String a_Transition)
Sets the value of the attribute: TRANSITION. Transition or event to which the expressionis associated. This attribute is null if and only if the expression is associated to a conditional router.

Supported API: false

Parameters:
a_Transition -

getTemplateRef

public ObjectReference getTemplateRef()
Gets the value of the attribute: TEMPLATE_REF. Reference to the template object which provides the variables used in the expression. In case of state transitions the is the template of the object subject to state tarnsition; for conditionals, this is the template of the object that precedes the router.

Supported API: false

Returns:
ObjectReference

setTemplateRef

protected void setTemplateRef(ObjectReference a_TemplateRef)
Sets the value of the attribute: TEMPLATE_REF. Reference to the template object which provides the variables used in the expression. In case of state transitions the is the template of the object subject to state tarnsition; for conditionals, this is the template of the object that precedes the router.

Supported API: false

Parameters:
a_TemplateRef -

getExprBody

public String getExprBody()
Gets the value of the attribute: EXPR_BODY. Body of the expression. Consists of a sequence of Java statements separated by semicolon and ending in a semi-colon. May reference the variables occurring in the context signature of the associated template object. May also contain references to arbitrary Java classes and methods, as long as: .

Supported API: false

Returns:
String

setExprBody

public void setExprBody(String a_ExprBody)
Sets the value of the attribute: EXPR_BODY. Body of the expression. Consists of a sequence of Java statements separated by semicolon and ending in a semi-colon. May reference the variables occurring in the context signature of the associated template object. May also contain references to arbitrary Java classes and methods, as long as: .

Supported API: false

Parameters:
a_ExprBody -

getCompilationMessage

public String getCompilationMessage()
Gets the value of the attribute: COMPILATION_MESSAGE. Message resulting from the compilation command. This attribute is not stored in the database and can't be set externally. This is a transient attribute.

Supported API: false

Returns:
String

setCompilationMessage

protected void setCompilationMessage(String a_CompilationMessage)
Sets the value of the attribute: COMPILATION_MESSAGE. Message resulting from the compilation command. This attribute is not stored in the database and can't be set externally. This is a transient attribute.

Supported API: false

Parameters:
a_CompilationMessage -

isCompiled

public boolean isCompiled()
Gets the value of the attribute: COMPILED. Records if the expression has been successfully compiled and loaded. This is a transient attribute.

Supported API: false

Returns:
boolean

setCompiled

public void setCompiled(boolean a_Compiled)
Sets the value of the attribute: COMPILED. Records if the expression has been successfully compiled and loaded. This is a transient attribute.

Supported API: false

Parameters:
a_Compiled -

getClassName

public String getClassName()
Returns the name of the class associated with the expression.

Supported API: false

Returns:
String

getFileName

public String getFileName()
Returns the name of the file that corresponds to the expression. This file is a Java file containing the expression body embedded in appropriate Java code.

Supported API: false

Returns:
String

compile

public WfExpression compile()
                     throws WTException
Compiles and, if no errors are detected, loads the class generated from the expression. Returns the expression after the command. If the compilation succeeded, the attribute compiled is true and coimpilationMessage is null; otherwise compiled is false and compilationMessage contains the error message issued by the compilation command.

Supported API: false

Returns:
WfExpression
Throws:
WTException

compile

public WfExpression compile(ProcessDataInfo signature)
                     throws WTException
Compiles expression with the given context signature. If no errors are detected, loads the class generated from the expression. Returns the expression after the command. If the compilation succeeded, the attribute compiled is true and coimpilationMessage is null; otherwise compiled is false and compilationMessage contains the error message issued by the compilation command

Supported API: false

Parameters:
signature -
Returns:
WfExpression
Throws:
WTException

execute

public Object execute(Object[] args)
               throws WTException
Method used to execute the expression given an array of values. Compiles and loads the expression if it has not been compiled

Supported API: false

Parameters:
args -
Returns:
Object
Throws:
WTException

execute

public Object execute(Object[] args,
                      Object event)
               throws WTException
Method used to execute the expression given an array of values and an event object. Compiles and loads the expression if it has not been compiled

Supported API: false

Parameters:
args -
event -
Returns:
Object
Throws:
WTException

execute

public Object execute(Object[] args,
                      ObjectIdentifier target_id,
                      String event_key)
               throws WTException
Method used to execute the expression given an array of values, the object identifier of a target object and an event key. This method is used by synchronization robots to synchornize against events occurrring to specific events. Compiles and loads the expression if it has not been compiled

Supported API: false

Parameters:
args -
target_id -
event_key -
Returns:
Object
Throws:
WTException

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

getContextSignature

protected ProcessDataInfo getContextSignature()
                                       throws WTException
Returns the contextSignature (ProcessDataInfo object) of the associated template if this is not a connector. If the associated template is a connector returns the contextSignature if the containing process template.

Supported API: false

Returns:
ProcessDataInfo
Throws:
WTException

getExprMethod

protected String getExprMethod(ProcessDataInfo signature)
                        throws WTException
Returns a String containing the code for the expression method. Uses the signature passed as argument.

Supported API: false

Parameters:
signature -
Returns:
String
Throws:
WTException

getMethods

protected String getMethods(ObjectReference template_ref,
                            ProcessDataInfo signature)
                     throws WTException
Returns a String containing the code for all methods associated with the given template (given its reference). Uses the signature passed as argument.

Supported API: false

Parameters:
template_ref -
signature -
Returns:
String
Throws:
WTException

newWfExpression

public static WfExpression newWfExpression(WfNodeTemplate template)
                                    throws WTException
Deprecated. Use instead WfExpression.newWfExpression (WfNodeTemplate, WfExpression.ROUTER_EXPRESSION)

Constructs a router expression given the associated template.

Supported API: false

Parameters:
template -
Returns:
WfExpression
Throws:
WTException

initialize

protected void initialize(WfNodeTemplate template)
                   throws WTException
Supports initialization, following construction of an instance. Invoked by "new" factory having the same signature.

Supported API: false

Parameters:
template -
Throws:
WTException

newWfExpression

public static WfExpression newWfExpression(WfNodeTemplate template,
                                           Object expr_type)
                                    throws WTException
Constructs a transition expression given the associated template and transition.

Supported API: false

Parameters:
template -
expr_type -
Returns:
WfExpression
Throws:
WTException

initialize

protected void initialize(WfNodeTemplate template,
                          Object expr_type)
                   throws WTException
Supports initialization, following construction of an instance. Invoked by "new" factory having the same signature.

Supported API: false

Parameters:
template -
expr_type -
Throws:
WTException

copy

public WfExpression copy(WfNodeTemplate template)
                  throws WTException
Returns a transient copy of the expression but associated with the template passed as argument.

Supported API: false

Parameters:
template -
Returns:
WfExpression
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 WTObject
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 WTObject
Returns:
int

getVarName

private String getVarName()
Returns String containing the name of a variable used by a router or transition method. This is name must not conflict with user defined variable names. Also a different one should be returned everytime the method is called.


getMethodName

private String getMethodName()
Returns String containing the name of the expression method. This is name is obtained by concatenating the method preffix ("execute") with the transition string.


getImportStmts

private String getImportStmts(ProcessDataInfo signature)
                       throws WTException
Returns String containing the import statements. The import statements are derived from the variables contained in execution object.

Throws:
WTException

createFile

private void createFile(ProcessDataInfo signature)
                 throws WTException
Creates and writes expression file.

Throws:
WTException

deleteFile

private void deleteFile()
Deletes expression file.


getVariableAssignment

private String getVariableAssignment(ProcessDataInfo signature)
                              throws WTException
Returns String containing assignments of the input argument elements to local variables. The assignment is different depending whether the varaible is a primititive Java type or not.

For primitive types:

 type_name variable_name = ((wrapper_type) context [index]).type_nameValue ();
 
For example, for 'int' types, the assignment generated is the following (for a variable 'i' which happens to be the 3rd variable in the context input.
 int i = ((Integer) context [2]).intValue ();
 
Note that for primitive types it implicitly assumes the context array element is not null. This is guaranteed by the requirement of the existence of a default value in every primitive type variable.

The assignment generated for non-primitive types is simpler:

 type_name variable_name = (type_name) context [index];
 
For example, for a String variable 's', of index 5, the following assignment is generated:
 String s = (String) context [5];
 

Throws:
WTException

getContextAssignment

private String getContextAssignment(ProcessDataInfo signature)
                             throws WTException
Returns a String containing assignments of the local variables to input argument elements. Each assignment format is different depending whether the type is a primitive Java type or not.

For primitive types:

 context [index] = new wrapper_type (variable_name);
 
For example, for 'int' types, the assignment generated is the following (for a variable 'i' which happens to be the 3rd variable in the context input.
 context [2] = new Integer (i);
 

The assignment generated for non-primitive types is even simpler:

 context [index] = variable_name;
 
For example, for a String variable 's', of index 5, the following assignment is generated:
 context [5] = s;
 

Throws:
WTException

getRouterMethod

private String getRouterMethod(ProcessDataInfo signature)
                        throws WTException
Returns the execution method for router expressions.

Returns:
java.lang.String
Throws:
WTException

getSynchMethod

private String getSynchMethod(ProcessDataInfo signature)
                       throws WTException
Returns the execution method for synchronization expressions. In addition to context and user events, it takes a KeyedEvent as argument.

Returns:
java.lang.String
Throws:
WTException

appendResultCheck

private void appendResultCheck(StringBuffer buf)
Appends code to check if expression returns a valid event or a set of valid events.


appendEventCheckMethod

private void appendEventCheckMethod(StringBuffer buf)
Appends code to create a method that checks whether a returned event is valid.


getWorkMethod

private String getWorkMethod(ProcessDataInfo signature)
                      throws WTException
Returns the execution method for expressions that have as input only the object's context.

Returns:
java.lang.String
Throws:
WTException

executeTransition

private Object executeTransition(Class target_cls,
                                 Object[] values)
                          throws WTException
Executes transition expression.

Parameters:
target_cls - - expression class
values - - object array containing execution object variable values.
Returns:
java.lang.Object
Throws:
WTException

executeFilter

private Object executeFilter(Class target_cls,
                             Object[] values,
                             Object[] user_events,
                             Object event)
                      throws WTException
Executes filter expression.

Parameters:
target_cls - - expression class
values - - object array containing execution object variable values.
event - - KeyedEvent object.
Returns:
java.lang.Object
Throws:
WTException

executeFilter

private Object executeFilter(Class target_cls,
                             Object[] values,
                             Object[] user_events,
                             ObjectIdentifier target_id,
                             String event_key)
                      throws WTException
Executes filter expression.

Parameters:
target_cls - - expression class
values - - object array containing execution object variable values.
Returns:
java.lang.Object
Throws:
WTException

executeRouter

private Object executeRouter(Class target_cls,
                             Object[] values,
                             Object[] user_events)
                      throws WTException
Executes router expression.

Parameters:
target_cls - - expression class
values - - object array containing execution object variable values.
Returns:
java.lang.Object
Throws:
WTException

getLastName

private String getLastName(Class var_class)
Returns the non-qualified name of the class.

Parameters:
var_class -
Returns:
java.lang.String

getWrapperClassName

private String getWrapperClassName(Class var_class)
Returns the name of the wrapper class. Assumes the class passed as parameter is a primitive Java type.

Parameters:
var_class -
Returns:
java.lang.String

getMessage

private String getMessage(InputStream stream)
                   throws IOException
Returns message from input stream passed as argument

Throws:
IOException

checkConsistency

protected void checkConsistency(WfNodeTemplate template,
                                Object expr_type)
                         throws WTException
Throws exception if type is not consistent with template.

Throws:
WTException