Class CmsLoginMessage

java.lang.Object
org.opencms.db.CmsLoginMessage

public class CmsLoginMessage extends 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 final long
    The default end time (if none has been set).
    static final long
    The default start time (if none has been set).
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    protected void
    Checks if this message is frozen.
     
    Returns the message.
    long
    Returns the time the message ends.
    long
    Returns the time the message starts.
    boolean
    Returns true if this message is currently active.
    boolean
    Returns true if this login message is the enabled.
    boolean
    Returns true if logins are currently forbidden according to the settings of this message.
    boolean
    Returns true if logins are forbidden while this message is active.
    void
    setEnabled(boolean enabled)
    Sets the enabled status of this message.
    protected void
    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(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 Details

    • 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 Details

    • CmsLoginMessage

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

    • CmsLoginMessage

      public CmsLoginMessage(long timeStart, long timeEnd, 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(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 Details

    • clone

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

      public 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(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
    • checkFrozen

      protected void checkFrozen() throws CmsRuntimeException
      Checks if this message is frozen.

      Throws:
      CmsRuntimeException - in case the message is already frozen
    • setFrozen

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