Class ChatLog

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


    public class ChatLog
    extends java.lang.Object
    implements java.lang.Comparable<ChatLog>
    This is a model class for chat log that will be created by LivechatChatLogPath.

    It is used to tell update to the chat log event of a chat session. Contains visitor/agent messages, system events and triggers.

    You can subscribe to chat log broadcast via com.zopim.android.sdk.data.DataSource#addChatLogObserver(java.util.Observer) using ChatLogObserver

    This class is a model that will be serialised to JSON and deserialised from JSON to this model. As such it does not follow the m naming prefix for fields.

    See Also:
    Agent Dashboard, Triggers Dashboard
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static class  ChatLog.Error
      Error type that can occur.
      static class  ChatLog.Option
      Model definition of an agent questionnaire option item
      static class  ChatLog.Rating
      Definition of valid chat ratings.
      static class  ChatLog.Type
      Definition of available chat log types.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ChatLog() 
      ChatLog(java.lang.String displayName, ChatLog.Type type, java.lang.String message)
      Constructor for chat log message that allows creation of a local message.
    • Constructor Detail

      • ChatLog

        public ChatLog()
      • ChatLog

        public ChatLog(java.lang.String displayName,
                       ChatLog.Type type,
                       java.lang.String message)
        Constructor for chat log message that allows creation of a local message.
        Parameters:
        displayName - of the visitor/agent or null if unspecified
        type - of the message defined in ChatLog.RawType
        message - content or null if none
    • Method Detail

      • getAttachment

        public Attachment getAttachment()
        Gets attachment in this event
        Returns:
        attachment model
      • getTimestamp

        public java.lang.Long getTimestamp()
        Time record of this event in milliseconds
        Returns:
        timestamp
      • getNick

        public java.lang.String getNick()
        Gets a nick name of the chat log participant. It can be used as unique id for visitors or agents depending of the chat log type.
        Returns:
        nick
        See Also:
        ChatLog.Type
      • getType

        public ChatLog.Type getType()
        Gets type of the chat log message.

        Chat log type will be different based on the log event. Eg. it can be a visitor message, system event or a trigger. See definition of available types are are defined in ChatLog.Type.

        Returns:
        type of the chat log event. ChatLog.Type.UNKNOWN if not found or error occurred.
      • getMessage

        public java.lang.String getMessage()
        Gets message body of this chat log event. It can be null based on the type of the chat log.
        Returns:
        message body
        See Also:
        ChatLog.getType()
      • getOptions

        public ChatLog.Option[] getOptions()
        Gets an array of options when a questionnaire chat log message is questionnaire sent by an agent

        If no options are available it will return an empty string array

        Returns:
        options available for the questionnaire
        See Also:
        Shortcuts Agent Dashboard
      • setFile

        public void setFile(java.io.File file)
        Sets file to this chat log event
        Parameters:
        file - to append to this chat log event
      • getFileName

        public java.lang.String getFileName()
        Gets file name of the file in this ChatLog
        Returns:
        file name
      • getError

        public ChatLog.Error getError()
        Gets error that occurred in this chat log event
        Returns:
        error type
      • setError

        public void setError(ChatLog.Error error)
        Sets the error to this chat log
        Parameters:
        error - type
      • getUploadUrl

        public java.net.URL getUploadUrl()
        Gets a copy of upload URL stored in this ChatLog event
        Returns:
        url in this log
      • getProgress

        public int getProgress()
        Gets the current transfer progress
        Returns:
        progress values 0 - 100
      • setProgress

        public void setProgress(int progress)
        Sets progress for this chat log
        Parameters:
        progress - in range 0 - 100
      • getRating

        public ChatLog.Rating getRating()
        Gets the rating for this chat log
        Returns:
        rating of the chat
      • setRawNewRating

        public void setRawNewRating(java.lang.String rawNewRating)
      • setRawRating

        public void setRawRating(java.lang.String rawRating)
      • getComment

        public java.lang.String getComment()
        Gets the comment for this chat log
        Returns:
        comment on the chat
      • setComment

        public void setComment(java.lang.String comment)
        Sets the comment for this chat log
        Parameters:
        comment - to set
      • getVisitorQueue

        public java.lang.Integer getVisitorQueue()
        Gets number of visitors in the queue being currently served in this chat session. It can be null based on the type of the chat log.
        Returns:
        number of visitors in queue
        See Also:
        ChatLog.getType()
      • isUnverified

        public java.lang.Boolean isUnverified()
        Tells if this chat log event has been received and verified by the server. All events that originate from the device will start as unverified until they get transited to the server and verified.
        Returns:
        true if verified, false if not verified, null if not specified
      • isFailed

        public java.lang.Boolean isFailed()
        Tells if this chat log failed to send
        Returns:
        false if the succeeded, true if it failed, null if unspecified
      • setFailed

        public void setFailed(boolean failed)
        Sets if chat log failed to send
        Parameters:
        failed - true if failed, false otherwise
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • compareTo

        public int compareTo(ChatLog chatLog)
        Compares two ChatLog by their time of creation. This is used for ascending sort of the incoming chat log events.
        Specified by:
        compareTo in interface java.lang.Comparable<ChatLog>
        Parameters:
        chatLog - to compare with
        Returns:
        -1 if chatLog param is more recent event, 1 if this is more recent, 0 if their time is the same or there was an error