Package org.opencms.db
Class CmsLoginMessage
java.lang.Object
org.opencms.db.CmsLoginMessage
A message to display when a user logs in to the system.
- Since:
- 6.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longThe default end time (if none has been set).static final longThe default start time (if none has been set). -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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 TypeMethodDescriptionprotected voidChecks if this message is frozen.clone()Returns the message.longReturns the time the message ends.longReturns the time the message starts.booleanisActive()Returnstrueif this message is currently active.booleanReturnstrueif this login message is the enabled.booleanReturnstrueif logins are currently forbidden according to the settings of this message.booleanReturnstrueif logins are forbidden while this message is active.voidsetEnabled(boolean enabled) Sets the enabled status of this message.protected voidFreezes the configuration of this login message object to prevent later changes.voidsetLoginForbidden(boolean loginForbidden) Sets the flag that controls if logins are forbidden while this message is active.voidsetMessage(String message) Sets the message to display.voidsetTimeEnd(long timeEnd) Sets the time when to finish displaying this message.voidsetTimeStart(long timeStart) Sets the time when to start displaying this message.
-
Field Details
-
DEFAULT_TIME_END
The default end time (if none has been set). This is December 31, 2039. -
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
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
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 Details
-
clone
-
getMessage
Returns the message.- Returns:
- the message
-
getTimeEnd
Returns the time the message ends.- Returns:
- the time the message ends
-
getTimeStart
Returns the time the message starts.- Returns:
- the time the message starts
-
isActive
Returnstrueif 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:
trueif this message is currently active
-
isEnabled
Returnstrueif this login message is the enabled.- Returns:
trueif this login message is the enabled
-
isLoginCurrentlyForbidden
Returnstrueif 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:
trueif logins are currently forbidden according to the settings of this message
-
isLoginForbidden
Returnstrueif logins are forbidden while this message is active.- Returns:
trueif logins are forbidden while this message is active
-
setEnabled
Sets the enabled status of this message.- Parameters:
enabled- the enabled status to set
-
setLoginForbidden
Sets the flag that controls if logins are forbidden while this message is active.- Parameters:
loginForbidden- the flag to set
-
setMessage
Sets the message to display.- Parameters:
message- the message to set
-
setTimeEnd
Sets the time when to finish displaying this message.- Parameters:
timeEnd- the time to set
-
setTimeStart
Sets the time when to start displaying this message.- Parameters:
timeStart- the time to set
-
checkFrozen
Checks if this message is frozen.- Throws:
CmsRuntimeException- in case the message is already frozen
-
setFrozen
Freezes the configuration of this login message object to prevent later changes.
-