Class PushNotification

  • All Implemented Interfaces:
    java.lang.Comparable<PushNotification>

    public class PushNotification
    extends java.lang.Object
    PushNotification is a model class which represents a message that was received from an external source. A notification could be raised against any mechanism. Currently used by Push mechanism.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(java.lang.String title, java.lang.String subtitle, boolean allowDeviceCredentials, androidx.appcompat.app.AppCompatActivity activity, FRAListener<java.lang.Void> listener)
      Accepts the push notification request with Biometric Authentication.
      void accept​(java.lang.String challengeResponse, FRAListener<java.lang.Void> listener)
      Accepts the push notification request with the challenge response.
      void accept​(FRAListener<java.lang.Void> listener)
      Accepts the push authentication request.
      static PushNotification.PushNotificationBuilder builder()
      Returns a builder for creating a PushNotification.
      int compareTo​(PushNotification another)  
      void deny​(FRAListener<java.lang.Void> listener)
      Deny any type of push authentication request.
      static PushNotification deserialize​(java.lang.String jsonString)
      Deserializes the specified Json into an object of the PushNotification object.
      boolean equals​(java.lang.Object o)  
      java.lang.String getAmlbCookie()
      Get load balance cookie from OpenAM
      java.lang.String getChallenge()
      Get challenge from message payload
      java.lang.String getContextInfo()
      Get the contextual information to this notification.
      java.lang.String getCustomPayload()
      Get the custom attributes added to this notification.
      java.lang.String getId()
      Gets the unique identifier for the PushNotification.
      java.lang.String getMechanismUID()
      Get the mechanism Id that this notification was intended for.
      java.lang.String getMessage()
      Get the message of this notification
      java.lang.String getMessageId()
      Get the message Id of this notification
      int[] getNumbersChallenge()
      Get numbers used for push challenge
      PushType getPushType()
      Get the type of Push notification.
      java.util.Calendar getTimeAdded()
      Get the time that this notification was received.
      java.util.Calendar getTimeExpired()
      Get the time that the notification will or did expire.
      long getTtl()
      Get time-to-live value from message payload
      int hashCode()  
      boolean isApproved()
      Determine whether the authentication the notification is related to succeeded.
      boolean isExpired()
      Determine if the notification has expired.
      boolean isPending()
      Determines if the PushNotification has been interacted with by the user.
      boolean matches​(PushNotification other)
      Returns true if the two objects would conflict if added to a storage system.
      java.lang.String toJson()
      Creates a JSON string representation of ModelObject object.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getId

        public java.lang.String getId()
        Gets the unique identifier for the PushNotification.
        Returns:
        The unique identifier.
      • getMechanismUID

        public java.lang.String getMechanismUID()
        Get the mechanism Id that this notification was intended for.
        Returns:
        The receiving Mechanism.
      • getMessageId

        public java.lang.String getMessageId()
        Get the message Id of this notification
        Returns:
        The messageId value
      • getMessage

        public java.lang.String getMessage()
        Get the message of this notification
        Returns:
        The message value
      • getChallenge

        public java.lang.String getChallenge()
        Get challenge from message payload
        Returns:
        The challenge value
      • getAmlbCookie

        public java.lang.String getAmlbCookie()
        Get load balance cookie from OpenAM
        Returns:
        The load balance cookie value
      • getTtl

        public long getTtl()
        Get time-to-live value from message payload
        Returns:
        The time-to-live value
      • getTimeAdded

        public java.util.Calendar getTimeAdded()
        Get the time that this notification was received.
        Returns:
        The date the notification was received.
      • getTimeExpired

        public java.util.Calendar getTimeExpired()
        Get the time that the notification will or did expire.
        Returns:
        The expiry date.
      • getContextInfo

        public java.lang.String getContextInfo()
        Get the contextual information to this notification.
        Returns:
        JSON String containing context information to this notification.
      • getCustomPayload

        public java.lang.String getCustomPayload()
        Get the custom attributes added to this notification.
        Returns:
        JSON String containing custom attributes added to the payload of this notification.
      • getPushType

        public PushType getPushType()
        Get the type of Push notification.
        Returns:
        the push type.
      • getNumbersChallenge

        public int[] getNumbersChallenge()
        Get numbers used for push challenge
        Returns:
        the numbers as int array. Returns {null} if "numbersChallenge" is not available
      • isApproved

        public boolean isApproved()
        Determine whether the authentication the notification is related to succeeded.
        Returns:
        True if the authentication succeeded, false otherwise.
      • isPending

        public boolean isPending()
        Determines if the PushNotification has been interacted with by the user.
        Returns:
        True if the PushNotification has not been interacted with, false otherwise.
      • isExpired

        public final boolean isExpired()
        Determine if the notification has expired.
        Returns:
        True if the notification has expired, false otherwise.
      • toJson

        public java.lang.String toJson()
        Creates a JSON string representation of ModelObject object. Sensitive information are not exposed.
        Returns:
        a JSON string object
      • accept

        public final void accept​(@NonNull
                                 FRAListener<java.lang.Void> listener)
        Accepts the push authentication request. Use this method to approve notification of type PushType.DEFAULT.
        Parameters:
        listener - Listener for receiving the authentication result.
      • accept

        public final void accept​(@NonNull
                                 java.lang.String challengeResponse,
                                 @NonNull
                                 FRAListener<java.lang.Void> listener)
        Accepts the push notification request with the challenge response. Use this method to handle notification of type PushType.CHALLENGE.
        Parameters:
        challengeResponse - the response for the Push Challenge
        listener - Listener for receiving the authentication result.
      • accept

        @RequiresApi(23)
        public final void accept​(java.lang.String title,
                                 java.lang.String subtitle,
                                 boolean allowDeviceCredentials,
                                 @NonNull
                                 androidx.appcompat.app.AppCompatActivity activity,
                                 @NonNull
                                 FRAListener<java.lang.Void> listener)
        Accepts the push notification request with Biometric Authentication. Use this method to handle notification of type PushType.BIOMETRIC.
        Parameters:
        title - the title to be displayed on the prompt.
        subtitle - the subtitle to be displayed on the prompt.
        allowDeviceCredentials - if true, accepts device PIN, pattern, or password to process notification.
        activity - the activity of the client application that will host the prompt.
        listener - listener for receiving the push authentication result.
      • deny

        public final void deny​(@NonNull
                               FRAListener<java.lang.Void> listener)
        Deny any type of push authentication request.
        Parameters:
        listener - Listener for receiving the HTTP call response code.
      • deserialize

        public static PushNotification deserialize​(java.lang.String jsonString)
        Deserializes the specified Json into an object of the PushNotification object.
        Parameters:
        jsonString - the json string representing the object to be deserialized
        Returns:
        a PushNotification object from the string. Returns null if jsonString is null or if jsonString is empty.
      • matches

        public boolean matches​(PushNotification other)
        Returns true if the two objects would conflict if added to a storage system.
        Parameters:
        other - The object to compare.
        Returns:
        True if key traits of the objects match, false otherwise.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object