Class ALfnEvent

java.lang.Object
com.luciad.fusion.platform.event.object.ALfnEvent
Direct Known Subclasses:
ALfnDataEvent, ALfnDataRootEvent, ALfnJobEvent, ALfnProductEvent, ALfnServiceEvent, ALfnStyleEvent, TLfnDataQueryEvent, TLfnProductQueryEvent, TLfnServiceQueryEvent, TLfnStyleQueryEvent

public abstract class ALfnEvent extends Object
Abstract class that all LuciadFusion events will extend.

An event will always have a valid reference to the date and time when it was created: see getTimestamp().

An event optionally can contain a reference to the TLfnUser who caused this event: see getUser(). Depending on the type of event, this user might be unavailable, in which case the method returns an empty Optional.

An event optionally can contain a TLfnEventSourceRequest that caused this event: see getRequest(). Depending on the type of event, this request context might be unavailable, in which case the method returns an empty Optional.

More information on how the LuciadFusion event system works and how your application can get notified of these events can be found in the Listening for LuciadFusion events documentation article.

Since:
2022.1
  • Constructor Details

    • ALfnEvent

      protected ALfnEvent(TLfnUser aUser)
      Create a new LuciadFusion event. The event will have the given user, and will have no request.
      Parameters:
      aUser - the TLfnUser who caused this event, or null
    • ALfnEvent

      protected ALfnEvent(TLfnUser aUser, TLfnEventSourceRequest aRequest)
      Create a new LuciadFusion event. The event will have the given user and request.
      Parameters:
      aUser - the TLfnUser who caused this event, or null
      aRequest - the TLfnEventSourceRequest that caused this event, or null
  • Method Details

    • getPropertiesString

      protected String getPropertiesString()
      Get the String object that is used in the toString() method for describing this event's properties.

      Implementing classes can override this method for including specific properties, as a comma-separated list of key-value pairs.
      For example, if a subclass has a name property, the overridden version of this method should be:

        @Override
         protected String getPropertiesString() {
           return super.getPropertiesString() + ", name='" + getName() + "'";
         }
       
      Returns:
      the String that is used in the toString() method.
    • getTimestamp

      public final ZonedDateTime getTimestamp()
      Returns the date and time when the event happened.
      Returns:
      the date and time when the event happened
    • getUser

      public Optional<TLfnUser> getUser()
      Returns an Optional containing the TLfnUser who caused this event. Can be an empty Optional when an event is triggered for an action that does not require a user (for example: accessing a service).
      Returns:
      an Optional containing the TLfnUser who caused this event
    • getRequest

      public Optional<TLfnEventSourceRequest> getRequest()
      Returns an Optional containing the TLfnEventSourceRequest that caused this event. Can be an empty Optional when an event is triggered for an action that is not related to an HTTP request (for example: queueing a scheduled job).
      Returns:
      an Optional containing the TLfnEventSourceRequest that caused this event
    • toString

      public final String toString()
      Overrides:
      toString in class Object