create or replace package body cdwp_br is /***************************************************************************************** Purpose HTML Report of Business Rule Functions for ODWA Usage Remarks The function cdwp_chk_fun_is_business_rule determines if a Designer business function is managed by this package or by cdwp_fun. Revision history When Who Construct Revision What ------------------------------------------------------------------------------------------ $REVISION_HISTORY$ 08-feb-2001 SANDRA MULLER 3.3 fix for issue 190: allow for br's without parent 07-feb-2001 Lucas Jellema 3.2 - add call to cdwp_fun. procedure implicitly_triggered_by 12-sep-2000 Lucas Jellema 3.1 Tune queries, version resolve (use i$SDD...), include HINTS Let odwarprt (through odwasrch) find the root-functions. 08-sep-2000 Lucas Jellema 3.0 Same support as FUN for toggle Tree/Details view c_root_fun should also return resutls when no folder context is set (context=WA or CFG) Removed summary_modfun (to cdwp_fun); changed call accordingly Show version label of functions in Tree View 11-aug-2000 Lucas Jellema 2.7 Enable DEU 04-aug-2000 MARC VAHSEN 2.6 Upgrade to designer 6i 20-jun-2000 Lucas Jellema procedure triggering_business_functions 2.5 + if a rule has no events, indicate for triggering functions they trigger Implicitly i.e. through data usages instead of data event triggers 20-jun-2000 Lucas Jellema c_trgfun 2.4 + if there are no triggering events for a Static Business Rule, take the Data Usages as input to derive what the triggers are (in line with the Headstart Utilities Business Rule Design Transformer) + in addition to the first item: the listing of triggering functions should also take into account that triggering events maybe events indirectly derived from the data usages 08-jun-2000 Lucas Jellema cursor c_funtrg 2.3 + only list function/rule as triggering if there is a real attribute update of the attribute triggering the event that triggers the rule/function 29-may-2000 Lucas Jellema root_functions 2.2 + do not reset_context (since this procedure is called by others who rely on that context) 29-may-2000 Lucas Jellema list_BR_definitions 2.1 + write menu_bar (status bar) for one_file = 'Y' 25-may-2000 Lucas Jellema short_list_ and list_ 2.0 + all functional improvements, such as + write_not_found + write_about + use report_link for hyperjumps + app_summary + icon bar + set_context and set_app + set_base_url and local_link 19-may-2000 Sandra Muller root_business_rules 1.2 c_root_fun: forgotten to remove child_fun from from-clause summary_childfun, list_business_rules changed function.gif to function_hierarchy_diagrammer.gif 12-may-2000 Sandra Muller root_business_rules 1.1 c_root_fun: made it a lot faster by disabling name filter also removed selection of child function so that stand-alone functions are shown as well list_business_rules, root_business_rules added write_about 25-apr-2000 Lucas Jellema 1.0 Creation 2.6 UPDGRADE TO DESIGNER 6i - specification changed of - root_business_rules - list_business_rules - root_business_functions: - call to odwactxt.update_context - call to cdwp.include_report_styles - deleted call to cdwpbase.reset_context; - list_business_functions: - call to odwactxt.update_context - deleted call to cdwpbase.reset_context - procedure icon_bar - call cdwp_fun version - htp. tableOpen and tableRowOpen changed in cdwp. tableOpen and tableRowOpen - htp. tableClose and tableRowClose changed in cdwp. tableClose and tableRowClose - the function property "atomic" has disappeared in des 6i, so we cannot make use of this property whether to make a link of a business rule function. This functionality has thus been removed. to do - summary_modfun_definitions show icon for module after upgrade of cdwp_mde to 6i - upgrade call to cdwp_dia call after upgrade of this package *****************************************************************************************/ -- -- private constants -- REVISION_LABEL constant varchar2(30) := '$x.y::3.3 $'; PACKAGE_NAME constant varchar2(30) := 'CDWP_BR'; -- -- -- cursor c_fun ( b_fun_ivid in number ) is select /*+ RULE */ fun.id , fun.irid , fun.ivid , fun.function_label , fun.short_definition , fun.frequency , fun.frequency_unit , decode(fun.response_needed , 'IMMEDIATE', 'Immediate' , 'OVERNIGHT', 'Overnight' , null, null , 'unknown' ) response_needed , fun.function_type , fun.parent_reference , fun.common_function_reference , parfun.function_label parent_function_label , parfun.short_definition parent_short_definition , parfun.ivid parent_ivid from i$sdd_fun parfun , ci_functions fun where fun.ivid = b_fun_ivid and fun.parent_reference = parfun.irid and parfun.ivid = cdwpbase.get_best_ivid( fun.parent_reference) -- 3.3 also select functions without a parent union select /*+ RULE */ fun.id , fun.irid , fun.ivid , fun.function_label , fun.short_definition , fun.frequency , fun.frequency_unit , decode(fun.response_needed , 'IMMEDIATE', 'Immediate' , 'OVERNIGHT', 'Overnight' , null, null , 'unknown' ) response_needed , fun.function_type , fun.parent_reference , fun.common_function_reference , null parent_function_label , null parent_short_definition , to_number(null) parent_ivid from ci_functions fun where fun.ivid = b_fun_ivid and fun.parent_reference is null ; -- -- procedure to create HTML listing all root business functions in -- a specific application system -- procedure root_business_rules ( p_session_id in number ) is l_first boolean:= true; -- /*skhwaja : Replace the view with base table name to support 817 database*/ cursor c_fun_tree ( b_fun_id in number ) is select fun.irid fun_id , fun.function_label fun_function_label , fun.short_definition fun_short_definition , fun.function_type fun_function_type , fun.irid fun_irid , fun.ivid fun_ivid , level from i$sdd_fun fun where jr_vn.context(fun.ivid) > 0 and fun.ivid = cdwpbase.get_best_ivid( fun.irid) start with fun.irid = b_fun_id connect by prior fun.irid = fun.parent_ref; begin -- root_business_rules cdwp.tableOpen('BORDER="0"'); cdwp.tableRowOpen; cdwp.TableDataHeading ( '' ||'Detail View' ||'' ||'
' ||'' ||'List View' ||'' ); cdwp.tableRowClose; for i in 1..odwasrch.g_ividTab.count loop for r_fun_tree in c_fun_tree(b_fun_id => odwasrch.g_iridTab(i) ) loop cdwp.tableRowOpen; cdwpbase.set_found; -- make no use of tabledataheading, so we have more room on the right side of the tree. -- cdwp.TableDataHeading(null); cdwp.tableDataValue( cdwpbase.nbsp(10), p_width => 80); for i in 1..r_fun_tree.level-2 loop cdwp.TableDataValue('|', 2, 10); end loop; if r_fun_tree.level > 1 then cdwp.TableDataValue('|___', 2, 10); end if; cdwp.TableDataValue ( cdwp.report_link ( p_el_id => r_fun_tree.fun_id , p_type_of => 'BR' , p_text => cdwp.add_images('{rule.gif} ') ||r_fun_tree.fun_function_label ) ||' ('||odwavrsn.get_version_label( r_fun_tree.fun_ivid)||')' , p_colspan => 10 ); for i in r_fun_tree.level..6 loop cdwp.TableDataValue(' ', 2, 10); end loop; cdwp.TableDataValue ( r_fun_tree.fun_short_definition , 2 , 600 --500 ); cdwp.tableRowClose; end loop; --r_fun_tree end loop; -- i in 1..odwasrch.g_ividTab.count cdwpbase.write_no_found( p_message => ROB_msg.getMsg(Rob_msg.MSG210_CDWP_RULEFUNTIONNA, '', '', '', '')); cdwp.tableClose; end; -- root_business_rules -- -- procedure list_business_rules ( p_session_id in number , p_irid in number default null , p_ivid in number default null ) is -- -- cursor to select properties of a specific business function -- cursor c_fun2 ( b_fun_irid number ) is select fun.irid fun_id , fun.ivid fun_ivid , fun.function_type fun_function_type , fun.function_label fun_function_label , fun.short_definition fun_short_definition , fun.elementary_flag fun_elementary_flag from i$sdd_fun fun where fun.ivid = cdwpbase.get_best_ivid( b_fun_irid) ; r_fun2 c_fun2%rowtype; -- l_first boolean; l_business_rule boolean; -- begin -- list_business_rules -- if an ivid is passed in, that suggests we are going outside the workarea -- so in updating the context, the workarea id should be reset odwactxt.update_context ( p_session_id => p_session_id , p_package_name => PACKAGE_NAME , p_procedure_name=> 'list_business_rules' , p_pac_irid => p_irid , p_pac_ivid => p_ivid , p_pac_type_id => 5024 ); cdwpbase.start_timer; htp.htmlOpen; htp.headOpen; cdwp.include_report_styles; cdwp.write_about(package_name, revision_label); if odwactxt.get_one_file = 'Y' then htp.title ( cdwpbase.get_el_name ( p_el_id => odwactxt.get_folder_irid , p_el_type_of => 'APP' ) ||' - '||ROB_msg.getMsg(Rob_msg.DSP260_CDWP_BRULE, '', '', '', '')||'s' ); else htp.title ( cdwpbase.get_el_name ( p_el_id => odwactxt.get_folder_irid , p_el_type_of => 'APP' ) ||' - '||ROB_msg.getMsg(Rob_msg.DSP260_CDWP_BRULE, '', '', '', '')||' - ' ||cdwpbase.get_el_name( p_el_id => nvl(p_irid, cdwpbase.get_irid( p_ivid)), p_el_type_of => 'FUN') ); -- odwactxt.get_one_file = 'Y' end if; htp.headClose; htp.bodyOpen; cdwpbase.open_timer_form; if odwactxt.get_one_file = 'Y' then root_business_rules ( p_session_id => odwactxt.get_session_id ); htp.nl; htp.nl; htp.nl; end if; -- -- create detailed business function descriptions -- for r_fun in c_fun( b_fun_ivid => nvl( p_ivid, cdwpbase.get_ivid( p_irid => p_irid))) loop odwactxt.update_context ( p_pac_irid => r_fun.irid , p_pac_ivid => r_fun.ivid , p_new_request => false ); cdwpbase.set_base_url ( p_el_id => r_fun.id , p_el_name => r_fun.function_label , p_type_of => 'BR' ); -- -- -- if cdwp_chk_fun_is_business_rule ( r_fun.id , r_fun.function_label , r_fun.function_type ) = 'Y' then l_business_rule := true; cdwp.bookmark(p_target_code => r_fun.function_label); cdwp.menu_bar ( p_level => 2 , p_el_short_name => 'BR' , p_el_id => r_fun.id ); cdwp.heading(3); cdwp.p ( r_fun.function_label||' - '||r_fun.short_definition , p_style => 'partitle' ); htp.nl; htp.nl; -- cdwp_fun.icon_bar; -- -- short definition -- cdwp.tableOpen('BORDER="0"'); -- odwavrsn.version_status; cdwpbase.app_summary ( p_el_id => r_fun.id ); cdwp.tableRowOpen; cdwp.TableDataHeading(ROB_msg.getMsg(Rob_msg.CAP010_CDWP_SHORTDEF, '', '', '', '')); cdwp.TableDataValue(r_fun.short_definition); cdwp.tableRowClose; cdwp_txt.display_mlt ( p_el_id => r_fun.id , p_txt_type => 'CDIDSC' , p_mlt_prompt_name => null , p_replace_entities => true , p_replace_tables => false , p_max_lines => null , p_el_type => 'BR' ); -- -- parent function -- if r_fun.parent_reference is not null then cdwp.tableRowOpen; cdwp.TableDataHeading('Parent function'); cdwp.TableDataValue ( cdwp.report_link ( p_el_id => r_fun.parent_reference , p_type_of => 'FUN' , p_text => '{gif} ' ||r_fun.parent_function_label ||' - ' ||r_fun.parent_short_definition ) ); cdwp.tableRowClose; end if; -- -- common function -- if r_fun.common_function_reference is not null then open c_fun2(b_fun_irid => r_fun.common_function_reference); fetch c_fun2 into r_fun2; if c_fun2%found then cdwp.tableRowOpen; cdwp.TableDataHeading(ROB_msg.getMsg(Rob_msg.CAP030_CDWP_MASTERFUN, '', '', '', '')); if r_fun2.fun_elementary_flag = 'Y' then cdwp.TableDataValue ( cdwp.report_link ( p_el_id => r_fun2.fun_id , p_ivid => r_fun2.fun_ivid , p_type_of => 'BR' , p_text => cdwp.add_images('{rule.gif}') -- {gif} returns wrong gif ||' ' ||r_fun2.fun_function_label ||' - ' ||r_fun2.fun_short_definition ) ); else cdwp.tableDataValue ( r_fun2.fun_function_label ||' - ' ||r_fun2.fun_short_definition ); end if; -- elementary cdwp.tableRowClose; end if; -- c_fun2%found close c_fun2; end if; -- r_fun.common_function_reference is not null -- -- frequency -- if nvl(r_fun.frequency,0) <> 0 or r_fun.frequency_unit is not null then cdwp.tableRowOpen; cdwp.TableDataHeading(ROB_msg.getMsg(Rob_msg.CAP031_CDWP_FREQ, '', '', '', '')); cdwp.TableDataValue(to_char(r_fun.frequency)||' / '||r_fun.frequency_unit); cdwp.tableRowClose; end if; -- -- response needed -- if r_fun.response_needed is not null then cdwp.tableRowOpen; cdwp.TableDataHeading(ROB_msg.getMsg(Rob_msg.CAP032_CDWP_RESPONSEREQ, '', '', '', '')); cdwp.TableDataValue(r_fun.response_needed); cdwp.tableRowClose; end if; cdwp.tableClose; -- cdwp_fun.summary_childfun; -- cdwp_fun.summary_funent; -- cdwp_fun.summary_funevt; -- cdwp_fun.summary_etg; -- cdwp_fun.triggered_business_rules ( p_fun_name => r_fun.function_label , p_br => 'Y' ); -- cdwp_fun.triggered_business_rules ( p_fun_name => r_fun.function_label , p_br => 'N' ); -- cdwp_fun.implicitly_triggered_by ( p_br => 'N' ); cdwp_fun.implicitly_triggered_by ( p_br => 'Y' ); cdwp_fun.summary_evtfun; -- cdwp_fun.summary_modfun_definitions; -- cdwp_dia.list_in_diagrams ( p_el_id => r_fun.id ); if cdwp.exists_mlt ( p_id => odwactxt.get_pac_ivid , p_not_include1 => 'CDIDSC' ) then cdwp.bookmark('FUN_MLT'||to_char(r_fun.irid)); -- BOOKMARK cdwp.tableOpen('BORDER="0"'); cdwp.tableRowOpen; cdwp.TableDataHeading ( cdwp.add_images('{mlt.gif}') ||ROB_msg.getMsg(Rob_msg.DSP259_CDWP_MLTF, r_fun.function_label, '', '', '') ); cdwp.TableDataValue(''); cdwp.tableRowClose; cdwp.tableRowOpen; cdwp_txt.display_all_mlt ( p_el_id => r_fun.irid , p_max_lines => null , p_do_not_display1 => 'CDIDSC' , p_el_type => 'FUN' ); cdwp.tableRowClose; cdwp.tableClose; end if; -- cdwp.exists_mlt = true end if; -- cdwp_chk_fun_is_business_rule end loop; --r_fun cdwpbase.write_timer; htp.formClose; htp.bodyClose; htp.htmlClose; -- 2.0 cdwpbase.reset_context; end; begin null; end; /