pt.digitalis.dif.dem.managers.impl
Class AbstractMessageManager

java.lang.Object
  extended by pt.digitalis.dif.dem.managers.impl.AbstractMessageManager
All Implemented Interfaces:
IMessageManager
Direct Known Subclasses:
MessageManagerImpl

public abstract class AbstractMessageManager
extends Object
implements IMessageManager

Manages the DEM messages, providing operations for access, pooling and persistence.

Author:
Pedro Viegas pviegas@digitalis.pt, Rodrigo Gonçalves rgoncalves@digitalis.pt
Created on:
2007/06/01

Field Summary
protected static String DEFAULT_MESSAGE_FILE_EXTENSION
          The default message file extension.
protected static String MESSAGES_FOLDER
          The messages folder.
protected static String NUMBER_SIGN
          The number sign character as a string.
 
Constructor Summary
AbstractMessageManager()
           
 
Method Summary
 void addSupportedLanguage(String language)
          Adds a new supported language to the manager.
protected  String getEntityID(IEntity entity)
          Generates the ID of a given entity.
 MessageList getMessageList(Entity type, IEntity entity)
          Gets the messages from the repository and collects them on first use
 MessageList getMessageList(IApplication application)
          Gets the messages of a given Provider with all translations.
 MessageList getMessageList(IProvider provider)
          Gets the messages of a given Provider with all translations.
 MessageList getMessageList(IService service)
          Gets the messages of a given service with all translations.
 MessageList getMessageList(IStage stage)
          Gets the messages of a given stage with all translations.
 Map<String,String> getMessages(IApplication application, String language)
          Gets the messages of a given Application.
 Map<String,String> getMessages(IProvider provider, String language)
          Gets the messages of a given Provider.
 Map<String,String> getMessages(IService service, String language)
          Gets the messages of a given Service.
 Map<String,String> getMessages(IStage stage, String language)
          Gets the messages of a given Stage.
 Set<String> getSupportedLanguages()
          Returns the list of supported languages.
 void invalidateMessages()
          Invalidates the messages, forcing their reloading.
 boolean isLanguageSupported(String language)
          Checks if a given language is supported.
 void updateMessage(Class<?> clazz, String messageID, MessageTranslations message)
          Updates a message with a given ID on a given class.
 void updateMessage(IEntity entity, String messageID, MessageTranslations message)
          Updates a message with a given ID on a given entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface pt.digitalis.dif.dem.managers.IMessageManager
collectEntityMessagesFromRepository, collectEntityMessagesFromRepository, collectEntityMessagesFromRepository, collectEntityMessagesFromRepository, isPersistent
 

Field Detail

DEFAULT_MESSAGE_FILE_EXTENSION

protected static final String DEFAULT_MESSAGE_FILE_EXTENSION
The default message file extension.

See Also:
Constant Field Values

MESSAGES_FOLDER

protected static final String MESSAGES_FOLDER
The messages folder.

See Also:
Constant Field Values

NUMBER_SIGN

protected static final String NUMBER_SIGN
The number sign character as a string.

See Also:
Constant Field Values
Constructor Detail

AbstractMessageManager

public AbstractMessageManager()
Method Detail

addSupportedLanguage

public void addSupportedLanguage(String language)
Description copied from interface: IMessageManager
Adds a new supported language to the manager.

Specified by:
addSupportedLanguage in interface IMessageManager
Parameters:
language - the new supported language to add
See Also:
IMessageManager.addSupportedLanguage(java.lang.String)

getEntityID

protected String getEntityID(IEntity entity)
Generates the ID of a given entity.

Parameters:
entity - the entity to generate the ID
Returns:
the entity ID

getMessageList

public MessageList getMessageList(Entity type,
                                  IEntity entity)
Gets the messages from the repository and collects them on first use

Specified by:
getMessageList in interface IMessageManager
Parameters:
type - the entity type
entity - the entity object
Returns:
the messages collected

getMessageList

public MessageList getMessageList(IApplication application)
Description copied from interface: IMessageManager
Gets the messages of a given Provider with all translations.

Specified by:
getMessageList in interface IMessageManager
Parameters:
application - the application for which the messages should be retrieved
Returns:
the application messages
See Also:
IMessageManager.getMessageList(pt.digitalis.dif.dem.interfaces.IApplication)

getMessageList

public MessageList getMessageList(IProvider provider)
Description copied from interface: IMessageManager
Gets the messages of a given Provider with all translations.

Specified by:
getMessageList in interface IMessageManager
Parameters:
provider - the provider for which the messages should be retrieved
Returns:
the provider messages
See Also:
IMessageManager.getMessageList(pt.digitalis.dif.dem.interfaces.IProvider)

getMessageList

public MessageList getMessageList(IService service)
Description copied from interface: IMessageManager
Gets the messages of a given service with all translations.

Specified by:
getMessageList in interface IMessageManager
Parameters:
service - the service for which the messages should be retrieved
Returns:
the service messages
See Also:
IMessageManager.getMessageList(pt.digitalis.dif.dem.interfaces.IService)

getMessageList

public MessageList getMessageList(IStage stage)
Description copied from interface: IMessageManager
Gets the messages of a given stage with all translations.

Specified by:
getMessageList in interface IMessageManager
Parameters:
stage - the stage for which the messages should be retrieved
Returns:
the stage messages
See Also:
IMessageManager.getMessageList(pt.digitalis.dif.dem.interfaces.IStage)

getMessages

public Map<String,String> getMessages(IApplication application,
                                      String language)
Description copied from interface: IMessageManager
Gets the messages of a given Application.

Specified by:
getMessages in interface IMessageManager
Parameters:
application - the application for which the messages should be retrieved
language - the language to filter
Returns:
the application messages
See Also:
IMessageManager.getMessages(pt.digitalis.dif.dem.interfaces.IApplication, String)

getMessages

public Map<String,String> getMessages(IProvider provider,
                                      String language)
Description copied from interface: IMessageManager
Gets the messages of a given Provider.

Specified by:
getMessages in interface IMessageManager
Parameters:
provider - the provider for which the messages should be retrieved
language - the language to search
Returns:
the provider messages
See Also:
IMessageManager.getMessages(pt.digitalis.dif.dem.interfaces.IProvider, String)

getMessages

public Map<String,String> getMessages(IService service,
                                      String language)
Description copied from interface: IMessageManager
Gets the messages of a given Service.

Specified by:
getMessages in interface IMessageManager
Parameters:
service - the service for which the messages should be retrieved
language - the language to filter
Returns:
the service messages
See Also:
IMessageManager.getMessages(pt.digitalis.dif.dem.interfaces.IService, String)

getMessages

public Map<String,String> getMessages(IStage stage,
                                      String language)
Description copied from interface: IMessageManager
Gets the messages of a given Stage.

Specified by:
getMessages in interface IMessageManager
Parameters:
stage - the stage for which the messages should be retrieved
language - the language to filter
Returns:
the stage messages
See Also:
IMessageManager.getMessages(pt.digitalis.dif.dem.interfaces.IStage, String)

getSupportedLanguages

public Set<String> getSupportedLanguages()
Description copied from interface: IMessageManager
Returns the list of supported languages.

Specified by:
getSupportedLanguages in interface IMessageManager
Returns:
the list of supported languages
See Also:
IMessageManager.getSupportedLanguages()

invalidateMessages

public void invalidateMessages()
Description copied from interface: IMessageManager
Invalidates the messages, forcing their reloading.

Specified by:
invalidateMessages in interface IMessageManager
See Also:
IMessageManager.invalidateMessages()

isLanguageSupported

public boolean isLanguageSupported(String language)
Description copied from interface: IMessageManager
Checks if a given language is supported.

Specified by:
isLanguageSupported in interface IMessageManager
Parameters:
language - the language to check
Returns:
T if the passed language is supported, F otherwise
See Also:
IMessageManager.isLanguageSupported(java.lang.String)

updateMessage

public void updateMessage(Class<?> clazz,
                          String messageID,
                          MessageTranslations message)
Description copied from interface: IMessageManager
Updates a message with a given ID on a given class.

Specified by:
updateMessage in interface IMessageManager
Parameters:
clazz - the class
messageID - the ID of the message to update
message - the message (and it's translations) to update
See Also:
IMessageManager.updateMessage(java.lang.Class, java.lang.String, pt.digitalis.dif.dem.objects.messages.MessageTranslations)

updateMessage

public void updateMessage(IEntity entity,
                          String messageID,
                          MessageTranslations message)
Description copied from interface: IMessageManager
Updates a message with a given ID on a given entity.

Specified by:
updateMessage in interface IMessageManager
Parameters:
entity - the entity
messageID - the ID of the message to update
message - the message (and it's translations) to update
See Also:
IMessageManager.updateMessage(pt.digitalis.dif.dem.interfaces.IEntity, java.lang.String, pt.digitalis.dif.dem.objects.messages.MessageTranslations)


Copyright © 2014 Digitalis Informática Lda. All Rights Reserved.