Package org.opencms.db
Class CmsLoginMessage
- java.lang.Object
-
- org.opencms.db.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()
Returnstrue
if this message is currently active.boolean
isEnabled()
Returnstrue
if this login message is the enabled.boolean
isLoginCurrentlyForbidden()
Returnstrue
if logins are currently forbidden according to the settings of this message.boolean
isLoginForbidden()
Returnstrue
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.
-
-
-
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 messagetimeEnd
- the time when to finish displaying this messagemessage
- the message to displayloginForbidden
- 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 displayloginForbidden
- controls if logins are forbidden while this message is active
-
-
Method Detail
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classjava.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()
Returnstrue
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()
Returnstrue
if this login message is the enabled.- Returns:
true
if this login message is the enabled
-
isLoginCurrentlyForbidden
public boolean isLoginCurrentlyForbidden()
Returnstrue
if logins are currently forbidden according to the settings of this message.This checks the time settings using
andisActive()
as well as theisEnabled()
flag.isLoginForbidden()
- Returns:
true
if logins are currently forbidden according to the settings of this message
-
isLoginForbidden
public boolean isLoginForbidden()
Returnstrue
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
-
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.
-
-