• Publicity: Public Only All

rss-support-procs.tcl

Procedure to add subscriptions

Location:
packages/rss-support/tcl/rss-support-procs.tcl
Created:
2005-01-22
Author:
Dave Bauer <dave@thedesignexperience.org>
CVS Identification:
$Id: rss-support-procs.tcl,v 1.8.2.3 2024/07/22 13:58:39 antoniop Exp $

Procedures in this file

Detailed information

rss_support::add_subscription (public)

 rss_support::add_subscription -summary_context_id summary_context_id \
    -impl_name impl_name -owner owner [ -creation_user creation_user ] \
    [ -creation_ip creation_ip ] [ -object_type object_type ] \
    [ -timeout timeout ] [ -lastbuild lastbuild ] \
    [ -context_id context_id ] [ -creation_date creation_date ]
Switches:
-summary_context_id (required)
object_id to subscribe to
-impl_name (required)
RssGenSubscr service contract implementation name
-owner (required)
-creation_user (optional)
-creation_ip (optional)
-object_type (optional, defaults to "rss_gen_subscr")
object type to create
-timeout (optional, defaults to "3600")
time between rebuilds of the rss feed
-lastbuild (optional)
-context_id (optional)
object this subscription inherits from
-creation_date (optional)
date and time subscription was created
Returns:
subscr_id
Error:
Author:
Dave Bauer <dave@thedesignexperience.org>
Created:
2005-01-22

Partial Call Graph (max 5 caller/called nodes):
%3 news::install::after_instantiate news::install::after_instantiate (private) rss_support::add_subscription rss_support::add_subscription news::install::after_instantiate->rss_support::add_subscription packages/news/www/admin/rss.tcl packages/news/ www/admin/rss.tcl packages/news/www/admin/rss.tcl->rss_support::add_subscription db_string db_string (public) rss_support::add_subscription->db_string package_exec_plsql package_exec_plsql (public) rss_support::add_subscription->package_exec_plsql

Testcases:
No testcase defined.

rss_support::del_subscription (public)

 rss_support::del_subscription \
    [ -summary_context_id summary_context_id ] \
    [ -impl_name impl_name ] [ -owner owner ]
Switches:
-summary_context_id (optional)
summary context id to delete
-impl_name (optional)
implementation name to delete
-owner (optional)
owner package of implementation
Returns:
Error:
Author:
Dave Bauer <dave@thedesignexperience.org>
Created:
2005-01-23

Partial Call Graph (max 5 caller/called nodes):
%3 news::install::before_uninstantiate news::install::before_uninstantiate (private) rss_support::del_subscription rss_support::del_subscription news::install::before_uninstantiate->rss_support::del_subscription packages/news/www/admin/rss.tcl packages/news/ www/admin/rss.tcl packages/news/www/admin/rss.tcl->rss_support::del_subscription package_exec_plsql package_exec_plsql (public) rss_support::del_subscription->package_exec_plsql rss_gen_report_dir rss_gen_report_dir (private) rss_support::del_subscription->rss_gen_report_dir rss_support::get_subscr_id rss_support::get_subscr_id (public) rss_support::del_subscription->rss_support::get_subscr_id rss_support::subscription_exists rss_support::subscription_exists (public) rss_support::del_subscription->rss_support::subscription_exists

Testcases:
No testcase defined.

rss_support::get_subscr_id (public)

 rss_support::get_subscr_id [ -summary_context_id summary_context_id ] \
    [ -impl_name impl_name ] [ -owner owner ]

Return subscription id

Switches:
-summary_context_id (optional)
Object_id subscribed to
-impl_name (optional)
Implementation (object_type) name
-owner (optional)
Owner of implementation (package_key)
Returns:
Error:
Author:
Dave Bauer <dave@thedesignexperience.org>
Created:
2005-02-04

Partial Call Graph (max 5 caller/called nodes):
%3 news_update_rss news_update_rss (private) rss_support::get_subscr_id rss_support::get_subscr_id news_update_rss->rss_support::get_subscr_id rss_support::del_subscription rss_support::del_subscription (public) rss_support::del_subscription->rss_support::get_subscr_id db_string db_string (public) rss_support::get_subscr_id->db_string

Testcases:
No testcase defined.

rss_support::subscription_exists (public)

 rss_support::subscription_exists \
    [ -summary_context_id summary_context_id ] \
    [ -impl_name impl_name ]

Check if a subscription exists

Switches:
-summary_context_id (optional)
summary context id to check
-impl_name (optional)
Returns:
Error:
Author:
Dave Bauer <dave@thedesignexperience.org>
Created:
2005-01-23

Partial Call Graph (max 5 caller/called nodes):
%3 packages/news/www/admin/approve-2.tcl packages/news/ www/admin/approve-2.tcl rss_support::subscription_exists rss_support::subscription_exists packages/news/www/admin/approve-2.tcl->rss_support::subscription_exists packages/news/www/admin/index.tcl packages/news/ www/admin/index.tcl packages/news/www/admin/index.tcl->rss_support::subscription_exists packages/news/www/admin/rss.tcl packages/news/ www/admin/rss.tcl packages/news/www/admin/rss.tcl->rss_support::subscription_exists packages/news/www/index.tcl packages/news/ www/index.tcl packages/news/www/index.tcl->rss_support::subscription_exists packages/news/www/item-create-3.tcl packages/news/ www/item-create-3.tcl packages/news/www/item-create-3.tcl->rss_support::subscription_exists db_string db_string (public) rss_support::subscription_exists->db_string

Testcases:
No testcase defined.
[ hide source ] | [ make this the default ]

Content File Source

ad_library {

    Procedure to add subscriptions

    @author Dave Bauer (dave@thedesignexperience.org)
    @creation-date 2005-01-22
    @cvs-id $Id: rss-support-procs.tcl,v 1.8.2.3 2024/07/22 13:58:39 antoniop Exp $
}

namespace eval ::rss_support:: {}

d_proc -public ::rss_support::add_subscription {
    -summary_context_id:required
    -impl_name:required
    -owner:required
    {-creation_user ""}
    {-creation_ip ""}
    {-object_type "rss_gen_subscr"}
    {-timeout 3600}
    {-lastbuild ""}
    -context_id
    -creation_date
} {


    @author Dave Bauer (dave@thedesignexperience.org)
    @creation-date 2005-01-22

    @param summary_context_id object_id to subscribe to
    @param impl_name RssGenSubscr service contract
    implementation name
    @param creation_user
    @param creation_ip
    @param object_type object type to create
    @param timeout time between rebuilds of the rss feed
    @param context_id object this subscription inherits from
    @param creation_date date and time subscription was created

    @return subscr_id

    @error
} {
    if {![info exists context_id]} {
        set context_id $summary_context_id
    }

    set impl_id [db_string get_impl_id ""]
    set sysdate [clock format [clock seconds] -format "%Y-%m-%d"]

    set var_list [list \
                      [list p_subscr_id ""] \
                      [list p_impl_id $impl_id] \
                      [list p_summary_context_id $summary_context_id] \
                      [list p_timeout $timeout] \
                      [list p_lastbuild $sysdate] \
                      [list p_object_type $object_type] \
                      [list p_creation_user $creation_user ] \
                      [list p_creation_ip $creation_ip] \
                      [list p_context_id $context_id]
                  ]
    if {([info exists creation_date] && $creation_date ne "")} {
        lappend var_list [list creation_date $creation_date]
    }
    if { $lastbuild ne "" } {
        lappend var_list [list p_lastbuild $lastbuild]
    }

    return [package_exec_plsql \
                -var_list $var_list \
                rss_gen_subscr new]
}

d_proc -public rss_support::del_subscription {
    -summary_context_id
    -impl_name
    -owner
} {

    @author Dave Bauer (dave@thedesignexperience.org)
    @creation-date 2005-01-23

    @param summary_context_id summary context id to delete

    @param impl_name implementation name to delete

    @param owner owner package of implementation
    @return

    @error
} {
    if {[rss_support::subscription_exists \
            -summary_context_id $summary_context_id \
            -impl_name $impl_name]
    } {
        set subscr_id [rss_support::get_subscr_id \
                           -summary_context_id $summary_context_id \
                           -impl_name $impl_name \
                           -owner $owner]
        set report_dir [rss_gen_report_dir -subscr_id $subscr_id]
        # remove generated RSS reports for this subscription
        file delete -force -- $report_dir
        package_exec_plsql \
            -var_list [list [list subscr_id $subscr_id]] \
            rss_gen_subscr del
    } else {
        ns_log Warning "rss_support::del_subscription \
            (summary_context_id $summary_context_id -impl_name $impl_name) \
            does not exist!"
    }
}

d_proc -public rss_support::subscription_exists {
    -summary_context_id
    -impl_name
} {

    Check if a subscription exists

    @author Dave Bauer (dave@thedesignexperience.org)
    @creation-date 2005-01-23

    @param summary_context_id summary context id to check

    @return

    @error
} {
    return [db_string subscription_exists "" -default 0]
}

d_proc -public rss_support::get_subscr_id {
    -summary_context_id
    -impl_name
    -owner
} {

    Return subscription id

    @author Dave Bauer (dave@thedesignexperience.org)
    @creation-date 2005-02-04

    @param summary_context_id Object_id subscribed to

    @param impl_name Implementation (object_type) name

    @param owner Owner of implementation (package_key)
    @return

    @error
} {
    return [db_string get_subscr_id {
        select subscr_id
         from rss_gen_subscrs
        where impl_id = (select impl_id
                          from acs_sc_impls
                         where impl_name = :impl_name
                           and impl_contract_name = 'RssGenerationSubscriber'
                           and impl_owner_name = :owner)
          and summary_context_id = :summary_context_id
    }]
}

# Local variables:
#    mode: tcl
#    tcl-indent-level: 4
#    indent-tabs-mode: nil
# End: