rem rem NAME rem ckcremod.hpb - Create a module as copy of an old one. rem rem DESCRIPTION rem Create a module as copy of an old one. rem rem PUBLIC rem Create_As rem Rem REWRITTEN DD/MM/YY Rem LOldham 29/07/99 - Now uses API deep copy prompt prompt Creating Stored Package CkoModule create or replace package body ckomodule as /*------------------------------ Create As ---------------------------------*/ /* Name Create As Description Create a module with new language as a copy of another module. Calls the API to deep copy the module Calls the API to update the language of any copied SMCs Calls the API make_private_copy to convert incluions of RMCs into SMCs + inclusions - No commit or rollback is done by this procedure. - Supports General Modules only. - Copy of RMCs and SMCs is now supported by the API Notes Original Spec. from Peter S , revised by Louise O on 29/07/99 after discussion with Jon Spyve and Pete Carlisle 1. Create As Copy can be called for Modules only in 6.5 2. This utility will only be called when the language of the new object is different from that of the copied object. 3. The API rules for creating objects of a certain language will be used when copying to the new object. 4. All Application Logic and Preferences will be copied. *** Assuming registration triggers support this 5. If a module has Module Component Inclusions that reference Resusable Module Components then private copies of the RMCs are created in the new language. */ procedure create_as (old_id in number, new_id out number, new_language_id in number, new_short_name in varchar2, new_name in varchar2 default null) as utility_name varchar2(35) := 'Copy Module with New Language'; proc varchar2(100) := 'Module.Copy With New Language '; gempl ciogeneral_module.data; smcpl ciospecific_mco.data; smcpl_null ciospecific_mco.data; smcpl1 ciospecific_mco.data; -- Don't need subcomponents because they don't have a language reference CURSOR sel_mun IS select mun.irid mun_id , mun.module_unit_subtype mun_type , mun.name mun_name from sdd_mcn mcn , sdd_mun mun where mcn.general_module_ref = gempl.v.id and mcn.module_component_ref = mun.irid; begin rmdbg.trace (proc ||'is started ' || to_char(old_id) || ' ' || to_char(new_language_id) || ' ' || new_short_name || ' ' || new_name); ck_util.register (utility_name,'Init'); rmmes.clear; if not cdapi.initialized then ciierr.fatal(1); end if; gempl.v.language_reference := new_language_id; gempl.i.language_reference := true; gempl.v.short_name := new_short_name; gempl.i.short_name := true; if new_name is null then gempl.i.name := false; else gempl.v.name := new_name; gempl.i.name := true; end if; -- Make a copy of the module rmdbg.trace('Make a copy of the module'); ciogeneral_module.copy_pac(old_id, NULL, gempl); FOR cmun IN sel_mun LOOP rmdbg.trace('In sel_mun loop'); if cmun.mun_type = 'RMC' then smcpl.v.general_module_reference := gempl.v.id; smcpl.i.general_module_reference := true; smcpl.v.language_reference := new_language_id; smcpl.i.language_reference := true; rmdbg.trace('Make a private copy of the RMC'); cimmun.dont_check_mcn_unique := true; -- don't want to check uniqueness of MCN for SMC as it will always fail rmdbg.trace('MPC of RMC : '||to_char(cmun.mun_id)); rmdbg.trace('MPC of RMC, general module reference : '||to_char(gempl.v.id)); rmdbg.trace('MPC of RMC, new lang reference : '||to_char(new_language_id)); cimmun.make_private_copy(cmun.mun_id, smcpl); -- Nullify SMC property list smcpl := smcpl_null; cimmun.dont_check_mcn_unique := false; else smcpl1.v.language_reference := new_language_id; smcpl1.i.language_reference := true; rmdbg.trace('Update SMC with new language'); ciospecific_mco.upd(cmun.mun_id, smcpl1); end if; END LOOP; -- populate new id to pass back to caller new_id := gempl.v.id; end create_as; end ckomodule; /