立即与支持人员聊天
与支持团队交流

Foglight 5.9.1 - Web Component Guide

Introducing the Web Component Framework The Web Component Framework Configuring Views and Context Queries Functions Bindings Additional Components

Java Functions

A JavaTM Function definition is used to execute a Java method and return a result. It can optionally have parameters to the Java method. Java Functions are meant to be used to call user-defined Java code that has been deployed to the Foglight server.

Using the editor, these attributes can be specified:

When a Java Function is executed, the parameter values are evaluated (if they are bindings) and passed into the method and the result is returned. If the declared output type is not a list and the result is not of the declared type, null is returned instead. If the declared output type is a list, then the result is checked to ensure it is a list, but the list items are not checked to determine whether they are of the declared output type.

This is the signature of the method for the Check Permission Java Function definition available in the Dashboard Support > Common module:

Map Functions

A Map Function definition consists of a set of keys and their corresponding mapped values. The function expects a key as its input value and the value corresponding to the key is returned.

An example of a Map Function:

Using the editor, these attributes can be specified:

When a Map Function is executed, the keys are checked (and evaluated if they are bindings) in order, and when one result equals the input, the corresponding Map value is returned (if it is a binding, it is evaluated and then returned). If no matching key is found, and the Map Default Value is specified, the function returns this default value. If no matching key is found, and the Map Default Value is not set, the function returns Null.

The editor ensures that all the keys of the map are the same type as the input type and that all the values of the map are the same type as the output type. Also, the map values must match the declaration of whether or not the output is a list.

One map entry having a null key is allowed. To specify a null key, simply do not set the map key.

Script Functions

A Script Function definition is used to execute a script and return a result. It can optionally take inputs to the script.

An example of a Script Function:

Using the editor, these attributes can be specified:

When a Script Function is executed, the inputs are evaluated (if they are bindings) and passed into the script. The script is executed via the ScriptService and the result is returned.

Script with Map Functions

A Script with Map Function definition is used to execute a script that accepts a map key and the corresponding map value is returned. The script can optionally take inputs.

An example of a Script with Map Function:

Using the editor, these attributes can be specified:

When a Script with Map Function is executed, the inputs are evaluated (if they are bindings) and passed into the script. The script is executed via the ScriptService. The script result is then checked against the map keys (which are evaluated if they are bindings) in order, and when one result equals the script result, the corresponding Map value is returned (if it is a binding, it is evaluated and then returned). If no matching key is found, and the Map Default Value is specified, the function returns this default value. If no matching key is found, and the Map Default Value is not set, the function returns Null.

The editor ensures that all the keys of the map are the same type as the map input type and that all the values of the map are the same type as the output type. Also, the map values must declaration of whether or not the output is a list.

相关文档

The document was helpful.

选择评级

I easily found the information I needed.

选择评级