Class 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 instead
      CmsBroadcast​(CmsUser sender, java.lang.String message, boolean repeat)
      Deprecated.
      use the constructors with the content mode instead
      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.
      CmsBroadcast​(CmsUser sender, java.lang.String message, long sendTime, long lastDisplay, boolean repeat)
      Deprecated.
      use the constructors with the content mode instead
      CmsBroadcast​(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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 instead
        Creates a new broadcast, with the current system time set as send time.

        Parameters:
        sender - the sender of the broadcast
        message - the message to send
      • CmsBroadcast

        @Deprecated
        public CmsBroadcast​(CmsUser sender,
                            java.lang.String message,
                            boolean repeat)
        Deprecated.
        use the constructors with the content mode instead
        Creates a new broadcast, with the current system time set as send time.

        Parameters:
        sender - the sender of the broadcast
        message - the message to send
        repeat - 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 broadcast
        message - the message to send
        repeat - true if message should be repeated
        mode - 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 broadcast
        message - the message to send
        mode - 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 instead
        Creates a new broadcast, with the current system time set as send time.

        Parameters:
        sender - the sender of the broadcast
        message - the message to send
        sendTime - time when broadcast initaly was send
        lastDisplay - last display time
        repeat - 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 broadcast
        message - the message to send
        sendTime - time when broadcast initaly was send
        lastDisplay - last display time
        repeat - true if the message should be repeated
        mode - the content mode
    • Method Detail

      • 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