REM *************************************************************************** REM Hand-carved package body for BC4J EVENT ATT MAPPING created on 16-JUL-99 REM *************************************************************************** CREATE OR REPLACE PACKAGE BODY cihcateat IS PROCEDURE check_delete(id number); str_type constant varchar2(6) := 'CATEAT'; part_type constant varchar2(6) := 'CAT'; use_type constant varchar2(6) := 'CAT'; --======================== PRE-PROCESS (INS,UPD) ============================-- PROCEDURE pre_process(operation varchar2,id number, pl in out NOCOPY ciobc4j_event_att_mapping.data) IS BEGIN -- Initialize unassigned properties with default values on INSERT if operation = 'INS' then pl.v.element_type_name := str_type; pl.i.element_type_name := true; end if; --Maintain the out_of_sync_flag for a corresponding file_usage ciheoc.maintain_sync_flag(pl.v.pac_reference); END; --======================== PRE-PROCESS (DEL,SEL) ============================-- PROCEDURE pre_process(operation varchar2,id number) IS BEGIN -- 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 ciobc4j_event_att_mapping.data) IS dummy number; error_flag boolean := false; BEGIN if operation != 'SEL' then BEGIN select 1 into dummy from sys.dual where exists ( select irid from ci_general_attributes where irid = pl.v.general_attribute_reference and event_classifier_reference IS NOT NULL ); EXCEPTION when no_data_found then --%0!s: Event attribute reference must refer to an event classifier attribute ciierr.post(2134,ciiutl.identify(id, 'CATEAT'), 'PRE'); error_flag := true; END; BEGIN select 1 into dummy from sys.dual where exists ( select pub.irid from ci_general_attributes gat ,ci_entity_object_attributes eat ,ci_event_publications pub where pub.classifier_reference = eat.entity_object_reference and pub.event_classifier_reference = gat.event_classifier_reference and gat.irid = pl.v.general_attribute_reference and eat.irid = pl.v.eo_attribute_reference ); EXCEPTION when no_data_found then --%0!s: Corresponding event publication must exist ciierr.post(2135,ciiutl.identify(id, 'CATEAT'), 'PRE'); error_flag := true; END; end if; if error_flag then raise cdapi.apierror; end if; END; --========================= POST PROCESS (DEL) ==============================-- PROCEDURE post_process(operation varchar2,id number) IS BEGIN null; 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_bc4j_event_att_mappings 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; /