create or replace package body odwasrch
is
/*****************************************************************************************
Purpose Search the Repository and present results in result Frame
Allow navigation from result frame to:
- VHV
- Report
- Browser
- ?
Usage
Remarks
Revision history
When Who Construct
Revision What
------------------------------------------------------------------------------------------
$revision_history$
10-Sep-2003 Kannan Parthasarathy
- B2881790: Fixed GIF file name.
03-Feb-2003 Kannan Parthasarathy
- B2822755: Fix improper tooltip.
25-Jan-2003 Kannan Parthasarathy
- B2727189: Escape double quotes in JavaScript.
10-Dec-2002 Kannan Parthasarathy
-B2701841 : Fixed.
28-nov-2002 Kannan Parthasarathy
- B2688895 Fixed Javascript errors.
14-nov-2002 Kannan Parthasarathy
- Fixed OAC p1 violations.
24-sep-2002 Kannan Parthasarathy
- References to CDM are hidden from general users
31-jul-2001 Lucas Jellema
3.13 - include join with RM_REPOSITORIES to resolve NLS Issue (bug 1911520) in queries with RM$NLS_ELEMENT_TYPES
27-jul-2001 Lucas Jellema
3.12 - building up the Advanced tab page takes way too long, because of the long list of element type+global name domain names
- support for file downloading using the download servlet
changes in:
* procedure js_dynamic_content
30-mar-2001 Lucas Jellema
3.11 - support Query Library
- support search on Dependency Data
01-mar-2001 Lucas Jellema
3.10 - list UE element types
28-feb-2001 Lucas Jellema
3.9 - for a search for EMP% under Ton, no proper results are shown: instead a lot of JavaScript is displayed, without the opening
'|| Rob_msg.getmsg(rob_msg.ACC005_NOSCRIPT,'','','','')||' ');
end; -- js_showSql
procedure js_saveQuery
is
begin
htp.p('
'|| Rob_msg.getmsg(rob_msg.ACC005_NOSCRIPT,'','','','')||' ');
end; -- js_saveQuery
procedure js_openLibrary
is
begin
htp.p('
'|| Rob_msg.getmsg(rob_msg.ACC005_NOSCRIPT,'','','','')||' ');
end; -- js_openLibrary
procedure queryFrame
( p_session_id in number
, p_mode in varchar2 default 'BASIC' -- values: BASIC, ADVANCED ( ??AUDIT, VERSION)
, qName in varchar2 default null -- BASIC
, qCaseSensitive in varchar2 default null
, qWorkareaIrid in varchar2 default null
, qTipVersionsOnly in varchar2 default null
, qFolderIrid in varchar2 default null
, qFolderIvid in varchar2 default null
, qIncludeNested in varchar2 default null
, qElementType in varchar2 default null
, qIvid in varchar2 default null -- ADVANCED
, qIrid in varchar2 default null
, qTxtType in varchar2 default null
, qTxtContains in varchar2 default null
, qFileContains in varchar2 default null
, qDepType in varchar2 default null
, qGlobalName in varchar2 default null
, qGlobalNameType in varchar2 default null
, qUsedByIvid in varchar2 default null
, qCheckState in varchar2 default null -- VERSION
, qRootVersionsOnly in varchar2 default null
, qVersionLabel in varchar2 default null
, qBranchIrid in varchar2 default null
, qCfgIvid in varchar2 default null
, qCheckNotesContain in varchar2 default null
, qCheckOutUser in varchar2 default null
, qCheckedOutAfter in varchar2 default null
, qCheckedOutBefore in varchar2 default null
, qCheckInUser in varchar2 default null
, qCheckedInAfter in varchar2 default null
, qCheckedInBefore in varchar2 default null
, qCreatedBy in varchar2 default null -- AUDIT
, qCreatedAfter in varchar2 default null
, qCreatedBefore in varchar2 default null
, qChangedBy in varchar2 default null
, qChangedAfter in varchar2 default null
, qChangedBefore in varchar2 default null
, qWastebasket in varchar2 default null
, qWhere in varchar2 default null
, qQueryId in varchar2 default null
, p_run_mode in varchar2 default 'search' -- search, show, saveQuery, execute
)
is
l_first boolean;
l_menu_bar varchar2(4000);
l_cdm_used varchar2(1);
cursor c_wa
is
select wa.irid
, wa.OWNER
, wa.NAME
, wa.KIND
, wa.DESCRIPTION
from sdd_workareas wa
order
by wa.name
;
cursor c_usr
is
select usr.username
, usr.full_user_name
from sdw_users usr
where usr.username <> 'PUBLIC' -- 1.7 PUBLIC is not a real user
and usr.user_type = 1 -- 2.4 exclude Roles
UNION
select 'USER' username
, 'USER' full_user_name
from dual
order
by full_user_name
;
cursor c_ete
is
select net.nls_name name
, et.id irid
, et.ivid
from ci_element_types cet
, rm_element_types et
, rm$nls_element_types net
, rm_repositories rep
where cet.short_name = et.short_name
and net.etid = et.irid
and supertype in ('SHR', 'NSHR')
and et.product = 'CI'
and et.abstract = 'N'
and net.nls_language = rep.nls_language --3.13
and exists (
select null
from ck_product_elements pe
where pe.element_name = et.name
and pe.product_code = 'DESIGN'
)
and et.irid not in (5052, 5055) -- filter out the element types that cannot truly serve as PAC
-- Specific MCO and LOV
union -- User Extended Types
select net.nls_name name
, et.id irid
, et.ivid
from rm_element_types et
, rm$nls_element_types net
, rm_repositories rep
where net.etid = et.irid
and et.product = 'CI'
and et.abstract = 'N'
and net.nls_language = rep.nls_language --3.13
and et.user_extension = 'YYY'
order
by 1
;
cursor c_brh
is
select brh.name
, brh.branch_id irid
from i$sdd_branches brh
order
by brh.name
;
cursor c_gnt
is
select distinct
net.nls_name type_name
, et.id type_irid
from ci_element_types cet
, rm_element_types et
, rm$nls_element_types net
, sdd_global_names gne
, rm_repositories rep
where net.etid = et.irid
and gne.type_id = et.irid
and net.nls_language = rep.nls_language --3.13
UNION
select distinct
initcap(gnd.name) type_name
, gnd.irid type_irid
from sdd_global_name_domains gnd
, sdd_global_names gne
where gne.domain_irid = gnd.irid
order
by type_name
;
procedure js_transferQueryForm
( p_mode in varchar2 default 'BASIC'
) is
begin
-- every field in the queryForm in queryFrame should be transfered to queryForm in resultFrame
htp.p('
'|| Rob_msg.getmsg(rob_msg.ACC005_NOSCRIPT,'','','','')||' ');
end; -- js_transferQueryForm
procedure write_tabbar_image_map
is
begin
-- BASIC
htp.p
( ' '
||' '
);
-- ADVANCED
htp.p
( ' '
);
-- VERSION
htp.p
( ' '
);
-- AUDIT
htp.p
( ' '
||' '
);
end; --write_tabbar_image_map
begin
l_cdm_used := odwapref.get_value('use_cdm');
-- if an existing Query is indicated, call the procedure loadQueryCriteria that will
-- retrieve the query criteria for this predefined query can call queryFrame again
-- with proper values for all query parameters (and NULL for qQueryId)
if qQueryId is not null
then
odwaslib.loadQueryCriteria
( p_session_id => p_session_id
, p_qlb_id => to_number(qQueryId)
);
else
-- create session when necessary, refresh session cache, set workarea context
-- from here on reference to odwactxt.get_... functions for any context value
odwactxt.update_context
( p_session_id => p_session_id
, p_package_name => PACKAGE_NAME
, p_procedure_name=> 'queryFrame'
, p_workarea_irid => to_number( qWorkareaIrid)
, p_cfg_ivid => to_number( qCfgIvid)
, p_folder_irid => to_number( qFolderIrid)
, p_pac_irid => null
, p_pac_ivid => null
);
htp.htmlOpen;
htp.headOpen;
cdwp.write_about(package_name, revision_label);
js_transferQueryForm( p_mode => p_mode );
odwarobs.js_invoke_robs
( p_type_id => 4845 -- 4844 = FOLDER, 4845 is supertype
, p_form_name => 'queryForm'
, p_ivid_field => 'qFolderIvid'
, p_irid_field => 'qFolderIrid'
, p_workarea_irid => to_number(qWorkareaIrid)
, p_cfg_ivid => to_number(qCfgIvid)
, p_folder_ivid => to_number(qFolderIvid)
, p_function_name => 'invokeRobsFolderIrid'
, p_wa_field => 'qWorkareaIrid'
, p_cfg_field => 'qCfgIvid'
);
odwarobs.js_invoke_robs
( p_type_id => 384781276385787681422765648005056569 -- Configuration
, p_form_name => 'queryForm'
, p_ivid_field => 'qCfgIvid'
, p_irid_field => ''
, p_function_name => 'invokeRobsCfgIvid'
);
odwarobs.js_invoke_robs
( p_type_id => null -- any type
, p_form_name => 'queryForm'
, p_ivid_field => 'qUsedByIvid'
, p_irid_field => ''
, p_function_name => 'invokeRobsUsedByIvid'
);
odwahelp.js_invoke_help;
js_saveQuery;
js_openLibrary;
js_showSql;
cdwp.include_report_styles;
htp.headClose;
--
-- body
--
htp.bodyOpen
( Cattributes => cdwpbase.ifThenElse
( p_run_mode ='execute'
, 'onLoad="transferQueryForm();'
||'top.resultFrame.document.queryForm.submit()"'
)
);
write_tabbar_image_map;
cdwp.tool_tab_header
( p_tool => 'search'
, p_tabimage => 'tab_'||lower(p_mode)||'.jpg'
, p_mapname => '#tabbarMap'
);
-- open table with the Search Input fields
cdwp.tableOpen
( p_parameters => 'ALIGN="LEFT" BORDER=0 CELLSPACING=4 ACOLS=4 WIDTH="100%" SUMMARY=""'
);
htp.formopen
( curl => 'odwasrch.queryFrame'
, cmethod => 'GET'
, cattributes => 'NAME="queryForm" '
, ctarget => ''
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
if p_mode='BASIC'
then
-- NAME
cdwp.tableRowOpen;
-- cdwp.TableDataHeading(p_Heading => 'Name',p_Attributes => 'WIDTH=80');
htp.tableData
( ''||Rob_msg.Getmsg(Rob_msg.CAP019_CDWP_NAME,'','','','')||' '
,'RIGHT'
, cattributes=> ' VALIGN="TOP" class="t2"'
);
htp.p('
');
htp.formText
( cname => 'qName'
, cvalue => qName
, csize => 30
, cmaxlength => 500
, cattributes => 'id=qName'
);
htp.p(odwahelp.help_url( p_him_id => 51));
htp.p(' '||Rob_msg.GetMsg(Rob_msg.CAP261_ODWASRCH_CASESENS,'','','','')||' ');
htp.formCheckBox
( CNAME => 'qCaseSensitive'
, CVALUE => 'YES'
, CCHECKED => cdwpbase.ifThenElse( qCaseSensitive is not null, 'YES')
, CATTRIBUTES => 'id=qCaseSensitive'
);
htp.p(odwahelp.help_url( p_him_id => 69));
htp.p(' ');
-- Element Type
htp.tableData
(cdwp.add_images('{doc.gif}')
||''||Rob_msg.Getmsg(Rob_msg.CAP217_ODWAROBS_ELTYPE,'','','','')||' '
,'RIGHT'
, cattributes=> 'VALIGN="TOP" class="t2"'
);
htp.p('');
htp.formselectopen
( cname => 'qElementType'
, cprompt => ''
, cattributes => 'id=qElementType'
);
htp.p
( ''
||Rob_msg.GetMsg(Rob_msg.CAP217_ODWAROBS_ELTYPE ,'','','','')
);
for r_ete in c_ete loop
htp.p( ' '
||r_ete.name
);
-- Do not display CDM specific objects to general users.
if (r_ete.irid = 5024 and lower(l_cdm_used) = 'y')-- 'BUSINESS FUNCTION'
then
-- add Business Rule -5024 (+5024 FUN)
htp.p
( ' '
||'Business Rule (Function)'
);
-- add Business Rule Design Definition -4907 (+4907 PLM)
htp.p
( ' '
||'Business Rule Design Definition'
);
end if; -- r_ete.irid = 5024 -- 'BUSINESS FUNCTION'
end loop; -- r_ete
htp.formselectclose;
htp.p(odwahelp.help_url( p_him_id => 52));
htp.p(' ');
cdwp.tableRowClose;
-- WORKAREA
cdwp.tableRowOpen;
cdwp.TableDataHeading
( cdwp.add_images('{workarea.gif}')
||' '||Rob_msg.GetMsg(Rob_msg.CAP077_ODWACHCK_WA,'','','','')||' '
);
htp.p('');
htp.formselectopen
( cname => 'qWorkareaIrid'
, cprompt => ''
, cattributes => 'id=qWorkareaIrid'
);
htp.p
( ''
||Rob_msg.GetMsg(Rob_msg.CAP077_ODWACHCK_WA,'','','','')
);
for r_wa in c_wa loop
htp.p( ' '
||r_wa.name
);
end loop; -- r_wa
htp.formselectclose;
htp.p(odwahelp.help_url( p_him_id => 56));
htp.p(' ');
-- ONLY TIP ON BRANCHES
htp.tableData
(cdwp.add_images('{vhv.gif}')
||' '||Rob_msg.GetMsg(Rob_msg.CAP262_ODWASRCH_TIPVER,'','','','')
||' '
,'RIGHT'
, cattributes=> 'VALIGN="TOP" class="t2"'
);
htp.p('');
htp.formCheckBox
( CNAME => 'qTipVersionsOnly'
, CVALUE => 'YES'
, CCHECKED => cdwpbase.ifThenElse( qTipVersionsOnly is not null, 'YES')
, CATTRIBUTES => 'id = qTipVersionsOnly'
);
htp.p(odwahelp.help_url( p_him_id => 55));
htp.p(' ');
-- cdwp.tableRowClose;
cdwp.tableRowClose;
-- FOLDER
cdwp.tableRowOpen;
cdwp.TableDataHeading
( cdwp.add_images('{folder.gif}')
||Rob_msg.GetMsg(Rob_msg.CAP263_ODWASRCH_OWNINGFOL,'','','','')
);
htp.p('');
htp.p
(' '
||jr_name.GET_PATH
( EL_ID => nvl( qFolderIvid, qFolderIrid)
, EL_TYPE=> 4845 -- 4844 = FOLDER, 4845 is supertype
, FORMAT => 'NAME'
)
||cdwpbase.ifThenElse
( qFolderIvid is not null
, ' ('||odwavrsn.get_version_label( p_ivid => to_number(qFolderIvid))||')'
)
||cdwpbase.ifThenElse
( qFolderIvid is null
, cdwpbase.nbsp(20)
, cdwpbase.nbsp(4)
)
||' '
||' '
||cdwp.add_images( '{browse_round.gif}')
||' '
||odwahelp.help_url( p_him_id => 54)
||' '
||'
'
);
htp.p(' ');
htp.tableData
(cdwp.add_images('{AllFolders.gif}')
||' '|| Rob_msg.GetMsg(Rob_msg.CAP264_ODWASRCH_INCLNEST,'','','','')
||' '
,'RIGHT'
, cattributes=> 'VALIGN="TOP" class="t2"'
);
htp.p('');
htp.formCheckBox
( CNAME => 'qIncludeNested'
, CVALUE => 'YES'
, CCHECKED => cdwpbase.ifThenElse( qIncludeNested is not null, 'YES')
, CATTRIBUTES => 'id=qIncludeNested'
);
htp.p(odwahelp.help_url( p_him_id => 57));
htp.p(' ');
cdwp.tableRowClose;
else
htp.p
( cdwpbase.ifThenElse
( qname is not null
, ' '
)
||' '
||cdwpbase.ifThenElse
( qWorkareaIrid is not null
, ' '
)
||cdwpbase.ifThenElse
( qElementType is not null
, ' '
)
||cdwpbase.ifThenElse
( qIncludeNested is not null
, ' '
)
||' '
);
end if; -- p_mode='BASIC'
htp.p
( ' '
);
htp.p
( ' '
);
if p_mode='ADVANCED'
then
cdwp.tableRowOpen;
cdwp.TableDataHeading(''||Rob_msg.GetMsg(Rob_msg.CAP265_ODWASRCH_ADDLCLAUSE,'','','','')||' ');
htp.p('');
htp.formText
( cname => 'qWhere'
, cvalue => qWhere
, csize => 80
, cmaxlength => 2000
, cattributes => 'id=qWhere'
);
htp.p(odwahelp.help_url( p_him_id => 63));
htp.p(' ');
cdwp.tableRowClose;
cdwp.tableRowOpen;
cdwp.TableDataHeading(' Irid ');
htp.p('');
htp.formText
( cname => 'qIrid'
, cvalue => qIrid
, csize => 25
, cmaxlength => 45
, cattributes => 'id=qIrid'
);
htp.p(odwahelp.help_url( p_him_id => 61));
htp.p(' ');
cdwp.TableDataHeading
( cdwp.add_images('{dependancy_manager.gif}')
||''||Rob_msg.GetMsg(Rob_msg.CAP266_ODWASRCH_DEPTYPE ,'','','','')||' '
);
/*
htp.p('');
htp.formText
( cname => 'qDepType'
, cvalue => qDepType
, csize => 25
, cmaxlength => 200
);
htp.p(odwahelp.help_url( p_him_id => 950));
htp.p(' ');
*/
htp.p('');
htp.formselectopen
( cname => 'qDepType'
, cprompt => ''
, cattributes => 'qDepType'
);
htp.p
( ''||Rob_msg.GetMsg(Rob_msg.CAP266_ODWASRCH_DEPTYPE ,'','','','')
);
htp.p
( ' '||Rob_msg.GetMsg(Rob_msg.CAP267_ODWASRCH_PROV,'','','','')
);
htp.p
( ' '||Rob_msg.GetMsg(Rob_msg.CAP066_ODWA_USES,'','','','')
);
htp.formselectclose;
htp.p(odwahelp.help_url( p_him_id => 86));
htp.p(' ');
cdwp.tableRowClose;
cdwp.tableRowOpen;
cdwp.TableDataHeading('Ivid');
htp.p('');
htp.formText
( cname => 'qIvid'
, cvalue => qIvid
, csize => 25
, cmaxlength => 45
);
htp.p(odwahelp.help_url( p_him_id => 62));
htp.p(' ');
cdwp.TableDataHeading
( cdwp.add_images('{global_name_domain.gif}')
||''||Rob_msg.GetMsg(Rob_msg.CAP270_ODWASRCH_GNAMEDOM,'','','','')||' '
);
htp.p('');
htp.formText
( cname => 'qGlobalNameType'
, cvalue => qGlobalNameType
, csize => 25
, cmaxlength => 45
,cattributes => 'id=qGlobalNameType'
);
/*
htp.formselectopen
( cname => 'qGlobalNameType'
, cprompt => ''
);
htp.p
( ''
||'Type of Element'
);
for r_gnt in c_gnt loop
htp.p( ' '
||r_gnt.type_name
);
end loop; -- r_gnt
htp.formselectclose;
*/
htp.p(' ');
cdwp.tableRowClose;
cdwp.tableRowOpen;
cdwp.TableDataHeading(''||Rob_msg.GetMsg(Rob_msg.CAP269_ODWASRCH_MLTCONT,'','','','')||' ');
htp.p('');
htp.formText
( cname => 'qTxtContains'
, cvalue => qTxtContains
, csize => 25
, cmaxlength => 1000
, cattributes => 'id=qTxtContains'
);
htp.p(odwahelp.help_url( p_him_id => 64));
htp.p(' ');
cdwp.TableDataHeading
( cdwp.add_images('{global_name.gif}')
||Rob_msg.GetMsg(''||Rob_msg.CAP268_ODWASRCH_GNAME,'','','','')||' ');
htp.p('');
htp.formText
( cname => 'qGlobalName'
, cvalue => qGlobalName
, csize => 25
, cmaxlength => 200
, cattributes => 'id=qGlobalName'
);
htp.p(odwahelp.help_url( p_him_id => 950));
htp.p(' ');
cdwp.tableRowClose;
cdwp.tableRowOpen;
cdwp.TableDataHeading(''||Rob_msg.GetMsg(Rob_msg.CAP271_ODWASRCH_FILCONT,'','','','')||' ');
htp.p('');
htp.formText
( cname => 'qFileContains'
, cvalue => qFileContains
, csize => 25
, cmaxlength => 1000
, cattributes => 'id=qFileContains'
);
htp.p(odwahelp.help_url( p_him_id => 65));
htp.p(' ');
cdwp.TableDataHeading
( cdwp.add_images('{usedby.gif}')
||Rob_msg.GetMsg(Rob_msg.CAP067_ODWA_USEDBY,'','','',''));
htp.p('');
if nvl(qUsedByIvid,'x') <> 'x'
then
htp.p
(' '
||jr_name.GET_PATH
( EL_ID => to_number(qUsedByIvid)
, EL_TYPE=> cdwpbase.get_ivid_type_id(p_ivid => to_number(qUsedByIvid))
, FORMAT => 'NAME'
)
||' ('||odwavrsn.get_version_label( p_ivid => to_number(qUsedByIvid))||')'
||cdwpbase.nbsp(4)
);
else
htp.p
(' '
);
htp.p(' ');
htp.p(' '
);
cdwp.tableRowClose;
else
htp.p
( cdwpbase.ifThenElse
( qIvid is not null
, ' '
)
||cdwpbase.ifThenElse
( qIrid is not null
, ' '
)
||cdwpbase.ifThenElse
( qWhere is not null
, ' '
)
||cdwpbase.ifThenElse
( qTxtContains is not null
, ' '
)
||cdwpbase.ifThenElse
( qFileContains is not null
, ' '
)
||' '
||cdwpbase.ifThenElse
( qGlobalName is not null
, ' '
)
||' '
||cdwpbase.ifThenElse
( qUsedByIvid is not null
, ' '
)
);
end if; -- p_mode='ADVANCED'
if p_mode='VERSION'
then
-- Check State
cdwp.tableRowOpen;
cdwp.TableDataHeading
( cdwp.add_images( '{checkout.gif}{checkin.gif}')
||''||Rob_msg.GetMsg(Rob_msg.CAP136_ODWAPROP_CHKSTATE ,'','','','')||' '
);
htp.p('');
htp.formselectopen
( cname => 'qCheckState'
, cprompt => ''
,cattributes => 'id=qCheckState'
);
htp.p
( ''||Rob_msg.GetMsg(Rob_msg.CAP272_ODWASRCH_ANY,'','','','')
);
htp.p
( ' '||Rob_msg.GetMsg(Rob_msg.CAP273_ODWASRCH_UVNCO ,'','','','')
);
htp.p
( ' '||Rob_msg.GetMsg(Rob_msg.CAP087_ODWACHKI_CO ,'','','','')
);
htp.p
( ' '||Rob_msg.GetMsg(Rob_msg.CAP274_ODWASRCH_UNV,'','','','')
);
htp.p
( ' '||Rob_msg.GetMsg(Rob_msg.DSP331_ODWARPRTS_CIN ,'','','','')
);
htp.formselectclose;
htp.p(odwahelp.help_url( p_him_id => 86));
htp.p(' ');
-- Version Label
htp.tableData
( cdwp.add_images('')
||''||Rob_msg.GetMsg(Rob_msg.CAP093_ODWACHKI_VERLBL,'','','','')||' '
,'RIGHT'
, cattributes=> 'VALIGN="TOP" class="t2"'
);
htp.p('');
htp.formtext
( cname => 'qVersionLabel'
, cvalue => qVersionLabel
, csize => 10
, cmaxlength => 40
, cattributes => 'id=qVersionLabel'
);
htp.p(odwahelp.help_url( p_him_id => 81));
htp.p(' ');
-- Check Notes
htp.tableData
( cdwp.add_images('')
||''||Rob_msg.GetMsg(Rob_msg.CAP275_ODWASRCH_CNHAS,'','','','')||' '
,'RIGHT'
, cattributes=> 'VALIGN="TOP" class="t2"'
);
htp.p('');
htp.formtext
( cname => 'qCheckNotesContain'
, cvalue => qCheckNotesContain
, csize => 20
, cmaxlength => 100
, cattributes => 'id=qCheckNotesContain'
);
htp.p(odwahelp.help_url( p_him_id => 82));
htp.p(' ');
cdwp.tableRowClose;
-- BRANCH
cdwp.tableRowOpen;
cdwp.TableDataHeading
( cdwp.add_images('{branch.gif}')
||''||Rob_msg.GetMsg(Rob_msg.CAP276_ODWASRCH_ONFROM,'','','','')||' '
);
htp.p('');
htp.formselectopen
( cname => 'qBranchIrid'
, cprompt => ''
, cattributes =>'id=qBranchIrid'
);
htp.p
( ''
||Rob_msg.GetMsg(Rob_msg.CAP277_ODWASRCH_BRLABEL,'','','','')
);
for r_brh in c_brh loop
htp.p( ' '
||r_brh.name
);
end loop; -- r_brh
htp.formselectclose;
htp.p(odwahelp.help_url( p_him_id => 83));
htp.p(' ');
-- ONLY ROOT of ON BRANCHES
htp.p(''
||''||Rob_msg.GetMsg(Rob_msg.CAP278_ODWASRCH_ROOTVER,'','','','')||' ');
htp.formCheckBox
( CNAME => 'qRootVersionsOnly'
, CVALUE => 'YES'
, CCHECKED => cdwpbase.ifThenElse( qRootVersionsOnly is not null, 'YES')
, CATTRIBUTES => 'id=qRootVersionsOnly'
);
htp.p(odwahelp.help_url( p_him_id => 84));
htp.p(' ');
-- Configuration
htp.tableData
(cdwp.add_images('{configuration.gif}')
||Rob_msg.GetMsg(Rob_msg.CAP279_ODWASRCH_INCONF,'','','','')
,'RIGHT'
, cattributes=> 'VALIGN="TOP" class="t2"'
);
htp.p('');
htp.p
(' '
||cdwpbase.get_cfg_name
( p_cfg_ivid => qCfgIvid
, p_FORMAT => 'VLABEL'
)
||cdwpbase.ifThenElse
( qCfgIvid is null
, cdwpbase.nbsp(20)
, cdwpbase.nbsp(4)
)
||' '
||cdwp.add_images( '{browse_round.gif}')
||' '
||odwahelp.help_url( p_him_id => 85)
||'
'
);
htp.p(' ');
cdwp.tableRowClose;
-- Check Out User
cdwp.tableRowOpen;
cdwp.TableDataHeading
( cdwp.add_images('{checkout.gif}{user.gif}')
||''||Rob_msg.GetMsg(Rob_msg.CAP280_ODWASRCH_COBY,'','','','')||' '
);
htp.p('');
htp.formselectopen
( cname => 'qCheckOutUser'
, cprompt => ''
, cattributes => 'id=qCheckOutUser'
);
htp.p
( ''
||Rob_msg.GetMsg(Rob_msg.CAP281_ODWASRCH_ANYREPUSR,'','','','')
);
for r_usr in c_usr loop
htp.p( ' '
||r_usr.full_user_name
);
end loop; -- r_usr
htp.formselectclose;
htp.p(odwahelp.help_url( p_him_id => 86));
htp.p(' ');
-- CheckInUser
cdwp.TableDataHeading
( cdwp.add_images('{checkin.gif}{user.gif}')
||''||Rob_msg.GetMsg(Rob_msg.CAP282_ODWASRCH_CINBY,'','','','')||' '
);
htp.p('');
htp.formselectopen
( cname => 'qCheckInUser'
, cprompt => ''
, cattributes =>'id=qCheckInUser'
);
htp.p
( ''
||Rob_msg.GetMsg(Rob_msg.CAP281_ODWASRCH_ANYREPUSR,'','','','')
);
for r_usr in c_usr loop
htp.p( ' '
||r_usr.full_user_name
);
end loop; -- r_usr
htp.formselectclose;
htp.p(odwahelp.help_url( p_him_id => 87));
htp.p(' ');
cdwp.tableRowClose;
-- Checked Out After/Before
cdwp.tableRowOpen;
cdwp.TableDataHeading
( cdwp.add_images( '{checkout.gif}')
||''||Rob_msg.GetMsg(Rob_msg.CAP283_ODWASRCH_COAFTER,'','','','')||' '
);
htp.p('');
htp.formtext
( cname => 'qCheckedOutAfter'
, cvalue => qCheckedOutAfter
, csize => 20
, cmaxlength => 25
, cattributes => 'id=qCheckedOutAfter'
);
htp.p( 'DD-MON-YYYY [HH24[:MI]] ');
htp.p(odwahelp.help_url( p_him_id => 88));
htp.p(' ');
cdwp.TableDataHeading
( cdwp.add_images( '{checkout.gif}')
||''||Rob_msg.GetMsg(Rob_msg.CAP284_ODWASRCH_COBEFORE,'','','','')||' '
);
htp.p('');
htp.formtext
( cname => 'qCheckedOutBefore'
, cvalue => qCheckedOutBefore
, csize => 20
, cmaxlength => 25
, cattributes =>'id=qCheckedOutBefore'
);
htp.p(odwahelp.help_url( p_him_id => 89));
htp.p(' ');
cdwp.tableRowClose;
-- Checked In After/Before
cdwp.tableRowOpen;
cdwp.TableDataHeading
( cdwp.add_images( '{checkin.gif}')
||''||Rob_msg.GetMsg(Rob_msg.CAP285_ODWASRCH_CIAFTER,'','','','')||' '
);
htp.p('');
htp.formtext
( cname => 'qCheckedInAfter'
, cvalue => qCheckedInAfter
, csize => 20
, cmaxlength => 25
, cattributes => 'id=qCheckedInAfter'
);
htp.p( 'DD-MON-YYYY [HH24[:MI]] ');
htp.p(odwahelp.help_url( p_him_id => 90));
htp.p(' ');
cdwp.TableDataHeading
( cdwp.add_images( '{checkin.gif}')
||''||Rob_msg.GetMsg(Rob_msg.CAP286_ODWASRCH_CIBEFORE,'','','','')||' '
);
htp.p('');
htp.formtext
( cname => 'qCheckedInBefore'
, cvalue => qCheckedInBefore
, csize => 20
, cmaxlength => 25
, cattributes=>'id=qCheckedInBefore'
);
htp.p(odwahelp.help_url( p_him_id => 91));
htp.p(' ');
cdwp.tableRowClose;
else
htp.p
( ' '
||cdwpbase.ifThenElse
( qVersionLabel is not null
, ' '
)
||cdwpbase.ifThenElse
( qCheckInUser is not null
, ' '
)
||cdwpbase.ifThenElse
( qCheckOutUser is not null
, ' '
)
||cdwpbase.ifThenElse
( qCheckNotesContain is not null
, ' '
)
||cdwpbase.ifThenElse
( qBranchIrid is not null
, ' '
)
||cdwpbase.ifThenElse
( qRootVersionsOnly is not null
, ' '
)
||cdwpbase.ifThenElse
( qCheckedOutBefore is not null
, ' '
)
||cdwpbase.ifThenElse
( qCheckedOutAfter is not null
, ' '
)
||cdwpbase.ifThenElse
( qCheckedInBefore is not null
, ' '
)
||cdwpbase.ifThenElse
( qCheckedInAfter is not null
, ' '
)
);
end if; -- p_mode='VERSION'
htp.p( ' '
);
if p_mode='AUDIT'
then
-- CreatedAfter/Before
cdwp.tableRowOpen;
cdwp.TableDataHeading
( ''||Rob_msg.Getmsg(Rob_msg.CAP316_ODWASRCH_CRAFTER,'','','','')||' '
);
htp.p('');
htp.formtext
( cname => 'qCreatedAfter'
, cvalue => qCreatedAfter
, csize => 20
, cmaxlength => 25
, cattributes=> 'id=qCreatedAfter'
);
htp.p( 'DD-MON-YYYY [HH24[:MI]] ');
htp.p(odwahelp.help_url( p_him_id => 71));
htp.p(' ');
cdwp.TableDataHeading
( ''||Rob_msg.GetMsg(Rob_msg.CAP287_ODWASRCH_CRBEFORE,'','','','')||' '
);
htp.p('');
htp.formtext
( cname => 'qCreatedBefore'
, cvalue => qCreatedBefore
, csize => 20
, cmaxlength => 25
, cattributes=>'qCreatedBefore'
);
htp.p( 'DD-MON-YYYY [HH24[:MI]] ');
htp.p(odwahelp.help_url( p_him_id => 72));
htp.p(' ');
cdwp.tableRowClose;
-- CreatedBy
cdwp.tableRowOpen;
cdwp.TableDataHeading
( cdwp.add_images('{user.gif}')
||''||Rob_msg.GetMsg(Rob_msg.DSP249_ODWAINFO_CREATEDBY,'','','','')||' '
);
htp.p('');
htp.formselectopen
( cname => 'qCreatedBy'
, cprompt => ''
, cattributes => 'id=qCreatedBy'
);
htp.p
( ''
||Rob_msg.GetMsg(Rob_msg.CAP281_ODWASRCH_ANYREPUSR,'','','','')
);
for r_usr in c_usr loop
htp.p( ' '
||r_usr.full_user_name
);
end loop; -- r_usr
htp.formselectclose;
htp.p(odwahelp.help_url( p_him_id => 73));
htp.p(' ');
cdwp.tableRowClose;
-- ChangedAfter/Before
cdwp.tableRowOpen;
cdwp.TableDataHeading
( ''||Rob_msg.GetMsg(Rob_msg.CAP288_ODWASRCH_CHAFTER,'','','','')||' '
);
htp.p('');
htp.formtext
( cname => 'qChangedAfter'
, cvalue => qChangedAfter
, csize => 20
, cmaxlength => 25
, cattributes=>'id=qChangedAfter'
);
htp.p( 'DD-MON-YYYY [HH24[:MI]] ');
htp.p(odwahelp.help_url( p_him_id => 74));
htp.p(' ');
cdwp.TableDataHeading
( ''||Rob_msg.GetMsg(Rob_msg.CAP289_ODWASRCH_CHBEFORE,'','','','')||' '
);
htp.p('');
htp.formtext
( cname => 'qChangedBefore'
, cvalue => qChangedBefore
, csize => 20
, cmaxlength => 25
, cattributes=>'id=qChangedBefore'
);
htp.p( 'DD-MON-YYYY [HH24[:MI]] ');
htp.p(odwahelp.help_url( p_him_id => 75));
htp.p(' ');
cdwp.tableRowClose;
-- ChangedBy
cdwp.tableRowOpen;
cdwp.TableDataHeading
( cdwp.add_images('{user.gif}')
||''||Rob_msg.GetMsg(Rob_msg.DSP250_ODWAINFO_MODBY,'','','','')||' '
);
htp.p('');
htp.formselectopen
( cname => 'qChangedBy'
, cprompt => ''
, cattributes => 'id=qChangedBy'
);
htp.p
( ''
||Rob_msg.GetMsg(Rob_msg.CAP281_ODWASRCH_ANYREPUSR,'','','','')
);
for r_usr in c_usr loop
htp.p( ' '
||r_usr.full_user_name
);
end loop; -- r_usr
htp.formselectclose;
htp.p(odwahelp.help_url( p_him_id => 76));
htp.p(' ');
cdwp.tableRowClose;
-- Check State
cdwp.tableRowOpen;
cdwp.TableDataHeading
( cdwp.add_images( '{wastebasket.gif}')
||''||Rob_msg.GetMsg(Rob_msg.CAP290_ODWASRCH_WBSTATE,'','','','')||' '
);
htp.p('');
htp.formselectopen
( cname => 'qWastebasket'
, cprompt => ''
, cattributes=>'id=qWastebasket'
);
htp.p
( ''||Rob_msg.GetMsg(Rob_msg.CAP291_ODWASRCH_NOWBCONT,'','','','')
);
htp.p
( ' '||Rob_msg.GetMsg(Rob_msg.CAP292_ODWASRCH_ONLYWB,'','','','')
);
htp.formselectclose;
htp.p(odwahelp.help_url( p_him_id => 77));
htp.p(' ');
cdwp.tablerowclose;
else
htp.p
( cdwpbase.ifThenElse
( qCreatedBy is not null
, ' '
)
||cdwpbase.ifThenElse
( qCreatedBefore is not null
, ' '
)
||cdwpbase.ifThenElse
( qCreatedAfter is not null
, ' '
)
||cdwpbase.ifThenElse
( qChangedBy is not null
, ' '
)
||cdwpbase.ifThenElse
( qChangedBefore is not null
, ' '
)
||cdwpbase.ifThenElse
( qChangedAfter is not null
, ' '
)
||' '
);
end if; -- p_mode='AUDIT'
htp.p( ' '
);
cdwp.tableRowOpen;
cdwp.TableDataHeading('');
htp.p
(' '
||cdwp.add_images( '{search_round.gif}')
||' '
||cdwpbase.nbsp(10)
||''
||cdwp.add_images( '{reset_round.gif}')
||' '
||cdwpbase.nbsp(10)
||''
||cdwp.add_images( '{save_round.gif}', p_attributes => 'ALT="'||Rob_msg.GetMsg(Rob_msg.CAP236_ODWASLIB_SAVE ,'','','','')||'"')
||' '
||cdwpbase.nbsp(10)
||''
||cdwp.add_images( '{library_round.gif}', p_attributes => 'ALT="'||Rob_msg.GetMsg(Rob_msg.DSP352_ODWASRCH_USEQRY,'','','','')||'"')
||' '
||'
');
cdwp.tableRowClose;
htp.formClose;
cdwp.tableClose;
htp.bodyClose;
htp.htmlClose;
end if; -- qQueryId is not null
end; -- queryFrame
procedure js_dynamic_content
( imagePath in varchar2
, checkedImage in varchar2
, wbasketImage in varchar2
, launchProc in varchar2
, verHistLabel in varchar2
, verHistProc in varchar2
, verHistImg in varchar2
, browserLabel in varchar2
, browserProc in varchar2
, browserImg in varchar2
, infoPopLabel in varchar2
, infoPopProc in varchar2
, infoPopImg in varchar2
) is
begin
htp.p('
'|| Rob_msg.getmsg(rob_msg.ACC005_NOSCRIPT,'','','','')||' ');
end;
procedure showSql
( p_session_id in number
, qName in varchar2 default null -- BASIC
, qCaseSensitive in varchar2 default null
, qWorkareaIrid in varchar2 default null
, qTipVersionsOnly in varchar2 default null
, qFolderIrid in varchar2 default null
, qFolderIvid in varchar2 default null
, qIncludeNested in varchar2 default null
, qElementType in varchar2 default null
, qIvid in varchar2 default null -- ADVANCED
, qIrid in varchar2 default null
, qTxtType in varchar2 default null
, qTxtContains in varchar2 default null
, qFileContains in varchar2 default null
, qDepType in varchar2 default null
, qGlobalName in varchar2 default null
, qGlobalNameType in varchar2 default null
, qUsedByIvid in varchar2 default null
, qCheckState in varchar2 default null -- VERSION
, qRootVersionsOnly in varchar2 default null
, qVersionLabel in varchar2 default null
, qBranchIrid in varchar2 default null
, qCfgIvid in varchar2 default null
, qCheckNotesContain in varchar2 default null
, qCheckOutUser in varchar2 default null
, qCheckedOutAfter in varchar2 default null
, qCheckedOutBefore in varchar2 default null
, qCheckInUser in varchar2 default null
, qCheckedInAfter in varchar2 default null
, qCheckedInBefore in varchar2 default null
, qCheckedInAt in varchar2 default null
, qCreatedBy in varchar2 default null -- AUDIT
, qCreatedAfter in varchar2 default null
, qCreatedBefore in varchar2 default null
, qChangedBy in varchar2 default null
, qChangedAfter in varchar2 default null
, qChangedBefore in varchar2 default null
, qWastebasket in varchar2 default null
, qWhere in varchar2 default null
, qOrderBy in varchar2 default null
)
is
l_query varchar2(20000);
l_where varchar2(2000);
l_element_type varchar2(2000):= qElementType;
begin
-- create session when necessary, refresh session cache, set workarea context
-- from here on reference to odwactxt.get_... functions for any context value
odwactxt.update_context
( p_session_id => p_session_id
, p_package_name => PACKAGE_NAME
, p_procedure_name=> 'showSql'
, p_new_request => false
);
if qElementType = '-4907' -- BRDD
then
l_where :=
' exists (select 1
from cdi_text
where txt_ref = ci.id
and txt_type = ''CDINOT''
and txt_text like ''%%''
and parent_ivid = ci.ivid
) ';
l_element_type:='4907';
end if;
if qElementType = '-5024' -- BR
then
l_where :=
' exists ( select ''x'' from dual where cdwp_chk_fun_is_business_rule
( ci.id
, ci.function_label
, ci.function_type ) = ''Y''
)
';
l_element_type:='5024';
end if;
if qElementType ='5024' -- FUN
then
l_where :=
' exists ( select ''x'' from dual where cdwp_chk_fun_is_business_rule
( ci.id
, ci.function_label
, ci.function_type ) = ''N''
)
';
end if;
-- compose l_where based on what was added complemented with
-- the qWhere passed in
if qWhere is not null
then
l_where:= l_where
||cdwpbase.ifThenElse
( l_where is not null
, ' AND '||qWhere
, qWhere
)
;
end if; -- qWhere is not null
odwasrch.runSearch
( qName => qName
, qCaseSensitive => qCaseSensitive
, qWorkareaIrid => cdwpbase.ifThenElse( qWorkareaIrid <> 'null', qWorkareaIrid)
, qFolderIrid => qFolderIrid
, qFolderIvid => qFolderIvid
, qIncludeNested => qIncludeNested
, qElementType => cdwpbase.ifThenElse( qElementType <> 'null', l_Element_Type)
, qIvid => qIvid
, qIrid => qIrid
, qTxtType => qTxtType
, qTxtContains => qTxtContains
, qFileContains => qFileContains
, qDepType => qDepType
, qGlobalName => qGlobalName
, qGlobalNameType => qGlobalNameType
, qUsedByIvid => qUsedByIvid
, qCheckState => qCheckState
, qTipVersionsOnly => qTipVersionsOnly
, qRootVersionsOnly => qRootVersionsOnly
, qVersionLabel => qVersionLabel
, qBranchIrid => qBranchIrid
, qCfgIvid => qCfgIvid
, qCheckNotesContain=> qCheckNotesContain
, qCheckOutUser => qCheckOutUser
, qCheckedOutAfter => qCheckedOutAfter
, qCheckedOutBefore => qCheckedOutBefore
, qCheckInUser => qCheckInUser
, qCheckedInAfter => qCheckedInAfter
, qCheckedInBefore => qCheckedInBefore
, qCreatedBy => qCreatedBy
, qCreatedAfter => qCreatedAfter
, qCreatedBefore => qCreatedBefore
, qChangedBy => qChangedBy
, qChangedAfter => qChangedAfter
, qChangedBefore => qChangedBefore
, qWastebasket => qWastebasket
, qWhere => l_Where
, p_order_by => qOrderBy
, p_show_sql_only => true
);
htp.htmlOpen;
htp.headOpen;
cdwp.write_about(package_name, revision_label);
htp.title(Rob_msg.GetMsg(Rob_msg.DSP353_ODWASRCH_SRCHSQL ,'','','',''));
htp.headClose;
htp.bodyOpen
( cattributes=>'BGCOLOR="#FFFFFF" '
);
htp.formopen
( curl => 'no url'
, cmethod => 'POST'
, cattributes => 'NAME="queryForm" '
, ctarget => ''
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.formClose;
htp.p
( ''
||htf.escape_sc
( odwasrch.get_last_search_query
)
||' '
);
htp.bodyClose;
htp.htmlClose;
end; -- showSql
function visible
( p_irid in number
, p_type_id in number default null
, p_user in varchar2 default USER
) return boolean
is
l_type_id number(38):= nvl( p_type_id, cdwpbase.get_type_id(p_el_id => p_irid));
cursor c_el
( b_irid in number
, b_user in varchar2
) is
select 'x'
from dual
where exists
( select 'x'
from i$sdd_folder_members fmo
, sdw_access_rights acc
where fmo.member_object = b_irid
and fmo.folder_reference = acc.object_reference
and acc.grantee_reference in ( b_user ,'PUBLIC')
)
;
cursor c_fol
( b_irid in number
, b_user in varchar2
) is
select 'x'
from dual
where exists
( select 'x'
from sdw_access_rights acc
where acc.object_reference = b_irid
and acc.grantee_reference in ( b_user,'PUBLIC')
)
;
l_test varchar2(1);
begin
if l_type_id in (4844,4845,5009) -- FOL, CEL, APP
then
open c_fol( b_irid => p_irid, b_user => p_user);
fetch c_fol
into l_test;
close c_fol;
return nvl(l_test,'y')='x';
else
open c_el( b_irid => p_irid, b_user => p_user);
fetch c_el
into l_test;
close c_el;
return nvl(l_test,'y')='x';
end if; -- l_type_id in (4844,4845,5009)
end; -- visible
function is_global_search_user
( p_user in varchar2 default USER
) return boolean
is
begin
return instr
( ','||nvl(odwapref.get_value(p_preference_name => 'global_search_users'),'X')||','
, ','||USER||','
) > 0
;
end; -- is_global_search_user
procedure resultFrame9
( p_session_id in number
, p_mode in varchar2 default 'BASIC' -- values: BASIC, ADVANCED ( ??AUDIT, VERSION)
, qName in varchar2 default null -- BASIC
, qCaseSensitive in varchar2 default null
, qWorkareaIrid in varchar2 default null
, qTipVersionsOnly in varchar2 default null
, qFolderIrid in varchar2 default null
, qFolderIvid in varchar2 default null
, qIncludeNested in varchar2 default null
, qElementType in varchar2 default null
, qIvid in varchar2 default null -- ADVANCED
, qIrid in varchar2 default null
, qTxtType in varchar2 default null
, qTxtContains in varchar2 default null
, qFileContains in varchar2 default null
, qDepType in varchar2 default null
, qGlobalName in varchar2 default null
, qGlobalNameType in varchar2 default null
, qUsedByIvid in varchar2 default null
, qCheckState in varchar2 default null -- VERSION
, qRootVersionsOnly in varchar2 default null
, qVersionLabel in varchar2 default null
, qBranchIrid in varchar2 default null
, qCfgIvid in varchar2 default null
, qCheckNotesContain in varchar2 default null
, qCheckOutUser in varchar2 default null
, qCheckedOutAfter in varchar2 default null
, qCheckedOutBefore in varchar2 default null
, qCheckInUser in varchar2 default null
, qCheckedInAfter in varchar2 default null
, qCheckedInBefore in varchar2 default null
, qCheckedInAt in varchar2 default null
, qCreatedBy in varchar2 default null -- AUDIT
, qCreatedAfter in varchar2 default null
, qCreatedBefore in varchar2 default null
, qChangedBy in varchar2 default null
, qChangedAfter in varchar2 default null
, qChangedBefore in varchar2 default null
, qWastebasket in varchar2 default null
, qWhere in varchar2 default null
, qOrderBy in varchar2 default null
, p_run_mode in varchar2 default 'search'
)
is
l_first boolean;
l_path varchar2(2000);
l_where varchar2(2000);
l_element_type varchar2(2000):= qElementType;
l_start_time number(38):= dbms_utility.get_time;
l_end_time number(38);
l_type number;
l_count_invisible number(10):=0;
TYPE typelist IS TABLE OF VARCHAR2(100) INDEX BY BINARY_INTEGER;
types typelist; -- array that stores 'regular' types, with id < 9999
irreg_types typelist; -- sequence-based array with indecex > 10000 that stores NLS names
irreg_max number := 9999;
function TypeAdded (p_type_id in number)
return boolean
is
begin
if types.exists(p_type_id) then
return true;
else
types(p_type_id) := 'Y';
return false;
end if;
end;
function GetTypeIndex (p_nls_name in varchar2)
return number
is
l_found_index number := -1;
begin
for i in 10000 .. irreg_max loop
if irreg_types(i) = p_nls_name then
l_found_index := i;
end if;
end loop;
if l_found_index < 0 then
irreg_max := irreg_max + 1;
irreg_types(irreg_max) := p_nls_name;
l_found_index := irreg_max;
end if;
return l_found_index;
end;
begin
-- create session when necessary, refresh session cache, set workarea context
-- from here on reference to odwactxt.get_... functions for any context value
odwactxt.update_context
( p_session_id => p_session_id
, p_package_name => PACKAGE_NAME
, p_procedure_name=> 'resultFrame'
, p_workarea_irid => to_number( qWorkareaIrid)
, p_cfg_ivid => to_number( qCfgIvid)
, p_folder_irid => to_number( qFolderIrid)
, p_pac_irid => null
, p_pac_ivid => null
);
if p_run_mode = 'showSql'
then
showSql
( p_session_id => odwactxt.get_session_id
, qName => qName
, qCaseSensitive => qCaseSensitive
, qWorkareaIrid => cdwpbase.ifThenElse( qWorkareaIrid <> 'null', qWorkareaIrid)
, qFolderIrid => qFolderIrid
, qFolderIvid => qFolderIvid
, qIncludeNested => qIncludeNested
, qElementType => cdwpbase.ifThenElse( qElementType <> 'null', l_Element_Type)
, qIvid => qIvid
, qIrid => qIrid
, qTxtType => qTxtType
, qTxtContains => qTxtContains
, qFileContains => qFileContains
, qDepType => qDepType
, qGlobalName => qGlobalName
, qGlobalNameType => qGlobalNameType
, qUsedByIvid => qUsedByIvid
, qCheckState => qCheckState
, qTipVersionsOnly => qTipVersionsOnly
, qRootVersionsOnly => qRootVersionsOnly
, qVersionLabel => qVersionLabel
, qBranchIrid => qBranchIrid
, qCfgIvid => qCfgIvid
, qCheckNotesContain => qCheckNotesContain
, qCheckOutUser => qCheckOutUser
, qCheckedOutAfter => qCheckedOutAfter
, qCheckedOutBefore => qCheckedOutBefore
, qCheckInUser => qCheckInUser
, qCheckedInAfter => qCheckedInAfter
, qCheckedInBefore => qCheckedInBefore
, qCreatedBy => qCreatedBy
, qCreatedAfter => qCreatedAfter
, qCreatedBefore => qCreatedBefore
, qChangedBy => qChangedBy
, qChangedAfter => qChangedAfter
, qChangedBefore => qChangedBefore
, qWastebasket => qWastebasket
, qWhere => qWhere
);
elsif p_run_mode = 'saveQuery'
then
odwaslib.savequery
( p_session_id => odwactxt.get_session_id
, qName => qName
, qCaseSensitive => qCaseSensitive
, qWorkareaIrid => cdwpbase.ifThenElse( qWorkareaIrid <> 'null', qWorkareaIrid)
, qFolderIrid => qFolderIrid
, qFolderIvid => qFolderIvid
, qIncludeNested => qIncludeNested
, qElementType => cdwpbase.ifThenElse( qElementType <> 'null', l_Element_Type)
, qIvid => qIvid
, qIrid => qIrid
, qTxtType => qTxtType
, qTxtContains => qTxtContains
, qFileContains => qFileContains
, qDepType => qDepType
, qGlobalName => qGlobalName
, qGlobalNameType => qGlobalNameType
, qUsedByIvid => qUsedByIvid
, qCheckState => qCheckState
, qTipVersionsOnly => qTipVersionsOnly
, qRootVersionsOnly => qRootVersionsOnly
, qVersionLabel => qVersionLabel
, qBranchIrid => qBranchIrid
, qCfgIvid => qCfgIvid
, qCheckNotesContain => qCheckNotesContain
, qCheckOutUser => qCheckOutUser
, qCheckedOutAfter => qCheckedOutAfter
, qCheckedOutBefore => qCheckedOutBefore
, qCheckInUser => qCheckInUser
, qCheckedInAfter => qCheckedInAfter
, qCheckedInBefore => qCheckedInBefore
, qCreatedBy => qCreatedBy
, qCreatedAfter => qCreatedAfter
, qCreatedBefore => qCreatedBefore
, qChangedBy => qChangedBy
, qChangedAfter => qChangedAfter
, qChangedBefore => qChangedBefore
, qWastebasket => qWastebasket
, qWhere => qWhere
);
else
htp.htmlOpen;
htp.headOpen;
cdwp.write_about(package_name, revision_label);
cdwp.include_report_styles;
odwainfo.js_invoke_info;
-- $revision 3.13$ JavaScript function to submit the download file request form
cdwp_fil.js_download_file_request;
odwabrow.js_invoke_browser;
odwavrsn.js_invoke_vhv_ivid_only;
odwa_fol.js_go(p_session_id => odwactxt.get_session_id,p_target => '_NEW');
js_dynamic_content
( imagePath => odwapref.get_value(p_preference_name => 'image_path')
, checkedImage => 'check_mark.gif'
, wbasketImage => 'wastebasket.gif'
, launchProc => cdwpbase.ifThenElse((p_run_mode='search'),'go','sel')
, verHistLabel => Rob_msg.GetMsg(Rob_msg.CAP220_ODWARPRT_VERHISVR ,'','','','')
, verHistProc => 'vhv'
, verhistImg => 'vhv.gif'
, browserLabel => Rob_msg.GetMsg(Rob_msg.DSP103_CDWP_OB ,'','','','')
, browserProc => 'browse'
, browserImg => 'browsemed.gif'
, infoPopLabel => Rob_msg.GetMsg(Rob_msg.CAP221_ODWARPRT_SHOWINFO ,'','','','')
, infoPopProc => 'popupInfo'
, infoPopImg => 'info.gif'
);
js_showSql;
htp.headClose;
--
-- body
--
htp.bodyOpen
( cattributes=>'BGCOLOR="#FFFFFF" '
);
-- $revision 3.13$ include form to request file download; by using the form, we can
-- cut down on the size of the file by downsizing the URL
cdwp_fil.form_download_file_request;
htp.formopen
( curl => 'odwasrch.resultFrame9'
, cmethod => 'GET'
, cattributes => 'NAME="queryForm" '
||' onSubmit="targetCheck()"'
, ctarget => ''
);
htp.p
( ' '
);
-- BASIC
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
-- ADVANCED
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
-- VERSION
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
-- AUDIT
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
htp.p
( ' '
);
-- Additional
htp.p
( ' '
);
htp.p( ' '
);
htp.formClose;
if qElementType = '-4907' -- BRDD
then
l_where :=
' exists (select 1
from cdi_text
where txt_ref = ci.id
and txt_type = ''CDINOT''
and txt_text like ''%%''
and parent_ivid = ci.ivid
) ';
l_element_type:='4907';
end if;
if qElementType = '-5024' -- BR
then
l_where :=
' exists ( select ''x'' from dual where cdwp_chk_fun_is_business_rule
( ci.id
, ci.function_label
, ci.function_type ) = ''Y''
)
';
l_element_type:='5024';
end if;
if qElementType ='5024' -- FUN
then
l_where :=
' exists ( select ''x'' from dual where cdwp_chk_fun_is_business_rule
( ci.id
, ci.function_label
, ci.function_type ) = ''N''
)
';
end if;
-- compose l_where based on what was added complemented with
-- the qWhere passed in
if qWhere is not null
then
l_where:= l_where
||cdwpbase.ifThenElse
( l_where is not null
, ' AND '||qWhere
, qWhere
)
;
end if; -- qWhere is not null
if nvl( qName, 'X') <> 'NEW_SEARCH_271269'
then
-- have the runSearch procedure gather search result in the g_<>Tab tables;
-- then move forward to actually display the result
runSearch
( qName => qName
, qCaseSensitive => qCaseSensitive
, qWorkareaIrid => cdwpbase.ifThenElse( qWorkareaIrid <> 'null', qWorkareaIrid)
, qFolderIrid => qFolderIrid
, qFolderIvid => qFolderIvid
, qIncludeNested => qIncludeNested
, qElementType => cdwpbase.ifThenElse( qElementType <> 'null', l_Element_Type)
, qIvid => qIvid
, qIrid => qIrid
, qTxtType => qTxtType
, qTxtContains => qTxtContains
, qFileContains => qFileContains
, qDepType => qDepType
, qGlobalName => qGlobalName
, qGlobalNameType => qGlobalNameType
, qUsedByIvid => qUsedByIvid
, qCheckState => qCheckState
, qTipVersionsOnly => qTipVersionsOnly
, qRootVersionsOnly => qRootVersionsOnly
, qVersionLabel => qVersionLabel
, qBranchIrid => qBranchIrid
, qCfgIvid=> qCfgIvid
, qCheckNotesContain=> qCheckNotesContain
, qCheckOutUser => qCheckOutUser
, qCheckedOutAfter => qCheckedOutAfter
, qCheckedOutBefore => qCheckedOutBefore
, qCheckInUser => qCheckInUser
, qCheckedInAfter => qCheckedInAfter
, qCheckedInBefore => qCheckedInBefore
, qCreatedBy => qCreatedBy
, qCreatedAfter => qCreatedAfter
, qCreatedBefore => qCreatedBefore
, qChangedBy => qChangedBy
, qChangedAfter => qChangedAfter
, qChangedBefore => qChangedBefore
, qWastebasket => qWastebasket
, qWhere => l_where
, p_order_by => qOrderBy
, p_enforce_acc_privs => false
);
-- filter invisble objects??
if g_ividTab.count > 0
and
g_ividTab(1) > 0
and
not is_global_search_user(USER)
then
for i in 1..g_ividTab.count loop
if not visible( p_irid => odwasrch.g_iridTab(i), p_type_id => odwasrch.g_typeTab(i))
then
l_count_invisible:= l_count_invisible + 1;
odwasrch.g_nameTab(i):='*******************';
odwasrch.g_ividTab(i):=-4;
end if;
end loop;
end if; -- g_ividTab.count > 0 and g_ividTab(1) > 0
l_end_time := dbms_utility.get_time;
cdwp.tableOpen;
cdwp.tableRowOpen;
cdwp.tableDataValue('');
cdwp.tableDataValue('');
cdwp.tableDataValue
( Rob_msg.GetMsg(Rob_msg.MSG191_ODWASRCH_STAT,odwavrsn.get_author_name( USER)||cdwpbase.nbsp(6),cdwpbase.ifThenElse( g_ividTab(1) > 0, to_char(g_ividTab.count - l_count_invisible), 'no')
,cdwpbase.nbsp(1)||cdwpbase.ifThenElse( (l_end_time - l_start_time) <100, '0' )|| to_char( round((l_end_time - l_start_time)/10)/10),'')
||cdwpbase.nbsp(6)
|| ''
||cdwp.add_images('{showsql_round.gif}', p_attributes => 'ALT="'||Rob_msg.GetMsg(Rob_msg.MSG192_ODWASRCH_SHOWSQL,'','','','')||'"')
||' '
||' '
, p_colspan => 5
);
cdwp.tableRowClose;
-- if some result was returned
if g_ividTab.count - l_count_invisible > 0
and
(
g_ividTab(1) > 0
or
g_ividTab(1) = -4
)
then
cdwp.tableRowOpen;
cdwp.tableDataValue(' '); -- wastebasket gif
cdwp.tableDataValue(' '); -- check mark gif
cdwp.tableDataValue
( ''
||''||Rob_msg.Getmsg(Rob_msg.CAP317_ODWASRCH_ELEMENT,'','','','')||' '
||' '
);
cdwp.tableDataValue(''||Rob_msg.Getmsg(Rob_msg.CAP203_ODWAPROP_VER,'','','','')||' ');
cdwp.tableDataValue(cdwpbase.nbsp(2));
-- cdwp.tableDataValue('Path ');
cdwp.tableDataValue
( ''
||''||Rob_msg.Getmsg(Rob_msg.CAP061_ODWA_PATH,'','','','')||' '
||' '
);
-- P.Ebell -- Check op gElementType tijdelijk verwijderd, Lucas raadplegen
-- if qElementType is null
-- then
cdwp.tableDataValue
(''
||''||Rob_msg.Getmsg(Rob_msg.CAP045_CDWP_TYPE,'','','','')||' '
||' '
);
-- end if;
-- cdwp.tableDataValue('Date Modified ');
cdwp.tableDataValue
( ''
||''||Rob_msg.GetMsg(Rob_msg.CAP293_ODWASRCH_DTMOD,'','','','')||' '
||' '
);
cdwp.tableDataValue
(''
||''
||' '
);
cdwp.tableDataValue
(''
||Rob_msg.GetMsg(Rob_msg.CAP0152_CDWP_NOTES,'','','','')
);
cdwp.tableRowClose;
l_first:= true;
for i in 1..g_ividTab.count loop
if g_ividTab(i) <> -4 -- -4 means it is invisble
then
if l_first
then
htp.p('
'|| Rob_msg.getmsg(rob_msg.ACC005_NOSCRIPT,'','','','')||' ');
end if;
-- htp.p(' ');
else
if g_ividTab(1) = -3
then
htp.p
( ''
||Rob_msg.GetMsg(Rob_msg.MSG187_ODWARPRTS_QRYNOTRUN,'','','','')
||' '
);
elsif g_ividTab(1) = -2
then
htp.p
( ''
||Rob_msg.GetMsg(Rob_msg.MSG188_ODWARPRTS_EXCEP,g_nameTab(1),'','','')
||' '
);
end if;
end if; -- g_ividTab(1) is not null
htp.formopen
( curl => 'odwasrch'
, cmethod => 'POST'
, cattributes => 'NAME="searchQuery" '
, ctarget => ''
);
htp.p
( ' '
);
htp.formClose;
end if; -- qName <> 'NEW_SEARCH_271269'
cdwp.tableClose;
htp.bodyClose;
htp.htmlClose;
end if; -- p_run_mode ='showSql'
end; -- resultFrame9
-- writes the function selected that should be called as link from the elements in the result
-- frame to return the selected values to the invoker
-- the p_js_selected may refer to the following variables:
-- ivid, workareaIrid, cfgIvid, folderIrid, typeId
-- an example:
-- p_js_selected => 'opener.location = "odwarobs.rob?p_type_id=4907"
-- +"'||chr(38)||'p_form_name=dingesForm"
-- +"'||chr(38)||'p_ivid_field=dingesIvid"
-- +"'||chr(38)||'p_irid_field=dingesIrid"
-- +"'||chr(38)||'p_cfg_ivid="+cfgIvid
-- +"'||chr(38)||'p_workarea_irid="+workareaIrid
-- +"'||chr(38)||'p_ivid="+ivid
-- +"'||chr(38)||'p_search_type_id="+type_id
-- ;
procedure js_selected
( p_js_selected in varchar2
, p_type_id in number
) is
begin
htp.p(' '|| Rob_msg.getmsg(rob_msg.ACC005_NOSCRIPT,'','','','')||' '
);
end; -- js_selected
procedure js_invoke_search
( p_session_id in number default null
, p_type_id in varchar2 default null
, p_wa_id in varchar2 default null
, p_cfg_id in varchar2 default null
, p_folder_ivid in varchar2 default null
, p_js_selected in varchar2
, p_function_name in varchar2 default 'invokeSearch'
) is
begin
htp.p('
'|| Rob_msg.getmsg(rob_msg.ACC005_NOSCRIPT,'','','','')||' ');
end; -- js_invoke_search
-- main procedure
-- -------------------------------
-- | queryFrame |
-- | |
-- | |
-- |-----------------------------|
-- | |
-- | resultFrame |
-- | |
-- -------------------------------
--
--
procedure rep_search
( p_session_id in number default null
, p_run_mode in varchar2 default 'search' -- values: search, select
, p_type_id in number default null
, p_wa_id in number default null
, p_cfg_id in number default null
, p_folder_ivid in number default null
, p_js_selected in varchar2 default null -- the Javascript that should be executed when
-- in select mode an element is selected
) is
begin
-- create session when necessary, refresh session cache, set workarea context
-- from here on reference to odwactxt.get_... functions for any context value
odwactxt.update_context
( p_package_name => PACKAGE_NAME
, p_procedure_name=> 'rep_search'
, p_folder_ivid => p_folder_ivid
, p_cfg_ivid => p_cfg_id
, p_workarea_irid => p_wa_id
, p_pac_irid => null
, p_pac_ivid => null
);
htp.htmlOpen;
htp.headOpen;
cdwp.write_about(package_name, revision_label);
htp.title(Rob_msg.GetMsg(Rob_msg.DSP112_CDWP_REPSEARCH ,'','','',''));
if p_run_mode ='select'
then
js_selected( p_js_selected => p_js_selected, p_type_id => p_type_id);
end if;
htp.headClose;
htp.framesetopen
( crows => '60%,40%'
, cattributes => 'BORDER="1" TITLE="'||Rob_msg.getMsg(rob_msg.DSP112_CDWP_REPSEARCH,'','','','')
||'" LONGDESC=odwahelp.rightSide?p_session_id=&p_him_id=402'
);
htp.frame
( csrc => 'odwasrch.queryFrame?p_session_id='
||to_char(odwactxt.get_session_id)
||chr(38)||'p_mode=BASIC'
||chr(38)||'qWorkareaIrid='||p_wa_id
||chr(38)||'qCfgIvid='||p_cfg_id
||chr(38)||'qFolderIrid='||to_char(cdwpbase.get_irid( p_ivid => p_folder_ivid))
||chr(38)||'qElementType='||to_char(p_type_id)
||chr(38)||'qTipVersionsOnly=YES'
||chr(38)||'p_run_mode='||p_run_mode
, cname=> 'queryFrame'
, cattributes => 'TITLE="'||Rob_msg.getMsg(rob_msg.DSP112_CDWP_REPSEARCH,'','','','')
||'" LONGDESC=odwahelp.rightSide?p_session_id=&p_him_id=402'
);
htp.frame
( csrc => 'odwasrch.resultFrame9?p_session_id='
||to_char(odwactxt.get_session_id)
||chr(38)||'p_run_mode='||p_run_mode
||chr(38)||'qName=NEW_SEARCH_271269' -- to indicate no message needs to be shown
, cname=> 'resultFrame'
, cattributes => 'TITLE="'||Rob_msg.getMsg(rob_msg.DSP112_CDWP_REPSEARCH,'','','','')
||'" LONGDESC=odwahelp.rightSide?p_session_id=&p_him_id=402'
);
htp.framesetclose;
htp.bodyopen
( cattributes => 'BGCOLOR="#FFFFFF"'
);
htp.bodyClose;
htp.htmlClose;
end; -- rep_search
-- procedure to be called with a number of search criteria that will collect results in the
-- odwasrch.g_<>Tab tables
procedure runSearch
( qName in varchar2 default null -- BASIC
, qCaseSensitive in varchar2 default null
, qWorkareaIrid in number default null
, qTipVersionsOnly in varchar2 default null
, qFolderIrid in varchar2 default null
, qFolderIvid in varchar2 default null
, qIncludeNested in varchar2 default null
, qElementType in varchar2 default null
, qIvid in number default null -- ADVANCED
, qIrid in number default null
, qTxtType in varchar2 default null
, qTxtContains in varchar2 default null
, qFileContains in varchar2 default null
, qDepType in varchar2 default null
, qGlobalName in varchar2 default null
, qGlobalNameType in varchar2 default null
, qUsedByIvid in varchar2 default null
, qCheckState in varchar2 default null -- VERSION
, qRootVersionsOnly in varchar2 default null
, qVersionLabel in varchar2 default null
, qBranchIrid in number default null
, qCfgIrid in number default null
, qCfgIvid in number default null
, qCheckNotesContain in varchar2 default null
, qCheckOutUser in varchar2 default null
, qCheckedOutAfter in varchar2 default null
, qCheckedOutBefore in varchar2 default null
, qCheckInUser in varchar2 default null
, qCheckedInAfter in varchar2 default null
, qCheckedInBefore in varchar2 default null
, qCreatedBy in varchar2 default null -- AUDIT
, qCreatedAfter in varchar2 default null
, qCreatedBefore in varchar2 default null
, qChangedBy in varchar2 default null
, qChangedAfter in varchar2 default null
, qChangedBefore in varchar2 default null
, qWastebasket in varchar2 default null
, qWhere in varchar2 default null
, p_order_by in varchar2 default null
, p_show_sql_only in boolean default false
, p_enforce_acc_privs in boolean default true
) is
l_cursor varchar2(4000);
l_ci_view_name varchar2(200):= upper(cdwpbase.get_ci_view(p_type_id => qElementType));
/*
function evaluate_date
( p_date_string in varchar2
) return date
is
begin
if p_date_string is not null
then
if length( p_date_string) > 12 --DD-MON-YYYY
then -- assume DD-MON-YYYY HH24[:MI]
if instr(p_date_string, ':') > 0 -- MI
then
return to_date( p_date_string, 'DD-MON-YYYY HH24:MI');
else
return to_date( p_date_string||':00', 'DD-MON-YYYY HH24:MI');
end if;
else
return to_date( p_date_string, 'DD-MON-YYYY');
end if;
else
return to_date(null);
end if;
end; -- evaluate_date
*/
function date_condition
( p_date_string in varchar2
) return varchar2
is
begin
if instr( upper(p_date_string), 'SYSDATE') > 0
then
return p_date_string;
else
return
' to_date('''
||p_date_string
||''' , '''
||cdwpbase.ifThenElse
( instr( p_date_string, ':') > 0
, 'DD-MON-YYYY HH24:MI'
, cdwpbase.ifThenElse
( length( p_date_string) > 12
, 'DD-MON-YYYY HH24'
, 'DD-MON-YYYY'
)
)
||''')'
;
end if; -- contains SYSDATE
end;
-- this procedure adds the line passed in to l_cursor
procedure add
( p_line in varchar2
, p_exclude_in_sql_only in boolean default false -- should this line be excluded if we only show SQL?
, p_nl in boolean default true
) is
begin
if not
( p_show_sql_only
and
p_exclude_in_sql_only
)
and
p_line is not null
then
l_cursor:= l_cursor
||p_line
||cdwpbase.ifThenElse
( p_nl
and
p_show_sql_only
, CHR(13)||chr(10)
);
end if;
end; -- add
begin
jr_context.set_workarea( to_char(null));
add('declare', true);
add(' cursor c_ivid',true);
add(' is',true);
add(' SELECT DISTINCT');
add(' e.irid');
add(' , e.ivid');
add(' , e.name');
add(' , decode');
add(' ( e.state');
add(' , ''N'', ''-''');
add(' , ''O'', odwavrsn.get_version_label( e.ivid)');
add(' , e.vlabel');
add(' ) ');
add
( cdwpbase.ifThenElse
( qElementType is not null
, ' , nvl( ci.date_changed, ci.date_created) '
, ' , nvl( e.date_changed, e.date_created) '
)
);
add(' , e.logical_type_id ');
add(' , e.wastebasket ');
add(' FROM I$SDD_OBJECT_VERSIONS e ');
add(' , I$SDD_BRANCHES be');
add
( cdwpbase.ifThenElse
( qCheckOutUser is not null
or
qCheckedOutAfter is not null
or
qCheckedOutBefore is not null
or
qCheckInUser is not null
or
qCheckedInAfter is not null
or
qCheckedInBefore is not null
or
qCheckNotesContain is not null
, ' , I$SDD_VERSION_ASSOCIATIONS va'
)
);
add
( cdwpbase.ifThenElse
( qTipVersionsOnly is not null
, ' , I$SDD_VERSION_ASSOCIATIONS vatip'
)
);
add
( cdwpbase.ifThenElse
( qRootVersionsOnly is not null
, ' , I$SDD_VERSION_ASSOCIATIONS varoot'
)
);
add
( cdwpbase.ifThenElse
( qCfgIvid is not null
,' , I$SDD_CONFIGURATION_MEMBERS cm '
)
);
add
( cdwpbase.ifThenElse
( qWorkareaIrid is not null
, ' , I$SDD_WA_CONTEXT wac '
)
);
add
( cdwpbase.ifThenElse
( qFolderIrid is not null
or
qFolderIvid is not null
, cdwpbase.ifThenElse
( qIncludeNested is not null
, ', ( select distinct level xx, member_object, folder_reference, parent_ivid from i$sdd_folder_members connect by prior member_object = folder_reference start with '
||cdwpbase.ifThenElse
( qFolderIvid is null
, ' folder_reference = '||qFolderirid||') mem'
, ' parent_ivid = '||qFolderivid||') mem'
)
, ', SDD_FOLDER_MEMBERS mem '
)
)
);
add
( cdwpbase.ifThenElse
( qElementType is not null
, ' , '||l_ci_view_name||' ci '
)
);
add
(' WHERE e.branch_id = be.branch_id(+) ');
-- 3.2 check whether the user can actually See the object, unless the user is listed in
-- the ODWA preference global_search_users
if instr
( ','||nvl(odwapref.get_value(p_preference_name => 'global_search_users'),'X')||','
, ','||USER||','
) = 0
and
p_enforce_acc_privs
then
add
(' AND exists ( select ''x''
from i$sdd_folder_members fmo
, sdw_access_rights acc
where fmo.member_object = e.irid
and fmo.folder_reference = acc.object_reference
and acc.grantee_reference in ( USER,''PUBLIC'')
UNION
select ''x''
from sdw_access_rights acc
where e.irid = acc.object_reference
and acc.grantee_reference in ( USER,''PUBLIC'')
)'
);
end if;
add
( cdwpbase.ifThenElse
( qBranchIrid is not null
, ' AND be.branch_id = '||qBranchIrid
)
);
add
( cdwpbase.ifThenElse
( qWastebasket = 'N' -- Exclude Wastebasket
, ' AND e.wastebasket = ''N'''
)
);
add
( cdwpbase.ifThenElse
( qWastebasket = 'Y' -- Only Wastebasket
, ' AND e.wastebasket = ''Y'''
)
);
if qWorkareaIrid is not null
then
add( ' AND wac.workarea_irid = '||qWorkareaIrid);
add( ' AND wac.object_ivid = E.ivid ');
end if; -- qWorkareaIrid is not null
add
( cdwpbase.ifThenElse
( qFolderIrid is not null
, cdwpbase.ifThenElse
( qIncludeNested is not null
, ' AND mem.member_object = E.irid '
, ' AND mem.folder_reference = '||qFolderIrid
||' AND mem.member_object = E.irid '
)
)
);
add
( cdwpbase.ifThenElse
( qFolderIvid is not null
, cdwpbase.ifThenElse
( qIncludeNested is not null
, ' AND mem.member_object = E.irid '
, ' AND mem.parent_ivid = '||qFolderIvid
||' AND mem.member_object = E.irid '
)
)
);
add
( cdwpbase.ifThenElse
( qElementType is not null
, ' AND e.ivid = ci.ivid '
)
);
add
( cdwpbase.ifThenElse
( qIvid is not null
, ' AND e.ivid = '||qIvid
)
);
add
( cdwpbase.ifThenElse
( qCfgIvid is not null
, ' AND cm.config_ivid = '||qCfgIvid
||' AND cm.object_ivid = e.ivid '
)
);
add
( cdwpbase.ifThenElse
( nvl(qCheckState, 'I,O,N') <> 'I,O,N' --2.5 if check state has not been set explicitly, it is not passed in
and
qCheckState <> 'null'
, ' AND e.state in (''WQA'' '
||cdwpbase.ifThenElse
( instr(qCheckState, 'N') > 0
, ', ''N'''
)
||cdwpbase.ifThenElse
( instr(qCheckState, 'I') > 0
, ', ''I'''
)
||cdwpbase.ifThenElse
( instr(qCheckState, 'O') > 0
, ', ''O'''
)
||')'
)
);
add
( cdwpbase.ifThenElse
( qVersionLabel is not null
, ' and e.vlabel '
||cdwpbase.ifThenElse
( ( instr( qVersionLabel , '%') + instr( qVersionLabel , '_')) > 0
, 'like '
, ' = '
)
||''''||qVersionLabel||''''
)
);
add
( cdwpbase.ifThenElse
( qCheckNotesContain is not null
, ' and instr( va.notes, '
||''''||qCheckNotesContain||''''
||') > 0 '
)
);
add
( cdwpbase.ifThenElse
( qCheckOutUser is not null
or
qCheckedOutAfter is not null
or
qCheckedOutBefore is not null
or
qCheckInUser is not null
or
qCheckedInAfter is not null
or
qCheckedInBefore is not null
or
qCheckNotesContain is not null
, ' and va.to_ivid = e.ivid '
||' and va.edge_kind NOT IN (''M'',''T'')' -- no Merge and Tip associations
)
);
if qTipVersionsOnly is not null
then
add(' AND vatip.from_ivid(+) = e.ivid ');
-- cater for unversioned
add(' AND');
add(' ( ');
add(' ( vatip.to_ivid = vatip.from_ivid ');
add(' AND');
add(' vatip.edge_kind = ''T''');
add(' )');
add(' OR');
add(' e.state = ''N''');
add(' OR');
add(' e.state = ''O''');
add(' ) ');
end if; -- qTipVersionsOnly is not null
if qRootVersionsOnly is not null
then
add(' AND varoot.from_ivid(+) = e.ivid ');
-- cater for unversioned
add(' AND');
add(' ( ');
add(' ( varoot.to_ivid = varoot.from_ivid ');
add(' AND');
add(' varoot.edge_kind = ''R''');
add(' )');
add(' OR');
add(' e.state = ''N''');
add(' ) ');
end if; -- qRootVersionsOnly is not null
-- Check Out Details
add
( cdwpbase.ifThenElse
( qCheckOutUser is not null
, ' AND va.created_by = '
||cdwpbase.ifThenElse
( qCheckOutUser = 'USER'
, qCheckOutUser
,''''||qCheckOutUser||''''
)
)
);
add
( cdwpbase.ifThenElse
( qCheckedOutAfter is not null
, ' AND va.date_created >= '
||date_condition( p_date_string => qCheckedOutAfter)
)
);
add
( cdwpbase.ifThenElse
( qCheckedOutBefore is not null
, ' AND va.date_created <= '
||date_condition( p_date_string => qCheckedOutBefore)
)
-- Check In Details
);
add
( cdwpbase.ifThenElse
( qCheckInUser is not null
, ' AND decode
( e.state
, ''N'' , va.created_by
, va.changed_by
) = '
||cdwpbase.ifThenElse
( qCheckInUser = 'USER'
, qCheckInUser
,''''||qCheckInUser||''''
)
)
);
add
( cdwpbase.ifThenElse
( qCheckedInAfter is not null
, ' AND decode
( e.state
, ''N'', va.date_created
, va.date_changed
) >= '
||date_condition( p_date_string => qCheckedInAfter)
)
);
add
( cdwpbase.ifThenElse
( qCheckedInBefore is not null
, ' AND nvl( va.date_changed, va.date_created) <= '
||date_condition( p_date_string => qCheckedInBefore)
)
);
add
( cdwpbase.ifThenElse
( qCreatedBy is not null
, ' AND e.created_by = '
||cdwpbase.ifThenElse
( qCreatedBy = 'USER'
, qCreatedBy
,''''||qCreatedBy||''''
)
)
);
add
( cdwpbase.ifThenElse
( qCreatedAfter is not null
, ' AND e.date_created >= '
||date_condition( p_date_string => qCreatedAfter)
)
);
add
( cdwpbase.ifThenElse
( qCreatedBefore is not null
, ' AND e.date_created <= '
||date_condition( p_date_string => qCreatedBefore)
)
);
add
( cdwpbase.ifThenElse
( qChangedBy is not null
, ' AND nvl( e.changed_by, e.created_by) = '
||cdwpbase.ifThenElse
( qChangedBy = 'USER'
, qChangedBy
,''''||qChangedBy||''''
)
)
);
add
( cdwpbase.ifThenElse
( qChangedAfter is not null
, ' AND nvl( e.date_changed, e.date_created) >= '
||date_condition( p_date_string => qChangedAfter)
)
);
add
( cdwpbase.ifThenElse
( qChangedBefore is not null
, ' AND nvl( e.date_changed, e.date_created) <= '
||date_condition( p_date_string => qChangedBefore)
)
);
add
( cdwpbase.ifThenElse
( qIrid is not null
, ' AND e.irid = '||qIrid
)
);
add
( cdwpbase.ifThenElse
( qWhere is not null
, ' AND '||qWhere
)
);
add
( cdwpbase.ifThenElse
( qTxtContains is not null
, ' AND exists
( select ''x''
from cdi_text
where parent_ivid = e.ivid
and txt_ref = e.irid
and instr( txt_text, '''||qTxtContains||''') > 0
)
' -- do not search all Secondary Elements; or should we???
)
);
add
( cdwpbase.ifThenElse
( qFileContains is not null
and
qElementType = 4819
, ' AND dbms_lob.instr
( contents_blob
, utl_raw.cast_to_raw
( '''||qFileContains||''')
, 1
) > 0
'
)
);
if qCaseSensitive ='YES'
then
add
( cdwpbase.ifThenElse
( qName is not null
, ' AND e.name '
||cdwpbase.ifThenElse
( ( instr( qName , '%') + instr( qName , '_') + instr( qName , '*') ) > 0 -- wildcards included??
, 'like '
, ' = '
)
||''''||replace ( qName, '*','%')||'''' -- to support * wildcards as if it were %
)
);
else
add
( cdwpbase.ifThenElse
( qName is not null
, ' AND lower(e.name) '
||cdwpbase.ifThenElse
( ( instr( qName , '%') + instr( qName , '_') + instr( qName , '*') ) > 0 -- wildcards included??
, 'like '
, ' = '
)
||''''||replace ( lower(qName), '*','%')||'''' -- to support * wildcards as if it were %
)
);
end if;
if qDepType is not null
then
-- check if there is any Global Name used by or provided by the versions
add( ' AND exists
( select ''x''
from sdd_dependencies d -- Global Names provided or used by e.ivid
'
||cdwpbase.ifThenElse
( qGlobalNameType is not null or qGlobalName is not null
, ', sdd_global_names gne '
)
||'
where e.ivid = '
||cdwpbase.ifthenelse
( qDepType = 'U'
, 'd.client_ivid
'
, 'd.supplier_ivid
'
)
||cdwpbase.ifThenElse
( qGlobalNameType is not null or qGlobalName is not null
, ' and gne.ivid = '
||cdwpbase.ifthenelse
( qDepType = 'U'
, 'd.supplier_ivid
'
, 'd.client_ivid
'
)
||cdwpbase.ifThenElse
( qGlobalNameType is not null
,' and ( gne.type_id = '||qGlobalNameType||'
or
gne.domain_irid = '||qGlobalNameType||'
)
'
)
||cdwpbase.ifThenElse
( qGlobalName is not null
, cdwpbase.ifThenElse
( instr( qGlobalName, '%') + instr( qGlobalName, '*') > 0
,' and gne.name like '''||replace(qGlobalName,'*','%')||'''
'
,' and gne.name = '''||qGlobalName||'''
'
)
)
)
||' UNION
select ''x''
from sdd_dependencies d -- Global Names provided or used by e.ivid
'
||cdwpbase.ifThenElse
( qGlobalNameType is not null or qGlobalName is not null
, ', sdd_global_names gne '
)
||'
where e.ivid = '
||cdwpbase.ifthenelse
( qDepType = 'U'
, 'd.client_parent_ivid
'
, 'd.supplier_parent_ivid
'
)
||cdwpbase.ifThenElse
( qGlobalNameType is not null or qGlobalName is not null
, ' and gne.ivid = '
||cdwpbase.ifthenelse
( qDepType = 'U'
, 'd.supplier_ivid
'
, 'd.client_ivid
'
)
||cdwpbase.ifThenElse
( qGlobalName is not null
, cdwpbase.ifThenElse
( instr( qGlobalName, '%') + instr( qGlobalName, '*') > 0
,' and gne.name like '''||replace(qGlobalName,'*','%')||'''
'
,' and gne.name = '''||qGlobalName||'''
'
)
)
||cdwpbase.ifThenElse
( qGlobalNameType is not null
,' and ( gne.type_id = '||qGlobalNameType||'
or
gne.domain_irid = '||qGlobalNameType||'
)
'
)
)
||'
)
');
end if; -- qDepType is not null
if qUsedByIvid is not null
then
add( ' AND exists
( select ''x''
from sdd_dependencies d -- Global Names provided by e.ivid
, sdd_dependencies d2 -- Dependencies on Global Names provided by e.ivid
where e.ivid = d.supplier_ivid
and d.client_ivid = d2.supplier_ivid -- Global Name = Supplier for Dependency
and (
d2.client_ivid = '||qUsedByIvid||'
OR
d2.client_parent_ivid = '||qUsedByIvid||'
)
UNION
select ''x''
from sdd_dependencies d -- Global Names provided by e.ivid
, sdd_dependencies d2 -- Dependencies on Global Names provided by e.ivid
where e.ivid = d.supplier_parent_ivid
and d.client_ivid = d2.supplier_ivid -- Global Name = Supplier for Dependency
and (
d2.client_ivid = '||qUsedByIvid||'
OR
d2.client_parent_ivid = '||qUsedByIvid||'
)
)
');
end if; -- qUsedByIvid is not null
add(' ORDER');
if p_order_by is not null
then
add(' BY '
||cdwpbase.ifThenElse
( instr(lower(p_order_by), 'touched') > 0
, cdwpbase.ifThenElse
( qElementType is not null
, ' nvl( ci.date_changed, ci.date_created) '
, ' nvl( e.date_changed, e.date_created) '
)
||cdwpbase.ifThenElse
( instr(lower(p_order_by), 'asc') > 0
, ' ASC'
, ' DESC'
)
, cdwpbase.ifThenElse
( instr(lower(p_order_by), 'path') > 0
, ' jr_name.get_path( e.ivid, ''NAME'', '''', 0) '
||cdwpbase.ifThenElse
( instr(lower(p_order_by), 'asc') > 0
, ' ASC'
, ' DESC'
)
, cdwpbase.ifThenElse
( instr(lower(p_order_by), 'type') > 0
, ' cdwpbase.get_nls_type_name( e.logical_type_id) '
,'e.'||p_order_by
)
)
)
||' , e.name '
);
else
add(' BY e.name');
add(' , e.irid ');
end if; -- p_order_by is not null
add
( ';'
||' begin
OPEN c_ivid;
FETCH c_ivid
BULK COLLECT
INTO odwasrch.g_iridTab
, odwasrch.g_ividTab
, odwasrch.g_nameTab
, odwasrch.g_vlabelTab
, odwasrch.g_dateChangedTab
, odwasrch.g_typeTab
, odwasrch.g_wbasketTab
;
close c_ivid;
end;'
, true
)
;
g_last_search_cursor:= l_cursor;
if not p_show_sql_only
then
if qWastebasket ='Y'
then
jr_context.set_wastebasket;
end if;
execute immediate l_cursor;
jr_context.unset_wastebasket;
if g_ividTab.count = 0
then
g_ividTab := t_ividTab( -1 );
g_nameTab:= t_nameTab( substr( sqlerrm||l_cursor, 1, 400)
, substr( sqlerrm||l_cursor, 401, 400)
, substr( sqlerrm||l_cursor, 801, 400)
);
end if; -- g_ividTab.count = 0
end if; --not p_show_sql_only
exception
when others
then
g_ividTab := t_ividTab( -2 );
g_iridTab := t_iridTab( null);
g_vlabelTab:= t_vlabelTab('1.0');
g_nameTab:= t_nameTab( substr( sqlerrm||l_cursor, 1, 400)
, substr( sqlerrm||l_cursor, 401, 400)
, substr( sqlerrm||l_cursor, 801, 400)
);
g_last_search_cursor:= l_cursor;
end; --runSearch
begin
null;
end; -- odwasrch
/