public interface AlertService extends OpenmrsService
Alert alert = new Alert(); alert.set___(___); ...etc Context.getAlertService().saveAlert(alert);
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
alert in the database |
void |
setAlertDAO(AlertDAO dao)
Used by Spring to set the specific/chosen database access implementation
|
onShutdown, onStartup
void setAlertDAO(AlertDAO dao)
dao
- The dao implementation to use@Authorized(value="Manage Alerts") Alert saveAlert(Alert alert) throws APIException
alert
in the databasealert
- the Alert object to saveAPIException
- Should save simple alert with one user
Should save alerts by role
Should assign uuid to alert@Authorized Alert getAlert(Integer alertId) throws APIException
alertId
- internal alert identifierAPIException
@Authorized(value="Manage Alerts") void purgeAlert(Alert alert) throws APIException
alert
- the Alert to purge/deleteAPIException
@Authorized List<Alert> getAllActiveAlerts(User user) throws APIException
user
- APIException
getAlerts(User, boolean, boolean)
@Authorized List<Alert> getAlertsByUser(User user) throws APIException
user
, find alerts for the
currently authenticated user. If no user is authenticated, search on "new
User()" (for "Anonymous" role alert possibilities)user
- the user that is assigned to the returned alertsAPIException
@Authorized List<Alert> getAlerts(User user, boolean includeRead, boolean includeExpired) throws APIException
user
- to restrict toincludeRead
- includeExpired
- APIException
@Authorized List<Alert> getAllAlerts() throws APIException
APIException
@Authorized List<Alert> getAllAlerts(boolean includeExpired) throws APIException
includeExpired
- APIException
@Authorized(value="Manage Alerts") void notifySuperUsers(String messageCode, Exception cause, Object... messageArguments)
messageCode
- 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 databaseCopyright © 2024 OpenMRS Inc.. All rights reserved.