rem rem $Header: L:\\\\model\\repman40\\api\\RCS\\ciitm.hpb 1.3 1998/10/12 15:09:49 cheaps Exp $ rem Rem Copyright (c) 1994 by Oracle Corporation Rem NAME Rem ciitm.hpb - Rem DESCRIPTION Rem Rem RETURNS Rem Rem NOTES Rem Rem MODIFIED (MM/DD/YY) Rem aheath 07/08/94 - Creation Rem aheath 10/24/94 - Add the real stuff Rem aheath 10/25/94 - Wrong disciminator values REM *************************************************************************** REM Hand-carved package body for DATASTRUCTURE ITEM created on 24-OCT-94 REM *************************************************************************** CREATE OR REPLACE PACKAGE BODY cihitm IS -- Generic post-process routines PROCEDURE check_delete(id number); sac_type constant varchar2(6) := 'ITM'; pac_type constant varchar2(6) := 'DAT'; --======================== PRE-PROCESS (INS,UPD) ============================-- PROCEDURE pre_process(operation varchar2,id number, pl in out NOCOPY ciodatastructure_item.data) IS BEGIN -- Access rights for datastructure item derive from the datastructure -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(pl.v.datastructure_reference,pac_type, -- 'UPD','SAC'); -- 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 := sac_type; pl.i.element_type_name := true; end if; --#BEGIN -- Maintain the item type if operation = 'INS' then -- believe the first property found in the arc, and derive the -- value for item_type. A generated check exists for more than one value -- in the arc. if pl.v.column_reference is not null then pl.v.item_type := 'COL'; elsif pl.v.cursor_reference is not null then pl.v.item_type := 'MOD'; elsif pl.v.domain_reference is not null then pl.v.item_type := 'DOM'; elsif pl.v.oracle_type_reference is not null then pl.v.item_type := 'ORT'; elsif pl.v.datastructure_reference2 is not null then pl.v.item_type := 'DAT'; elsif pl.v.datatype is not null then pl.v.item_type := 'DATATYPE'; elsif pl.v.program_datum_reference is not null then pl.v.item_type := 'PGD'; elsif pl.v.table_definition_reference is not null then pl.v.item_type := 'TAB'; else pl.v.item_type := 'DATATYPE'; -- A default value end if; pl.i.item_type := true; else -- operation = 'UPD' /** b646137 jkc 17sep98 - arc resolution added so others null **/ -- CW 13-Mar-2000 Fix bug 959663, nullify package reference when cursor reference -- is nullified, and vice versa if pl.i.column_reference and pl.v.column_reference is not null and pl.v.item_type != 'COL' then pl.v.item_type := 'COL'; pl.i.item_type := true; pl.v.domain_reference := null; pl.v.table_definition_reference := null; pl.v.oracle_type_reference := null; pl.v.datastructure_reference2 := null; pl.v.program_datum_reference := null; pl.v.cursor_reference := null; pl.v.plsql_module_reference := null; pl.v.datatype := null; elsif pl.i.cursor_reference and pl.v.cursor_reference is not null and pl.v.item_type != 'MOD' then pl.v.item_type := 'MOD'; pl.i.item_type := true; pl.v.domain_reference := null; pl.v.table_definition_reference := null; pl.v.column_reference := null; pl.v.oracle_type_reference := null; pl.v.datastructure_reference2 := null; pl.v.program_datum_reference := null; pl.v.datatype := null; elsif pl.i.plsql_module_reference and pl.v.plsql_module_reference is not null and pl.v.item_type != 'MOD' then -- CW 13-Mar-2000 Fix bug 959663 nullify cursor_reference and plsql_module_reference -- together. Note, plsql_module_reference is really in the 'defined by' arc as well pl.v.item_type := 'MOD'; pl.i.item_type := true; pl.v.domain_reference := null; pl.v.table_definition_reference := null; pl.v.column_reference := null; pl.v.oracle_type_reference := null; pl.v.datastructure_reference2 := null; pl.v.program_datum_reference := null; pl.v.datatype := null; elsif pl.i.domain_reference and pl.v.domain_reference is not null and pl.v.item_type != 'DOM' then pl.v.item_type := 'DOM'; pl.i.item_type := true; pl.v.table_definition_reference := null; pl.v.column_reference := null; pl.v.oracle_type_reference := null; pl.v.datastructure_reference2 := null; pl.v.program_datum_reference := null; pl.v.cursor_reference := null; pl.v.plsql_module_reference := null; pl.v.datatype := null; elsif pl.i.oracle_type_reference and pl.v.oracle_type_reference is not null and pl.v.item_type != 'ORT' then pl.v.item_type := 'ORT'; pl.i.item_type := true; pl.v.domain_reference := null; pl.v.table_definition_reference := null; pl.v.column_reference := null; pl.v.datastructure_reference2 := null; pl.v.program_datum_reference := null; pl.v.cursor_reference := null; pl.v.plsql_module_reference := null; pl.v.datatype := null; elsif pl.i.datastructure_reference2 and pl.v.datastructure_reference2 is not null and pl.v.item_type != 'DAT' then pl.v.item_type := 'DAT'; pl.i.item_type := true; pl.v.domain_reference := null; pl.v.table_definition_reference := null; pl.v.column_reference := null; pl.v.oracle_type_reference := null; pl.v.program_datum_reference := null; pl.v.cursor_reference := null; pl.v.plsql_module_reference := null; pl.v.datatype := null; elsif pl.i.datatype and pl.v.datatype is not null and pl.v.item_type != 'DATATYPE' then pl.v.item_type := 'DATATYPE'; pl.i.item_type := true; pl.v.domain_reference := null; pl.v.table_definition_reference := null; pl.v.column_reference := null; pl.v.oracle_type_reference := null; pl.v.datastructure_reference2 := null; pl.v.program_datum_reference := null; pl.v.cursor_reference := null; pl.v.plsql_module_reference := null; elsif pl.i.program_datum_reference and pl.v.program_datum_reference is not null and pl.v.item_type != 'PGD' then pl.v.item_type := 'PGD'; pl.i.item_type := true; pl.v.domain_reference := null; pl.v.table_definition_reference := null; pl.v.column_reference := null; pl.v.oracle_type_reference := null; pl.v.datastructure_reference2 := null; pl.v.cursor_reference := null; pl.v.plsql_module_reference := null; pl.v.datatype := null; elsif pl.i.table_definition_reference and pl.v.table_definition_reference is not null and pl.v.item_type != 'TAB' then pl.v.item_type := 'TAB'; pl.i.item_type := true; pl.v.domain_reference := null; pl.v.column_reference := null; pl.v.oracle_type_reference := null; pl.v.datastructure_reference2 := null; pl.v.program_datum_reference := null; pl.v.cursor_reference := null; pl.v.plsql_module_reference := null; pl.v.datatype := null; else pl.i.item_type := false; end if; end if; -- Store in table_reference the denormalised table of the column_reference if (operation = 'INS' and pl.v.item_type = 'COL') or (operation = 'UPD' and pl.i.item_type and pl.v.item_type = 'COL') then select col.table_reference into pl.v.table_definition_reference from ci_columns col where col.id = pl.v.column_reference; pl.i.table_definition_reference := true; end if; --Convert spaces to underscores in item name. if operation='INS' or (operation='UPD' and pl.i.name) then cihtbl.remove_spaces(pl.v.name); --B631806 end if; -- Default value must be specified if Optional is False --if pl.v.nulls = 'False' and pl.v.default_value is null if pl.v.nulls = 'N' and pl.v.default_value is null then ciierr.fatal(1317,ciiutl.identify(pl.v.id, pl.v.types)); end if; --#END END; --======================== PRE-PROCESS (DEL,SEL) ============================-- PROCEDURE pre_process(operation varchar2,id number) IS BEGIN -- Access rights for datastructure item derive from the datastructure -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(id,sac_type,operation,'SAC'); -- if operation is 'DELETE', make sure no non-cascading references exist if operation = 'DEL' then check_delete(id); end if; END; --===================== POST-PROCESS (INS,UPD,SEL) ==========================-- PROCEDURE post_process(operation varchar2,id number, pl ciodatastructure_item.data) IS BEGIN null; END; --========================= POST PROCESS (DEL) ==============================-- PROCEDURE post_process(operation varchar2,id number) IS BEGIN if operation = 'DEL' then -- Delete the datastructure item and all it's related sub-bits ciiutl.delete_element(id,sac_type); end if; END; --============================= CHECK DELETE ================================-- PROCEDURE check_delete(id number) IS dummy number; error_count number := 0; BEGIN null; END; --#BEGIN --===================== IS CONNECTED ========================================-- FUNCTION is_connected(par_id number, child_id number) RETURN boolean IS cnt number; BEGIN select count(*) into cnt from ci_module_networks where parent_module_reference = par_id and child_module_reference = child_id; if cnt = 0 then return(false); else return(true); end if; END; --#END --================================== END ====================================-- -- -- Package instantiation block -- BEGIN is_installed := true; END; /