Class UserNotice
#include <UserNotice.h >
This class is used to send a (short or long) notice to a user with urgency of either now, soon, or monthly.
Notification to external systems like email or SMS is done so via scripts created in /usr/mae/notice/mediatype where templates are stored.
long id |
db table record id; 0 for empty record |
Constructor with optional db table record id.
const XMLData& data |
key-value pairs with property names as keys |
Constructor with input from XML data.
const string& longname |
name of template for a long notification |
const string& shortname |
name of template for a short notification |
const XMLData& params |
key/value pairs for filling in the template, e.g. the text Email is converted to the user's email address |
DbRecNum userId |
Default value: 0 |
Contructor with long and short template name along with parameters to fill in the blanks.
A long template is typically used for sending a brief, like an e-mail.
A short template is typically used to display text on the user's device, which is often terse.
Create an empty UserNotice.
Reset/Clear the contents of this class
Determine if this is valid data or not
Return value: true if the record is valid, false if it is not
Get the value of the record id.
Return value: the value of id
Get the value of the User id.
Return value: the value of UserId
Get the value of timestamp for when the notice was posted.
Return value: the value of PostTime
Get the value of timestamp of confirmed notification.
Return value: the value of ConfirmedTime
Get the value of name of the template with longer text (suitable for e-mail).
Return value: the value of FormLongName
Get the value of name of the template with shorter text (suitable for e-mail.
Return value: the value of FormShortName
const string& paramname |
parameter key to get value for |
Get the value of a specific notice data parameter.
Return value: the value of parameter as string
const string& paramname |
parameter key to get value for |
Get the value of a specific notice data parameter.
Return value: the value of parameter as integer
Get the value of data to support the notice (to fill in the template blanks).
Return value: the value of Data
Query if the notice priority to now
Return value: true if priority is now
Query if the notice priority to soon
Return value: true if priority is soon
Query if the notice priority to monthly
Return value: true if priority is monthly
Query if the notice urgency as a string
Return value: the notice urgency
Check if current notification status is queued.
It is queued if it has been sent to NoticeGW, but has not been sent yet.
Return value: true if the notification is queued
Check if current notification status is sent.
It is sent if sending it was successful.
Return value: true if the notification is sent
Check if current notification status is failed.
It is failed if sending it has failed.
Return value: true if the notification is failed
Check if current notification status is confirmed.
It is confirmed if the user has seen it or specifically confirmed it.
Return value: true if the notification is confirmed
Get the current notification status, e.g. queued, sent, failed, confirmed
Get the value of the media used to send the notification, e.g. email.
Return value: the value of SendMedia
Get the value of the app channel that made the notification request.
Return value: the value of FromApp
Get the value of (supporting data) the address to send to the user.
Return value: the value of Address
int newUserId |
the new value for UserId |
Set the value of the User id.
Return value: the updated instance of UserNotice
time_t newPostTime |
the new value for PostTime |
Set the value of timestamp for when the notice was posted.
Return value: the updated instance of UserNotice
time_t newConfirmedTime |
the new value for ConfirmedTime |
Set the value of timestamp of confirmed notification.
Return value: the updated instance of UserNotice
const string& newFormLongName |
the new value for FormLongName |
Set the value of name of the template with longer text (suitable for e-mail).
Return value: the updated instance of UserNotice
const string& newFormShortName |
the new value for FormShortName |
Set the value of name of the template with shorter text (suitable for e-mail.
Return value: the updated instance of UserNotice
const string& key |
the name of the value to set |
const string& value |
the value (as string) |
Set a specific data value to support the notice (for the template).
Return value: the updated instance of UserNotice
const string& key |
the name of the value to set |
long value |
the value (as long) |
Set a specific data value to support the notice (for the template).
Return value: the updated instance of UserNotice
const XMLData& newData |
the new value for Data |
Set the value of data to support the notice (to fill in the template blanks).
Return value: the updated instance of UserNotice
Set the value of urgency of notification to now, e.g. txt message, IM, Facebook messanger, or email
Return value: the updated instance of UserNotice
Set the value of urgency of notification to soon, e.g. email, NewsSystem
Return value: the updated instance of UserNotice
Set the value of urgency of notification to monthly, e.g. attach to monthly communication to user
Return value: the updated instance of UserNotice
Note that the message has been queued; it's ready to send.
Return value: the updated instance of UserNotice
Note that the message has been successful sent.
Return value: the updated instance of UserNotice
Note that the message has failed.
Return value: the updated instance of UserNotice
Note that the message has been confirmed seen by user.
Return value: the updated instance of UserNotice
const string& newFromApp |
the new value for FromApp |
Set the value of the app channel that made the notification request.
Return value: the updated instance of UserNotice
const string& newAddress |
the new value for Address |
Set the value of (supporting data) the address to send to the user.
Note that Address is set by NoticeGW, not calling app.
Return value: the updated instance of UserNotice
const string& newSendMedia |
the new value for SendMedia |
Set the value of the media used to send the notification, e.g. email.
Note that SendMedia is set by NoticeGW, not calling app.
Return value: the updated instance of UserNotice
const XMLData& data |
Given a set of UserNotice properties in key-value pairs, initialize this instance with them.
This is complementary to toHashArray().
Return value: the initialized instance of UserNotice
bool forDB |
false to include Id; true to exclude Id, which is handy for sending to Datastore Default value: false |
Convert this instance's data into a HashArray.
This is the complement of set()
Return value: a HashArray of instance's properties
bool forDB |
false to include Id; true to exclude Id, which is handy for sending to Datastore Default value: false |
Convert this instance's data to XML.
Return value: a XMLData of instance's properties
Save this record to the Datastore.
If the data has not changed, it is not saved.
Return value: the Id upon success, 0 on failure
Send the notice (via noticegw)
DbRecNum id |
the id of the record to load |
Load data from the Datastore with the provided Id.
Return value: true upon success; false upon faliure
long id |
the record id |
DbRecNum UserId |
the User id |
time_t PostTime |
timestamp for when the notice was posted |
time_t ConfirmedTime |
timestamp of confirmed notification |
string FormLongName |
name of the template with longer text (suitable for e-mail) |
string FormShortName |
name of the template with shorter text (suitable for e-mail |
XMLData Data |
data to support the notice (to fill in the template blanks) |
string Urgency |
urgency of notification, e.g. soon, now, monthly |
string FromApp |
the app channel that made the notification request |
string Address |
(supporting data) the address to send to the user |
string SendStatus |
the current status of sending the notification |
string SendMedia |
the media used to send the notification, e.g. email |
bool changed |
Flag: true if any data in this instance has changed |
static Datastore db |
Our connection to DB table data |
Make sure we're connected to our table in the Datastore
Return value: true upon success, false upon failure
Add a new record to the Datastore.
If the Id is set, it will be used; if 0, a new Id will be assigned.
Return value: the new record's record Id
const string& newUrgency |
the new value for Urgency |
Set the value of urgency of notification, e.g. soon, now, monthly.
Return value: the updated instance of UserNotice
const string& newStatus |
the new value for SendStatus |
Set the value of the current status of sending the notification.
Return value: the updated instance of UserNotice