rem rem $Header: L:\\\\model\\repman40\\api\\RCS\\ciplm.hpb 1.3 1998/12/16 16:14:52 cvanes Exp $ rem Rem Copyright (c) 1996 by Oracle Corporation Rem NAME Rem ciplm.hpb - Rem DESCRIPTION Rem Rem RETURNS Rem Rem NOTES Rem Rem MODIFIED (MM/DD/YY) Rem cvanes 07/10/96 - Creation REM *************************************************************************** REM Hand-carved package body for PLSQL MODULE created on 10-JAN-96 REM *************************************************************************** CREATE OR REPLACE PACKAGE BODY cihplm IS -- Generic post-process routines PROCEDURE check_delete(id number); pac_type constant varchar2(6) := 'MOD'; --======================== PRE-PROCESS (INS,UPD) ============================-- PROCEDURE pre_process(operation varchar2,id number, pl in out NOCOPY cioplsql_module.data) IS BEGIN -- Access control checks -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(pl.v.id,pac_type,operation,'SHR'); -- Validate user-defined properties if cieval.is_extended then cieval.check_element(id,pl.v.types,(operation='UPD') ,pl.v.user_defined_property_0,pl.i.user_defined_property_0 ,pl.v.user_defined_property_1,pl.i.user_defined_property_1 ,pl.v.user_defined_property_2,pl.i.user_defined_property_2 ,pl.v.user_defined_property_3,pl.i.user_defined_property_3 ,pl.v.user_defined_property_4,pl.i.user_defined_property_4 ,pl.v.user_defined_property_5,pl.i.user_defined_property_5 ,pl.v.user_defined_property_6,pl.i.user_defined_property_6 ,pl.v.user_defined_property_7,pl.i.user_defined_property_7 ,pl.v.user_defined_property_8,pl.i.user_defined_property_8 ,pl.v.user_defined_property_9,pl.i.user_defined_property_9 ,pl.v.user_defined_property_10,pl.i.user_defined_property_10 ,pl.v.user_defined_property_11,pl.i.user_defined_property_11 ,pl.v.user_defined_property_12,pl.i.user_defined_property_12 ,pl.v.user_defined_property_13,pl.i.user_defined_property_13 ,pl.v.user_defined_property_14,pl.i.user_defined_property_14 ,pl.v.user_defined_property_15,pl.i.user_defined_property_15 ,pl.v.user_defined_property_16,pl.i.user_defined_property_16 ,pl.v.user_defined_property_17,pl.i.user_defined_property_17 ,pl.v.user_defined_property_18,pl.i.user_defined_property_18 ,pl.v.user_defined_property_19,pl.i.user_defined_property_19 ); end if; -- Initialize unassigned properties with default values on INSERT if operation = 'INS' then pl.v.element_type_name := pac_type; pl.i.element_type_name := true; pl.v.module_type := 'PLM'; pl.i.module_type := true; if pl.v.name is null then pl.v.name := pl.v.short_name; pl.i.name := true; end if; end if; END; --======================== PRE-PROCESS (DEL,SEL) ============================-- PROCEDURE pre_process(operation varchar2,id number) IS -- cursor to delete all immediate children if the plsql module is of type -- 'TYPE BODY' ie. created from an OOT (B548080) CURSOR mco_first_child_delete IS select child_module_reference cmr from ci_module_networks modmod where parent_module_reference = pre_process.id; pm_type varchar2(10); BEGIN -- Access control checks -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(id,pac_type,operation,'SHR'); -- if operation is 'DELETE', make sure no non-cascading references exist if operation = 'DEL' then check_delete(id); end if; if operation = 'DEL' then select plm.plsql_module_type into pm_type from ci_plsql_modules plm where plm.id = pre_process.id; if pm_type = 'TYPE BODY' then FOR modmod IN mco_first_child_delete LOOP cioplsql_module.del(modmod.cmr); END LOOP; end if; -- Fix bug 1273845 -- (must pre-delete module networks for OOT method delete) for modmod in (select modmod.irid from ci_module_networks modmod ,ci_plsql_modules parent where parent.irid = modmod.parent_module_reference and parent.plsql_module_type = 'TYPE BODY' and modmod.child_module_reference = pre_process.id) loop ciomodule_network.del(modmod.irid); end loop; end if; END; --===================== POST-PROCESS (INS,UPD,SEL) ==========================-- PROCEDURE post_process(operation varchar2,id number, pl cioplsql_module.data) IS plsql_flag boolean := true; other_plm_id number; -- ID of clashing PLM dummy number; BEGIN if operation = 'SEL' then return; end if; if operation = 'INS' then ciiutl.create_appxxx(pac_type,pl.v.id,pl.v.name); elsif operation = 'UPD' then if pl.i.name or pl.i.short_name then cioapp_con_interface.traverse('CIHAPPCONU1',id, 'APPMOD'); end if; end if; --Check implementation name if it has a value or check name if null (B632516) if ((operation in ('INS', 'UPD')) and (pl.i.implementation_name or pl.i.name or pl.i.short_name)) then if (pl.v.name is not null and pl.i.name) then -- check name is a valid ORACLE name if cihtbl.is_name_valid(pl.v.name, plsql_flag) then ciierr.fatal(1003,ciiutl.identify(pl.v.id, pl.v.types),pl.v.name); end if; end if; if (pl.v.implementation_name is not null and pl.i.implementation_name) then -- check name is a valid ORACLE name if cihtbl.is_name_valid(pl.v.implementation_name, plsql_flag) then ciierr.fatal(1003,ciiutl.identify(pl.v.id, pl.v.types),pl.v.implementation_name); end if; end if; if pl.i.short_name then -- check name is a valid ORACLE name if cihtbl.is_name_valid(pl.v.short_name, plsql_flag) then ciierr.fatal(1003,ciiutl.identify(pl.v.id, pl.v.types),pl.v.short_name); end if; end if; end if; -- if plm is trg-logic attached to a database trigger then it cannot -- be changed to another type (B431348) if operation = 'UPD' and pl.i.plsql_module_type then select count(*) into dummy from ci_database_triggers where plsql_module_reference = pl.v.id; if dummy > 0 then ciierr.fatal(1042,ciiutl.identify(id, pl.v.types)); end if; end if; -- B644632: Only one TYPE BODY PLM per type if pl.v.plsql_module_type = 'TYPE BODY' then select min(plm.id) into other_plm_id from ci_plsql_modules plm where plm.oracle_object_type_reference = pl.v.oracle_object_type_reference and plm.id != nvl(pl.v.id, 0); if other_plm_id is not null then -- %0!s: %1!s already exists for %2!s. Only one TYPE BODY is permitted -- Cause : Only one TYPE BODY PL/SQL Module is permitted for an -- Oracle Object Type, and one exists for this Oracle Object Type already. -- Action: Delete the other TYPE BODY PL/SQL Module, or choose a different -- value for PLSQL_MODULE_TYPE. ciierr.fatal(1025, ciiutl.identify(pl.v.id, pl.v.types), ciiutl.identify(other_plm_id, 'PLM'), ciiutl.identify(pl.v.oracle_object_type_reference, 'OOT')); end if; end if; END; --========================= POST PROCESS (DEL) ==============================-- PROCEDURE post_process(operation varchar2,id number) IS BEGIN if operation = 'DEL' then -- Delete the plsql module and all it's related sub-bits ciiutl.delete_element(id,pac_type); end if; END; --============================= CHECK DELETE ================================-- PROCEDURE check_delete(id number) IS dummy number; error_count number := 0; BEGIN null; -- 4.0.12 Removed all simple delete checking -- Check if this plsql module is connected to other application systems -- Check if any database triggers are connected to me -- Check if any datastructures are connected to me -- Check if any datastructure items are connected to me -- Check if any datastructure items are connected to me -- Check if any module program data are connected to me -- Check if any other Modules refer to Program Data owned by me select count(*) into dummy from ci_module_program_data modpgd ,ci_program_data pgd where pgd.plsql_module_reference = check_delete.id and modpgd.PROGRAM_DATUM_REFERENCE = pgd.id and modpgd.plsql_module_reference != check_delete.id; if dummy > 0 then ciierr.post(1345,ciiutl.identify(id, 'PLM')); error_count := 1; end if; if error_count > 0 then raise cdapi.apierror; end if; END; --================================== END ====================================-- -- -- Package instantiation block -- BEGIN is_installed := true; END; /