Class UserNotice

Index Home MAE > MAE Architecture > MAE Data Types > Class Index > Class UserNotice

Summary
Public Methods
UserNotice(id)
UserNotice(data)
UserNotice(longname, shortname, params, userId)
UserNotice()
void clear()
inline bool valid() const
inline long getId() const
inline DbRecNum getUserId() const
inline time_t getPostTime() const
inline time_t getConfirmedTime() const
inline string getFormLongName() const
inline string getFormShortName() const
inline string getDataParam(paramname) const
inline long getDataParamInt(paramname) const
inline XMLData getData() const
inline bool priorityNow() const
inline bool prioritySoon() const
inline bool priorityMonthly() const
inline string getUrgency() const
inline bool isQueued() const
inline bool isSent() const
inline bool isFailed() const
inline bool isConfirmed() const
inline string getSendStatus() const
inline string getSendMedia() const
inline string getFromApp() const
inline string getAddress() const
inline UserNotice& setUserId(newUserId)
inline UserNotice& setPostTime(newPostTime)
inline UserNotice& setConfirmedTime(newConfirmedTime)
inline UserNotice& setFormLongName(newFormLongName)
inline UserNotice& setFormShortName(newFormShortName)
inline UserNotice& setData(key, value)
inline UserNotice& setData(key, value)
inline UserNotice& setData(newData)
inline UserNotice& setUrgencyNow()
inline UserNotice& setUrgencySoon()
inline UserNotice& setUrgencyMonthly()
inline UserNotice& setQueued()
inline UserNotice& setSent()
inline UserNotice& setFailed()
inline UserNotice& setConfirmed()
inline UserNotice& setFromApp(newFromApp)
inline UserNotice& setAddress(newAddress)
inline UserNotice& setSendMedia(newSendMedia)
UserNotice& set(data)
HashArray toHashArray(forDB) const
inline XMLData toXML(forDB) const
DbRecNum save()
bool post()
Protected Methods
bool load(id)
Private Properties
Private Methods
static bool initdb()
DbRecNum append()
inline UserNotice& setUrgency(newUrgency)
inline UserNotice& setSendStatus(newStatus)
See Also

#include <UserNotice.h >

Summary

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.

Public Methods

UserNotice(id)

long id

db table record id; 0 for empty record


Constructor with optional db table record id.

UserNotice(data)

const XMLData& data

key-value pairs with property names as keys


Constructor with input from XML data.

UserNotice(longname, shortname, params, userId)

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.

UserNotice()

Create an empty UserNotice.

void clear()

Reset/Clear the contents of this class

inline bool valid() const

Determine if this is valid data or not

Return value: true if the record is valid, false if it is not

inline long getId() const

Get the value of the record id.

Return value: the value of id

inline DbRecNum getUserId() const

Get the value of the User id.

Return value: the value of UserId

inline time_t getPostTime() const

Get the value of timestamp for when the notice was posted.

Return value: the value of PostTime

inline time_t getConfirmedTime() const

Get the value of timestamp of confirmed notification.

Return value: the value of ConfirmedTime

inline string getFormLongName() const

Get the value of name of the template with longer text (suitable for e-mail).

Return value: the value of FormLongName

inline string getFormShortName() const

Get the value of name of the template with shorter text (suitable for e-mail.

Return value: the value of FormShortName

inline string getDataParam(paramname) const

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

inline long getDataParamInt(paramname) const

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

inline XMLData getData() const

Get the value of data to support the notice (to fill in the template blanks).

Return value: the value of Data

inline bool priorityNow() const

Query if the notice priority to now

Return value: true if priority is now

inline bool prioritySoon() const

Query if the notice priority to soon

Return value: true if priority is soon

inline bool priorityMonthly() const

Query if the notice priority to monthly

Return value: true if priority is monthly

inline string getUrgency() const

Query if the notice urgency as a string

Return value: the notice urgency

inline bool isQueued() const

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

inline bool isSent() const

Check if current notification status is sent.

It is sent if sending it was successful.

Return value: true if the notification is sent

inline bool isFailed() const

Check if current notification status is failed.

It is failed if sending it has failed.

Return value: true if the notification is failed

inline bool isConfirmed() const

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

inline string getSendStatus() const

Get the current notification status, e.g. queued, sent, failed, confirmed

inline string getSendMedia() const

Get the value of the media used to send the notification, e.g. email.

Return value: the value of SendMedia

inline string getFromApp() const

Get the value of the app channel that made the notification request.

Return value: the value of FromApp

inline string getAddress() const

Get the value of (supporting data) the address to send to the user.

Return value: the value of Address

inline UserNotice& setUserId(newUserId)

int newUserId

the new value for UserId


Set the value of the User id.

Return value: the updated instance of UserNotice

inline UserNotice& setPostTime(newPostTime)

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

inline UserNotice& setConfirmedTime(newConfirmedTime)

time_t newConfirmedTime

the new value for ConfirmedTime


Set the value of timestamp of confirmed notification.

Return value: the updated instance of UserNotice

inline UserNotice& setFormLongName(newFormLongName)

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

inline UserNotice& setFormShortName(newFormShortName)

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

inline UserNotice& setData(key, value)

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

inline UserNotice& setData(key, value)

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

inline UserNotice& setData(newData)

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

inline UserNotice& setUrgencyNow()

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

inline UserNotice& setUrgencySoon()

Set the value of urgency of notification to soon, e.g. email, NewsSystem

Return value: the updated instance of UserNotice

inline UserNotice& setUrgencyMonthly()

Set the value of urgency of notification to monthly, e.g. attach to monthly communication to user

Return value: the updated instance of UserNotice

inline UserNotice& setQueued()

Note that the message has been queued; it's ready to send.

Return value: the updated instance of UserNotice

inline UserNotice& setSent()

Note that the message has been successful sent.

Return value: the updated instance of UserNotice

inline UserNotice& setFailed()

Note that the message has failed.

Return value: the updated instance of UserNotice

inline UserNotice& setConfirmed()

Note that the message has been confirmed seen by user.

Return value: the updated instance of UserNotice

inline UserNotice& setFromApp(newFromApp)

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

inline UserNotice& setAddress(newAddress)

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

inline UserNotice& setSendMedia(newSendMedia)

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

UserNotice& set(data)

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

HashArray toHashArray(forDB) const

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

inline XMLData toXML(forDB) const

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

DbRecNum save()

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

bool post()

Send the notice (via noticegw)

Protected Methods

bool load(id)

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

Private Properties

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


Private Methods

static bool initdb()

Make sure we're connected to our table in the Datastore

Return value: true upon success, false upon failure

DbRecNum append()

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

inline UserNotice& setUrgency(newUrgency)

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

inline UserNotice& setSendStatus(newStatus)

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

See Also

UserNotice database table