Class Geotrigger

  • Direct Known Subclasses:
    FenceGeotrigger

    public class Geotrigger
    extends Object
    A condition monitored by a GeotriggerMonitor.

    A Geotrigger defines a condition that can be continually monitored in real-time. Once the condition is met, the Geotrigger defines how a GeotriggerNotificationInfo can be used to inform the user.

    A GeotriggerMonitor, created with the Geotrigger, handles monitoring and notification.

    You can create a FenceGeotrigger describing areas of interest, covered by spatial rules such as enter or exit. This type of spatial monitoring is also known as "Geofencing".

    Since:
    100.12.0
    • Method Detail

      • getMessageExpression

        public ArcadeExpression getMessageExpression()
        Gets an ArcadeExpression that controls the message when a Geotrigger is met.

        The expression uses the Arcade language to form an output message that can be:

        • A string literal that is the same for all notifications relating to this Geotrigger
        • A message that is specific to the attributes of objects that met the Geotrigger
        The expression is evaluated whenever the Geotrigger condition is met in order to populate the GeotriggerNotificationInfo.getMessage() property. This message can be displayed to alert the user that the Geotrigger condition has been met. Note that the expression cannot be changed when the GeotriggerMonitor is running.

        For example, with a FenceGeotrigger, setting the getMessageExpression() property to:

        "You have " + $fencenotificationtype + ' ' + $fencefeature.name

        would return the GeotriggerNotification.getMessage() "You have entered Area A", where "area_name" is an attribute field on the FenceGeotriggerNotificationInfo.getFenceGeoElement().

        Optionally, the expression can return extra properties in addition to the message. For example, it could produce another string, suitable for logging to a database. To supply additional properties, write an arcade expression that evaluates to a dictionary of key value pairs. A value with the key "message" will be used to populate the GeotriggerNotificationInfo.getMessage() property and additional key value pairs will be returned in the GeotriggerNotificationInfo.getMessageProperties() dictionary.

        The ArcadeExpression must evaluate to either a string or a dictionary - see ArcadeExpression.getReturnType().

        For more information on the available globals and functions for creating the Geotrigger.getMessageExpression() see the "Geotrigger Notification" profile at https://developers.arcgis.com/arcade/guide/profiles/.

        Returns:
        an ArcadeExpression that controls the message when a Geotrigger is met, or null if none
        Since:
        100.12.0
      • setMessageExpression

        public void setMessageExpression​(ArcadeExpression messageExpression)
        Sets an ArcadeExpression that controls the message when a Geotrigger is met.

        The expression uses the Arcade language to form an output message that can be:

        • A string literal that is the same for all notifications relating to this Geotrigger
        • A message that is specific to the attributes of objects that met the Geotrigger
        The expression is evaluated whenever the Geotrigger condition is met in order to populate the GeotriggerNotificationInfo.getMessage() property. This message can be displayed to alert the user that the Geotrigger condition has been met. Note that the expression cannot be changed when the GeotriggerMonitor is running.

        For example, with a FenceGeotrigger, setting the getMessageExpression() property to:

        "You have " + $fencenotificationtype + ' ' + $fencefeature.name

        would return the GeotriggerNotificationInfo.getMessage() "You have entered Area A", where "area_name" is an attribute field on the FenceGeotriggerNotificationInfo.getFenceGeoElement().

        Optionally, the expression can return extra properties in addition to the message. For example, it could produce another string, suitable for logging to a database. To supply additional properties, write an arcade expression that evaluates to a dictionary of key value pairs. A value with the key "message" will be used to populate the GeotriggerNotificationInfo.getMessage() property and additional key value pairs will be returned in the GeotriggerNotificationInfo.getMessageProperties() dictionary.

        The ArcadeExpression must evaluate to either a string or a dictionary - see ArcadeExpression.getReturnType().

        For more information on the available globals and functions for creating the Geotrigger.getMessageExpression() see the "Geotrigger Notification" profile at https://developers.arcgis.com/arcade/guide/profiles/.

        Parameters:
        messageExpression - an ArcadeExpression that controls the message when a Geotrigger is met
        Since:
        100.12.0
      • getName

        public String getName()
        Gets the name of the Geotrigger.
        Returns:
        the name of the Geotrigger
        Since:
        100.12.0
      • setName

        public void setName​(String name)
        Sets the name of the Geotrigger.
        Parameters:
        name - the name of the Geotrigger
        Throws:
        IllegalArgumentException - if name is null
        Since:
        100.12.0