org.openmrs.notification
Class Alert

java.lang.Object
  extended by org.openmrs.BaseOpenmrsObject
      extended by org.openmrs.notification.Alert
All Implemented Interfaces:
java.io.Serializable, Auditable, OpenmrsObject

public class Alert
extends BaseOpenmrsObject
implements Auditable, java.io.Serializable

Alerts are the simplest form of communication. An Administrator (or script) sets the user or role to attribute the alert to. Alerts are not intended to be sent from user to user and a user cannot send a "reply alert"

See Also:
Serialized Form

Constructor Summary
Alert()
          Default empty constructor
Alert(java.lang.Integer alertId)
          Initializes an alert with the given alert id
Alert(java.lang.String text, java.util.Collection<User> users)
          Convenience constructor to create an alert with the given text and for the given users
Alert(java.lang.String text, User user)
          Convenience constructor to create an alert with the given text and for the given users
 
Method Summary
 void addRecipient(AlertRecipient r)
          Convenience method to add the given AlertRecipient to the list of recipients for this alert
 void addRecipient(User u)
          Convenience method to add the given user to this list of recipients for this alert
 boolean equals(java.lang.Object obj)
           
 java.lang.Integer getAlertId()
           
 java.lang.Boolean getAlertRead()
           
 User getChangedBy()
           
 User getCreator()
           
 java.util.Date getDateChanged()
           
 java.util.Date getDateCreated()
           
 java.util.Date getDateToExpire()
           
 java.lang.Integer getId()
           
 AlertRecipient getRecipient(User recipient)
          Convenience method to find the AlertRecipient object within this alert that corresponds to the given recipient
 java.util.Set<AlertRecipient> getRecipients()
           
 java.lang.Boolean getSatisfiedByAny()
           
 java.lang.String getText()
           
 int hashCode()
           
 java.lang.Boolean isAlertRead()
           
 java.lang.Boolean isSatisfiedByAny()
           
 Alert markAlertRead()
          Convenience method to mark this alert as read.
 void removeRecipient(AlertRecipient r)
          Convenience method to remove the given AlertRecipient from this Alert's list of recipients
 void setAlertId(java.lang.Integer alertId)
           
 void setAlertRead(java.lang.Boolean alertRead)
           
 void setChangedBy(User changedBy)
           
 void setCreator(User creator)
           
 void setDateChanged(java.util.Date dateChanged)
           
 void setDateCreated(java.util.Date dateCreated)
           
 void setDateToExpire(java.util.Date dateToExpire)
           
 void setId(java.lang.Integer id)
           
 void setRecipients(java.util.Set<AlertRecipient> recipients)
           
 void setSatisfiedByAny(java.lang.Boolean satisfiedByAny)
           
 void setText(java.lang.String text)
           
 java.lang.String toString()
           
 
Methods inherited from class org.openmrs.BaseOpenmrsObject
getUuid, setUuid
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openmrs.OpenmrsObject
getUuid, setUuid
 

Constructor Detail

Alert

public Alert()
Default empty constructor


Alert

public Alert(java.lang.Integer alertId)
Initializes an alert with the given alert id


Alert

public Alert(java.lang.String text,
             java.util.Collection<User> users)
Convenience constructor to create an alert with the given text and for the given users

Parameters:
text - String to display for the alert
users - Recipients of this alert

Alert

public Alert(java.lang.String text,
             User user)
Convenience constructor to create an alert with the given text and for the given users

Parameters:
text - String to display for the alert
user - Recipient of the alert
Method Detail

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

getAlertId

public java.lang.Integer getAlertId()
Returns:
Returns the alertId.

setAlertId

public void setAlertId(java.lang.Integer alertId)
Parameters:
alertId - The alertId to set.

getCreator

public User getCreator()
Specified by:
getCreator in interface Auditable
Returns:
Returns the creator.

setCreator

public void setCreator(User creator)
Specified by:
setCreator in interface Auditable
Parameters:
creator - The creator to set.

getDateCreated

public java.util.Date getDateCreated()
Specified by:
getDateCreated in interface Auditable
Returns:
Returns the dateCreated.

setDateCreated

public void setDateCreated(java.util.Date dateCreated)
Specified by:
setDateCreated in interface Auditable
Parameters:
dateCreated - The dateCreated to set.

getDateToExpire

public java.util.Date getDateToExpire()
Returns:
Returns the date this alert expires

setDateToExpire

public void setDateToExpire(java.util.Date dateToExpire)
Parameters:
dateToExpire - The date To Expire this alert

getText

public java.lang.String getText()
Returns:
Returns the text.

setText

public void setText(java.lang.String text)
Parameters:
text - The text to set.

getSatisfiedByAny

public java.lang.Boolean getSatisfiedByAny()
See Also:
isSatisfiedByAny()

isSatisfiedByAny

public java.lang.Boolean isSatisfiedByAny()
Returns:
Returns the satisfiedByAny.

setSatisfiedByAny

public void setSatisfiedByAny(java.lang.Boolean satisfiedByAny)
Parameters:
satisfiedByAny - The satisfiedByAny to set.

getAlertRead

public java.lang.Boolean getAlertRead()
See Also:
isAlertRead()

isAlertRead

public java.lang.Boolean isAlertRead()
Returns:
Returns the alertRead.

setAlertRead

public void setAlertRead(java.lang.Boolean alertRead)
Parameters:
alertRead - The alertRead to set.

getChangedBy

public User getChangedBy()
Specified by:
getChangedBy in interface Auditable
Returns:
Returns the changedBy.

setChangedBy

public void setChangedBy(User changedBy)
Specified by:
setChangedBy in interface Auditable
Parameters:
changedBy - The user that changed this alert

getDateChanged

public java.util.Date getDateChanged()
Specified by:
getDateChanged in interface Auditable
Returns:
Returns the date this alert was changed

setDateChanged

public void setDateChanged(java.util.Date dateChanged)
Specified by:
setDateChanged in interface Auditable
Parameters:
dateChanged - The date this alert was changed

getRecipients

public java.util.Set<AlertRecipient> getRecipients()
Returns:
Returns the Recipients of this alert

setRecipients

public void setRecipients(java.util.Set<AlertRecipient> recipients)
Parameters:
recipients - The recipients of this alert

addRecipient

public void addRecipient(AlertRecipient r)
Convenience method to add the given AlertRecipient to the list of recipients for this alert

Parameters:
r - AlertRecipient to add

addRecipient

public void addRecipient(User u)
Convenience method to add the given user to this list of recipients for this alert

Parameters:
u - User to add to list of recipients

removeRecipient

public void removeRecipient(AlertRecipient r)
Convenience method to remove the given AlertRecipient from this Alert's list of recipients

Parameters:
r - user to remove from list of recipients

getRecipient

public AlertRecipient getRecipient(User recipient)
Convenience method to find the AlertRecipient object within this alert that corresponds to the given recipient

Parameters:
recipient -
Returns:
AlertRecipient

markAlertRead

public Alert markAlertRead()
Convenience method to mark this alert as read. In order to persist this change in the database, AlertService.saveAlert(Alert) will need to be called after this method is done.

Returns:
This alert (for chaining and one-liner purposes)
See Also:
AlertService.saveAlert(Alert)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getId

public java.lang.Integer getId()
Specified by:
getId in interface OpenmrsObject
Returns:
id - The unique Identifier for the object
Since:
1.5
See Also:
OpenmrsObject.getId()

setId

public void setId(java.lang.Integer id)
Specified by:
setId in interface OpenmrsObject
Parameters:
id - - The unique Identifier for the object
Since:
1.5
See Also:
OpenmrsObject.setId(java.lang.Integer)

OpenMRS-1.7.x

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