content::item::get (public)

 content::item::get -item_id item_id [ -revision revision ] \
    [ -array_name array_name ]

Defined in packages/acs-content-repository/tcl/content-item-procs.tcl

Get an item.

Switches:
-item_id
(required)
-revision
(defaults to "live") (optional)
live, latest
-array_name
(defaults to "content_item") (optional)
name of array to upvar content into
Returns:
upvars array_name containing all attributes of the content type except content
returns 0 if item does not exists or 1 if query was successful
Error:
Author:
Dave Bauer <dave@thedesignexperience.org>
Created:
2004-05-28

Partial Call Graph (max 5 caller/called nodes):
%3 test_content_folder content_folder (test acs-content-repository) content::item::get content::item::get test_content_folder->content::item::get test_content_item content_item (test acs-content-repository) test_content_item->content::item::get acs_object_type::get acs_object_type::get (public) content::item::get->acs_object_type::get acs_object_type::get_table_name acs_object_type::get_table_name (public) content::item::get->acs_object_type::get_table_name content::item::get_content_type content::item::get_content_type (public) content::item::get->content::item::get_content_type db_0or1row db_0or1row (public) content::item::get->db_0or1row fs::item_editable_info fs::item_editable_info (public, deprecated) fs::item_editable_info->content::item::get fs::publish_versioned_object_to_file_system fs::publish_versioned_object_to_file_system (public) fs::publish_versioned_object_to_file_system->content::item::get packages/acs-subsite/lib/home.tcl packages/acs-subsite/ lib/home.tcl packages/acs-subsite/lib/home.tcl->content::item::get packages/acs-subsite/www/shared/portrait-bits.tcl packages/acs-subsite/ www/shared/portrait-bits.tcl packages/acs-subsite/www/shared/portrait-bits.tcl->content::item::get packages/acs-subsite/www/user/portrait/upload.tcl packages/acs-subsite/ www/user/portrait/upload.tcl packages/acs-subsite/www/user/portrait/upload.tcl->content::item::get

Testcases:
content_folder, content_item
Source code:
    upvar $array_name local_array
    if {$revision ni {live latest}} {
        error "content::item::get revision was '${revision}'. It must be 'live' or 'latest'"
    }
    set content_type [content::item::get_content_type -item_id $item_id]
    if {$content_type eq ""} {
        # content_type query was unsuccessful, item does not exist
        return 0
    }
    if {"content_folder" eq $content_type} {
        return [db_0or1row get_item_folder "" -column_array local_array]
    }
    set table_name [acs_object_type::get_table_name -object_type $content_type]
    while {$table_name eq ""} {
        acs_object_type::get -object_type $content_type -array typeInfo
        ns_log notice "no table for $content_type registered, trying '$typeInfo(supertype)' instead"
        set content_type $typeInfo(supertype)
        set table_name [acs_object_type::get_table_name -object_type $content_type]
    }
    set table_name "${table_name}x"
    # get attributes of the content_item use the content_typex view
    return [db_0or1row get_item "" -column_array local_array]
Generic XQL file:
<fullquery name="content::item::get.get_item">
    <querytext>
      select cx.*,
      ci.live_revision,
      ci.latest_revision,
      ci.locale,
      ci.publish_status,
      ci.content_type,
      ci.storage_type
      from ${table_name} cx,
      cr_items ci
      where ci.${revision}_revision = cx.revision_id
      and ci.item_id = :item_id
    </querytext>
</fullquery>

<fullquery name="content::item::get.get_item_folder">
    <querytext>
      select cf.*,
      ci.name,
      ci.item_id,
      ci.live_revision,
      ci.latest_revision,
      ci.locale,
      ci.publish_status,
      ci.content_type,
      ci.storage_type
      from cr_folders cf,
      cr_items ci
      where ci.item_id = cf.folder_id
      and ci.item_id = :item_id
    </querytext>
</fullquery>
packages/acs-content-repository/tcl/content-item-procs.xql

PostgreSQL XQL file:
packages/acs-content-repository/tcl/content-item-procs-postgresql.xql

Oracle XQL file:
packages/acs-content-repository/tcl/content-item-procs-oracle.xql

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