rem rem $Header: L:\\\\model\\repman40\\api\\RCS\\ciuee.hpb 1.3 1998/10/09 13:47:06 jkchow Exp $ rem Rem Copyright (c) 1994 by Oracle Corporation Rem NAME Rem ciuee.hpb - Rem DESCRIPTION Rem Rem RETURNS Rem Rem NOTES Rem Rem MODIFIED (MM/DD/YY) Rem loldham 06/10/98 - Bug 741444 - remove references to sdd_elements etc Rem Added call to CIHE1U1 (etc) to check descendants Rem aheath 02/27/95 - Add call to validate properties Rem jwetherb 10/24/94 - Creation REM *************************************************************************** REM Hand-carved package body for OBJECTIVE created on 24-OCT-94 REM *************************************************************************** CREATE OR REPLACE PACKAGE BODY cihuee IS -- Generic post-process routines PROCEDURE check_delete(id number,pac_type varchar2,pac_name varchar2); sav_pac_name varchar2(10); --======================== PRE-PROCESS (INS,UPD) ============================-- PROCEDURE pre_process(operation varchar2,id number, pl in out NOCOPY cioextended_element.data) IS -- parent_id number; BEGIN if operation = 'INS' then select et.id into pl.v.types from rm_element_types et where et.short_name = pl.v.element_type_name; pl.i.types := true; end if; cihuee.pre_process(operation,pl.v.id,pl.v.element_type_name, pl.v.element_type_name,pl.i.element_type_name); -- 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; END; --======================== PRE-PROCESS (DEL,SEL) ============================-- PROCEDURE pre_process(operation varchar2,id number) IS short_name varchar2(10); nls_name varchar2(240); BEGIN select et.short_name, ex.nls_name into short_name, nls_name from rm_element_type_extensions ex, sdd_object_versions ov , rm_element_types et where ov.logical_type_id = ex.for_type and ov.irid = pre_process.id and et.id = ov.logical_type_id; sav_pac_name := short_name; cihuee.pre_process(operation,id,short_name,nls_name); END; --=================== POST-PROCESS (DEL) ====================================-- PROCEDURE post_process(operation varchar2,id number) IS BEGIN cihuee.post_process('DEL', id, sav_pac_name); END; --=================== POST-PROCESS (INS,SEL,UPD) ============================-- PROCEDURE post_process(operation varchar2,id number, pl cioextended_element.data) IS BEGIN if operation = 'SEL' or operation = 'INS' then cihuee.post_process(operation, pl.v.id, pl.v.element_type_name); else cihuee.post_process('UPD',id,pl.v.element_type_name,pl.i.name); end if; END; --======================== PRE-PROCESS (INS,UPD) ============================-- PROCEDURE pre_process(operation varchar2,id number,pac_type varchar2, element_type_name in out NOCOPY varchar2,element_type_name_ind in out boolean) IS BEGIN -- Access control checks -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(id,pac_type,operation,'SHR'); -- Initialize unassigned properties with default values on INSERT if operation = 'INS' then element_type_name := pac_type; element_type_name_ind := true; end if; END; --======================== PRE-PROCESS (DEL,SEL) ============================-- PROCEDURE pre_process(operation varchar2,id number,pac_type varchar2, pac_name varchar2) IS 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,pac_type,pac_name); end if; END; --=================== POST-PROCESS (INS,SEL,DEL) ============================-- PROCEDURE post_process(operation varchar2,id number,pac_type varchar2) IS BEGIN if operation = 'INS' then ciiutl.create_appxxx(pac_type,id); elsif operation = 'DEL' then -- Delete the objective and all it's related sub-bits ciiutl.delete_element(id,pac_type); end if; END; --=================== POST-PROCESS (UPD) ====================================-- PROCEDURE post_process(operation varchar2,id number,pac_type varchar2, name_ind in boolean) IS parent_id number; big_str varchar2(1000); cur_id integer; ret_val integer; elm_col varchar2(20); BEGIN if pac_type in ('E1','E2','E3','E5','E6') then /* Column name is different for each element type */ if (pac_type = 'E1') then elm_col := 'objective_ref'; elsif (pac_type = 'E2') then elm_col := 'csf_ref'; elsif (pac_type = 'E3') then elm_col := 'kpi_ref'; elsif (pac_type = 'E5') then elm_col := 'problem_ref'; elsif (pac_type = 'E6') then elm_col := 'location_ref'; end if; big_str := ' select e.'||elm_col|| ' from sdd_' || pac_type || ' e' || ' where e.irid = :p_id '; rmdbg.trace('big_str is : '||big_str); cur_id := dbms_sql.open_cursor; dbms_sql.parse(cur_id, big_str, dbms_sql.native); dbms_sql.bind_variable(cur_id, ':p_id', post_process.id); dbms_sql.define_column(cur_id, 1, parent_id); ret_val := dbms_sql.execute(cur_id); if (dbms_sql.fetch_rows(cur_id) > 0 ) then dbms_sql.column_value(cur_id, 1, parent_id); end if; dbms_sql.close_cursor(cur_id); end if; /* select el_within_id, el_type_of into parent_id, el_type from sdd_elements sdd where sdd.el_id = post_process.id; */ if operation = 'UPD' and name_ind then cioapp_con_interface.traverse('CIHAPPCONU1',id,'APP'||pac_type); end if; if operation = 'UPD' and pac_type in ('E1','E2','E3','E5','E6') and parent_id is not null then rmdbg.trace('Calling rmman.log_change...'); rmman.log_change('CIH'||pac_type||'U1',post_process.id); /* Remove this check as above call will do it and more ... if post_process.id = parent_id then ciierr.fatal(1193,ciiutl.identify(id, pac_type)); end if; */ end if; END; --============================= CHECK DELETE ================================-- PROCEDURE check_delete(id number,pac_type varchar2,pac_name varchar2) IS dummy number; error_count number := 0; big_str varchar2(1000); cur_id integer; ret_val integer; elm_col varchar2(20); BEGIN null; -- 4.0.12 Removed all simple delete checking -- Check if this extended element is connected to other application systems -- If extented element is hierarchical, make sure no sub-types exist if pac_type in ('E1','E2','E3','E5','E6') then /* Column name is different for each element type */ if (pac_type = 'E1') then elm_col := 'objective_ref'; elsif (pac_type = 'E2') then elm_col := 'csf_ref'; elsif (pac_type = 'E3') then elm_col := 'kpi_ref'; elsif (pac_type = 'E5') then elm_col := 'problem_ref'; else /*(pac_type = 'E6')*/ elm_col := 'location_ref'; end if; big_str := ' select count(*) '|| ' from sdd_' || pac_type || ' e' || ' where '||elm_col||' = :p_id '; rmdbg.trace('big_str is : '||big_str); cur_id := dbms_sql.open_cursor; dbms_sql.parse(cur_id, big_str, dbms_sql.native); dbms_sql.bind_variable(cur_id, ':p_id', check_delete.id); dbms_sql.define_column(cur_id, 1, dummy); ret_val := dbms_sql.execute(cur_id); if dbms_sql.fetch_rows(cur_id) > 0 then dbms_sql.column_value(cur_id, 1, dummy); if (dummy > 0) then ciierr.post(102,ciiutl.identify(id, 'UEE'),'sub-types',pac_name); error_count := 1; end if; end if; dbms_sql.close_cursor(cur_id); end if; if error_count > 0 then raise cdapi.apierror; end if; END; --================================== END ====================================-- -- -- Package instantiation block -- BEGIN is_installed := true; END; /