Package com.cometchat.pro.models
Class BaseMessage
- java.lang.Object
-
- com.cometchat.pro.models.AppEntity
-
- com.cometchat.pro.models.BaseMessage
-
- Direct Known Subclasses:
Action
,Call
,CustomMessage
,MediaMessage
,TextMessage
public class BaseMessage extends AppEntity
BaseMessage class provides information about message
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
category
protected java.lang.String
conversationId
protected long
deletedAt
protected java.lang.String
deletedBy
protected long
deliveredAt
protected long
deliveredToMeAt
protected long
editedAt
protected java.lang.String
editedBy
protected int
id
protected JSONObject
metadata
protected java.lang.String
muid
protected int
parentMessageId
protected JSONObject
rawMessage
protected long
readAt
protected long
readByMeAt
protected AppEntity
receiver
protected java.lang.String
receiverType
protected java.lang.String
receiverUid
protected int
replyCount
protected User
sender
protected long
sentAt
static java.lang.String
TABLE_CONVERSATIONS
protected java.lang.String
type
protected long
updatedAt
-
Constructor Summary
Constructors Constructor Description BaseMessage()
BaseMessage(java.lang.String receiverUid, java.lang.String type, java.lang.String receiverType)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.lang.String
getCategory()
Get of the category of messagejava.lang.String
getConversationId()
Returns the id of the Conversation.long
getDeletedAt()
Get timestamp of the message when it was deletedjava.lang.String
getDeletedBy()
Get UID of the user who deleted the messagelong
getDeliveredAt()
Get delivery timestamp of the messagelong
getDeliveredToMeAt()
Get timestamp of the message at which it was delivered to logged in userlong
getEditedAt()
Get timestamp of the message when it was updated/editedjava.lang.String
getEditedBy()
Get UID of the user who edited/updated the messageint
getId()
Get id of the messagestatic java.util.List<BaseMessage>
getMessagesFromJSON(java.lang.String json)
JSONObject
getMetadata()
GetJSONObject
of data set by developer
java.lang.String
getMuid()
Get muid of Message Additional id field for the developers in case they want to use.int
getParentMessageId()
Returns the parent message id for the message showing that the message belongs to a thread.JSONObject
getRawMessage()
Returns the raw JSON message for the message object.long
getReadAt()
Get Timestamp of the when message was read atlong
getReadByMeAt()
Get timestamp when the message is read by logged in userAppEntity
getReceiver()
Returns User/Group object with the details of the receiver of the message.java.lang.String
getReceiverType()
Get type of receiverjava.lang.String
getReceiverUid()
Get id of the receiverint
getReplyCount()
Returns the count of the messages that belong to the thread for which the message is the parent.User
getSender()
Get sender objectlong
getSentAt()
Get message's sent at timestampjava.lang.String
getType()
Get type of the messagelong
getUpdatedAt()
Get timestamp of the message when it was updated/editedint
hashCode()
void
setCategory(java.lang.String category)
void
setConversationId(java.lang.String conversationId)
void
setDeletedAt(long deletedAt)
void
setDeletedBy(java.lang.String deletedBy)
void
setDeliveredAt(long deliveredAt)
void
setDeliveredToMeAt(long deliveredToMeAt)
void
setEditedAt(long editedAt)
void
setEditedBy(java.lang.String editedBy)
void
setId(int id)
void
setMetadata(JSONObject metadata)
void
setMuid(java.lang.String muid)
void
setParentMessageId(int parentMessageId)
void
setRawMessage(JSONObject rawMessage)
void
setReadAt(long readAt)
void
setReadByMeAt(long readByMeAt)
void
setReceiver(AppEntity receiver)
void
setReceiverType(java.lang.String receiverType)
void
setReceiverUid(java.lang.String receiverUid)
void
setReplyCount(int replyCount)
void
setSender(User sender)
void
setSentAt(long sentAt)
void
setType(java.lang.String type)
void
setUpdatedAt(long updatedAt)
java.lang.String
toString()
-
-
-
Field Detail
-
TABLE_CONVERSATIONS
public static final java.lang.String TABLE_CONVERSATIONS
- See Also:
- Constant Field Values
-
id
protected int id
-
muid
protected java.lang.String muid
-
sender
protected User sender
-
receiver
protected AppEntity receiver
-
receiverUid
protected java.lang.String receiverUid
-
type
protected java.lang.String type
-
receiverType
protected java.lang.String receiverType
-
category
protected java.lang.String category
-
sentAt
protected long sentAt
-
deliveredAt
protected long deliveredAt
-
readAt
protected long readAt
-
metadata
protected JSONObject metadata
-
readByMeAt
protected long readByMeAt
-
deliveredToMeAt
protected long deliveredToMeAt
-
deletedAt
protected long deletedAt
-
editedAt
protected long editedAt
-
deletedBy
protected java.lang.String deletedBy
-
editedBy
protected java.lang.String editedBy
-
updatedAt
protected long updatedAt
-
conversationId
protected java.lang.String conversationId
-
parentMessageId
protected int parentMessageId
-
replyCount
protected int replyCount
-
rawMessage
protected JSONObject rawMessage
-
-
Method Detail
-
getId
public int getId()
Get id of the message- Returns:
- unique id of the message
- Since:
- v1
-
setId
public void setId(int id)
-
getMuid
public java.lang.String getMuid()
Get muid of Message Additional id field for the developers in case they want to use.- Returns:
- muid set by developer
- Since:
- v1
-
setMuid
public void setMuid(java.lang.String muid)
-
getSender
public User getSender()
Get sender object- Returns:
- An object of
User
class
- Since:
- v1
- See Also:
User
-
setSender
public void setSender(User sender)
-
getReceiverUid
public java.lang.String getReceiverUid()
Get id of the receiver- Returns:
- id of the receiver(user/group)
- Since:
- v1
-
setReceiverUid
public void setReceiverUid(java.lang.String receiverUid)
-
getType
public java.lang.String getType()
Get type of the message- Returns:
- type of the message
- Since:
- v1
-
setType
public void setType(java.lang.String type)
-
getReceiverType
public java.lang.String getReceiverType()
Get type of receiver- Returns:
- type of the receiver
- Since:
- v1
- See Also:
CometChatConstants.ReceiverTypes
-
setReceiverType
public void setReceiverType(java.lang.String receiverType)
-
getSentAt
public long getSentAt()
Get message's sent at timestamp- Returns:
- message sent timestamp
- Since:
- v1
-
setSentAt
public void setSentAt(long sentAt)
-
getCategory
public java.lang.String getCategory()
Get of the category of message- Returns:
- category of the message
- Since:
- v1
-
setCategory
public void setCategory(java.lang.String category)
-
getDeliveredAt
public long getDeliveredAt()
Get delivery timestamp of the message- Returns:
- delivery timestamp of message
- Since:
- v1
-
setDeliveredAt
public void setDeliveredAt(long deliveredAt)
-
getReadAt
public long getReadAt()
Get Timestamp of the when message was read at- Returns:
- Timestamp of the time the message was read at
- Since:
- v1 Note In case of group this field is set only when at message is read by all the member of the group
-
setReadAt
public void setReadAt(long readAt)
-
getMetadata
public JSONObject getMetadata()
GetJSONObject
of data set by developer
- Returns:
JSONObject
of custom data set by developer
- Since:
- v1
-
setMetadata
public void setMetadata(JSONObject metadata)
-
getReadByMeAt
public long getReadByMeAt()
Get timestamp when the message is read by logged in user- Returns:
- read at of the message
- Since:
- v1
-
setReadByMeAt
public void setReadByMeAt(long readByMeAt)
-
getDeliveredToMeAt
public long getDeliveredToMeAt()
Get timestamp of the message at which it was delivered to logged in user- Returns:
- delivery timestamp of the message
- Since:
- v1
-
setDeliveredToMeAt
public void setDeliveredToMeAt(long deliveredToMeAt)
-
getDeletedAt
public long getDeletedAt()
Get timestamp of the message when it was deleted- Returns:
- deleted at timestamp
- Since:
- v1
-
setDeletedAt
public void setDeletedAt(long deletedAt)
-
getEditedAt
public long getEditedAt()
Get timestamp of the message when it was updated/edited- Returns:
- edited/updated at timestamp
- Since:
- v1
-
setEditedAt
public void setEditedAt(long editedAt)
-
getDeletedBy
public java.lang.String getDeletedBy()
Get UID of the user who deleted the message- Returns:
- UID of the user
- Since:
- v1
-
setDeletedBy
public void setDeletedBy(java.lang.String deletedBy)
-
getEditedBy
public java.lang.String getEditedBy()
Get UID of the user who edited/updated the message- Returns:
- UID of the user
- Since:
- v1
-
setEditedBy
public void setEditedBy(java.lang.String editedBy)
-
getUpdatedAt
public long getUpdatedAt()
Get timestamp of the message when it was updated/edited- Returns:
- updated/edited at timestamp
- Since:
- v1
-
setUpdatedAt
public void setUpdatedAt(long updatedAt)
-
getConversationId
public java.lang.String getConversationId()
Returns the id of the Conversation.- Returns:
- conversationId
- Since:
- v2
-
setConversationId
public void setConversationId(java.lang.String conversationId)
-
getReceiver
public AppEntity getReceiver()
Returns User/Group object with the details of the receiver of the message.- Returns:
- User/Group object with the details of the receiever of the message.
- Since:
- v2
-
setReceiver
public void setReceiver(AppEntity receiver)
-
getParentMessageId
public int getParentMessageId()
Returns the parent message id for the message showing that the message belongs to a thread.- Returns:
- an int which is the parent message id for the message showing that the message belongs to a thread.
- Since:
- v2
-
setParentMessageId
public void setParentMessageId(int parentMessageId)
-
getReplyCount
public int getReplyCount()
Returns the count of the messages that belong to the thread for which the message is the parent.- Returns:
- an int which is the count of the messages that belong to the thread for which the message is the parent.
- Since:
- v2
-
setReplyCount
public void setReplyCount(int replyCount)
-
getRawMessage
public JSONObject getRawMessage()
Returns the raw JSON message for the message object.- Returns:
- A JSONObject which holds the raw data of the message..
- Since:
- v2
-
setRawMessage
public void setRawMessage(JSONObject rawMessage)
-
getMessagesFromJSON
public static java.util.List<BaseMessage> getMessagesFromJSON(java.lang.String json) throws JSONException
- Throws:
JSONException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-