A class that represents a Process Flow token.
|activity||Gets a reference to the token's current activity.|
|childRank||Gets the rank of the child token.|
|children||Accesses the token's children.|
|color||Gets or sets the color of the token.|
|entryTime||Gets the model time of when the token entered its current activity.|
|id||Gets the token's unique ID.|
|instance||Gets the token's Process Flow instance.|
|labelProperties||Use your own named properties to get/set label values.|
|labels||Accesses a node's labels as nodes.|
|name||Gets and sets the token's name.|
|parent||Gets the token's parent.|
|processFlow||Gets the token's Process Flow object.|
|stopCount||Gets the number of stops for the token.|
|byID||Gets the token associated with the id.|
|release||Releases the token from its current activity.|
|resume||Removes a stop from the token.|
|setColor||Deprecated. Use the color property. Sets the color of the token.|
|setShape||Sets the shape of the token.|
|stop||Adds a stop to the token|
|create||Creates a token and places it inside the activity for the given owner object (instance).|
Accesses the token's children.
Accessing the Number of Children
You can access the number of children on the token with the following code.
Accessing Children by Rank
You can access an individual child token by rank with the following code.
token.children // first child token.children[token.children.length] // last child token.children[i] // i-th child
Getting an Array of Objects
You can get an Array of all child tokens with the following code.
Array childTokens = token.children.toArray();
Use your own named properties to get/set label values.
Works just like labelProperties on treenodes.
|Token byID( int id , Variant processFlow = NULL )|
|id||The unique id number of the token.|
|processFlow||If no process flow is defined, this will search through every ProcessFlow object in the model. When there are multiple process flow objects you can pass in the process flow object (or name) where the token resides for a faster search.|
Gets the token associated with the id.Token's have their own unique id among all instances of all ProcessFlow objects.
Token token = Token.byID(25); Token token = Token.byID(4, "ProcessFlow1");
|release( Variant connector )|
|connector||If this is a number or a string, it identifies the connector to be released to. If it is an object, it directly references the new activity to "jump" to.|
Releases the token from its current activity.
|setColor( int red , int green , int blue , int alpha )|
|red||The red color component [0 - 255].|
|green||The green color component [0 - 255].|
|blue||The blue color component [0 - 255].|
|alpha||The alpha color component [0 - 255].|
Deprecated. Use the color property. Sets the color of the token.This overrides the Token Colors functionality defined in the visual properties of the process flow object.
token.setColor(255, 0, 0);
Adds a stop to the tokenUsually, this method is called when the token is blocked in an activity, such as a Delay. In this case, the token will not leave the activity. The following table describes the effect of stopping the token in various activities, if the token was not previously stopped:
|Activity||Effect of stop()|
|Delay||The token's exit time is postponed.|
|Push To List||The token's Push Value is removed from the list.|
|Pull From List||The token's back order is removed from the list.|
|Enter Zone||The token's request to enter the zone is destroyed.|
|Acquire||The token's request to acquire the resource is destroyed.|
|Batch||The token is remove from its batch. If it was the only token in the batch, the batch is destroyed.|
|Wait for Event||The token's listener for the specified event is destroyed.|
|Synchronize/Join||The token is removed from its wave. If it was the only token in the wave, the wave is destroyed.|
|Travel||The task sequence created by this activity is preempted. This is true for all Task Sequence activities.|
|static Token create( treenode ownerNode , Variant activity , int start = 0 , Token parent = NULL , int labelAcess = 1 )|
|ownerNode||The owner object of the process flow. For a General Process Flow this is the process flow object. For a Fixed Resource, Task Executer or Sub Flow, this is the attached object.|
|activity||This can be the activity node or the name of the activity. If this is the activity node in a General Process Flow, ownerNode may be NULL.|
|start||If start is 1, the token will immediately call the activity's start and begin moving through the process flow. If start is 0, the default, the token will sit in the activity until it is manually released. Calling the release method on the token will fire the activity's finish causing the activity's start to never be called. This may affect how the token responds to the activity it was created in. For example, if a token is created in an Assign Labels activity with a start of 1, the created token will evaluate the Assign Labels as if entering the activity and receive whatever labels are assigned to it. If a token is created in the same Assign Labels with a start of 0 and then later it is released, the token will never evaluate the Assign Labels and no labels will be assigned.|
|parent||If another token is specified here, the new token will be created as a child of this one.|
|labelAccess||This defines what access the child token has to its parent's labels.
The possible access types are:
Creates a token and places it inside the activity for the given owner object (instance).
Token aToken = Token.create(NULL, getactivity("ProcessFlow", "Start"), 0); //General Process Flow Token newToken = Token.create(Model.find("Processor1"), "Start", 0, aToken, TOKEN_LABEL_ACCESS_READ); newToken.Type = 1; newToken.release(0);