Class CmsLoginMessage


  • public class CmsLoginMessage
    extends java.lang.Object
    A message to display when a user logs in to the system.

    Since:
    6.0.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static long DEFAULT_TIME_END
      The default end time (if none has been set).
      static long DEFAULT_TIME_START
      The default start time (if none has been set).
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsLoginMessage()
      Creates a new login message with all default values.
      CmsLoginMessage​(long timeStart, long timeEnd, java.lang.String message, boolean loginForbidden)
      Creates a new login message with the given parameters.
      CmsLoginMessage​(java.lang.String message, boolean loginForbidden)
      Creates a new login message with the given parameters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void checkFrozen()
      Checks if this message is frozen.
      java.lang.Object clone()  
      java.lang.String getMessage()
      Returns the message.
      long getTimeEnd()
      Returns the time the message ends.
      long getTimeStart()
      Returns the time the message starts.
      boolean isActive()
      Returns true if this message is currently active.
      boolean isEnabled()
      Returns true if this login message is the enabled.
      boolean isLoginCurrentlyForbidden()
      Returns true if logins are currently forbidden according to the settings of this message.
      boolean isLoginForbidden()
      Returns true if logins are forbidden while this message is active.
      void setEnabled​(boolean enabled)
      Sets the enabled status of this message.
      protected void setFrozen()
      Freezes the configuration of this login message object to prevent later changes.
      void setLoginForbidden​(boolean loginForbidden)
      Sets the flag that controls if logins are forbidden while this message is active.
      void setMessage​(java.lang.String message)
      Sets the message to display.
      void setTimeEnd​(long timeEnd)
      Sets the time when to finish displaying this message.
      void setTimeStart​(long timeStart)
      Sets the time when to start displaying this message.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_TIME_END

        public static final long DEFAULT_TIME_END
        The default end time (if none has been set). This is December 31, 2039.
      • DEFAULT_TIME_START

        public static final long DEFAULT_TIME_START
        The default start time (if none has been set). This is January 1, 2000.
    • Constructor Detail

      • CmsLoginMessage

        public CmsLoginMessage()
        Creates a new login message with all default values.

      • CmsLoginMessage

        public CmsLoginMessage​(long timeStart,
                               long timeEnd,
                               java.lang.String message,
                               boolean loginForbidden)
        Creates a new login message with the given parameters.

        Parameters:
        timeStart - the time when to start displaying this message
        timeEnd - the time when to finish displaying this message
        message - the message to display
        loginForbidden - controls if logins are forbidden while this message is active
      • CmsLoginMessage

        public CmsLoginMessage​(java.lang.String message,
                               boolean loginForbidden)
        Creates a new login message with the given parameters.

        Parameters:
        message - the message to display
        loginForbidden - controls if logins are forbidden while this message is active
    • Method Detail

      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object
        See Also:
        Object.clone()
      • getMessage

        public java.lang.String getMessage()
        Returns the message.

        Returns:
        the message
      • getTimeEnd

        public long getTimeEnd()
        Returns the time the message ends.

        Returns:
        the time the message ends
      • getTimeStart

        public long getTimeStart()
        Returns the time the message starts.

        Returns:
        the time the message starts
      • isActive

        public boolean isActive()
        Returns true if this message is currently active.

        A message is active if it is enabled and the current time is after the message start time and before the message end time.

        Returns:
        true if this message is currently active
      • isEnabled

        public boolean isEnabled()
        Returns true if this login message is the enabled.

        Returns:
        true if this login message is the enabled
      • isLoginCurrentlyForbidden

        public boolean isLoginCurrentlyForbidden()
        Returns true if logins are currently forbidden according to the settings of this message.

        This checks the time settings using isActive() and isEnabled() as well as the isLoginForbidden() flag.

        Returns:
        true if logins are currently forbidden according to the settings of this message
      • isLoginForbidden

        public boolean isLoginForbidden()
        Returns true if logins are forbidden while this message is active.

        Returns:
        true if logins are forbidden while this message is active
      • setEnabled

        public void setEnabled​(boolean enabled)
        Sets the enabled status of this message.

        Parameters:
        enabled - the enabled status to set
      • setLoginForbidden

        public void setLoginForbidden​(boolean loginForbidden)
        Sets the flag that controls if logins are forbidden while this message is active.

        Parameters:
        loginForbidden - the flag to set
      • setMessage

        public void setMessage​(java.lang.String message)
        Sets the message to display.

        Parameters:
        message - the message to set
      • setTimeEnd

        public void setTimeEnd​(long timeEnd)
        Sets the time when to finish displaying this message.

        Parameters:
        timeEnd - the time to set
      • setTimeStart

        public void setTimeStart​(long timeStart)
        Sets the time when to start displaying this message.

        Parameters:
        timeStart - the time to set
      • setFrozen

        protected void setFrozen()
        Freezes the configuration of this login message object to prevent later changes.