prompt Package Body: jr_rule_procs create or replace package body jr_rule_procs is -------------------------------------------------- --- Include_folder() --- Gets the specified folder, the latest versions --- of its contents (on the same branch as the --- folder), and the members of the path to the --- root. -------------------------------------------------- function include_folder(folder in varchar2) return jr_name.objver_list is i integer; fol_ivid number; path_members jr_name.objver_list; object_set jr_name.objver_list; begin --Get the objects making up the path... path_members:=jr_name.path_members(folder); --If we couldn't find the folder, raise an error... if path_members.last is null then RAISE JR_RULE.RULE_ERROR; end if; --Get the objects contained in the folder... object_set:=jr_name.folder_contents(folder,TRUE,TRUE); --Add the path memebers to the object set i:=path_members.first; while i is not null loop object_set.extend(); object_set(object_set.last).irid:=path_members(i).irid; object_set(object_set.last).ivid:=path_members(i).ivid; i:=path_members.next(i); end loop; --Return the object set return object_set; end; -------------------------------------------------- --- Include_object() --- Gets the specified object and the members of --- the path back to the root folder. -------------------------------------------------- function include_object(name in varchar2) return jr_name.objver_list is path_members jr_name.objver_list; begin --Use naming service to get path members path_members:=jr_name.path_members(name); --If we couldn't find the object, raise an error if (path_members.last is null) then RAISE JR_RULE.RULE_ERROR; end if; return path_members; end; -------------------------------------------------- --- Folder_latest_contets() --- Gets the specified folder, the latest versions --- of its contents, on the specified branch, --- and the members of the path to the --- root. -------------------------------------------------- function folder_latest_contents(folder in varchar2 ,branch in varchar2) return jr_name.objver_list is i integer; fol_ivid number; path_members jr_name.objver_list; object_set jr_name.objver_list; begin --Get the objects making up the path... path_members:=jr_name.path_members(folder); --If we couldn't find the folder, finish now... if path_members.last is null then RAISE JR_RULE.RULE_ERROR; end if; --Get the latest versions objects contained in the folder, on the --specified branch. object_set:=jr_name.folder_latest_contents(jr_name.get_vid(folder) ,jr_version.get_branch_id(branch) ,TRUE); --Add the path memebers to the object set i:=path_members.first; while i is not null loop object_set.extend(); object_set(object_set.last).irid:=path_members(i).irid; object_set(object_set.last).ivid:=path_members(i).ivid; i:=path_members.next(i); end loop; --Return the object set return object_set; end; -------------------------------------------------- --- Folder_contets_before() --- Gets the specified folder version, and the -- latest versions of its contents, before the -- specified date, on the same branch as the specified -- folder version. -------------------------------------------------- function folder_latest_before(folder in varchar2 ,before_date in varchar2) return jr_name.objver_list is i integer; path_members jr_name.objver_list; object_set jr_name.objver_list; folder_irid number; folder_ivid number; branch_id number; begin --Get the objects making up the path... path_members:=jr_name.path_members(folder); --If we couldn't find the folder, finish now... if path_members.last is null then RAISE JR_RULE.RULE_ERROR; end if; --Get hold of the folder irid and ivid, and the id of the branch it is on jr_name.get_rid_vid(folder,folder_irid,folder_ivid); branch_id:=jr_version.get_current_branch_id(folder_irid,folder_ivid); --Get the objects in the folder object_set:=jr_name.folder_contents_before(folder_ivid ,branch_id ,to_date(before_date,'DD-MON-YYYY HH24:MI:SS') ,TRUE); --Add the path memebers to the object set i:=path_members.first; while i is not null loop object_set.extend(); object_set(object_set.last).irid:=path_members(i).irid; object_set(object_set.last).ivid:=path_members(i).ivid; i:=path_members.next(i); end loop; --Return the object set return object_set; end; -------------------------------------------------- --- Folder_contets_between() --- Gets the specified folder, the latest versions --- of its contents, on the specified branch, --- and the members of the path to the --- root. -------------------------------------------------- function folder_latest_between(folder in varchar2 ,start_date in varchar2 ,end_date in varchar2) return jr_name.objver_list is i integer; path_members jr_name.objver_list; object_set jr_name.objver_list; folder_irid number; folder_ivid number; branch_id number; begin --Get the objects making up the path... path_members:=jr_name.path_members(folder); --If we couldn't find the folder, finish now... if path_members.last is null then RAISE JR_RULE.RULE_ERROR; end if; --Get hold of the folder irid and ivid, and the id of the branch it is on jr_name.get_rid_vid(folder,folder_irid,folder_ivid); branch_id:=jr_version.get_current_branch_id(folder_irid,folder_ivid); --Get the objects in the folder object_set:=jr_name.folder_contents_between(folder_ivid ,branch_id ,to_date(start_date,'DD-MON-YYYY HH24:MI:SS') ,to_date(end_date,'DD-MON-YYYY HH24:MI:SS') ,TRUE); --Add the path memebers to the object set i:=path_members.first; while i is not null loop object_set.extend(); object_set(object_set.last).irid:=path_members(i).irid; object_set(object_set.last).ivid:=path_members(i).ivid; i:=path_members.next(i); end loop; --Return the object set return object_set; end; -------------------------------------------------- --- Exclude_folder() --- Gets the specified folder, the latest versions --- of its contents (on the same branch as the --- folder). -------------------------------------------------- function exclude_folder(folder in varchar2) return jr_name.objver_list is i integer; fol_ivid number; folder_list jr_name.objver_list; object_set jr_name.objver_list:= jr_name.objver_list(); begin -- Get the folder(s)... folder_list:=jr_name.get_objects(folder); -- If we couldn't find the folder, finish now... if folder_list.last is null then RAISE JR_RULE.RULE_ERROR; end if; -- Get the objects contained in the folder... -- CW 13-Dec-2001 -- Fix bug 2121275 exclude_folder removes referenced objects from -- workarea. -- If a folder member is a reference to an object (rather than the object -- itself) this inclusion of the object causes the object to be removed). -- Do not attempt to remove content here. -- Leave it up to the remove_orphans procedure, called from the compile -- procedure, to decide what content to remove. -- START removed code for bug fix 2121275 -- object_set:=jr_name.folder_contents(folder,TRUE,TRUE); -- END removed code for bug fix 2121275 -- Add the folder(s) to the object set i:=folder_list.first; while i is not null loop object_set.extend(); object_set(object_set.last).irid:=folder_list(i).irid; object_set(object_set.last).ivid:=folder_list(i).ivid; i:=folder_list.next(i); end loop; -- Return the object set return object_set; end; -------------------------------------------------- --- Exclude_object() --- Gets the specified object. -------------------------------------------------- function exclude_object(name in varchar2) return jr_name.objver_list is object_set jr_name.objver_list; begin --Don't get all objects making up full path like include object, --just get object(s) pointed to by the path... --Use naming service to get object(s) object_set:=jr_name.get_objects(name); --If we couldn't locate the object with the path, throw an error if object_set.last is null then raise JR_RULE.RULE_ERROR; end if; return object_set; end; -------------------------------------------------- -- Latest_diagram_contents -- Gets the specified Diagram, the latest versions -- of its contents, on the specified branch, -- and the members of the path to the -- root. -- Added to Fix US BUGS 1969465 -- 1969487 -------------------------------------------------- function latest_diagram_contents( diagram in varchar2 , branch in varchar2) return jr_name.objver_list is i integer; fol_ivid number; path_members jr_name.objver_list; object_set jr_name.objver_list; diagram_ivid number; branch_id number; begin --Get the objects making up the path... path_members:=jr_name.path_members(diagram); --If we couldn't find the folder, finish now... if path_members.last is null then RAISE JR_RULE.RULE_ERROR; end if; --Get the latest versions objects contained in the folder, on the --specified branch. diagram_ivid := jr_name.get_vid(diagram); branch_id := jr_version.get_branch_id(branch); object_set:=jr_name.latest_diagram_contents( diagram_ivid , branch_id); --Add the path memebers to the object set i:=path_members.first; while i is not null loop object_set.extend(); object_set(object_set.last).irid:=path_members(i).irid; object_set(object_set.last).ivid:=path_members(i).ivid; i:=path_members.next(i); end loop; --Return the object set return object_set; end latest_diagram_contents; end; /