prompt Package body wsg_generic_provider... create or replace package body WSG_GENERIC_PROVIDER is -- The name of the security package used WSG_SECURITY_PACKAGE constant varchar2(10) := 'wsgsso'; /******************************************************************************/ -- Name: WSG_GENERIC_PROVIDER.get_api_version -- /******************************************************************************/ function get_api_version ( p_provider_id in integer ) return integer is begin return wwpro_api_provider.API_VERSION_1; end get_api_version; /******************************************************************************/ -- Name: WSG_GENERIC_PROVIDER.register_provider -- /******************************************************************************/ procedure register_provider ( p_provider_id in integer ) is begin null; end register_provider; /******************************************************************************/ -- Name: WSG_GENERIC_PROVIDER.deregister_provider -- /******************************************************************************/ procedure deregister_provider ( p_provider_id in integer ) is begin null; end deregister_provider; /******************************************************************************/ -- Name: WSG_GENERIC_PROVIDER.do_login -- /******************************************************************************/ procedure do_login ( p_provider_id in integer ,p_browser_cookies in wwpro_api_provider.cookie_table ,p_provider_cookies out wwpro_api_provider.cookie_table ) is v_row pls_integer; -- B1956579 : Must use type defined by wsgsso_sessions.client_id%type -- in wsgsso.sql and wsgsec.sql l_client_id VARCHAR2(240) := null; l_wsg_cookie wwpro_api_provider.cookie_record; l_dynamic_sql varchar2(500); begin -- Find any existing wsg cookie value. v_row := p_browser_cookies.first; loop exit when v_row is null or l_client_id is not null; if p_browser_cookies( v_row ).cookie_name = wsgl.WSG_CLIENTID_COOKIE then l_client_id := p_browser_cookies( v_row ).cookie_content; end if; v_row := p_browser_cookies.next( v_row ); end loop; -- -- Create or update wsgsso session passed on information from portal -- context. -- A dynamic sql call is used so that this package can be installed -- without installing the security packages. -- If there is no security package this will cause a runtime provider -- execution exception. Without security we do not need to call -- do_login, so to avoid the provider_execution_exception prevent -- do_login being called by setting the provider login frequency to -- never, in the portal provider registration. -- l_dynamic_sql := 'begin '|| WSG_SECURITY_PACKAGE || '.update_session( :1, :2, :3, true ); end;'; begin EXECUTE IMMEDIATE l_dynamic_sql USING IN OUT l_client_id, IN wwctx_api.get_ip_address, IN wwctx_api.get_user; exception when others then wwerr_api_error.add('provider', 'oracle', 'generic', 'wsg_generic_provider.do_login', p1 => sqlerrm); wwerr_api_error.add('provider', 'wsg_generic_provider', 'exec_exception', 'wsg_generic_provider.do_login'); raise wwpro_api_provider.provider_execution_exception; end; -- Return cookie with new client_id. p_provider_cookies(1).cookie_name := wsgl.WSG_CLIENTID_COOKIE; p_provider_cookies(1).cookie_content := l_client_id; p_provider_cookies(1).cookie_path := '/'; exception when wsgl.invalid_user then null; when others then raise; end do_login; /******************************************************************************/ -- Name: WSG_GENERIC_PROVIDER.get_portlet -- /******************************************************************************/ function get_portlet ( p_provider_id in integer ,p_portlet_id in integer ,p_language in varchar2 ) return wwpro_api_provider.portlet_record is l_package varchar2(30); l_dynamic_sql varchar2(4000); l_portlet_rec wwpro_api_provider.portlet_record; l_has_show_edit varchar2(1); l_has_show_edit_defaults varchar2(1); l_has_show_preview varchar2(1); begin -- -- Get the portlet package name -- begin select portlet_package into l_package from wsg_available_portlets where portlet_id = p_portlet_id; exception when no_data_found then raise wwpro_api_provider.PORTLET_NOT_FOUND_EXCEPTION; end; -- -- Build dynamic SQL to retrieve the portlet record -- l_dynamic_sql := 'DECLARE l_portlet_rec wwpro_api_provider.portlet_record; l_has_show_edit varchar2(1); l_has_show_edit_defaults varchar2(1); l_has_show_preview varchar2(1); BEGIN l_portlet_rec := '||l_package||'.get_portlet_info(p_provider_id=>'||p_provider_id||', p_language=>'''||p_language||'''); :1 := l_portlet_rec.id; :2 := l_portlet_rec.provider_id; :3 := l_portlet_rec.name; :4 := l_portlet_rec.title; :5 := l_portlet_rec.description; :6 := l_portlet_rec.image_url; :7 := l_portlet_rec.thumbnail_image_url; :8 := l_portlet_rec.help_url; :9 := l_portlet_rec.timeout; :10 := l_portlet_rec.timeout_msg; :11 := l_portlet_rec.implementation_style; :12 := l_portlet_rec.implementation_owner; :13 := l_portlet_rec.implementation_name; :14 := l_portlet_rec.content_type; :15 := l_portlet_rec.api_version; if (l_portlet_rec.has_show_edit) then l_has_show_edit := ''Y''; end if; :16 := l_has_show_edit; if (l_portlet_rec.has_show_edit_defaults) then l_has_show_edit_defaults := ''Y''; end if; :17 := l_has_show_edit_defaults; if (l_portlet_rec.has_show_preview) then l_has_show_preview := ''Y''; end if; :18 := l_has_show_preview; :19 := l_portlet_rec.language; :20 := l_portlet_rec.preference_store_path; :21 := l_portlet_rec.created_on; :22 := l_portlet_rec.created_by; :23 := l_portlet_rec.last_updated_on; :24 := l_portlet_rec.last_updated_by; END;'; -- -- Execute dynamic SQL into local portlet record -- EXECUTE IMMEDIATE l_dynamic_sql USING OUT l_portlet_rec.id ,OUT l_portlet_rec.provider_id ,OUT l_portlet_rec.name ,OUT l_portlet_rec.title ,OUT l_portlet_rec.description ,OUT l_portlet_rec.image_url ,OUT l_portlet_rec.thumbnail_image_url ,OUT l_portlet_rec.help_url ,OUT l_portlet_rec.timeout ,OUT l_portlet_rec.timeout_msg ,OUT l_portlet_rec.implementation_style ,OUT l_portlet_rec.implementation_owner ,OUT l_portlet_rec.implementation_name ,OUT l_portlet_rec.content_type ,OUT l_portlet_rec.api_version ,OUT l_has_show_edit ,OUT l_has_show_edit_defaults ,OUT l_has_show_preview ,OUT l_portlet_rec.language ,OUT l_portlet_rec.preference_store_path ,OUT l_portlet_rec.created_on ,OUT l_portlet_rec.created_by ,OUT l_portlet_rec.last_updated_on ,OUT l_portlet_rec.last_updated_by; if (l_has_show_edit = 'Y') then l_portlet_rec.has_show_edit := true; end if; if (l_has_show_edit_defaults = 'Y') then l_portlet_rec.has_show_edit_defaults := true; end if; if (l_has_show_preview = 'Y') then l_portlet_rec.has_show_preview := true; end if; return l_portlet_rec; end get_portlet; /******************************************************************************/ -- WSG_GENERIC_PROVIDER.is_portlet_runnable -- -- Private function. Takes portlet package name and calls is_runnable -- on that package using dynamic sql call. -- Returns result of is_runnable call. /******************************************************************************/ function is_portlet_runnable ( p_portlet_package in wsg_available_portlets.portlet_package%type, p_provider_id in number, p_reference_path in varchar2 ) return boolean is l_dynamic_sql varchar2(2000); l_runnable varchar2(1); begin l_dynamic_sql := 'DECLARE l_return boolean := false; BEGIN l_return := '|| p_portlet_package ||'.is_runnable(:1,:2); if l_return = TRUE then :3:=''Y''; else :3:=''N''; end if; END;'; execute immediate l_dynamic_sql using IN p_provider_id, IN p_reference_path, OUT l_runnable; if l_runnable = 'Y' then return true; else return false; end if; end is_portlet_runnable; /******************************************************************************/ -- Name: WSG_GENERIC_PROVIDER.get_portlet_list -- /******************************************************************************/ function get_portlet_list ( p_provider_id in integer ,p_start_row in integer ,p_rowcount in integer ,p_language in varchar2 ,p_security_level in boolean ,p_type in integer ) return wwpro_api_provider.portlet_table is l_portlet_list wwpro_api_provider.portlet_table; l_cnt number; begin l_cnt := 0; for c1 in (select portlet_id, portlet_package from wsg_available_portlets) loop if ( p_security_level = true ) then l_cnt := l_cnt + 1; l_portlet_list(l_cnt) := get_portlet( p_provider_id => p_provider_id ,p_portlet_id => c1.portlet_id ,p_language => p_language ); elsif ( is_portlet_runnable( c1.portlet_package, p_provider_id, c1.portlet_package ) ) then l_cnt := l_cnt + 1; l_portlet_list(l_cnt) := get_portlet( p_provider_id => p_provider_id ,p_portlet_id => c1.portlet_id ,p_language => p_language ); end if; end loop; return l_portlet_list; end get_portlet_list; /******************************************************************************/ -- Name: WSG_GENERIC_PROVIDER.is_portlet_runnable -- /******************************************************************************/ function is_portlet_runnable ( p_portlet_instance in wwpro_api_provider.portlet_instance_record ) return boolean is l_package wsg_available_portlets.portlet_package%type; l_dynamic_sql varchar2(2000); l_runnable boolean; begin begin select portlet_package into l_package from wsg_available_portlets where portlet_id = p_portlet_instance.portlet_id; exception when no_data_found then raise wwpro_api_provider.PORTLET_NOT_FOUND_EXCEPTION; end; return is_portlet_runnable( l_package, p_portlet_instance.provider_id, p_portlet_instance.reference_path ); end is_portlet_runnable; /******************************************************************************/ -- Name: WSG_GENERIC_PROVIDER.register_portlet -- /******************************************************************************/ procedure register_portlet ( p_portlet_instance in wwpro_api_provider.portlet_instance_record ) is begin null; end register_portlet; /******************************************************************************/ -- Name: WSG_GENERIC_PROVIDER.deregister_portlet -- /******************************************************************************/ procedure deregister_portlet ( p_portlet_instance in wwpro_api_provider.portlet_instance_record ) is begin null; end deregister_portlet; /******************************************************************************/ -- Name: WSG_GENERIC_PROVIDER.show_portlet -- /******************************************************************************/ procedure show_portlet ( p_portlet_record in out wwpro_api_provider.portlet_runtime_record ) is l_dynamic_sql varchar2(4000); l_has_title_region varchar2(1); l_has_border varchar2(1); l_package varchar2(30); begin if (p_portlet_record.has_title_region) then l_has_title_region := 'Y'; end if; if (p_portlet_record.has_border) then l_has_border := 'Y'; end if; -- -- Get the portlet package name -- begin select portlet_package into l_package from wsg_available_portlets where portlet_id = p_portlet_record.portlet_id; exception when no_data_found then raise wwpro_api_provider.PORTLET_NOT_FOUND_EXCEPTION; end; -- -- Create the dynamic sql -- l_dynamic_sql := 'DECLARE l_portlet_record wwpro_api_provider.portlet_runtime_record; BEGIN l_portlet_record.portlet_id := :1; l_portlet_record.provider_id := :2; l_portlet_record.node_id := :3; l_portlet_record.reference_path := :4; l_portlet_record.language := :5; l_portlet_record.exec_mode := :6; l_portlet_record.back_page_url := :7; l_portlet_record.page_url := :8; l_portlet_record.page_type := :9; if (:10 = ''Y'') then l_portlet_record.has_title_region := true; end if; if (:11 = ''Y'') then l_portlet_record.has_border := true; end if; l_portlet_record.caching_key := :12; l_portlet_record.caching_level := :13; l_portlet_record.caching_period := :14; '||l_package||'.show(l_portlet_record); :15 := l_portlet_record.portlet_id; :16 := l_portlet_record.provider_id; :17 := l_portlet_record.node_id; :18 := l_portlet_record.reference_path; :19 := l_portlet_record.language; :20 := l_portlet_record.exec_mode; :21 := l_portlet_record.back_page_url; :22 := l_portlet_record.page_url; :23 := l_portlet_record.page_type; if (l_portlet_record.has_title_region) then :24 := ''Y''; end if; if (l_portlet_record.has_border) then :25 := ''Y''; end if; :26 := l_portlet_record.caching_key; :27 := l_portlet_record.caching_level; :28 := l_portlet_record.caching_period; END;'; -- -- and execute -- EXECUTE IMMEDIATE l_dynamic_sql USING p_portlet_record.portlet_id ,p_portlet_record.provider_id ,p_portlet_record.node_id ,p_portlet_record.reference_path ,p_portlet_record.language ,p_portlet_record.exec_mode ,p_portlet_record.back_page_url ,p_portlet_record.page_url ,p_portlet_record.page_type ,l_has_title_region ,l_has_border ,p_portlet_record.caching_key ,p_portlet_record.caching_level ,p_portlet_record.caching_period ,OUT p_portlet_record.portlet_id ,OUT p_portlet_record.provider_id ,OUT p_portlet_record.node_id ,OUT p_portlet_record.reference_path ,OUT p_portlet_record.language ,OUT p_portlet_record.exec_mode ,OUT p_portlet_record.back_page_url ,OUT p_portlet_record.page_url ,OUT p_portlet_record.page_type ,OUT l_has_title_region ,OUT l_has_border ,OUT p_portlet_record.caching_key ,OUT p_portlet_record.caching_level ,OUT p_portlet_record.caching_period; if (l_has_title_region = 'Y') then p_portlet_record.has_title_region := true; end if; if (l_has_border = 'Y') then p_portlet_record.has_border := true; end if; end show_portlet; /******************************************************************************/ -- Name: WSG_GENERIC_PROVIDER.copy_portlet -- /******************************************************************************/ procedure copy_portlet ( p_copy_portlet_info in wwpro_api_provider.copy_portlet_record ) is begin null; end copy_portlet; function describe_portlet_parameters ( p_provider_id in integer ,p_portlet_id in integer ,p_language in varchar2 ) return wwpro_api_provider.portlet_parameter_table is begin null; end describe_portlet_parameters; end WSG_GENERIC_PROVIDER; / show errors