-- {{ $Header: \\ukst76\rcsroot.7_0\model\jin\RCS\jriworka.jps 40.6 1998/10/23 15:48:18 wstallar Exp wstallar $ -- {{ -----------------------------------------------------------------------+ -- File: $Workfile: jrpbwaut.sql $ -- Author: $Author: wstallar $ -- Date: $Date: 1998/10/23 15:48:18 $ -- Version: $Revision: 40.6 $ -- Status: $State: Exp $ -- Locked_by: $Locker: wstallar $ -- Project: The Oracle Common Repository -- Description: Workarea management utility package header -- Notes: -- RealAuth: E.J.Harding -- IncepDate: 12-MAR-1998 -- Copyright: (c) Oracle Corporation 1998. All Rights Reserved. -- Tagline: -- Oracle Repository: Managing *all* your data -- -- --------------------------------------------------------------------------+ -- Log of Changes from Source Control System -- --------------------------------------------------------------------------+ -- $Log: jriworka.jps $ -- Revision 40.6 1998/10/23 15:48:18 wstallar -- Added create_config_from_workarea method. -- -- Revision 40.5 1998/10/12 10:19:54 wstallar -- Fixed conflicting method names -- Added wrappers for functions returning BOOLEANS -- -- Revision 40.4 1998/09/17 10:27:16 wstallar -- Re-written for 4.0.4A -- New workarea compilation method to use I$SDD_WA_EXCLUSIONS table. -- Support for rules based definition of workarea specs. -- Support for automatic branching for workarea. -- Uses rmmes error stack. -- -- --rem Revision 40.3 1998/05/28 11:11:12 rmolland --rem added order entry change functions --rem --rem Revision 40.2 1998/05/27 13:08:27 eharding --rem Moved reference JR_* PL/SQL from ClearCase --rem ------------------------------------------------------------------------------- -- prompt Package Header: jr_workarea create or replace package jr_workarea is ------------------------------------------------------------------------------- --Internal exceptions ------------------------------------------------------------------------------- SPEC_PARSE_ERROR exception; COMPILE_ERROR exception; DELETE_ERROR exception; INVALID_SEQ exception; WORKAREA_EXISTS exception; INVALID_ENTRY exception; INVALID_WORKAREA_IRID exception; ----------------------------------------- --Lock types for LOCK_FOR_UPDATE ----------------------------------------- subtype locktype is integer; nl_mode constant locktype := 1; --Null lock mode ss_mode constant locktype := 2; --Sub-shared lock mode sx_mode constant locktype := 3; --Sub-exclusive lock mode s_mode constant locktype := 4; --Shared lock mode ssx_mode constant locktype := 5; --Sub-shared exclusive lock mode x_mode constant locktype := 6; --Exclusive lock mode ----------------------------------------------------------------------------- -- jr_workarea.CREATE_WORKAREA() -- -- Creates a new workarea, using the specified name and owner. -- function create_workarea(user_name in varchar2 ,workarea_name in varchar2 ,description in varchar2 default NULL ,kind in varchar2 default 'PRIVATE' ) return number; ----------------------------------------------------------------------------- -- jr_workarea.DELETE_WORKAREA() -- -- Deletes the specified workarea -- procedure delete_workarea(workarea_id in number ,user_name in varchar2 default NULL ); ----------------------------------------------------------------------------- -- jr_workarea.LOCK_FOR_UPDATE() -- Locks the specified workarea for update, and posts -- appropriate error if workarea could not be locked. -- lock_mode - is one of the following lockmodes: -- nl_mode : Null lock mode -- ss_mode : Sub-shared lock mode -- sx_mode : Sub-exclusive lock mode -- s_mode : Shared lock mode -- ssx_mode: Sub-shared exclusive lock mode -- x_mode : Exclusive lock mode -- -- lock_timeout - is length of time to wait to aquire lock in seconds -- procedure lock_for_update(workarea_id in number ,lock_mode in locktype default JR_WORKAREA.X_MODE ,lock_timeout in integer default 3); ----------------------------------------------------------------------------- -- jr_workarea.RENAME_WORKAREA() -- -- Renames the specified workarea -- procedure rename_workarea(workarea_id in number ,new_name in varchar2 ,user_name in varchar2 default NULL ); ----------------------------------------------------------------------------- -- jr_workarea.CHANGE_WORKAREA_DESC() -- -- Changes the description for the specified workarea -- procedure change_workarea_desc(workarea_id in number ,new_desc in varchar2); ----------------------------------------------------------------------------- -- jr_workarea.COPY_WORKAREA() -- -- Copies the specified workarea -- function copy_workarea(workarea_id in number ,new_name in varchar2 ,new_user_name in varchar2 ,new_desc in varchar2 default null ) return number; ----------------------------------------------------------------------------- -- jr_workarea.IS_WORKAREA_EMPTY() -- -- Checks if workarea is empty. -- If no workarea id is specified, checks current context workarea. -- If check_access is FALSE (default), then the workarea must be -- completely empty of all objects, whether current user can see them or not. -- If check_access is TRUE, then method checks ONLY for objects current user -- can see. -- function is_workarea_empty(workarea_id in number:=NULL ,check_access in boolean:=FALSE) return boolean; ----------------------------------------------------------------------------- -- jr_workarea.CREATE_CONFIG_FROM_WORKAREA() -- Creates a configuration based on the specified workarea. -- Checked out objects are not included in the configurations -- Configuration may be based on entire workarea, or just the private config -- Workarea may optionally be re-compiled before creating the config. -- Default behaviour is entire workarea, no recompile. -- procedure create_config_from_workarea(workarea_id in number ,config_name in varchar2 ,config_irid out number ,config_ivid out number ,description in varchar2 ,entire_wa in BOOLEAN default TRUE ,recompile in BOOLEAN default FALSE); -- -- -- Workarea content maintenance -- -- ----------------------------------------------------------------------------- -- jr_workarea.ADD_HEAD_ENTRY() -- -- Add an entry at the head of the contents list for the specified workarea - -- returns the new entry's sequence. -- function add_head_entry(workarea_id in number ,entry_ivid in number ,rule_id in number :=NULL ,v_param1 in varchar2 :=NULL ,v_param2 in varchar2 :=NULL ,v_param3 in varchar2 :=NULL ,c_exclude in char :=NULL) return number; ----------------------------------------------------------------------------- -- jr_workarea.ADD_TAIL_ENTRY() -- -- Add an entry at the tail of the contents list for the specified workarea - -- returns the new entry's sequence. -- function add_tail_entry(workarea_id in number ,entry_ivid in number ,rule_id in number :=NULL ,v_param1 in varchar2 :=NULL ,v_param2 in varchar2 :=NULL ,v_param3 in varchar2 :=NULL ,c_exclude in char :=NULL) return number; ----------------------------------------------------------------------------- -- jr_workarea.ADD_ENTRY_BEFORE_REF() -- -- Inserts an entry on the contents list of the specified workarea -- before the existing entry with the specified sequence. -- function add_entry_before_ref(workarea_id in number ,entry_ivid in number ,rule_id in number :=NULL ,v_param1 in varchar2 :=NULL ,v_param2 in varchar2 :=NULL ,v_param3 in varchar2 :=NULL ,c_exclude in char :=NULL ,ref_seq in number ) return number; ----------------------------------------------------------------------------- -- jr_workarea.ADD_ENTRY_AFTER_REF() -- -- Inserts an entry on the contents list of the specified workarea -- after the existing entry with the specified sequence. -- function add_entry_after_ref(workarea_id in number ,entry_ivid in number ,rule_id in number :=NULL ,v_param1 in varchar2 :=NULL ,v_param2 in varchar2 :=NULL ,v_param3 in varchar2 :=NULL ,c_exclude in char :=NULL ,ref_seq in number ) return number; ----------------------------------------------------------------------------- -- jr_workarea.REMOVE_ENTRY() -- -- Removes a reference to the specified configuration, identified by -- irid and ivid, from a workarea definition. -- procedure remove_entry(workarea_id in number ,entry_ivid in number ); ----------------------------------------------------------------------------- -- jr_workarea.REMOVE_ENTRY() -- -- Removes a reference to the specified configuration, identified by -- sequence, from a workarea definition. -- procedure remove_entry_seq(workarea_id in number ,ref_seq in number ); -- -- -- Workarea content navigation -- -- ----------------------------------------------------------------------------- -- jr_workarea.FIND_REF_SUCCESSOR() -- -- Returns the member of a given workarea specification which has the next -- lowest priority than the specified entry. An initial reference entry -- of NULL will return the first entry in the list. -- function find_ref_successor(workarea_id in number ,ref_entry_seq in number ) return number; -- -- -- Workarea compilation logic -- -- ----------------------------------------------------------------------------- -- jr_workarea.compile() -- -- Full compilation of the specified workarea -- procedure compile(workarea_id in number ,record_changes in varchar2 default 'N'); procedure refresh_from_rule (entry_seq in number ,wa_irid in number ,exclude_rule in varchar2 default 'N'); ----------------------------------------------------------------------------- -- jr_workarea.ADD_TO_WORKAREA() -- -- Public wrapper for ADD_TO_WA, allows API Clients to temporarily -- add an object version to a workarea, but skips if object is not checked in, or -- is a configuration, or owner of workarea doesn't have SEL access on it. -- User must also have UPD access to the workarea itself in order to add objects -- to it. -- Note that on Refresh, object will be removed from the workarea, unless -- an appropriate rule to add the object version is included in the workarea -- spec. If a version of the object already exists in the workarea, the version -- will be temporarily replaced. -- function add_to_workarea(obj_irid in number ,obj_ivid in number ,workarea_id in number) return boolean; ----------------------------------------------------------------------------- -- jr_workarea.CAN_EXCLUDE -- Method used to determine if an object can be excluded from the CURRENT -- workarea. If the object is non-versioned, or checked out, it CANNOT -- be excluded. For containers, if the container has a member that is -- checked-out or non-versioned, it cannot be excluded. Function can -- be called directly from SQL, and returns Y or N -- A method that accepts a repository path is also provided... function CAN_EXCLUDE(obj_ivid in number) return varchar2; PRAGMA RESTRICT_REFERENCES(can_exclude,wnps,wnds); function CAN_EXCLUDE(obj_path in varchar2) return varchar2; ----------------------------------------------------------------------------- -- jr_workarea.CHECK_WORKAREA_EXISTS() -- -- Checks that the specified workarea exists - throws a user exception -- if the workarea id does not exist -- procedure check_workarea_exists(workarea_id in number); ----------------------------------------------------------------------------- -- jr_workarea.CHECK_SEQUENCE_EXISTS() -- -- Checks that the specified workarea and entry sequence exist - throws a -- user exception if the workarea or sequence do not exist -- procedure check_sequence_exists(workarea_id in number ,ref_seq in number); ----------------------------------------------------------------------------- -- jr_workarea.GET_NEXT_SEQ() -- -- Returns the next sequence entry given a specified sequence -- as a starting point. Returns NULL if there is no such entry. -- function get_next_seq(n_seq in number) return number; ----------------------------------------------------------------------------- -- jr_workarea.GET_CONFIG_REF_BY_SEQ() -- -- Populates the specified config IRID/IVID from a given sequence -- procedure get_config_ref_by_seq(n_seq in number ,n_config_ivid in out number ); ----------------------------------------------------------------------------- -- jr_workarea.GET_NEXT_INCL_SEQ() -- -- Returns the next inclusion sequence entry given a specified sequence -- as a starting point. Returns NULL if there is no such entry. -- If specified sequence is null, then start at head of list. -- procedure get_next_incl_seq(n_seq in out number,workarea_id in number); ----------------------------------------------------------------------------- -- jr_workarea.GET_NEXT_EXCL_SEQ() -- -- Returns the next exclusion sequence entry given a specified sequence -- as a starting point. Returns NULL if there is no such entry. -- If specified sequence is null, then start at head of list. -- procedure get_next_excl_seq(n_seq in out number,workarea_id in number); ----------------------------------------------------------------------------- -- jr_workarea.IS_EXCLUDE_SEQ() -- -- Returns true if the given sequence is an exclusion. -- function is_exclude_seq(n_seq in number) return boolean; --Wrapper to return 1,0 function exclude_seq(n_seq in number) return number; ----------------------------------------------------------------------------- -- jr_workarea.SET_COMPILE_FLAG() -- -- If flag is 'Y', the workarea specification is marked for auto -- compilation - any other value clears the autocompiled flag. -- procedure set_compile_flag(workarea_id in number ,c_compile_flag in char); ----------------------------------------------------------------------------- -- jr_workarea.GET_COMPILE_FLAG() -- -- Returns 'Y' if the workarea definition is currently compiled -- otherwise 'N' -- function get_compile_flag(workarea_id in number) return char; -- -- Internal compilation flag maintenance -- ----------------------------------------------------------------------------- -- jr_workarea.ON_UPDATE() -- -- If the specified workarea is in autocompile mode, recompiles the -- workarea, otherwise marks the definition as not compiled -- procedure on_update(workarea_id in number); ----------------------------------------------------------------------------- -- jr_workarea.ENTRY_UP() -- -- Moves the workarea configuration entry up one place in the sequence -- list by swapping seq-predecessor values with its predecessor, -- no action if predecessor is null (top of list) -- procedure entry_up(n_workarea_irid number, n_this_seq number); ----------------------------------------------------------------------------- -- jr_workarea.ENTRY_DOWN() -- -- Moves the workarea configuration entry down one place in the sequence -- list by swapping seq-predecessor values with its predecessor, -- no action if seq is not referenced by a predecessor (bottom of list) -- procedure entry_down(n_workarea_irid number, n_this_seq number); ----------------------------------------------------------------------------- -- jr_workarea.GET_CHECKIN_BRANCH() -- -- Returns the branch id of the branch to be used when checking in objects -- in the context of the workarea. -- function get_checkin_branch(workarea_id in number) return number; ----------------------------------------------------------------------------- -- jr_workarea.SET_CHECKIN_BRANCH() -- -- Sets the branch id of the branch to be used when checking in objects -- in the context of the workarea. -- procedure set_checkin_branch(workarea_id in number, branch_id in number); ----------------------------------------------------------------------------- -- jr_workarea.GET_SOURCE_ENTRY() -- -- Returns the entry SEQ responsible for the specified object version -- appearing in the specified workarea. -- function get_source_entry(object_ivid in number ,workarea_id in number default NULL) return number; ----------------------------------------------------------------------------- -- jr_workarea.GET_SOURCE() -- -- Gets text-based description of the spec entry responsible for including -- the specifed element into the workarea. ----------------------------------------------------------------------------- function get_source(object_ivid in number ,workarea_id in number default NULL) return varchar2; ----------------------------------------------------------------------------- -- jr_workarea.DEFINE_SPEC() -- -- Allows text-based definition of the specification of a given workarea. -- procedure define_spec(workarea_id in number ,spec in varchar2); ----------------------------------------------------------------------------- -- jr_workarea.DESCRIBE() -- -- Gives text-based description of the specification of a given workarea. -- procedure describe(wa_irid in number ,spec out varchar2); PRAGMA RESTRICT_REFERENCES(get_source,wnds); PRAGMA RESTRICT_REFERENCES(get_source_entry,wnds); PRAGMA RESTRICT_REFERENCES(can_exclude,wnds); end jr_workarea; / --REM --REM --------------------------------------------------------------------------+ --REM }} End of file --REM --------------------------------------------------------------------------+