REM *************************************************************************** REM Hand-carved package body for EVENT PUBLICATION created on 13-JAN-99 REM *************************************************************************** CREATE OR REPLACE PACKAGE BODY cihclaevc IS -- Generic post-process routines PROCEDURE check_delete(id number); str_type constant varchar2(6) := 'CLAEVC'; part_type constant varchar2(6) := 'CLA'; use_type constant varchar2(6) := 'CLA'; --======================== PRE-PROCESS (INS,UPD) ============================-- PROCEDURE pre_process(operation varchar2,id number, pl in out NOCOPY cioevent_publication.data) IS BEGIN -- Perform INSERT-specific processing -- Access rights for event publication derive from the classifier -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(pl.v.classifier_reference, -- part_type,'UPD','SHR'); -- if operation = 'INS' then -- ciiacc.check_access_rights(pl.v.event_classifier_reference, use_type,'SEL','SHR'); -- end if; 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 -- Access rights for event publication derive from the classifier -- Access rights checking performed by triggers in config 4.0.9 -- if operation = 'DEL' then -- ciiacc.check_access_rights(id,str_type,'UPD','MM'); -- else -- ciiacc.check_access_rights(id,str_type,operation,'MM'); -- end if; -- 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 cioevent_publication.data) IS sud_data ciosubscription_detail.data; CURSOR details_c(event_ref number) IS select irid from ci_event_subscriptions where uml_type_flag = 'Y' and event_classifier_reference = event_ref; BEGIN if operation = 'INS' then --insert any neccessary Subscription Details FOR details_rec IN details_c(pl.v.event_classifier_reference) LOOP sud_data.v.event_publication_reference := pl.v.irid; sud_data.i.event_publication_reference := true; sud_data.v.event_subscription_reference := details_rec.irid; sud_data.i.event_subscription_reference := true; ciosubscription_detail.ins(null, sud_data); END LOOP; 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 where usage.classifier_reference = post_process.id; vfile_irid number; vfu_irid number; BEGIN if operation = 'LCK' then -- Maintain the out_of_sync_flag for any corresponding file_usages 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, 'CLAEVC'), 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_flag boolean := false; CURSOR file_c(irid_ref number) IS select pac_reference cla from ci_event_publications where irid = irid_ref; CURSOR class_ref_c(irid_ref number) IS select classifier_reference ,event_classifier_reference from ci_event_publications where irid = irid_ref; CURSOR attributes_c(class_ref number, event_class_ref number) IS select mapping.irid from ci_bc4j_event_att_mappings mapping ,ci_entity_object_attributes entity ,ci_general_attributes general where (mapping.eo_attribute_reference = entity.irid and entity.entity_object_reference = class_ref) or (mapping.general_attribute_reference = general.irid and general.event_classifier_reference = event_class_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; /*Delete any bc4j_event_att_mappings where the owning classifier of either the entitiy_object_attribute or the general attribute refered to is the same as the clasifier refered to in this event publication by either the event_classifier_reference or the classifier_reference respectively. */ FOR class_ref_rec IN class_ref_c(check_delete.id) LOOP FOR attributes_rec IN attributes_c(class_ref_rec.classifier_reference ,class_ref_rec.event_classifier_reference) LOOP ciobc4j_event_att_mapping.del(attributes_rec.irid); END LOOP; END LOOP; END; --================================== END ====================================-- -- -- Package instantiation block -- BEGIN is_installed := true; END; /