REM *************************************************************************** REM Hand-carved package body for ENTITY OBJECT USAGE created on 23-FEB-99 REM *************************************************************************** CREATE OR REPLACE PACKAGE BODY ciheou IS -- Generic post-process routines PROCEDURE check_delete(id number); sac_type constant varchar2(6) := 'EOU'; pac_type constant varchar2(6) := 'CLA'; --======================== PRE-PROCESS (INS,UPD) ============================-- PROCEDURE pre_process(operation varchar2,id number, pl in out NOCOPY cioentity_object_usage.data) IS BEGIN -- Access rights for entity object usage derive from the view object -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(pl.v.view_object_reference,pac_type, -- 'UPD','SHR'); -- 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; if pl.i.sequence_number = false then pl.v.sequence_number := ciiexp.default_str_seq(pl.v.view_object_reference, pl.v.entity_object_reference, 'EOU', 10); pl.i.sequence_number := true; end if; -- Property going in 4.0.13 so very primative setting through the API -- idea is that EOU with the lowest sequence has primative_flag set to Y -- as the code will go in 4.0.13 no point in doing any elaborate code -- so whilst the following won't always be correct it is good enough if pl.i.primary_flag = false then if pl.v.sequence_number = 10 then pl.v.primary_flag := 'Y'; else pl.v.primary_flag := 'N'; end if; pl.i.primary_flag := true; end if; end if; END; --======================== PRE-PROCESS (DEL,SEL) ============================-- PROCEDURE pre_process(operation varchar2,id number) IS CURSOR file_c(irid_ref number) IS select view_object_reference cla from ci_entity_object_usages where id = irid_ref; BEGIN -- Access rights for entity object usage derive from the view object -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(id,sac_type,operation,'SAC'); if operation = 'DEL' then -- if operation is 'DELETE', make sure no non-cascading references exist check_delete(id); -- Maintain the out_of_sync_flag for any corresponding file_usages FOR file_rec IN file_c(pre_process.id) LOOP ciheoc.maintain_sync_flag(file_rec.cla); END LOOP; end if; END; --===================== POST-PROCESS (INS,UPD,SEL) ==========================-- PROCEDURE post_process(operation varchar2,id number, pl cioentity_object_usage.data) IS BEGIN -- Shares namespace with VOA.NAME -- deferred unique name check if operation = 'INS' or (operation = 'UPD' and (pl.i.name or pl.i.sql_alias)) then rmman.log_change('CIHVOAE_UNIQUE_NAME',pl.v.id); end if; if operation = 'INS' or operation = 'UPD' then -- Maintain the out_of_sync_flag for any corresponding file_usages -- Should be maintained on INSERT and UPDATE ciheoc.maintain_sync_flag(pl.v.view_object_reference); end if; END; --========================= POST PROCESS (DEL, LCK) ==============================-- PROCEDURE post_process(operation varchar2,id number) IS CURSOR cfilpac IS select usage.primary_access_file_reference file_irid , usage.irid fu_irid from ci_file_usages usage , ci_entity_object_usages eou where usage.classifier_reference = eou.view_object_reference and eou.id = post_process.id; vfile_irid number; vfu_irid number; BEGIN if operation = 'LCK' then FOR files_rec IN cfilpac LOOP vfile_irid := files_rec.file_irid; vfu_irid := files_rec.fu_irid; cioprimary_access_file.lck(files_rec.file_irid); END LOOP; end if; EXCEPTION WHEN cioprimary_access_file.invalid_ref then ciierr.fatal(6089,ciiutl.identify(id, 'EOU'), to_char(vfile_irid), ciiutl.identify(vfu_irid, 'FILPAC')); raise; WHEN OTHERS then raise; END; --============================= CHECK DELETE ================================-- PROCEDURE check_delete(id number) IS dummy number; error_count number := 0; CURSOR file_c(irid_ref number) IS select pac_reference cla from ci_entity_object_usages where irid = irid_ref; BEGIN FOR file_rec IN file_c(check_delete.id) LOOP --Maintain the out_of_sync_flag for a corresponding file_usage ciheoc.maintain_sync_flag(file_rec.cla); END LOOP; END; --================================== END ====================================-- -- -- Package instantiation block -- BEGIN is_installed := true; END; /