Class SystemHelper
- java.lang.Object
- 
- org.apache.avalon.framework.logger.AbstractLogEnabled
- 
- org.ametys.runtime.plugins.admin.system.SystemHelper
 
 
- 
- All Implemented Interfaces:
- Component,- Contextualizable,- LogEnabled,- Serviceable
 
 public class SystemHelper extends AbstractLogEnabled implements Component, Serviceable, Contextualizable Helper for manipulating system announcement
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classSystemHelper.SystemAnnouncementClass representing the system announcement file
 - 
Field SummaryFields Modifier and Type Field Description static StringADMINISTRATOR_SYSTEM_FILEThe relative path to the file where system information are saved (announcement, maintenance...)static StringROLEAvalon role
 - 
Constructor SummaryConstructors Constructor Description SystemHelper()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcontextualize(Context context)MapdeleteAnnouncement(String language)Delete a announcementMap<String,Object>editAnnouncement(String language, String message, boolean override)Add or edit a system announcementlonggetSystemAnnoucementLastModificationDate()Return the date of the last modification of the annonceStringgetSystemAnnouncement(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.booleanisSystemAnnouncementAvailable()Tests if system announcements are active.SystemHelper.SystemAnnouncementreadValues()Read the system announcement's valuesvoidservice(ServiceManager serviceManager)voidsetAnnouncementAvailable(boolean available)Enables or disable system announcement- 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabledenableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
- 
 
- 
- 
- 
Field Detail- 
ADMINISTRATOR_SYSTEM_FILEpublic static final String ADMINISTRATOR_SYSTEM_FILE The relative path to the file where system information are saved (announcement, maintenance...)- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
SystemHelperpublic SystemHelper() 
 
- 
 - 
Method Detail- 
servicepublic void service(ServiceManager serviceManager) throws ServiceException - Specified by:
- servicein interface- Serviceable
- Throws:
- ServiceException
 
 - 
contextualizepublic void contextualize(Context context) throws ContextException - Specified by:
- contextualizein interface- Contextualizable
- Throws:
- ContextException
 
 - 
setAnnouncementAvailablepublic void setAnnouncementAvailable(boolean available) throws ProcessingException Enables or disable system announcement- Parameters:
- available- true to enable system announcement
- Throws:
- ProcessingException- if an error occurred
 
 - 
editAnnouncementpublic Map<String,Object> editAnnouncement(String language, String message, boolean override) throws Exception Add or edit a system announcement- Parameters:
- language- the language typed in by the user or "*" if modifying the default message
- message- the message to add nor edit
- override- true to override the existing value if exists
- Returns:
- the result map
- Throws:
- Exception- if an exception occurs
 
 - 
deleteAnnouncementpublic Map deleteAnnouncement(String language) throws ProcessingException Delete a announcement- Parameters:
- language- the language of the announcement to delete
- Returns:
- an empty map
- Throws:
- ProcessingException- if an exception occurs
 
 - 
isSystemAnnouncementAvailablepublic boolean isSystemAnnouncementAvailable() Tests if system announcements are active.- Returns:
- true if system announcements are active.
 
 - 
getSystemAnnoucementLastModificationDatepublic long getSystemAnnoucementLastModificationDate() Return the date of the last modification of the annonce- Returns:
- The date of the last modification or 0 if there is no announce file
 
 - 
getSystemAnnouncementpublic 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.- Parameters:
- languageCode- the desired language code of the system announcement
- Returns:
- the system announcement in the specified language code, or in the default language code, or null if announcements are not active.
 
 - 
readValuespublic SystemHelper.SystemAnnouncement readValues() Read the system announcement's values- Returns:
- The system announcement values;
 
 
- 
 
-