Package de.xima.fc.entities
Class FormRecordChat
- java.lang.Object
-
- de.xima.cmn.dao.model.AEntity<Long>
-
- de.xima.fc.entities.AbstractEntity
-
- de.xima.fc.entities.AbstractLockableEntity
-
- de.xima.fc.entities.FormRecordChat
-
- All Implemented Interfaces:
de.xima.cmn.dao.interfaces.IEntity<Long>
,de.xima.cmn.dao.interfaces.ILockableEntity<Long>
,ILockingVersionProviding
,ITransferable
,ITransferableEntity
,ITransferableLockableEntity
,IUUIDEntity
,Serializable
,Comparable<de.xima.cmn.dao.interfaces.IEntity<Long>>
@Entity public class FormRecordChat extends AbstractLockableEntity implements IUUIDEntity
Entity representing a form record scoped chat. The chat belongs to a specificform record
and can receive messages.- Since:
- 8.2.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
ATTR_CREATED_INSTANT
static String
ATTR_FORM_RECORD
static String
ATTR_MEMBER_PROFILES
Deprecated.useATTR_MEMBERS
andFormRecordAccess.ATTR_USER_PROFILE_UUID
insteadstatic String
ATTR_MEMBER_REFS
Deprecated.useATTR_MEMBERS
andFormRecordAccess.ATTR_UNIVERSAL_REFERENCE_ID
insteadstatic String
ATTR_MEMBERS
static String
ATTR_MESSAGES
static String
ATTR_OPEN
static String
COL_FORM_RECORD_ID
-
Fields inherited from class de.xima.fc.entities.AbstractLockableEntity
COL_LOCKINGVERSION, lockingVersion
-
Fields inherited from class de.xima.fc.entities.AbstractEntity
COL_ID, id
-
Fields inherited from interface de.xima.fc.entities.interfaces.ITransferableEntity
IMPORT_ID, INVALID_ID
-
Fields inherited from interface de.xima.fc.entities.interfaces.IUUIDEntity
ATTR_UUID, COL_UUID, INVALID_UUID, INVALID_UUID_OBJECT, NULL_SAFE_UUID_TYPE, NULLABLE_UUID_TYPE, TYPE_NAME_UUID
-
-
Constructor Summary
Constructors Constructor Description FormRecordChat()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addMessage(FormRecordMessage message)
Adds a message to this chat, and set this chat on the message.Instant
getCreatedInstant()
String
getDisplayName(Locale locale)
Returns the display name of this chat in the context of the given user portal and locale.Vorgang
getFormRecord()
Long
getId()
Set<UserProfile>
getMemberProfiles()
Deprecated.Returns an empty collection.Set<String>
getMemberRefs()
Deprecated.Returns a collection of member refs.Set<FormRecordAccess>
getMembers()
List<FormRecordMessage>
getMessages()
List<FormRecordMessage>
getSenderMessages(IUser sender)
Returns all messages sent by the given user.int
getUnreadMessageCount(IUser user)
Returns the number of unread messages in the chat for the given user.int
getUnreadMessageCount(IUserRef userRef)
Returns the number of unread messages in the chat for the given user.@NotNull List<FormRecordMessage>
getUnreadMessages(IUser user)
Returns all unread messages in the chat for the given user.@NotNull List<FormRecordMessage>
getUnreadMessages(IUserRef userRef)
Returns all unread messages in the chat for the given user.String
getUUID()
Gets the UUID of this chat.UUID
getUUIDObject()
Gets the UUID of this chat.boolean
isMember(IUser user)
Returns whether a user is a member of this chat and can therefore receive its messages.boolean
isMember(IUserRef userRef)
Returns whether a user reference is a member of this chat and can therefore receive its messages.boolean
isOpen()
boolean
isRead(IUser user)
Returns whether all messages in the chat are read by the given user.boolean
isRead(IUserRef userRef)
Returns whether all messages in the chat are read by the given user.void
markAsReadByInboxUser()
Marks all messages in this chat as read by an inbox user.void
markRead(UserProfile profile)
Deprecated.UsemarkRead(IUser)
instead.void
markRead(IUser user)
Marks all messages in this chat as read for the given user.void
setCreatedInstant(Instant createdInstant)
void
setFormRecord(Vorgang formRecord)
void
setMember(FormRecordAccess access)
Sets the member to this chatvoid
setMemberProfiles(Set<UserProfile> memberProfiles)
Deprecated.Does nothing.void
setMemberRefs(Set<String> memberRefs)
Deprecated.Does nothing.void
setMembers(Set<FormRecordAccess> members)
void
setMessages(List<FormRecordMessage> messages)
void
setOpen(boolean open)
void
setUUID(String uuid)
Sets the UUID of this chat.void
setUUIDObject(UUID uuid)
Sets the UUID of this chat.-
Methods inherited from class de.xima.fc.entities.AbstractLockableEntity
entityHasChanged, getLockingVersion, setLockingVersion, toString
-
Methods inherited from class de.xima.fc.entities.AbstractEntity
asIntValue, isPersisted, setId, setId
-
Methods inherited from class de.xima.cmn.dao.model.AEntity
compareTo, equals, getDBTableName, hashCode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Field Detail
-
ATTR_FORM_RECORD
public static final String ATTR_FORM_RECORD
- See Also:
- Constant Field Values
-
ATTR_CREATED_INSTANT
public static final String ATTR_CREATED_INSTANT
- See Also:
- Constant Field Values
-
ATTR_OPEN
public static final String ATTR_OPEN
- See Also:
- Constant Field Values
-
ATTR_MESSAGES
public static final String ATTR_MESSAGES
- See Also:
- Constant Field Values
-
ATTR_MEMBERS
public static final String ATTR_MEMBERS
- See Also:
- Constant Field Values
-
ATTR_MEMBER_REFS
@Deprecated public static final String ATTR_MEMBER_REFS
Deprecated.useATTR_MEMBERS
andFormRecordAccess.ATTR_UNIVERSAL_REFERENCE_ID
instead- See Also:
- Constant Field Values
-
ATTR_MEMBER_PROFILES
@Deprecated public static final String ATTR_MEMBER_PROFILES
Deprecated.useATTR_MEMBERS
andFormRecordAccess.ATTR_USER_PROFILE_UUID
instead- See Also:
- Constant Field Values
-
COL_FORM_RECORD_ID
public static final String COL_FORM_RECORD_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
getUUID
public String getUUID()
Gets the UUID of this chat. The UUID must be globally unique among all form records and all clients.- Specified by:
getUUID
in interfaceIUUIDEntity
- Returns:
- The UUID of this chat.
-
setUUID
public void setUUID(String uuid)
Sets the UUID of this chat. The UUID must be globally unique among all form records and all clients.- Specified by:
setUUID
in interfaceIUUIDEntity
- Parameters:
uuid
- The UUID of this chat.
-
getUUIDObject
public UUID getUUIDObject()
Gets the UUID of this chat. The UUID must be globally unique among all form records and all clients.- Specified by:
getUUIDObject
in interfaceIUUIDEntity
- Returns:
- The UUID of this chat.
-
setUUIDObject
public void setUUIDObject(UUID uuid)
Sets the UUID of this chat. The UUID must be globally unique among all form records and all clients.- Parameters:
uuid
- The UUID of this chat.
-
getFormRecord
public Vorgang getFormRecord()
-
setFormRecord
public void setFormRecord(Vorgang formRecord)
-
getCreatedInstant
public Instant getCreatedInstant()
-
setCreatedInstant
public void setCreatedInstant(Instant createdInstant)
-
isOpen
public boolean isOpen()
-
setOpen
public void setOpen(boolean open)
-
getMembers
public Set<FormRecordAccess> getMembers()
-
setMembers
public void setMembers(Set<FormRecordAccess> members)
-
getMessages
public List<FormRecordMessage> getMessages()
-
setMessages
public void setMessages(List<FormRecordMessage> messages)
-
setMember
public void setMember(FormRecordAccess access)
Sets the member to this chat- Parameters:
access
- The access to set.
-
addMessage
public void addMessage(FormRecordMessage message)
Adds a message to this chat, and set this chat on the message.- Parameters:
message
- The message to add.
-
getSenderMessages
public List<FormRecordMessage> getSenderMessages(IUser sender)
Returns all messages sent by the given user.- Parameters:
sender
- the user that sent the messages.- Returns:
- a list of all the messages sent by the given user ordered by their submit date.
-
getUnreadMessageCount
public int getUnreadMessageCount(IUser user)
Returns the number of unread messages in the chat for the given user.- Parameters:
user
- The user to get the unread message count for.- Returns:
- The number of unread messages in the chat for the given user.
-
getUnreadMessageCount
public int getUnreadMessageCount(IUserRef userRef)
Returns the number of unread messages in the chat for the given user.- Parameters:
userRef
- The user reference to get the unread message count for.- Returns:
- The number of unread messages in the chat for the given user.
-
getUnreadMessages
@NotNull public @NotNull List<FormRecordMessage> getUnreadMessages(IUser user)
Returns all unread messages in the chat for the given user.- Parameters:
user
- The user to get the unread messages for.- Returns:
- The unread messages in the chat for the given user.
-
getUnreadMessages
@NotNull public @NotNull List<FormRecordMessage> getUnreadMessages(IUserRef userRef)
Returns all unread messages in the chat for the given user.- Parameters:
userRef
- The user reference to get the unread messages for.- Returns:
- The unread messages in the chat for the given user.
-
isRead
public boolean isRead(IUser user)
Returns whether all messages in the chat are read by the given user.- Parameters:
user
- The user to check the read state for.- Returns:
true
if all messages in the chat are read by the given user andfalse
if there is at least one unread message.
-
isRead
public boolean isRead(IUserRef userRef)
Returns whether all messages in the chat are read by the given user.- Parameters:
userRef
- The user reference to check the read state for.- Returns:
true
if all messages in the chat are read by the given user andfalse
if there is at least one unread message.
-
getDisplayName
public String getDisplayName(Locale locale)
Returns the display name of this chat in the context of the given user portal and locale.- Parameters:
locale
- The locale to get the display name for.- Returns:
- The display name of this chat in the context of the given user portal and locale.
-
isMember
public boolean isMember(IUser user)
Returns whether a user is a member of this chat and can therefore receive its messages.- Parameters:
user
- to check.- Returns:
true
if the given user is a member of this chat andfalse
otherwise.
-
isMember
public boolean isMember(IUserRef userRef)
Returns whether a user reference is a member of this chat and can therefore receive its messages.- Parameters:
userRef
- to check.- Returns:
true
if the given user reference is a member of this chat andfalse
otherwise.
-
markRead
@Deprecated public void markRead(UserProfile profile)
Deprecated.UsemarkRead(IUser)
instead.Marks all messages in this chat as read for the given user.- Parameters:
profile
- The user profile to mark the messages as read for.
-
markRead
public void markRead(IUser user)
Marks all messages in this chat as read for the given user.- Parameters:
user
- The user to mark the messages as read for.
-
markAsReadByInboxUser
public void markAsReadByInboxUser()
Marks all messages in this chat as read by an inbox user.
-
getMemberRefs
@Deprecated public Set<String> getMemberRefs()
Deprecated.Returns a collection of member refs. UsegetMembers()
andFormRecordAccess.getUniversalReferenceId()
instead.
-
setMemberRefs
@Deprecated public void setMemberRefs(Set<String> memberRefs)
Deprecated.Does nothing. UsesetMembers(Set)
instead- Parameters:
memberRefs
- the member references
-
getMemberProfiles
@Deprecated public Set<UserProfile> getMemberProfiles()
Deprecated.Returns an empty collection. UsegetMembers()
andFormRecordAccess.getUserProfileUuid()
instead.
-
setMemberProfiles
@Deprecated public void setMemberProfiles(Set<UserProfile> memberProfiles)
Deprecated.Does nothing. UsesetMembers(Set)
instead- Parameters:
memberProfiles
- the member profiles
-
-