org.openmrs.notification
Interface AlertService

All Superinterfaces:
OpenmrsService
All Known Implementing Classes:
AlertServiceImpl

@Transactional
public interface AlertService
extends OpenmrsService

Contains methods pertaining to creating/deleting/voiding Alerts in the system Use:

   Alert alert = new Alert();
   alert.set___(___);
   ...etc
   Context.getAlertService().saveAlert(alert);
 


Method Summary
 void createAlert(Alert alert)
          Deprecated. use saveAlert(Alert)
 void createAlert(java.lang.String text, java.util.Collection<User> users)
          Deprecated. use saveAlert(Alert)
 void createAlert(java.lang.String text, User user)
          Deprecated. use saveAlert(Alert)
 Alert getAlert(java.lang.Integer alertId)
          Get alert by internal identifier
 java.util.List<Alert> getAlerts()
          Deprecated. use getAlertsByUser(User) and pass "null" as the parameter for user
 java.util.List<Alert> getAlerts(User user)
          Deprecated. use getAlertsByUser(User)
 java.util.List<Alert> getAlerts(User user, boolean includeRead, boolean includeExpired)
          Finds alerts for the given user with the given status
 java.util.List<Alert> getAlertsByUser(User user)
          Find the alerts that are not read and have not expired for a user This will probably be the most commonly called method If null is passed in for user, find alerts for the currently authenticated user.
 java.util.List<Alert> getAllActiveAlerts(User user)
          Find all alerts for a user that have not expired
 java.util.List<Alert> getAllAlerts()
          Get all unexpired alerts for all users
 java.util.List<Alert> getAllAlerts(boolean includeExpired)
          Get alerts for all users while obeying includeExpired
 java.util.List<Alert> getAllAlerts(User user)
          Deprecated. use #getAlerts(User, boolean, boolean)
 void markAlertRead(Alert alert)
          Deprecated. use saveAlert(Alert)
 void purgeAlert(Alert alert)
          Completely delete the given alert from the database
 Alert saveAlert(Alert alert)
          Save the given alert in the database
 void setAlertDAO(AlertDAO dao)
          Used by Spring to set the specific/chosen database access implementation
 void updateAlert(Alert alert)
          Deprecated. use saveAlert(Alert)
 
Methods inherited from interface org.openmrs.api.OpenmrsService
onShutdown, onStartup
 

Method Detail

setAlertDAO

void setAlertDAO(AlertDAO dao)
Used by Spring to set the specific/chosen database access implementation

Parameters:
dao - The dao implementation to use

saveAlert

@Authorized(value="Manage Alerts")
Alert saveAlert(Alert alert)
                throws APIException
Save the given alert in the database

Parameters:
alert - the Alert object to save
Returns:
The saved alert object
Throws:
APIException
Expected behavior:
save simple alert with one user, save alerts by role, assign uuid to alert

createAlert

void createAlert(Alert alert)
                 throws APIException
Deprecated. use saveAlert(Alert)

Throws:
APIException

createAlert

void createAlert(java.lang.String text,
                 User user)
                 throws APIException
Deprecated. use saveAlert(Alert)

Use AlertService.saveAlert(new Alert(text, user))

Throws:
APIException

createAlert

void createAlert(java.lang.String text,
                 java.util.Collection<User> users)
                 throws APIException
Deprecated. use saveAlert(Alert)

Use AlertService.saveAlert(new Alert(text, users))

Throws:
APIException

getAlert

@Transactional(readOnly=true)
Alert getAlert(java.lang.Integer alertId)
               throws APIException
Get alert by internal identifier

Parameters:
alertId - internal alert identifier
Returns:
alert with given internal identifier
Throws:
APIException

updateAlert

void updateAlert(Alert alert)
                 throws APIException
Deprecated. use saveAlert(Alert)

Throws:
APIException

purgeAlert

@Authorized(value="Manage Alerts")
void purgeAlert(Alert alert)
                throws APIException
Completely delete the given alert from the database

Parameters:
alert - the Alert to purge/delete
Throws:
APIException

markAlertRead

void markAlertRead(Alert alert)
                   throws APIException
Deprecated. use saveAlert(Alert)

Use AlertService.saveAlert(alert.markAlertRead())

Throws:
APIException

getAllAlerts

@Transactional(readOnly=true)
java.util.List<Alert> getAllAlerts(User user)
                                   throws APIException
Deprecated. use #getAlerts(User, boolean, boolean)

Throws:
APIException

getAllActiveAlerts

@Transactional(readOnly=true)
java.util.List<Alert> getAllActiveAlerts(User user)
                                         throws APIException
Find all alerts for a user that have not expired

Parameters:
user -
Returns:
alerts that are unread _or_ read that have not expired
Throws:
APIException
See Also:
getAlerts(User, boolean, boolean)

getAlerts

@Transactional(readOnly=true)
java.util.List<Alert> getAlerts(User user)
                                throws APIException
Deprecated. use getAlertsByUser(User)

Throws:
APIException

getAlertsByUser

@Transactional(readOnly=true)
java.util.List<Alert> getAlertsByUser(User user)
                                      throws APIException
Find the alerts that are not read and have not expired for a user This will probably be the most commonly called method If null is passed in for user, find alerts for the currently authenticated user. If no user is authenticated, search on "new User()" (for "Anonymous" role alert possibilities)

Parameters:
user - the user that is assigned to the returned alerts
Returns:
alerts that are unread and not expired
Throws:
APIException

getAlerts

@Transactional(readOnly=true)
java.util.List<Alert> getAlerts()
                                throws APIException
Deprecated. use getAlertsByUser(User) and pass "null" as the parameter for user

Throws:
APIException

getAlerts

@Transactional(readOnly=true)
java.util.List<Alert> getAlerts(User user,
                                              boolean includeRead,
                                              boolean includeExpired)
                                throws APIException
Finds alerts for the given user with the given status

Parameters:
user - to restrict to
includeRead -
includeExpired -
Returns:
alerts for this user with these options
Throws:
APIException

getAllAlerts

@Transactional(readOnly=true)
java.util.List<Alert> getAllAlerts()
                                   throws APIException
Get all unexpired alerts for all users

Returns:
list of unexpired alerts
Throws:
APIException

getAllAlerts

@Transactional(readOnly=true)
java.util.List<Alert> getAllAlerts(boolean includeExpired)
                                   throws APIException
Get alerts for all users while obeying includeExpired

Parameters:
includeExpired -
Returns:
list of alerts
Throws:
APIException

OpenMRS-1.7.x

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