Property editing

These optional entry points support editing and validating properties defined in the script declaration; see Property definition properties, Property editors and Validating property values.

getLibraryForProperty( s : Switch, tag : String ) : String[ ]

Invoked when a user chooses the "Select from library" or "Select many from library" property editor in the designer for one of this script's properties. The second argument specifies the tag of the property involved in the operation.

Returns the list of strings to display in the property editor dialog.

If this entry point is absent, it is considered to return an empty list.

getLibraryForConnectionProperty( s : Switch, c : Connection, tag : String ) : String[ ]

Invoked when a user chooses the "Select from library" or "Select many from library" property editor in the designer for a property injected on this script's outgoing connections. The second and third arguments specify the connection and the tag of the property involved in the operation.

Returns the list of strings to display in the property editor dialog.

If this entry point is absent, the getLibraryForProperty entry point is invoked instead, omitting the connection argument. This is meaningful in case the result does not depend on the connection involved in the operation.

isPropertyValid( s : Switch, tag : String, value : String ) : Boolean

Invoked at appropriate times to validate the value of a property for the script with "custom" validation, example: when the user changes the property value in the designer, when the user attempts to activate the flow in which the script resides, or just before invoking the jobArrived entry point (while the flow is running). See validating property values.

The second argument specifies the tag of the property that needs to be validated.

The third argument specifies the current value of the property. It is provided for convenience only; it is identical to the return value of getPropertyValue(tag).

Returns true if the value of the specified property is deemed valid, false otherwise.

If this entry point is absent, it is considered to return false.

isConnectionPropertyValid( s : Switch, c : Connection, tag : String, value : String ) : Boolean

Invoked at appropriate times to validate the value of a property injected on this script's outgoing connections with "custom" validation, example: when the user changes the property value in the designer, when the user attempts to activate the flow in which the script resides, or just before invoking the jobArrived entry point (while the flow is running). See validating property values.

The second and third arguments specify the connection and the tag of the property involved in the operation. The last argument specifies the current value of the property. It is provided for convenience only; it is identical to the return value of getPropertyValue(tag).

Returns true if the value of the specified property is deemed valid, false otherwise.

If this entry point is absent, the isPropertyValid entry point is invoked instead, omitting the connection argument. This is meaningful in case the result doesn't depend on the connection involved in the operation.

No run-time context

These entry points are often invoked while the flow is inactive, which means there is no valid flow run-time context and no valid job context. As a consequence, within these entry points calling the following Switch class functions has undefined (and possibly destructive) results:


It is safe to call the Switch class functions for accessing the flow definition and accessing injected properties and any of the Environment class functions inherited by the Switch class.

Variables and script expressions

Furthermore, when the flow is inactive, there is no way to determine the value of a property that contains a variable or a script expression. Thus in that case the getPropertyValue() and getPropertyValueList() functions return the source value of a property instead of its computed value (that is, the variable or script expression definition rather than its evaluation result).

The isPropertyValid entry point is invoked only when an actual value is available for the property that needs to be validated (that is, a property that contains a variable or a script expression is never validated when the flow is inactive; see validating property values). So in most cases the validation process does not need to worry about this complexity. However sometimes properties are interrelated and the validation process requires referring to another property value. In that case, the validation code must verify that an actual value exists for the other property through the isPropertyValueActual() function.