org.openmrs.notification.impl
Class MessageServiceImpl

java.lang.Object
  extended by org.openmrs.notification.impl.MessageServiceImpl
All Implemented Interfaces:
MessageService

public class MessageServiceImpl
extends java.lang.Object
implements MessageService


Constructor Summary
MessageServiceImpl()
          Public constructor Required for use with spring's method injection.
 
Method Summary
 Message create(java.lang.String subject, java.lang.String message)
          Deprecated.  
 Message create(java.lang.String sender, java.lang.String subject, java.lang.String message)
          Deprecated.  
 Message create(java.lang.String recipients, java.lang.String sender, java.lang.String subject, java.lang.String message)
          Deprecated.  
 Message createMessage(java.lang.String subject, java.lang.String content)
          Create a message object with the given parts.
 Message createMessage(java.lang.String sender, java.lang.String subject, java.lang.String content)
          Create a message object with the given parts.
 Message createMessage(java.lang.String recipients, java.lang.String sender, java.lang.String subject, java.lang.String content)
          Create a message object with the given parts.
 Message createMessage(java.lang.String recipients, java.lang.String sender, java.lang.String subject, java.lang.String content, java.lang.String attachment, java.lang.String attachmentContentType, java.lang.String attachmentFileName)
           
 java.util.List getAllTemplates()
          Get all templates in the database.
 MessagePreparator getMessagePreparator()
           
 MessageSender getMessageSender()
           
 Template getTemplate(java.lang.Integer id)
          Get template by identifier.
 java.util.List getTemplatesByName(java.lang.String name)
          Get templates by name.
 Message prepare(java.lang.String templateName, java.util.Map data)
          Deprecated.  
 Message prepare(Template template)
          Deprecated.  
 Message prepareMessage(java.lang.String templateName, java.util.Map data)
          Prepare a message based on a template and data used for variable subsitution within template.
 Message prepareMessage(Template template)
          Prepare a message given the template.
 void send(Message message)
          Deprecated. use sendMessage(Message)
 void send(Message message, java.util.Collection<User> users)
          Deprecated. send(Message, Collection)
 void send(Message message, java.lang.Integer userId)
          Deprecated. use sendMessage(Message, Integer)
 void send(Message message, Role role)
          Deprecated. send(Message, Role)
 void send(Message message, java.lang.String roleName)
          Deprecated. use sendMessage(Message, String)
 void send(Message message, User user)
          Deprecated. use sendMessage(Message, User)
 void send(java.lang.String recipients, java.lang.String sender, java.lang.String subject, java.lang.String message)
          Deprecated. use send(String, String, String, String)
 void sendMessage(Message message)
          Send the message.
 void sendMessage(Message message, java.util.Collection<User> users)
          Send message to a collection of recipients.
 void sendMessage(Message message, java.lang.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 thir role.
 void sendMessage(Message message, java.lang.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(java.lang.String recipients, java.lang.String sender, java.lang.String subject, java.lang.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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageServiceImpl

public MessageServiceImpl()
Public constructor Required for use with spring's method injection. Be careful because this class requires a DAO Context in order to work properly. Please set the DAO context

Method Detail

setTemplateDAO

public void setTemplateDAO(TemplateDAO dao)

setMessagePreparator

public void setMessagePreparator(MessagePreparator messagePreparator)
Set the message preparator.

Specified by:
setMessagePreparator in interface MessageService
Parameters:
messagePreparator -

getMessagePreparator

public MessagePreparator getMessagePreparator()
Specified by:
getMessagePreparator in interface MessageService

setMessageSender

public void setMessageSender(MessageSender messageSender)
Set the message sender.

Specified by:
setMessageSender in interface MessageService
Parameters:
messageSender -

getMessageSender

public MessageSender getMessageSender()
Specified by:
getMessageSender in interface MessageService

sendMessage

public void sendMessage(Message message)
                 throws MessageException
Send the message. All send calls go through this method.

Specified by:
sendMessage in interface MessageService
Parameters:
message - the Message to be sent
Throws:
MessageException
See Also:
MessageService.sendMessage(org.openmrs.notification.Message)

createMessage

public Message createMessage(java.lang.String recipients,
                             java.lang.String sender,
                             java.lang.String subject,
                             java.lang.String content)
                      throws MessageException
Create a message object with the given parts.

Specified by:
createMessage in interface MessageService
Parameters:
recipients - the recipients of the message
sender - the send of the message
subject - the subject of the message
content - the content or body of the message
Returns:
Message the message that was created
Throws:
MessageException

createMessage

public Message createMessage(java.lang.String sender,
                             java.lang.String subject,
                             java.lang.String content)
                      throws MessageException
Create a message object with the given parts.

Specified by:
createMessage in interface MessageService
Parameters:
sender - the send of the message
subject - the subject of the message
content - the content or body of the message
Throws:
MessageException

createMessage

public Message createMessage(java.lang.String subject,
                             java.lang.String content)
                      throws MessageException
Create a message object with the given parts.

Specified by:
createMessage in interface MessageService
Parameters:
subject - the subject of the message
content - the content or body of the message
Throws:
MessageException

createMessage

public Message createMessage(java.lang.String recipients,
                             java.lang.String sender,
                             java.lang.String subject,
                             java.lang.String content,
                             java.lang.String attachment,
                             java.lang.String attachmentContentType,
                             java.lang.String attachmentFileName)
                      throws MessageException
Specified by:
createMessage in interface MessageService
Throws:
MessageException
See Also:
MessageService.createMessage(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)

sendMessage

public void sendMessage(java.lang.String recipients,
                        java.lang.String sender,
                        java.lang.String subject,
                        java.lang.String content)
                 throws MessageException
Send a message using the given parameters. This is a convenience method so that the client does not need to create its own Message object.

Specified by:
sendMessage in interface MessageService
Throws:
MessageException

sendMessage

public void sendMessage(Message message,
                        java.lang.Integer recipientId)
                 throws MessageException
Send a message to a user that is identified by the given identifier.

Specified by:
sendMessage in interface MessageService
Parameters:
message - Message to be sent
recipientId - Integer identifier of user (recipient)
Throws:
MessageException

sendMessage

public void sendMessage(Message message,
                        User user)
                 throws MessageException
Send message to a single user.

Specified by:
sendMessage in interface MessageService
Parameters:
message - the Message to be sent
user - the recipient of the message
Throws:
MessageException

sendMessage

public void sendMessage(Message message,
                        java.util.Collection<User> users)
                 throws MessageException
Send message to a collection of recipients.

Specified by:
sendMessage in interface MessageService
Throws:
MessageException

sendMessage

public void sendMessage(Message message,
                        java.lang.String roleName)
                 throws MessageException
Send a message to a group of users identified by their role.

Specified by:
sendMessage in interface MessageService
Throws:
MessageException

sendMessage

public void sendMessage(Message message,
                        Role role)
                 throws MessageException
Sends a message to a group of users identifier by thir role.

Specified by:
sendMessage in interface MessageService
Throws:
MessageException

prepareMessage

public Message prepareMessage(Template template)
                       throws MessageException
Prepare a message given the template. The template should be populated with all necessary data including the variable name-value pairs

Specified by:
prepareMessage in interface MessageService
Parameters:
template - the given Template
Returns:
the prepared Message
Throws:
MessageException

prepareMessage

public Message prepareMessage(java.lang.String templateName,
                              java.util.Map data)
                       throws MessageException
Prepare a message based on a template and data used for variable subsitution within template.

Specified by:
prepareMessage in interface MessageService
Parameters:
templateName - name of the template to be used
data - data mapping used for variable substitution within template
Returns:
the prepared Message
Throws:
MessageException

getAllTemplates

public java.util.List getAllTemplates()
                               throws MessageException
Get all templates in the database.

Specified by:
getAllTemplates in interface MessageService
Returns:
list of Templates
Throws:
MessageException

getTemplate

public Template getTemplate(java.lang.Integer id)
                     throws MessageException
Get template by identifier.

Specified by:
getTemplate in interface MessageService
Parameters:
id - template identifier
Returns:
Template
Throws:
MessageException

getTemplatesByName

public java.util.List getTemplatesByName(java.lang.String name)
                                  throws MessageException
Get templates by name.

Specified by:
getTemplatesByName in interface MessageService
Parameters:
name - the name of the template
Returns:
list of Templates
Throws:
MessageException

create

public Message create(java.lang.String subject,
                      java.lang.String message)
               throws MessageException
Deprecated. 

Specified by:
create in interface MessageService
Throws:
MessageException
See Also:
MessageService.create(java.lang.String, java.lang.String)

create

public Message create(java.lang.String sender,
                      java.lang.String subject,
                      java.lang.String message)
               throws MessageException
Deprecated. 

Specified by:
create in interface MessageService
Throws:
MessageException
See Also:
MessageService.create(java.lang.String, java.lang.String, java.lang.String)

create

public Message create(java.lang.String recipients,
                      java.lang.String sender,
                      java.lang.String subject,
                      java.lang.String message)
               throws MessageException
Deprecated. 

Specified by:
create in interface MessageService
Throws:
MessageException
See Also:
MessageService.create(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

prepare

public Message prepare(java.lang.String templateName,
                       java.util.Map data)
                throws MessageException
Deprecated. 

Specified by:
prepare in interface MessageService
Throws:
MessageException
See Also:
MessageService.prepare(java.lang.String, java.util.Map)

prepare

public Message prepare(Template template)
                throws MessageException
Deprecated. 

Specified by:
prepare in interface MessageService
Throws:
MessageException
See Also:
MessageService.prepare(org.openmrs.notification.Template)

send

public void send(Message message)
          throws MessageException
Deprecated. use sendMessage(Message)

Specified by:
send in interface MessageService
Throws:
MessageException
See Also:
MessageService.send(org.openmrs.notification.Message)

send

public void send(Message message,
                 java.lang.String roleName)
          throws MessageException
Deprecated. use sendMessage(Message, String)

Specified by:
send in interface MessageService
Throws:
MessageException
See Also:
MessageService.send(org.openmrs.notification.Message, java.lang.String)

send

public void send(Message message,
                 java.lang.Integer userId)
          throws MessageException
Deprecated. use sendMessage(Message, Integer)

Specified by:
send in interface MessageService
Throws:
MessageException
See Also:
MessageService.send(org.openmrs.notification.Message, java.lang.Integer)

send

public void send(Message message,
                 User user)
          throws MessageException
Deprecated. use sendMessage(Message, User)

Specified by:
send in interface MessageService
Throws:
MessageException
See Also:
MessageService.send(org.openmrs.notification.Message, org.openmrs.User)

send

public void send(Message message,
                 Role role)
          throws MessageException
Deprecated. send(Message, Role)

Specified by:
send in interface MessageService
Throws:
MessageException
See Also:
MessageService.send(org.openmrs.notification.Message, org.openmrs.Role)

send

public void send(Message message,
                 java.util.Collection<User> users)
          throws MessageException
Deprecated. send(Message, Collection)

Specified by:
send in interface MessageService
Throws:
MessageException
See Also:
MessageService.send(org.openmrs.notification.Message, java.util.Collection)

send

public void send(java.lang.String recipients,
                 java.lang.String sender,
                 java.lang.String subject,
                 java.lang.String message)
          throws MessageException
Deprecated. use send(String, String, String, String)

Specified by:
send in interface MessageService
Throws:
MessageException
See Also:
MessageService.send(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change