REM *************************************************************************** REM Hand-carved package body for OBJECT STATE created on 16-OCT-98 REM *************************************************************************** CREATE OR REPLACE PACKAGE BODY cihost IS -- Generic post-process routines PROCEDURE check_delete(id number); PROCEDURE create_evc(ost_id number, ost_name varchar2); sac_type constant varchar2(6) := 'OST'; pac_type constant varchar2(6) := 'CLA'; cla_ref number; -- Store classifier ref in pre-delete code --======================== PRE-PROCESS (INS,UPD) ============================-- PROCEDURE pre_process(operation varchar2,id number, pl in out NOCOPY cioobject_state.data) IS BEGIN -- Access rights for object state derive from the generic java class -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(pac_ref, 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; end if; if pl.i.business_object_reference or pl.i.classifier_reference or pl.i.workflow_item_type_reference or pl.i.workflow_mess_type_reference then if pl.v.business_object_reference is not null then pl.v.object_state_for := 'BOB'; elsif pl.v.classifier_reference is not null then pl.v.object_state_for := 'CLA'; elsif pl.v.workflow_item_type_reference is not null then pl.v.object_state_for := 'WIT'; elsif pl.v.workflow_mess_type_reference is not null then pl.v.object_state_for := 'WMT'; end if; pl.i.object_state_for := true; end if; -- Qualified the call due to 960831 if pl.v.classifier_reference is not null then --Maintain the out_of_sync_flag for a corresponding file_usage ciheoc.maintain_sync_flag(pl.v.classifier_reference); end if; END; --======================== PRE-PROCESS (DEL,SEL) ============================-- PROCEDURE pre_process(operation varchar2,id number) IS BEGIN -- Access rights for object state derive from the generic java class -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(id,sac_type,operation,'SAC'); -- if operation is 'DELETE', make sure no non-cascading references exist if operation = 'DEL' then select ost.classifier_reference into cla_ref from ci_object_states ost where ost.irid = pre_process.id; check_delete(id); end if; END; --===================== POST-PROCESS (INS,UPD,SEL) ==========================-- PROCEDURE post_process(operation varchar2,id number, pl cioobject_state.data) IS new_name varchar2(100); BEGIN if operation = 'INS' then create_evc(id, pl.v.name); end if; /* Commentesd out at 4.0.11 - it was never specced functionality anyway if (operation = 'UPD' and (pl.i.name or pl.i.entity_object_reference or pl.i.generic_class_reference or pl.i.interface_classifier_reference )) then select substr(cla.name||'_'||ost.name, 1, 100) into new_name from sdd_cla cla , sdd_ost ost where ost.irid = post_process.id and cla.irid = NVL(NVL(ost.entity_object_ref, ost.generic_class_ref),ost.interface_classifier_ref); update sdd_cla set name = new_name where object_state_ref = post_process.id; end if; */ END; --========================= POST PROCESS (DEL, LCK) =========================-- PROCEDURE post_process(operation varchar2,id number) IS CURSOR file_c(pcla_ref number) IS select fu.primary_access_file_reference from ci_file_usages fu where fu.classifier_reference = pcla_ref; BEGIN if operation = 'DEL' then --Maintain the out_of_sync_flag for a corresponding file_usage ciheoc.maintain_sync_flag(cla_ref); elsif operation = 'LCK' then FOR file_rec IN file_c(cla_ref) LOOP cioprimary_access_file.lck(file_rec.primary_access_file_reference); END LOOP; end if; END; --============================= CHECK DELETE ================================-- PROCEDURE check_delete(id number) IS BEGIN null; END; --========================= CREATE EVC =====================================-- PROCEDURE create_evc(ost_id number, ost_name varchar2) IS save_csynch boolean; evcpl cioevent_classifier.data; temp_context_folder number; save_context_folder number; BEGIN if cdapi.load_mode then return; end if; select substrb(cla.name||'_'||ost_name, 1, 100), fm.folder_reference into evcpl.v.name, temp_context_folder from sdd_cla cla ,sdd_ost ost ,sdd_folder_members fm where fm.member_object = cla.irid and cla.irid = ost.classifier_ref and ost.irid = ost_id and fm.ownership_flag = 'Y' UNION select substrb(bob.name||'_'||ost_name, 1, 100), fm.folder_reference from sdd_bob bob ,sdd_ost ost ,sdd_folder_members fm where fm.member_object = bob.irid and bob.irid = ost.business_object_ref and ost.irid = ost_id and fm.ownership_flag = 'Y' UNION select substrb(wit.name||'_'||ost_name, 1, 100), fm.folder_reference from sdd_wit wit ,sdd_ost ost ,sdd_folder_members fm where fm.member_object = wit.irid and wit.irid = ost.workflow_item_type_ref and ost.irid = ost_id and fm.ownership_flag = 'Y' UNION select substrb(wmt.name||'_'||ost_name, 1, 100), fm.folder_reference from sdd_wmt wmt ,sdd_ost ost ,sdd_folder_members fm where fm.member_object = wmt.workflow_item_type_ref and wmt.irid = ost.workflow_mess_type_ref and ost.irid = ost_id and fm.ownership_flag = 'Y' ; evcpl.i.name := true; evcpl.v.object_state_reference := ost_id; evcpl.i.object_state_reference := true; save_csynch := rm.do_csynch; rm.do_csynch := true; -- Create new EVC in folder that owns this OST save_context_folder := cdapi.app_sys_ref; cdapi.set_context_container(null, temp_context_folder); cioevent_classifier.ins(null, evcpl); rm.do_csynch := save_csynch; cdapi.set_context_container(null, save_context_folder); exception -- In case ins call fails, must not be left in system mode when others then rm.do_csynch := save_csynch; cdapi.set_context_container(null, save_context_folder); raise; end; --================================== END ====================================-- -- -- Package instantiation block -- BEGIN is_installed := true; END; /