apm::convert_type (public)
apm::convert_type -package_id package_id \ -old_package_key old_package_key -new_package_key new_package_key
Defined in packages/acs-tcl/tcl/apm-procs.tcl
Convert a package instance to a new type, doing the proper instantiate and mount callbacks and parameter creation.
- Switches:
- -package_id (required)
- The package instance to convert.
- -old_package_key (required)
- The package key we're converting from.
- -new_package_key (required)
- The new subsite type we're converting to.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: db_dml update_package_key {} util_memoize_flush "apm_package_key_from_id_not_cached $package_id" set node_id [site_node::get_node_id_from_object_id -object_id $package_id] if { $node_id ne "" } { site_node::update_cache -node_id $node_id } # DRB: parameter fix! db_foreach get_params {} { db_1row get_new_parameter_id {} db_dml update_param {} } db_list copy_new_params {} apm_parameter_sync $new_package_key $package_id foreach inherited_package_key [::apm_package_inherit_order $new_package_key] { if {$inherited_package_key ni [::apm_package_inherit_order $old_package_key]} { apm_invoke_callback_proc -package_key $inherited_package_key -type after-instantiate -arg_list [list package_id $package_id] if { $node_id ne "" } { apm_invoke_callback_proc -package_key $inherited_package_key -type after-mount -arg_list [list node_id $node_id package_id $package_id] } } }Generic XQL file: <fullquery name="apm::convert_type.update_package_key"> <querytext> update apm_packages set package_key = :new_package_key where package_id = :package_id </querytext> </fullquery> <fullquery name="apm::convert_type.get_params"> <querytext> select parameter_name, parameter_id from apm_parameters where package_key = :old_package_key </querytext> </fullquery> <fullquery name="apm::convert_type.get_new_parameter_id"> <querytext> select parameter_id as new_parameter_id from apm_parameters where package_key = :new_package_key and parameter_name = :parameter_name </querytext> </fullquery> <fullquery name="apm::convert_type.update_param"> <querytext> update apm_parameter_values set parameter_id = :new_parameter_id where parameter_id = :parameter_id and package_id = :package_id </querytext> </fullquery>packages/acs-tcl/tcl/apm-procs.xql
PostgreSQL XQL file: <fullquery name="apm::convert_type.copy_new_params"> <querytext> select apm_parameter_value__new(null, :package_id, ap.parameter_id, ap.default_value) from apm_parameters ap where ap.package_key = :new_package_key and not exists (select 1 from apm_parameters ap2 where ap2.package_key = :old_package_key and ap2.parameter_name = ap.parameter_name) </querytext> </fullquery>packages/acs-tcl/tcl/apm-procs-postgresql.xql
Oracle XQL file: <fullquery name="apm::convert_type.copy_new_params"> <querytext> select apm_parameter_value.new( package_id => :package_id, parameter_id => ap.parameter_id, value => ap.default_value) from apm_parameters ap where ap.package_key = :new_package_key and not exists (select 1 from apm_parameters ap2 where ap2.package_key = :old_package_key and ap2.parameter_name = ap.parameter_name) </querytext> </fullquery>packages/acs-tcl/tcl/apm-procs-oracle.xql