REM *************************************************************************** REM Hand-carved package body for VIEW OBJECT ATTRIBUTE created on 23-FEB-99 REM *************************************************************************** CREATE OR REPLACE PACKAGE BODY cihvoa IS sac_type constant varchar2(6) := 'CAT'; pac_type constant varchar2(6) := 'CLA'; --======================== PRE-PROCESS (INS,UPD) ============================-- PROCEDURE pre_process(operation varchar2,id number, pl in out NOCOPY cioview_object_attribute.data) IS BEGIN -- Access rights for view object attribute derive from the reference --remove spaces from name if pl.i.name then pl.v.name := REPLACE (pl.v.name, ' ', NULL); end if; -- 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; pl.v.classifier_attribute_subtype := 'VOA'; pl.i.classifier_attribute_subtype := true; if not pl.i.sequence then pl.v.sequence :=ciiexp.default_seq(pl.v.view_object_reference, sac_type); pl.i.sequence :=true; end if; if not pl.i.prompt then pl.v.prompt := initcap(translate(pl.v.name, '_', '')); pl.i.prompt := true; end if; end if; -- Do this on insert and update, even if pl.v.eo_attribute_reference is unchanged -- as this enforces the 'not updateable' rules on these properties if pl.v.eo_attribute_reference is not null then select eoa.classifier_reference ,eoa.scalar_datatype ,eoa.datatype_format ,eoa.maximum_multiplicity ,eoa.minimum_multiplicity into pl.v.classifier_reference ,pl.v.scalar_datatype ,pl.v.datatype_format ,pl.v.maximum_multiplicity ,pl.v.minimum_multiplicity from ci_entity_object_attributes eoa where eoa.id = pl.v.eo_attribute_reference; pl.i.classifier_reference := true; pl.i.scalar_datatype := true; pl.i.datatype_format := true; pl.i.maximum_multiplicity := true; pl.i.minimum_multiplicity := true; --pl.v.persistent_flag := 'Y'; else --pl.v.persistent_flag := 'N'; if pl.i.scalar_datatype and pl.v.scalar_datatype is not NULL then pl.v.datatype_format := 'SCALAR'; pl.i.datatype_format := true; pl.v.classifier_reference := null; pl.i.classifier_reference := true; elsif pl.i.classifier_reference and pl.v.classifier_reference is not NULL then pl.v.datatype_format := 'CLASSIFIER'; pl.i.datatype_format := true; pl.v.scalar_datatype := null; pl.i.scalar_datatype := true; end if; end if; --pl.i.persistent_flag := true; if operation = 'INS' and pl.v.scalar_datatype is NULL and pl.v.classifier_reference is NULL then pl.v.datatype_format := 'SCALAR'; pl.i.datatype_format := true; pl.v.scalar_datatype := 'int'; pl.i.scalar_datatype := true; if not pl.i.maximum_length then pl.v.maximum_length := '38'; pl.i.maximum_length := true; end if; end if; --Maintain the out_of_sync_flag for a corresponding file_usage ciheoc.maintain_sync_flag(pl.v.classifier_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 cioview_object_attribute.data) IS BEGIN if operation != 'SEL' then --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 pl.v.eo_attribute_reference is not null then -- No point retesting this if we've just copied it from EO_ATT cihgat.check_multiplicity(pl.v.id, sac_type, pl.v.minimum_multiplicity, pl.v.maximum_multiplicity); end if; end if; END; --========================= POST PROCESS (DEL, LCK) =========================-- PROCEDURE post_process(operation varchar2,id number) IS CURSOR file_c(irid_ref number) IS select pac_reference cla from ci_classifier_attributes where irid = irid_ref; BEGIN FOR file_rec IN file_c(post_process.id) LOOP if operation = 'DEL' then --Maintain the out_of_sync_flag for a corresponding file_usage ciheoc.maintain_sync_flag(file_rec.cla); end if; if operation = 'LCK' then --And lock the corresponding Primary Access File cihamc.on_lock(file_rec.cla); end if; END LOOP; END; --================================== END ====================================-- -- -- Package instantiation block -- BEGIN is_installed := true; END; /