NotificationHandler
- Class to handle several notifications in a folder.
use NotificationHandler;
# create instance
my $nh=NotificationHandler->new();
# update notification list
$nh->update();
# reset next notification iteration
$nh->resetNext();
# get next notification in list
my $n=$nh->getNext();
# delete/remove notification
$n->delete($n);
# move notification to another folder and forget about it
$nh->move($n,"/MY/NEW/FOLDER/ROOT");
# get absolute path of
# notification-folder
my $folder=$nh->folder();
# get last error
print $nh->error();
A class to handle multiple instances of the AURORA-systems notifications.
The class manages to iterate over notifications in the AURORA notification root-folder and clean away notifications that are to be deleted.
Please see the AURORA notification-service documentation for more information about the structure of the service.
Instantiate class.
The method takes one input: folder. Folder specifies the absolute path to the AURORA main/root notification-folder. If not specified or found as a combination of the environment-variable "AURORA_PATH" appended "/notification", it will default to "/local/app/aurora/notification".
Returns a class instance.
Updates the list of notifications in the root notification-folder. It will only add new notification-instances to its list, retaining the old.
Return 1 upon success, 0 upon failure. Upon failure, please check the error()-method for more information.
Resets the next pos pointer for fetching notification instances.
No input accepted. Always returns 1.
Gets the next notification in the notification list.
No input is accepted.
Returns the next notification-instance upon success, or undef upon end of list.
Deletes a notification instance, its events and folder.
One mandatory input: notification-instance reference. There has to be an instance of the Notification-class reference specified here that is to be deleted.
It first asks the notification-instance to clean up and then attempts to remove the instance folder.
Returns 1 upon success, 0 upon failure. Please check the error()-method for more information upon failure.
Returns the absolute folder path of the notification root-folder.
No input is accepted.
Returns the absolute folder path of the notification root-folder as used by the NotificationHandler instance.
Move a notification to another folder and forget about it.
Accepts the following parameters in this order:
notification The instance of the notification to move.
folder The new folder to put the notification in. It can be either relative or absolute.
The method will move the notification to the new folder and then evacuate its instance from the notificationhandlers internal list and thereby forgetting about it. The method can be used to move notifications to another place to avoid them causing issues in the notification handling.
Will return 1 upon success, 0 upon some failure. Please check the error()-method for more information upon failure.
Evacuates a notification from the notificationhandlers list.
Accepts the following parameters in this order:
notification The instance of the notification to evacuate.
deallocate Decides if the method is to deallocate the notification instance or not after a successful move. An expression evaluating to true means yes, while an expression that evaluates to false means no. It will default to false if parameter is not specified.
Upon success this method return 1, 0 upon failure. Please check the error()-method for more information upon failure.
This method is internal and should not be called by others than the notificationhandler-class itself.
Returns the last error that has happened (if any).
No input is accepted.