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.Stringcategoryprotected java.lang.StringconversationIdprotected longdeletedAtprotected java.lang.StringdeletedByprotected longdeliveredAtprotected longdeliveredToMeAtprotected longeditedAtprotected java.lang.StringeditedByprotected intidprotected JSONObjectmetadataprotected java.lang.Stringmuidprotected intparentMessageIdprotected JSONObjectrawMessageprotected longreadAtprotected longreadByMeAtprotected AppEntityreceiverprotected java.lang.StringreceiverTypeprotected java.lang.StringreceiverUidprotected intreplyCountprotected Usersenderprotected longsentAtstatic java.lang.StringTABLE_CONVERSATIONSprotected java.lang.Stringtypeprotected longupdatedAt
-
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 booleanequals(java.lang.Object obj)java.lang.StringgetCategory()Get of the category of messagejava.lang.StringgetConversationId()Returns the id of the Conversation.longgetDeletedAt()Get timestamp of the message when it was deletedjava.lang.StringgetDeletedBy()Get UID of the user who deleted the messagelonggetDeliveredAt()Get delivery timestamp of the messagelonggetDeliveredToMeAt()Get timestamp of the message at which it was delivered to logged in userlonggetEditedAt()Get timestamp of the message when it was updated/editedjava.lang.StringgetEditedBy()Get UID of the user who edited/updated the messageintgetId()Get id of the messagestatic java.util.List<BaseMessage>getMessagesFromJSON(java.lang.String json)JSONObjectgetMetadata()GetJSONObjectof data set by developerjava.lang.StringgetMuid()Get muid of Message Additional id field for the developers in case they want to use.intgetParentMessageId()Returns the parent message id for the message showing that the message belongs to a thread.JSONObjectgetRawMessage()Returns the raw JSON message for the message object.longgetReadAt()Get Timestamp of the when message was read atlonggetReadByMeAt()Get timestamp when the message is read by logged in userAppEntitygetReceiver()Returns User/Group object with the details of the receiver of the message.java.lang.StringgetReceiverType()Get type of receiverjava.lang.StringgetReceiverUid()Get id of the receiverintgetReplyCount()Returns the count of the messages that belong to the thread for which the message is the parent.UsergetSender()Get sender objectlonggetSentAt()Get message's sent at timestampjava.lang.StringgetType()Get type of the messagelonggetUpdatedAt()Get timestamp of the message when it was updated/editedinthashCode()voidsetCategory(java.lang.String category)voidsetConversationId(java.lang.String conversationId)voidsetDeletedAt(long deletedAt)voidsetDeletedBy(java.lang.String deletedBy)voidsetDeliveredAt(long deliveredAt)voidsetDeliveredToMeAt(long deliveredToMeAt)voidsetEditedAt(long editedAt)voidsetEditedBy(java.lang.String editedBy)voidsetId(int id)voidsetMetadata(JSONObject metadata)voidsetMuid(java.lang.String muid)voidsetParentMessageId(int parentMessageId)voidsetRawMessage(JSONObject rawMessage)voidsetReadAt(long readAt)voidsetReadByMeAt(long readByMeAt)voidsetReceiver(AppEntity receiver)voidsetReceiverType(java.lang.String receiverType)voidsetReceiverUid(java.lang.String receiverUid)voidsetReplyCount(int replyCount)voidsetSender(User sender)voidsetSentAt(long sentAt)voidsetType(java.lang.String type)voidsetUpdatedAt(long updatedAt)java.lang.StringtoString()
-
-
-
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
Userclass - 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()
GetJSONObjectof data set by developer- Returns:
JSONObjectof 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:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-