The single instance of the Switch class is passed as an argument to the script entry points that operate in the context of a particular flow element. By convention, the name for the Switch object is "s" (although the script developer can choose to use another name).
Since the Switch class inherits from the Environment class, any of the functions described for that class can be called for the Switch class as well. In other words, you can call the Environment class functions with "e.function()" or "s.function()" depending on the argument passed to the entry point.
See script element, script declaration and main script properties for background information.
Returns the name of the flow, as displayed in the Flows pane, in which this script resides.
Returns the name of the flow element associated with this script as displayed in the canvas.
Returns a string that uniquely identifies the flow element associated with this script (within the limits of the guarantees described below). Callers should not rely on the syntax of the returned string as this may change between Switch versions.
The element ID for a particular flow element offers two fundamental guarantees:
It differs from the element ID for any other flow element in any currently active flow.
It remains unchanged as long as the flow in which it resides is not edited, even if the flow is deactivated and reactivated and across Switch sessions.
Note that holding or releasing connections or renaming the flow does not count as editing in this context. However, exporting and re-importing (or upgrading) a flow, or renaming a flow element inside the flow, does count as editing.
Returns the name of this script as defined in the script declaration.
Returns a list of Connection instances representing the incoming connections forthe flow element associated with this script. The list is in arbitrary order. If there are no incoming connections the list is empty.
Returns a list of Connection instances representing the outgoing connections for the flow element associated with this script. The list is in arbitrary order. If there are no outgoing connections the list is empty.
The functions in this section retrieve information about the properties injected into the script element as defined in the script declaration (see property definition properties). The property value is entered by the user in the Properties pane; the property tags are defined in the script declaration.
Property values for which isPropertyValueStatic() returns false can be computed only in the context of a particular job. By default the functions getPropertyValue() and getPropertyValueList() use the current job (that is, the job for which the jobArrived entry point was invoked) to compute property values. Thus in most cases the job argument can be omitted. In situations however where there is no current job (for example: because this function is called from within the timerFired entry point), it is necessary to specify the job argument when getting non-static property values.
Returns the value of the injected flow element property with the specified tag for the script element associated with this script. If the specified tag is not defined in the script declaration, the function returns null. If the property has a string list value, this function returns the first string in the list.
If this function is invoked while the flow is inactive, it returns the source value of a property that contains a variable or a script expression instead of its computed value (that is, the variable or script expression definition rather than its evaluation result).
The optional job argument specifies the job for which the property value is computed. If the argument is null or missing, the current job is used instead. If the argument is null or missing, and there is no current job, and the property value is non-static, this function returns null.
Returns the string list value of the injected flow element property with the specified tag for the script element associated with this script. If the specified tag is not defined in the script declaration, the function returns null. If the property has a single-string value, this function returns a list with a single string.
If this function is invoked while the flow is inactive, it returns the source value of a property that contains a variable or a script expression instead of its computed value (i.e. the variable or script expression definition rather than its evaluation result).
The optional job argument specifies the job for which the property value is computed. If the argument is null or missing, the current job is used instead. If the argument is null or missing, and there is no current job, and the property value is non-static, this function returns null.
Returns the name of the property editor that was used to enter the value for the specified property. In case a property offers multiple editors, this information may be required to correctly interpret the property value. If the specified tag is not defined in the script declaration, the function returns null.
The function returns the property editor's name exactly as it appears in the tables in inline property editors and other property editors.
Returns true if the value for the specified property is guaranteed not to change between entry point invocations for this flow element as long as the containing flow remains active; false otherwise. If the specified tag is not defined in the script declaration, the function returns null.
This function is useful to determine whether an invalid property value should result in calling Job.failProcess() (the value is static) or Job.fail() (the value is dynamic).
Specifically, the function returns false if one of the following conditions holds:
The property value was entered with the property editor "Script expression" or "Condition with variables".
The property value was entered with the property editor "Single-line text with variables" or "Multi-line text with variables" and the text does indeed contain a syntactically valid variable.
The property offers the property editor "Single-line text with variables" or "Multi-line text with variables", and the property value was entered with the inline property editor "Single-line text" instead, and the text does indeed contain a syntactically valid variable.
Returns true if the getPropertyValue() or getPropertyValueList() functions return an actual value for the specified property, in other words if the property value is static or if the flow is active so that the property value can be computed.
Returns false if the getPropertyValue() or getPropertyValueList() functions return the source value for the specified property, in other words if the property value is not static and the flow is inactive.
If the specified tag is not defined in the script declaration, the function returns null.
Returns a list of Job instances representing all of the jobs currently waiting in the input folders for the flow element. The list is in arbitrary order and includes all jobs that have formally "arrived", whether they were already passed to the jobArrived entry point or not, and including the job passed to the current invocation of the jobArrived entry point. If there are no such jobs, the list is empty.
Returns a list of Job instances representing all of the jobs currently waiting in the input folders for the specified incoming connection. Same semantics as for the getJobs function apply.
Returns a Job instance representing a new job that does not correspond to an incoming job. The job is given a fresh job ticket with default values. The file path associated with the job is the empty string.
A new job is needed only in cases the script generates or imports new jobs into a flow. In all other cases the script should use (one of) the incoming job(s) related to the output so that job ticket information is preserved.
The optional argument provides an indication of the origin of the job before it was injected in the flow, for example its absolute file path or location in a third-party data base. This value is written in the origin attribute of the ‘Produced' occurrence in the newly created job ticket (see job occurrence trail). If the origin argument is missing or null, the empty string is used.
Logs a fatal error with the specified message and puts the flow element instance in the "problem process" state, without providing the context of a particular job.
This function should be used only when there is no appropriate job context, for example in the timerArrived entry point of a Producer. In all other cases, use the Job.failProcess() function instead so that the job causing the problem is properly retried when the process is retried.
See the description of the Environment.log() function for more information on the message and extra arguments. See viewing problem status for more information on problem processes.
Sets the interval, in seconds, between subsequent invocations of the timerFired entry point (if it has been declared in the script). The implementation guarantees only that the time between invocations will not be less than the specified number of seconds. Depending on run-time circumstances the actual interval may be (much) longer. The default value for the timer interval is 300 seconds (5 minutes).
Returns the interval, in seconds between subsequent invocations of the timerFired entry point.
Returns true if the flow in which this script resides is attempting to deactivate at the time of invocation; false otherwise.
When the user deactivates a flow (or quits the server) Switch waits until all executing entry points have run to completion. Therefore, an entry point that potentially executes for a long time, for example because it is waiting for an external event, can invoke this function at regular intervals to determine whether it should abort its operation.