Package org.opencms.main
Class CmsBroadcast
- java.lang.Object
-
- org.opencms.main.CmsBroadcast
-
- All Implemented Interfaces:
java.lang.Cloneable
public class CmsBroadcast extends java.lang.Object implements java.lang.Cloneable
A single broadcast message, send from one OpenCms user to another.To addess a broadcast to another user, it must be placed in the broadcast queue of that user using for example
CmsSessionManager.sendBroadcast(CmsUser, String, CmsUser)
.- Since:
- 6.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CmsBroadcast.ContentMode
The content mode describes how the text used for a broadcast message should be interpreted.
-
Field Summary
Fields Modifier and Type Field Description static long
DISPLAY_AGAIN_TIME
Time interval between displays of repeated messages.
-
Constructor Summary
Constructors Constructor Description CmsBroadcast(CmsUser sender, java.lang.String message)
Deprecated.use the constructors with the content mode insteadCmsBroadcast(CmsUser sender, java.lang.String message, boolean repeat)
Deprecated.use the constructors with the content mode insteadCmsBroadcast(CmsUser sender, java.lang.String message, boolean repeat, CmsBroadcast.ContentMode mode)
Creates a new broadcast, with the current system time set as send time.CmsBroadcast(CmsUser sender, java.lang.String message, long sendTime, long lastDisplay, boolean repeat)
Deprecated.use the constructors with the content mode insteadCmsBroadcast(CmsUser sender, java.lang.String message, long sendTime, long lastDisplay, boolean repeat, CmsBroadcast.ContentMode mode)
Deprecated.CmsBroadcast(CmsUser sender, java.lang.String message, CmsBroadcast.ContentMode mode)
Creates a new broadcast, with the current system time set as send time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CmsBroadcast.ContentMode
getContentMode()
Gets the content mode.long
getLastDisplay()
Gets the last display time.java.lang.String
getMessage()
Returns the processed broadcast message content as HTML.java.lang.String
getRawMessage()
Returns the original message text passed in the constructor.long
getSendTime()
Returns the time this broadcast was send.CmsUser
getUser()
Returns the user that was the sender of this broadcast.boolean
isRepeat()
Returns true if this is a repeating message.CmsBroadcast
withLastDisplay(long lastDisplay)
Produces a copy of this object, but with a changed lastDisplay attribute.
-
-
-
Field Detail
-
DISPLAY_AGAIN_TIME
public static long DISPLAY_AGAIN_TIME
Time interval between displays of repeated messages.
-
-
Constructor Detail
-
CmsBroadcast
@Deprecated public CmsBroadcast(CmsUser sender, java.lang.String message)
Deprecated.use the constructors with the content mode insteadCreates a new broadcast, with the current system time set as send time.- Parameters:
sender
- the sender of the broadcastmessage
- the message to send
-
CmsBroadcast
@Deprecated public CmsBroadcast(CmsUser sender, java.lang.String message, boolean repeat)
Deprecated.use the constructors with the content mode insteadCreates a new broadcast, with the current system time set as send time.- Parameters:
sender
- the sender of the broadcastmessage
- the message to sendrepeat
- true if message shoul be repeated
-
CmsBroadcast
public CmsBroadcast(CmsUser sender, java.lang.String message, boolean repeat, CmsBroadcast.ContentMode mode)
Creates a new broadcast, with the current system time set as send time.- Parameters:
sender
- the sender of the broadcastmessage
- the message to sendrepeat
- true if message should be repeatedmode
- the content mode
-
CmsBroadcast
public CmsBroadcast(CmsUser sender, java.lang.String message, CmsBroadcast.ContentMode mode)
Creates a new broadcast, with the current system time set as send time.- Parameters:
sender
- the sender of the broadcastmessage
- the message to sendmode
- the content mode
-
CmsBroadcast
@Deprecated public CmsBroadcast(CmsUser sender, java.lang.String message, long sendTime, long lastDisplay, boolean repeat)
Deprecated.use the constructors with the content mode insteadCreates a new broadcast, with the current system time set as send time.- Parameters:
sender
- the sender of the broadcastmessage
- the message to sendsendTime
- time when broadcast initaly was sendlastDisplay
- last display timerepeat
- true if message should be repeated
-
CmsBroadcast
@Deprecated public CmsBroadcast(CmsUser sender, java.lang.String message, long sendTime, long lastDisplay, boolean repeat, CmsBroadcast.ContentMode mode)
Deprecated.Creates a new broadcast, with the current system time set as send time.- Parameters:
sender
- the sender of the broadcastmessage
- the message to sendsendTime
- time when broadcast initaly was sendlastDisplay
- last display timerepeat
- true if the message should be repeatedmode
- the content mode
-
-
Method Detail
-
getContentMode
public CmsBroadcast.ContentMode getContentMode()
Gets the content mode.- Returns:
- the content mode
-
getLastDisplay
public long getLastDisplay()
Gets the last display time.- Returns:
- the last display time
-
getMessage
public java.lang.String getMessage()
Returns the processed broadcast message content as HTML.- Returns:
- the broadcast message content HTML
-
getRawMessage
public java.lang.String getRawMessage()
Returns the original message text passed in the constructor.- Returns:
- the original message text
-
getSendTime
public long getSendTime()
Returns the time this broadcast was send.- Returns:
- the time this broadcast was send
-
getUser
public CmsUser getUser()
Returns the user that was the sender of this broadcast.It could be
null
to signalize a system message.- Returns:
- the user that was the sender of this broadcast
-
isRepeat
public boolean isRepeat()
Returns true if this is a repeating message.- Returns:
- true if this is a repeating message
-
withLastDisplay
public CmsBroadcast withLastDisplay(long lastDisplay)
Produces a copy of this object, but with a changed lastDisplay attribute.- Parameters:
lastDisplay
- the new value for the lastDisplay attribute- Returns:
- the copy with the modified time
-
-