namespace eval ::xo::db::sql {}
::nsf::object::alloc ::xo::db::Class ::xo::db::sql::content_item {set :__default_metaclass ::xotcl::Class
set :__default_superclass ::xotcl::Object
set :abstract_p f
set :auto_save false
set :name_method {}
set :object_type ::xo::db::sql::content_item
set :security_inherit_p t
set :sql_package_name content_item
set :supertype acs_object
set :with_table true}
::xo::db::sql::content_item proc new {{-dbn {}} -name:required -parent_id -item_id -locale {-creation_date now} -creation_user -context_id -creation_ip {-item_subtype content_item} {-content_type content_revision} -title -description {-mime_type text/plain} -nls_language -text -data -relation_tag {-is_live f} -storage_type -package_id {-with_child_rels t} -childof} {
foreach var [list NAME PARENT_ID ITEM_ID LOCALE CREATION_DATE CREATION_USER CONTEXT_ID CREATION_IP ITEM_SUBTYPE CONTENT_TYPE TITLE DESCRIPTION MIME_TYPE NLS_LANGUAGE TEXT DATA RELATION_TAG IS_LIVE STORAGE_TYPE PACKAGE_ID WITH_CHILD_RELS] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__new($_NAME, $_PARENT_ID, $_ITEM_ID, $_LOCALE, $_CREATION_DATE, $_CREATION_USER, $_CONTEXT_ID, $_CREATION_IP, $_ITEM_SUBTYPE, $_CONTENT_TYPE, $_TITLE, $_DESCRIPTION, $_MIME_TYPE, $_NLS_LANGUAGE, $_TEXT, $_DATA, $_RELATION_TAG, $_IS_LIVE, $_STORAGE_TYPE, $_PACKAGE_ID, $_WITH_CHILD_RELS) FOR UPDATE
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc get_virtual_path {{-dbn {}} -item_id:required -root_folder_id} {
foreach var [list ITEM_ID ROOT_FOLDER_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__get_virtual_path($_ITEM_ID, $_ROOT_FOLDER_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc get_best_revision {{-dbn {}} -item_id:required} {
foreach var [list ITEM_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__get_best_revision($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc copy {{-dbn {}} -item_id:required -target_folder_id:required -creation_user:required -creation_ip -name} {
foreach var [list ITEM_ID TARGET_FOLDER_ID CREATION_USER CREATION_IP NAME] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__copy($_ITEM_ID, $_TARGET_FOLDER_ID, $_CREATION_USER, $_CREATION_IP, $_NAME)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc get_content_type {{-dbn {}} -item_id:required} {
foreach var [list ITEM_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__get_content_type($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc get_publish_date {{-dbn {}} -item_id:required {-is_live f}} {
foreach var [list ITEM_ID IS_LIVE] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__get_publish_date($_ITEM_ID, $_IS_LIVE)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc is_subclass {{-dbn {}} -object_type:required -supertype:required} {
foreach var [list OBJECT_TYPE SUPERTYPE] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__is_subclass($_OBJECT_TYPE, $_SUPERTYPE)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc is_published {{-dbn {}} -item_id:required} {
foreach var [list ITEM_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__is_published($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc delete {{-dbn {}} -item_id:required} {
foreach var [list ITEM_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__delete($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc get_path {{-dbn {}} -item_id:required -root_folder_id} {
foreach var [list ITEM_ID ROOT_FOLDER_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__get_path($_ITEM_ID, $_ROOT_FOLDER_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc is_valid_child {{-dbn {}} -item_id:required -content_type:required -relation_tag:required} {
foreach var [list ITEM_ID CONTENT_TYPE RELATION_TAG] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__is_valid_child($_ITEM_ID, $_CONTENT_TYPE, $_RELATION_TAG)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc is_index_page {{-dbn {}} -item_id:required -folder_id:required} {
foreach var [list ITEM_ID FOLDER_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__is_index_page($_ITEM_ID, $_FOLDER_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc register_template {{-dbn {}} -item_id:required -template_id:required -use_context:required} {
foreach var [list ITEM_ID TEMPLATE_ID USE_CONTEXT] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__register_template($_ITEM_ID, $_TEMPLATE_ID, $_USE_CONTEXT)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc unrelate {{-dbn {}} -rel_id:required} {
foreach var [list REL_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__unrelate($_REL_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc get_title {{-dbn {}} -item_id:required {-is_live f}} {
foreach var [list ITEM_ID IS_LIVE] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__get_title($_ITEM_ID, $_IS_LIVE)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc set_live_revision {{-dbn {}} -revision_id:required {-publish_status ready} {-publish_date now()} {-is_latest f}} {
foreach var [list REVISION_ID PUBLISH_STATUS PUBLISH_DATE IS_LATEST] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__set_live_revision($_REVISION_ID, $_PUBLISH_STATUS, $_PUBLISH_DATE, $_IS_LATEST) FOR NO KEY UPDATE
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc get_latest_revision {{-dbn {}} -item_id:required} {
foreach var [list ITEM_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__get_latest_revision($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc unregister_template {{-dbn {}} -item_id:required -template_id -use_context} {
foreach var [list ITEM_ID TEMPLATE_ID USE_CONTEXT] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__unregister_template($_ITEM_ID, $_TEMPLATE_ID, $_USE_CONTEXT)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc get_template {{-dbn {}} -item_id:required -use_context:required} {
foreach var [list ITEM_ID USE_CONTEXT] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__get_template($_ITEM_ID, $_USE_CONTEXT)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc generic_move {{-dbn {}} -item_id:required -target_item_id:required -name:required} {
foreach var [list ITEM_ID TARGET_ITEM_ID NAME] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__generic_move($_ITEM_ID, $_TARGET_ITEM_ID, $_NAME)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc get_id {{-dbn {}} -item_path:required -root_folder_id {-resolve_index f}} {
foreach var [list ITEM_PATH ROOT_FOLDER_ID RESOLVE_INDEX] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__get_id($_ITEM_PATH, $_ROOT_FOLDER_ID, $_RESOLVE_INDEX)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc unset_live_revision {{-dbn {}} -item_id:required} {
foreach var [list ITEM_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__unset_live_revision($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc get_context {{-dbn {}} -item_id:required} {
foreach var [list ITEM_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__get_context($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc write_to_file {{-dbn {}} -item_id:required -root_path:required} {
foreach var [list ITEM_ID ROOT_PATH] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__write_to_file($_ITEM_ID, $_ROOT_PATH)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc get_parent_folder {{-dbn {}} -item_id:required} {
foreach var [list ITEM_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__get_parent_folder($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc del {{-dbn {}} -item_id:required} {
foreach var [list ITEM_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__del($_ITEM_ID) FOR UPDATE
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc relate {{-dbn {}} -item_id:required -object_id:required {-relation_tag generic} -order_n {-relation_type cr_item_rel}} {
foreach var [list ITEM_ID OBJECT_ID RELATION_TAG ORDER_N RELATION_TYPE] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__relate($_ITEM_ID, $_OBJECT_ID, $_RELATION_TAG, $_ORDER_N, $_RELATION_TYPE)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc copy2 {{-dbn {}} -item_id:required -target_folder_id:required -creation_user:required -creation_ip} {
foreach var [list ITEM_ID TARGET_FOLDER_ID CREATION_USER CREATION_IP] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__copy2($_ITEM_ID, $_TARGET_FOLDER_ID, $_CREATION_USER, $_CREATION_IP)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc get_live_revision {{-dbn {}} -item_id:required} {
foreach var [list ITEM_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__get_live_revision($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc get_root_folder {{-dbn {}} -item_id} {
foreach var [list ITEM_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__get_root_folder($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc is_publishable {{-dbn {}} -item_id:required} {
foreach var [list ITEM_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__is_publishable($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc set_release_period {{-dbn {}} -item_id:required -start_when -end_when} {
foreach var [list ITEM_ID START_WHEN END_WHEN] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__set_release_period($_ITEM_ID, $_START_WHEN, $_END_WHEN)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc edit_name {{-dbn {}} -item_id:required -name:required} {
foreach var [list ITEM_ID NAME] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__edit_name($_ITEM_ID, $_NAME)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc get_revision_count {{-dbn {}} -item_id:required} {
foreach var [list ITEM_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__get_revision_count($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::content_item proc move {{-dbn {}} -item_id:required -target_folder_id:required -name:required} {
foreach var [list ITEM_ID TARGET_FOLDER_ID NAME] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select content_item__move($_ITEM_ID, $_TARGET_FOLDER_ID, $_NAME)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}