public class MessageSourceServiceImpl extends Object implements MessageSourceService
Constructor and Description |
---|
MessageSourceServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addPresentation(PresentationMessage message)
Adds a presentation message to the source.
|
MutableMessageSource |
getActiveMessageSource()
Gets the message source service which is currently providing services.
|
Collection<Locale> |
getLocales()
Gets the locales which are available from the current message source.
|
String |
getMessage(org.springframework.context.MessageSourceResolvable resolvable,
Locale locale) |
String |
getMessage(String s)
Get the message with the given code from the current user's selected locale.
|
String |
getMessage(String code,
Object[] args,
Locale locale) |
String |
getMessage(String code,
Object[] args,
String defaultMessage,
Locale locale) |
Set<MutableMessageSource> |
getMessageSources() |
org.springframework.context.MessageSource |
getParentMessageSource() |
PresentationMessage |
getPresentation(String key,
Locale forLocale)
Gets the PresentationMessage for a particular locale.
|
Collection<PresentationMessage> |
getPresentations()
Returns all available messages.
|
Collection<PresentationMessage> |
getPresentationsInLocale(Locale locale)
Gets alll the available messages in a particular locale, packaged as PresentationMessages.
|
void |
merge(MutableMessageSource fromSource,
boolean overwrite)
Merges messages from another message source into the active (current) message source.
|
void |
removePresentation(PresentationMessage message)
Removes a presentation message from the source.
|
void |
setActiveMessageSource(MutableMessageSource activeMessageSource)
Sets the message source service which will actually provide services.
|
void |
setMessageSources(Set<MutableMessageSource> availableMessageSources) |
void |
setParentMessageSource(org.springframework.context.MessageSource parent) |
public String getMessage(String s)
MessageSourceService
getMessage
in interface MessageSourceService
s
- message code to retrieveMessageSourceService.getMessage(java.lang.String)
public MutableMessageSource getActiveMessageSource()
getActiveMessageSource
in interface MessageSourceService
public void setActiveMessageSource(MutableMessageSource activeMessageSource)
setActiveMessageSource
in interface MessageSourceService
activeMessageSource
- the activeMessageSourceService to setpublic Collection<Locale> getLocales()
getLocales
in interface MutableMessageSource
MutableMessageSource.getLocales()
public Collection<PresentationMessage> getPresentations()
getPresentations
in interface MutableMessageSource
MutableMessageSource.getPresentations()
public String getMessage(org.springframework.context.MessageSourceResolvable resolvable, Locale locale)
getMessage
in interface org.springframework.context.MessageSource
MessageSource.getMessage(org.springframework.context.MessageSourceResolvable,
java.util.Locale)
public String getMessage(String code, Object[] args, Locale locale) throws org.springframework.context.NoSuchMessageException
getMessage
in interface org.springframework.context.MessageSource
org.springframework.context.NoSuchMessageException
MessageSource.getMessage(java.lang.String,
java.lang.Object[], java.util.Locale)
public String getMessage(String code, Object[] args, String defaultMessage, Locale locale)
getMessage
in interface org.springframework.context.MessageSource
MessageSource.getMessage(java.lang.String,
java.lang.Object[], java.lang.String, java.util.Locale)
public void addPresentation(PresentationMessage message)
MutableMessageSource
addPresentation
in interface MutableMessageSource
message
- message to add to the sourceMutableMessageSource.addPresentation(org.openmrs.messagesource.PresentationMessage)
public void removePresentation(PresentationMessage message)
MutableMessageSource
removePresentation
in interface MutableMessageSource
message
- the message to removeMutableMessageSource.addPresentation(org.openmrs.messagesource.PresentationMessage)
public Set<MutableMessageSource> getMessageSources()
getMessageSources
in interface MessageSourceService
public void setMessageSources(Set<MutableMessageSource> availableMessageSources)
setMessageSources
in interface MessageSourceService
availableMessageSources
- the availableMessageSources to setpublic void merge(MutableMessageSource fromSource, boolean overwrite)
merge
in interface MutableMessageSource
fromSource
- message source from which messages should be mergeoverwrite
- whether to overwrite existing messagesMutableMessageSource.merge(MutableMessageSource, boolean)
public PresentationMessage getPresentation(String key, Locale forLocale)
MutableMessageSource
getPresentation
in interface MutableMessageSource
key
- textual key for the messageforLocale
- locale for which to get the messageMutableMessageSource.getPresentation(java.lang.String,
java.util.Locale)
public Collection<PresentationMessage> getPresentationsInLocale(Locale locale)
MutableMessageSource
getPresentationsInLocale
in interface MutableMessageSource
locale
- locale for which to get the messagesMutableMessageSource.getPresentationsInLocale(java.util.Locale)
public org.springframework.context.MessageSource getParentMessageSource()
getParentMessageSource
in interface org.springframework.context.HierarchicalMessageSource
HierarchicalMessageSource.getParentMessageSource()
public void setParentMessageSource(org.springframework.context.MessageSource parent)
setParentMessageSource
in interface org.springframework.context.HierarchicalMessageSource
HierarchicalMessageSource.setParentMessageSource(org.springframework.context.MessageSource)
Copyright © 2024 OpenMRS Inc.. All rights reserved.