Class ChatLog
- java.lang.Object
-
- com.zopim.android.sdk.model.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 byLivechatChatLogPath.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
DataSource.addChatLogObserver(java.util.Observer)usingChatLogObserverThis 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 classChatLog.ErrorError type that can occur.static classChatLog.OptionModel definition of an agent questionnaire option itemstatic classChatLog.RatingDefinition of valid chat ratings.static classChatLog.TypeDefinition 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intcompareTo(ChatLog chatLog)Compares twoChatLogby their time of creation.AttachmentgetAttachment()Gets attachment in this eventjava.lang.StringgetComment()Gets the comment for this chat logjava.lang.StringgetDisplayName()Gets display name of the visitor.ChatLog.ErrorgetError()Gets error that occurred in this chat log eventjava.io.FilegetFile()Gets file attachment in thisChatLogFiles being attached viaChatApiCommands.send(File)java.lang.StringgetFileName()Gets file name of the file in thisChatLogjava.lang.StringgetMessage()Gets message body of this chat log event.java.lang.StringgetNick()Gets a nick name of the chat log participant.ChatLog.Option[]getOptions()Gets an array of options when a questionnaire chat log message is questionnaire sent by an agentintgetProgress()Gets the current transfer progressChatLog.RatinggetRating()Gets the rating for this chat logjava.lang.LonggetTimestamp()Time record of this event in millisecondsChatLog.TypegetType()Gets type of the chat log message.java.net.URLgetUploadUrl()Gets a copy of uploadURLstored in thisChatLogeventjava.lang.IntegergetVisitorQueue()Gets number of visitors in the queue being currently served in this chat session.java.lang.BooleanisFailed()Tells if this chat log failed to sendjava.lang.BooleanisUnverified()Tells if this chat log event has been received and verified by the server.voidsetComment(java.lang.String comment)Sets the comment for this chat logvoidsetError(ChatLog.Error error)Sets the error to this chat logvoidsetFailed(boolean failed)Sets if chat log failed to sendvoidsetFile(java.io.File file)Sets file to this chat log eventvoidsetProgress(int progress)Sets progress for this chat logvoidsetRawNewRating(java.lang.String rawNewRating)voidsetRawRating(java.lang.String rawRating)java.lang.StringtoString()
-
-
-
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 unspecifiedtype- of the message defined inChatLog.RawTypemessage- 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
-
getDisplayName
public java.lang.String getDisplayName()
Gets display name of the visitor.Display name can be configured using
VisitorInfoviaZopimChatApi.setVisitorInfo(VisitorInfo)- Returns:
- name of the visitor
-
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.UNKNOWNif 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 agentIf no options are available it will return an empty string array
- Returns:
- options available for the questionnaire
- See Also:
- Shortcuts Agent Dashboard
-
getFile
public java.io.File getFile()
Gets file attachment in thisChatLogFiles being attached viaChatApiCommands.send(File)- Returns:
- file attached
-
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 thisChatLog- 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 uploadURLstored in thisChatLogevent- 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:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(ChatLog chatLog)
Compares twoChatLogby their time of creation. This is used for ascending sort of the incoming chat log events.- Specified by:
compareToin interfacejava.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
-
-