pt.digitalis.dif.dem.managers
Interface IMessageManager

All Known Implementing Classes:
AbstractMessageManager, MessageManagerImpl

public interface 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

Method Summary
 void addSupportedLanguage(String language)
          Adds a new supported language to the manager.
 MessageList collectEntityMessagesFromRepository(Class<?> clazz)
          Collect entity messages from resource LanguageID, MessageID, theMessageObject
 MessageList collectEntityMessagesFromRepository(Entity type, Object instance)
          Collect entity messages from resource LanguageID, MessageID, theMessageObject
 MessageList collectEntityMessagesFromRepository(Entity type, String id, String className, String parentID)
          Collect entity messages from resource LanguageID, MessageID, theMessageObject
 MessageList collectEntityMessagesFromRepository(String messagePath)
          Collect entity messages from resource LanguageID, MessageID, theMessageObject
 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.
 boolean isPersistent()
           
 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.
 

Method Detail

addSupportedLanguage

void addSupportedLanguage(String language)
Adds a new supported language to the manager.

Parameters:
language - the new supported language to add

collectEntityMessagesFromRepository

MessageList collectEntityMessagesFromRepository(Class<?> clazz)
Collect entity messages from resource LanguageID, MessageID, theMessageObject

Parameters:
clazz - the class to read the messages from
Returns:
the collected messages

collectEntityMessagesFromRepository

MessageList collectEntityMessagesFromRepository(Entity type,
                                                Object instance)
Collect entity messages from resource LanguageID, MessageID, theMessageObject

Parameters:
type - the type of the entity or null if it's not a DEM entity
instance - the entity instance
Returns:
the collected messages

collectEntityMessagesFromRepository

MessageList collectEntityMessagesFromRepository(Entity type,
                                                String id,
                                                String className,
                                                String parentID)
                                                throws pt.digitalis.utils.inspection.exception.ResourceNotFoundException
Collect entity messages from resource LanguageID, MessageID, theMessageObject

Parameters:
type - the type of the entity or null if it's not a DEM entity
id - the entity id
className - the class name
parentID - the entity's parent ID
Returns:
the collected messages
Throws:
pt.digitalis.utils.inspection.exception.ResourceNotFoundException - if a needed resource for message collection can't be found

collectEntityMessagesFromRepository

MessageList collectEntityMessagesFromRepository(String messagePath)
Collect entity messages from resource LanguageID, MessageID, theMessageObject

Parameters:
messagePath - the messagePath for the message file (without the ".messages.xx" suffix)
Returns:
the collected messages

getMessageList

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

Parameters:
type - the entity type
entity - the entity object
Returns:
the messages collected

getMessageList

MessageList getMessageList(IApplication application)
Gets the messages of a given Provider with all translations.

Parameters:
application - the application for which the messages should be retrieved
Returns:
the application messages

getMessageList

MessageList getMessageList(IProvider provider)
Gets the messages of a given Provider with all translations.

Parameters:
provider - the provider for which the messages should be retrieved
Returns:
the provider messages

getMessageList

MessageList getMessageList(IService service)
Gets the messages of a given service with all translations.

Parameters:
service - the service for which the messages should be retrieved
Returns:
the service messages

getMessageList

MessageList getMessageList(IStage stage)
Gets the messages of a given stage with all translations.

Parameters:
stage - the stage for which the messages should be retrieved
Returns:
the stage messages

getMessages

Map<String,String> getMessages(IApplication application,
                               String language)
Gets the messages of a given Application.

Parameters:
application - the application for which the messages should be retrieved
language - the language to filter
Returns:
the application messages

getMessages

Map<String,String> getMessages(IProvider provider,
                               String language)
Gets the messages of a given Provider.

Parameters:
provider - the provider for which the messages should be retrieved
language - the language to search
Returns:
the provider messages

getMessages

Map<String,String> getMessages(IService service,
                               String language)
Gets the messages of a given Service.

Parameters:
service - the service for which the messages should be retrieved
language - the language to filter
Returns:
the service messages

getMessages

Map<String,String> getMessages(IStage stage,
                               String language)
Gets the messages of a given Stage.

Parameters:
stage - the stage for which the messages should be retrieved
language - the language to filter
Returns:
the stage messages

getSupportedLanguages

Set<String> getSupportedLanguages()
Returns the list of supported languages.

Returns:
the list of supported languages

invalidateMessages

void invalidateMessages()
Invalidates the messages, forcing their reloading.


isLanguageSupported

boolean isLanguageSupported(String language)
Checks if a given language is supported.

Parameters:
language - the language to check
Returns:
T if the passed language is supported, F otherwise

isPersistent

boolean isPersistent()
Returns:
T this implementation supports saving messages to a persistent media. If F changes will be lost after a server restart

updateMessage

void updateMessage(Class<?> clazz,
                   String messageID,
                   MessageTranslations message)
Updates a message with a given ID on a given class.

Parameters:
clazz - the class
messageID - the ID of the message to update
message - the message (and it's translations) to update

updateMessage

void updateMessage(IEntity entity,
                   String messageID,
                   MessageTranslations message)
Updates a message with a given ID on a given entity.

Parameters:
entity - the entity
messageID - the ID of the message to update
message - the message (and it's translations) to update


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