REM *************************************************************************** REM Hand-carved package body for EVENT SUBSCRIPTION created on 13-JAN-99 REM *************************************************************************** CREATE OR REPLACE PACKAGE BODY cihevs IS str_type constant varchar2(6) := 'EVS'; 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_subscription.data) IS BEGIN -- Perform INSERT-specific processing 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 null; END; --===================== POST-PROCESS (INS,UPD,SEL) ==========================-- PROCEDURE post_process(operation varchar2,id number, pl cioevent_subscription.data) IS save_context_app_sys number; new_context_app_sys number; interface_name varchar2(120); inc_ref number; inc_data ciointerface_classifier.data; evc_data cioevent_classifier.data; dummy number; sud_data ciosubscription_detail.data; CURSOR details_c(event_ref number) IS select irid from ci_event_publications where event_classifier_reference = event_ref; BEGIN if operation != 'SEL' and pl.v.uml_type_flag = 'Y' and not cdapi.load_mode then --create any neccessay subscription details FOR details_rec IN details_c(pl.v.event_classifier_reference) LOOP select count(*) into dummy from ci_subscription_details where event_publication_reference = details_rec.irid and event_subscription_reference = pl.v.irid; if dummy = 0 then sud_data.v.event_publication_reference := details_rec.irid; sud_data.i.event_publication_reference := true; sud_data.v.event_subscription_reference := pl.v.irid; sud_data.i.event_subscription_reference := true; ciosubscription_detail.ins(null, sud_data); end if; END LOOP; end if; -- Create a Listener Interface Classifier if one does not exist if operation = 'INS' then select evc.name || 'Listener' ,evc.interface_classifier_reference ,fm.folder_reference into interface_name ,inc_ref ,new_context_app_sys from ci_event_classifiers evc ,ci_folder_members fm where fm.member_object = pl.v.event_classifier_reference and evc.irid = pl.v.event_classifier_reference and fm.ownership_flag = 'Y'; if inc_ref is null and not cdapi.load_mode then begin -- New INC must be inserted into same package as owns the EVC save_context_app_sys := cdapi.app_sys_ref; if save_context_app_sys != new_context_app_sys then cdapi.set_context_container(null, new_context_app_sys); end if; inc_data.v.NAME := interface_name; inc_data.i.NAME := true; ciointerface_classifier.ins(null,inc_data); evc_data.v.interface_classifier_reference := inc_data.v.id; evc_data.i.interface_classifier_reference := true; cioevent_classifier.upd(pl.v.event_classifier_reference, evc_data); if save_context_app_sys != new_context_app_sys then cdapi.set_context_container(null, save_context_app_sys); end if; exception when others then if save_context_app_sys != new_context_app_sys then cdapi.set_context_container(null, save_context_app_sys); end if; null; -- This is just a helper. If things fail due to -- non checked out folders or PACs then fail silently. end; end if; end if; END; --========================= POST PROCESS (DEL) ==============================-- PROCEDURE post_process(operation varchar2,id number) IS BEGIN null; END; --================================== END ====================================-- -- -- Package instantiation block -- BEGIN is_installed := true; END; /