public class SystemHelper extends AbstractLogEnabled implements Component, Serviceable, Contextualizable
Modifier and Type | Class and Description |
---|---|
class |
SystemHelper.SystemAnnouncement
Class representing the system announcement file
|
Modifier and Type | Field and Description |
---|---|
private Context |
_context |
private I18nUtils |
_i18nUtils |
static String |
ADMINISTRATOR_SYSTEM_FILE
The relative path to the file where system information are saved (announcement, maintenance...)
|
static String |
ROLE
Avalon role
|
Constructor and Description |
---|
SystemHelper() |
Modifier and Type | Method and Description |
---|---|
private void |
_save(boolean state,
Map<String,String> messages)
Saves the system announcement's values
|
private void |
_setDefaultValues() |
void |
contextualize(Context context) |
Map |
deleteAnnouncement(String language)
Delete a announcement
|
Map<String,Object> |
editAnnouncement(String language,
String message,
boolean override)
Add or edit a system announcement
|
long |
getSystemAnnoucementLastModificationDate()
Return the date of the last modification of the annonce
|
String |
getSystemAnnouncement(String languageCode)
Returns the system announcement for the given language code, or for the default language code if there is no specified announcement for the given language code.
Returns null if the system announcements are not activated. |
boolean |
isSystemAnnouncementAvailable()
Tests if system announcements are active.
|
SystemHelper.SystemAnnouncement |
readValues()
Read the system announcement's values
|
void |
service(ServiceManager serviceManager) |
void |
setAnnouncementAvailable(boolean available)
Enables or disable system announcement
|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
public static final String ADMINISTRATOR_SYSTEM_FILE
private I18nUtils _i18nUtils
public SystemHelper()
public void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
ServiceException
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void setAnnouncementAvailable(boolean available) throws ProcessingException
available
- true to enable system announcementProcessingException
- if an error occurredpublic Map<String,Object> editAnnouncement(String language, String message, boolean override) throws Exception
language
- the language typed in by the user or "*" if modifying the default messagemessage
- the message to add nor editoverride
- true to override the existing value if existsException
- if an exception occurspublic Map deleteAnnouncement(String language) throws ProcessingException
language
- the language of the announcement to deleteProcessingException
- if an exception occursprivate void _save(boolean state, Map<String,String> messages) throws ProcessingException
state
- true to enable system announcementmessages
- the messagesProcessingException
- if an error ocurredpublic boolean isSystemAnnouncementAvailable()
public long getSystemAnnoucementLastModificationDate()
public String getSystemAnnouncement(String languageCode)
languageCode
- the desired language code of the system announcementpublic SystemHelper.SystemAnnouncement readValues()
private void _setDefaultValues() throws ProcessingException
ProcessingException