@Transactional public class AlertServiceImpl extends BaseOpenmrsService implements Serializable, AlertService
AlertService, 
Serialized Form| Constructor and Description | 
|---|
| AlertServiceImpl()Default constructor | 
| Modifier and Type | Method and Description | 
|---|---|
| Alert | getAlert(Integer alertId)Get alert by internal identifier | 
| List<Alert> | getAlerts(User user,
         boolean includeRead,
         boolean includeExpired)Finds alerts for the given user with the given status | 
| 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. | 
| List<Alert> | getAllActiveAlerts(User user)Find all alerts for a user that have not expired | 
| List<Alert> | getAllAlerts()Get all unexpired alerts for all users | 
| List<Alert> | getAllAlerts(boolean includeExpired)Get alerts for all users while obeying includeExpired | 
| void | notifySuperUsers(String messageCode,
                Exception cause,
                Object... messageArguments)Sends an alert to all superusers | 
| void | purgeAlert(Alert alert)Completely delete the given alert from the database | 
| Alert | saveAlert(Alert alert)Save the given  alertin the database | 
| void | setAlertDAO(AlertDAO dao)Used by Spring to set the specific/chosen database access implementation | 
onShutdown, onStartupclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonShutdown, onStartuppublic void setAlertDAO(AlertDAO dao)
AlertServicesetAlertDAO in interface AlertServicedao - The dao implementation to useAlertService.setAlertDAO(org.openmrs.notification.db.AlertDAO)public Alert saveAlert(Alert alert) throws APIException
AlertServicealert in the databasesaveAlert in interface AlertServicealert - the Alert object to saveAPIException - Should save simple alert with one user
 Should save alerts by role
 Should assign uuid to alertAlertService.saveAlert(org.openmrs.notification.Alert)@Transactional(readOnly=true) public Alert getAlert(Integer alertId) throws APIException
AlertServicegetAlert in interface AlertServicealertId - internal alert identifierAPIExceptionAlertService.getAlert(java.lang.Integer)public void purgeAlert(Alert alert) throws APIException
AlertServicepurgeAlert in interface AlertServicealert - the Alert to purge/deleteAPIExceptionAlertService.purgeAlert(org.openmrs.notification.Alert)@Transactional(readOnly=true) public List<Alert> getAllActiveAlerts(User user) throws APIException
AlertServicegetAllActiveAlerts in interface AlertServiceAPIExceptionAlertService.getAllActiveAlerts(org.openmrs.User)@Transactional(readOnly=true) public List<Alert> getAlertsByUser(User user) throws APIException
AlertServiceuser, find alerts for the
 currently authenticated user. If no user is authenticated, search on "new
 User()" (for "Anonymous" role alert possibilities)getAlertsByUser in interface AlertServiceuser - the user that is assigned to the returned alertsAPIExceptionAlertService.getAlertsByUser(org.openmrs.User)@Transactional(readOnly=true) public List<Alert> getAlerts(User user, boolean includeRead, boolean includeExpired) throws APIException
AlertServicegetAlerts in interface AlertServiceuser - to restrict toAPIExceptionAlertService.getAlerts(org.openmrs.User, boolean, boolean)@Transactional(readOnly=true) public List<Alert> getAllAlerts() throws APIException
AlertServicegetAllAlerts in interface AlertServiceAPIExceptionAlertService.getAllAlerts()@Transactional(readOnly=true) public List<Alert> getAllAlerts(boolean includeExpired) throws APIException
AlertServicegetAllAlerts in interface AlertServiceAPIExceptionAlertService.getAllAlerts(boolean)public void notifySuperUsers(String messageCode, Exception cause, Object... messageArguments)
AlertServicenotifySuperUsers in interface AlertServicemessageCode - The alert message code from messages.propertiescause - The exception that was thrown, method will work if cause is nullmessageArguments - The arguments for the coded message
 Should add an alert with message of length equals Text Max Length
 Should add an alert with message text if cause is null
 Should add an alert to the databaseAlertService.notifySuperUsers(String, Exception, Object...)Copyright © 2024 OpenMRS Inc.. All rights reserved.