application_data_link::update_links_from (public)

 application_data_link::update_links_from [ -object_id object_id ] \
    [ -text text ] [ -link_object_ids link_object_ids ] \
    [ -relation_tag relation_tag ]

Defined in packages/acs-tcl/tcl/application-data-link-procs.tcl

Update the references to this object in the database, optionally update links using the given relation_tag.

Switches:
-object_id (optional)
Object_id to update
-text (optional)
Text to scan for references
-link_object_ids (optional)
List of object ids to update the links to. Links not in this list will be deleted, and any in this list that are not in the database will be added.
-relation_tag (optional)
Relationship identifier
Returns:
List of updated linked object_ids
Author:
Dave Bauer <dave@solutiongrove.com>
Created:
2006-08-31

Partial Call Graph (max 5 caller/called nodes):
%3 test_data_links_update_links data_links_update_links (test acs-tcl) application_data_link::update_links_from application_data_link::update_links_from test_data_links_update_links->application_data_link::update_links_from test_data_links_update_links_with_tag data_links_update_links_with_tag (test acs-tcl) test_data_links_update_links_with_tag->application_data_link::update_links_from application_data_link::delete_from_list application_data_link::delete_from_list (public) application_data_link::update_links_from->application_data_link::delete_from_list application_data_link::get_links_from application_data_link::get_links_from (public) application_data_link::update_links_from->application_data_link::get_links_from application_data_link::link_exists application_data_link::link_exists (public) application_data_link::update_links_from->application_data_link::link_exists application_data_link::new_from application_data_link::new_from (public) application_data_link::update_links_from->application_data_link::new_from application_data_link::scan_for_links application_data_link::scan_for_links (public) application_data_link::update_links_from->application_data_link::scan_for_links Class ::xowiki::WikiForm Class ::xowiki::WikiForm (public) Class ::xowiki::WikiForm->application_data_link::update_links_from

Testcases:
data_links_update_links, data_links_update_links_with_tag
Source code:
    set old_links [application_data_link::get_links_from  -object_id $object_id  -relation_tag $relation_tag]

    if {![llength $link_object_ids]} {
        set link_object_ids [application_data_link::scan_for_links -text $text]
    }
    set delete_ids [list]
    foreach old_link $old_links {
        if {$old_link ni $link_object_ids} {
            lappend delete_ids $old_link
        }
    }
    application_data_link::delete_from_list  -object_id $object_id  -link_object_id_list $delete_ids  -relation_tag $relation_tag

    foreach new_link $link_object_ids {
        if {![application_data_link::link_exists  -from_object_id $object_id  -to_object_id $new_link  -relation_tag $relation_tag]
        } {
            application_data_link::new_from  -object_id $object_id  -to_object_id $new_link  -relation_tag $relation_tag
        }
    }
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-tcl/tcl/application-data-link-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: