|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.fc.WTObject
wt.workflow.definer.WfExpression
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
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 ObjectIdentifier s. |
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 |
private static final String RESOURCE
private static final String CLASSNAME
public static final String TRANSITION
private static int TRANSITION_UPPER_LIMIT
private String transition
public static final String TEMPLATE_REF
private ObjectReference templateRef
public static final String EXPR_BODY
private static int EXPR_BODY_UPPER_LIMIT
private String exprBody
public static final String COMPILATION_MESSAGE
private String compilationMessage
public static final String COMPILED
private boolean compiled
private static final String EXPR_PACKAGE
private static final String EXPR_FILE_DIR
private static final String JAVA_COMMAND
public static final String ROBOT_EXPRESSION
public static final String SYNCH_EXPRESSION
public static final String INITIAL_SYNCH_EXPRESSION
public static final String ROUTER_EXPRESSION
public static final String BLOCK_EXPRESSION
static final long serialVersionUID
public static final long EXTERNALIZATION_VERSION_UID
protected static final long OLD_FORMAT_VERSION_UID
private static final String CLASS_PREFFIX
private static final String METHOD_PREFFIX
private static final String ROUTER_METHOD
private static final String RESULT_VAR_NAME
private static final String CONTEXT_ARG_NAME
private static final String USER_EVENTS_ARG_NAME
private static final String EVENT_ARG_NAME
private static final String TARGET_ID_ARG_NAME
private static final String EVENT_KEY_ARG_NAME
private static final int MESSAGE_SIZE
private static boolean DELETE_EXPR_FILE
private static boolean VERBOSE_DEFINE
private static boolean VERBOSE_EXECUTE
private static boolean VERBOSE
private static int varNumber
Object lock
Constructor Detail |
public WfExpression()
Method Detail |
public void writeExternal(ObjectOutput output) throws IOException
writeExternal
in interface Externalizable
writeExternal
in class WTObject
output
-
IOException
public void readExternal(ObjectInput input) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
readExternal
in class WTObject
input
-
IOException
ClassNotFoundException
protected boolean readVersion(WfExpression thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone) throws IOException, ClassNotFoundException
thisObject
- input
- readSerialVersionUID
- passThrough
- superDone
-
IOException
ClassNotFoundException
private boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone) throws IOException, ClassNotFoundException
input
- readSerialVersionUID
- passThrough
- superDone
-
IOException
ClassNotFoundException
public void writeExternal(PersistentStoreIfc output) throws SQLException, DatastoreException
(Not intended for general use.)
Supported API: false
writeExternal
in interface ObjectMappable
writeExternal
in class WTObject
output
-
SQLException
DatastoreException
public void readExternal(PersistentRetrieveIfc input) throws SQLException, DatastoreException
(Not intended for general
use.)
Supported API: false
readExternal
in interface ObjectMappable
readExternal
in class WTObject
input
-
SQLException
DatastoreException
public String getConceptualClassname()
getConceptualClassname
in interface NetFactor
public String getTransition()
protected void setTransition(String a_Transition)
a_Transition
- public ObjectReference getTemplateRef()
protected void setTemplateRef(ObjectReference a_TemplateRef)
a_TemplateRef
- public String getExprBody()
public void setExprBody(String a_ExprBody)
a_ExprBody
- public String getCompilationMessage()
protected void setCompilationMessage(String a_CompilationMessage)
a_CompilationMessage
- public boolean isCompiled()
public void setCompiled(boolean a_Compiled)
a_Compiled
- public String getClassName()
public String getFileName()
public WfExpression compile() throws WTException
WTException
public WfExpression compile(ProcessDataInfo signature) throws WTException
signature
-
WTException
public Object execute(Object[] args) throws WTException
args
-
WTException
public Object execute(Object[] args, Object event) throws WTException
args
- event
-
WTException
public Object execute(Object[] args, ObjectIdentifier target_id, String event_key) throws WTException
args
- target_id
- event_key
-
WTException
public String toString()
toString
in class WTObject
protected ProcessDataInfo getContextSignature() throws WTException
WTException
protected String getExprMethod(ProcessDataInfo signature) throws WTException
signature
-
WTException
protected String getMethods(ObjectReference template_ref, ProcessDataInfo signature) throws WTException
template_ref
- signature
-
WTException
public static WfExpression newWfExpression(WfNodeTemplate template) throws WTException
template
-
WTException
protected void initialize(WfNodeTemplate template) throws WTException
template
-
WTException
public static WfExpression newWfExpression(WfNodeTemplate template, Object expr_type) throws WTException
template
- expr_type
-
WTException
protected void initialize(WfNodeTemplate template, Object expr_type) throws WTException
template
- expr_type
-
WTException
public WfExpression copy(WfNodeTemplate template) throws WTException
template
-
WTException
public boolean equals(Object obj)
ObjectIdentifier
s.
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
equals
in class WTObject
obj
-
public int hashCode()
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
hashCode
in class WTObject
private String getVarName()
private String getMethodName()
private String getImportStmts(ProcessDataInfo signature) throws WTException
WTException
private void createFile(ProcessDataInfo signature) throws WTException
WTException
private void deleteFile()
private String getVariableAssignment(ProcessDataInfo signature) throws WTException
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];
WTException
private String getContextAssignment(ProcessDataInfo signature) throws WTException
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;
WTException
private String getRouterMethod(ProcessDataInfo signature) throws WTException
WTException
private String getSynchMethod(ProcessDataInfo signature) throws WTException
WTException
private void appendResultCheck(StringBuffer buf)
private void appendEventCheckMethod(StringBuffer buf)
private String getWorkMethod(ProcessDataInfo signature) throws WTException
WTException
private Object executeTransition(Class target_cls, Object[] values) throws WTException
target_cls
- - expression classvalues
- - object array containing execution object variable values.
WTException
private Object executeFilter(Class target_cls, Object[] values, Object[] user_events, Object event) throws WTException
target_cls
- - expression classvalues
- - object array containing execution object variable values.event
- - KeyedEvent object.
WTException
private Object executeFilter(Class target_cls, Object[] values, Object[] user_events, ObjectIdentifier target_id, String event_key) throws WTException
target_cls
- - expression classvalues
- - object array containing execution object variable values.
WTException
private Object executeRouter(Class target_cls, Object[] values, Object[] user_events) throws WTException
target_cls
- - expression classvalues
- - object array containing execution object variable values.
WTException
private String getLastName(Class var_class)
var_class
-
private String getWrapperClassName(Class var_class)
var_class
-
private String getMessage(InputStream stream) throws IOException
IOException
protected void checkConsistency(WfNodeTemplate template, Object expr_type) throws WTException
WTException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |