- Publicity: Public Only All
notification-request-procs.tcl
Notification Requests When a user wishes to receive notifications of a certain type on a given object, he issues a notification request. This request is recorded specifically for that user. These procs help to manage such requests.
- Location:
- packages/notifications/tcl/notification-request-procs.tcl
- Created:
- 2002-05-24
- Author:
- Ben Adida
- CVS Identification:
$Id: notification-request-procs.tcl,v 1.14.2.2 2022/07/12 14:15:11 antoniop Exp $
Procedures in this file
- notification::request::delete (public)
- notification::request::delete_all (public)
- notification::request::delete_all_for_user (public)
- notification::request::get_request_id (public)
- notification::request::new (public)
- notification::request::request_count (public)
- notification::request::request_exists (public)
- notification::request::request_ids (public)
- notification::request::subscribers (public)
Detailed information
notification::request::delete (public)
notification::request::delete -request_id request_id
delete a request for notifications by request ID.
- Switches:
- -request_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
notification::request::delete_all (public)
notification::request::delete_all -object_id object_id
remove all requests for a particular object ID usually because the object is getting deleted.
- Switches:
- -object_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
notification::request::delete_all_for_user (public)
notification::request::delete_all_for_user -user_id user_id
delete all the requests for a given user
- Switches:
- -user_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
notification::request::get_request_id (public)
notification::request::get_request_id -type_id type_id \ -object_id object_id -user_id user_id
Checks if a particular notification request exists, and if so return the request ID. Note that the primary key on notification requests is notification_type, object, user. Interval and delivery method are specific parameters, but do not impact the uniqueness: a user can choose only one interval and delivery method for a given notification type and object.
- Switches:
- -type_id (required)
- -object_id (required)
- -user_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
notification::request::new (public)
notification::request::new [ -request_id request_id ] -type_id type_id \ -user_id user_id -object_id object_id -interval_id interval_id \ -delivery_method_id delivery_method_id [ -format format ] \ [ -dynamic_p dynamic_p ]
create a new request for a given user, notification type, object, interval and delivery method.
- Switches:
- -request_id (optional)
- -type_id (required)
- -user_id (required)
- -object_id (required)
- -interval_id (required)
- -delivery_method_id (required)
- -format (optional, defaults to
"text"
)- -dynamic_p (optional, defaults to
"f"
)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
notification::request::request_count (public)
notification::request::request_count -type_id type_id \ -object_id object_id
returns number of notification requests for this type and object
- Switches:
- -type_id (required)
- -object_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
notification::request::request_exists (public)
notification::request::request_exists -type_id type_id \ -object_id object_id
returns true if at least one request exists for this object and type
- Switches:
- -type_id (required)
- -object_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
notification::request::request_ids (public)
notification::request::request_ids -type_id type_id \ -object_id object_id
returns a list of request_ids for the object_id of the given type
- Switches:
- -type_id (required)
- -object_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
notification::request::subscribers (public)
notification::request::subscribers -type_id type_id \ -object_id object_id
returns a list of subscribers for notifications on that object of this type
- Switches:
- -type_id (required)
- -object_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Content File Source
ad_library { Notification Requests When a user wishes to receive notifications of a certain type on a given object, he issues a notification request. This request is recorded specifically for that user. These procs help to manage such requests. @creation-date 2002-05-24 @author Ben Adida <ben@openforce.biz> @cvs-id $Id: notification-request-procs.tcl,v 1.14.2.2 2022/07/12 14:15:11 antoniop Exp $ } namespace eval notification::request { d_proc -public new { {-request_id ""} {-type_id:required} {-user_id:required} {-object_id:required} {-interval_id:required} {-delivery_method_id:required} {-format "text"} {-dynamic_p "f"} } { create a new request for a given user, notification type, object, interval and delivery method. } { set request_id [get_request_id -type_id $type_id -object_id $object_id -user_id $user_id] if {$request_id eq ""} { # Set up the vars set extra_vars [ns_set create s \ request_id $request_id \ type_id $type_id \ user_id $user_id \ object_id $object_id \ interval_id $interval_id \ delivery_method_id $delivery_method_id \ format $format \ dynamic_p $dynamic_p \ ] # Create the request set request_id [package_instantiate_object -extra_vars $extra_vars notification_request] } return $request_id } d_proc -public get_request_id { {-type_id:required} {-object_id:required} {-user_id:required} } { Checks if a particular notification request exists, and if so return the request ID. Note that the primary key on notification requests is notification_type, object, user. Interval and delivery method are specific parameters, but do not impact the uniqueness: a user can choose only one interval and delivery method for a given notification type and object. } { return [db_string select_request_id {} -default {}] } d_proc -public request_exists { {-type_id:required} {-object_id:required} } { returns true if at least one request exists for this object and type } { return [db_0or1row exists { select 1 from notification_requests where type_id = :type_id and object_id = :object_id fetch first 1 rows only }] } d_proc -public request_count { {-type_id:required} {-object_id:required} } { returns number of notification requests for this type and object } { return [db_string request_count {} -default 0] } d_proc -public subscribers { {-type_id:required} {-object_id:required} } { returns a list of subscribers for notifications on that object of this type } { return [db_list request_subscribers {}] } d_proc -public request_ids { {-type_id:required} {-object_id:required} } { returns a list of request_ids for the object_id of the given type } { return [db_list request_ids {}] } d_proc -public delete { {-request_id:required} } { delete a request for notifications by request ID. } { # do the delete db_exec_plsql delete_request {} } d_proc -public delete_all { {-object_id:required} } { remove all requests for a particular object ID usually because the object is getting deleted. } { # Do it db_exec_plsql delete_all_requests {} } d_proc -public delete_all_for_user { {-user_id:required} } { delete all the requests for a given user } { # do the delete db_exec_plsql delete_all_for_user {} } } # Local variables: # mode: tcl # tcl-indent-level: 4 # indent-tabs-mode: nil # End: