@Transactional public class MessageServiceImpl extends Object implements MessageService
Constructor and Description |
---|
MessageServiceImpl()
Public constructor Required for use with spring's method injection.
|
Modifier and Type | Method and Description |
---|---|
Message |
createMessage(String subject,
String content)
Create a message object with the given parts.
|
Message |
createMessage(String sender,
String subject,
String content)
Create a message object with the given parts.
|
Message |
createMessage(String recipients,
String sender,
String subject,
String content)
Create a message object with the given parts.
|
Message |
createMessage(String recipients,
String sender,
String subject,
String content,
String attachment,
String attachmentContentType,
String attachmentFileName) |
List |
getAllTemplates()
Get all templates in the database.
|
MessagePreparator |
getMessagePreparator() |
MessageSender |
getMessageSender() |
Template |
getTemplate(Integer id)
Get template by identifier.
|
List |
getTemplatesByName(String name)
Get templates by name.
|
Message |
prepareMessage(String templateName,
Map data)
Prepare a message based on a template and data used for variable substitution within template.
|
Message |
prepareMessage(Template template)
Prepare a message given the template.
|
void |
sendMessage(Message message)
Send the message.
|
void |
sendMessage(Message message,
Collection<User> users)
Send message to a collection of recipients.
|
void |
sendMessage(Message message,
Integer recipientId)
Send a message to a user that is identified by the given identifier.
|
void |
sendMessage(Message message,
Role role)
Sends a message to a group of users identifier by their role.
|
void |
sendMessage(Message message,
String roleName)
Send a message to a group of users identified by their role.
|
void |
sendMessage(Message message,
User user)
Send message to a single user.
|
void |
sendMessage(String recipients,
String sender,
String subject,
String content)
Send a message using the given parameters.
|
void |
setMessagePreparator(MessagePreparator messagePreparator)
Set the message preparator.
|
void |
setMessageSender(MessageSender messageSender)
Set the message sender.
|
void |
setTemplateDAO(TemplateDAO dao) |
public MessageServiceImpl()
public void setTemplateDAO(TemplateDAO dao)
public void setMessagePreparator(MessagePreparator messagePreparator)
setMessagePreparator
in interface MessageService
messagePreparator
- public MessagePreparator getMessagePreparator()
getMessagePreparator
in interface MessageService
public void setMessageSender(MessageSender messageSender)
setMessageSender
in interface MessageService
messageSender
- public MessageSender getMessageSender()
getMessageSender
in interface MessageService
public void sendMessage(Message message) throws MessageException
sendMessage
in interface MessageService
message
- the Message to be sentMessageException
- Should send messageMessageService.sendMessage(org.openmrs.notification.Message)
public Message createMessage(String recipients, String sender, String subject, String content) throws MessageException
createMessage
in interface MessageService
recipients
- the recipients of the messagesender
- the send of the messagesubject
- the subject of the messagecontent
- the content or body of the messageMessageException
- Should create messagepublic Message createMessage(String sender, String subject, String content) throws MessageException
createMessage
in interface MessageService
sender
- the send of the messagesubject
- the subject of the messagecontent
- the content or body of the messageMessageException
public Message createMessage(String subject, String content) throws MessageException
createMessage
in interface MessageService
subject
- the subject of the messagecontent
- the content or body of the messageMessageException
public Message createMessage(String recipients, String sender, String subject, String content, String attachment, String attachmentContentType, String attachmentFileName) throws MessageException
public void sendMessage(String recipients, String sender, String subject, String content) throws MessageException
sendMessage
in interface MessageService
MessageException
public void sendMessage(Message message, Integer recipientId) throws MessageException
sendMessage
in interface MessageService
message
- Message
to be sentrecipientId
- Integer identifier of user (recipient)MessageException
public void sendMessage(Message message, User user) throws MessageException
sendMessage
in interface MessageService
message
- the Message
to be sentuser
- the recipient of the messageMessageException
public void sendMessage(Message message, Collection<User> users) throws MessageException
sendMessage
in interface MessageService
MessageException
public void sendMessage(Message message, String roleName) throws MessageException
sendMessage
in interface MessageService
MessageException
public void sendMessage(Message message, Role role) throws MessageException
sendMessage
in interface MessageService
MessageException
public Message prepareMessage(Template template) throws MessageException
prepareMessage
in interface MessageService
template
- the given Template
Message
MessageException
@Transactional(readOnly=true) public Message prepareMessage(String templateName, Map data) throws MessageException
prepareMessage
in interface MessageService
templateName
- name of the template to be useddata
- mapping used for variable substitution within templateMessageException
@Transactional(readOnly=true) public List getAllTemplates() throws MessageException
getAllTemplates
in interface MessageService
MessageException
@Transactional(readOnly=true) public Template getTemplate(Integer id) throws MessageException
getTemplate
in interface MessageService
id
- template identifierMessageException
@Transactional(readOnly=true) public List getTemplatesByName(String name) throws MessageException
getTemplatesByName
in interface MessageService
name
- the name of the templateMessageException
Copyright © 2024 OpenMRS Inc.. All rights reserved.