DBA Data[Home] [Help]

PACKAGE BODY: APPS.FND_CONC_CONNECT

Source


1 package body FND_CONC_CONNECT  as
2 /* $Header: AFCPUTOB.pls 120.3 2006/03/02 12:13:44 tkamiya ship $ */
3 
4 
5   function get_domain(web_agent in varchar2) return varchar2 is
6      pos            number;
7      l_domain_count number;
8      server_name    varchar2(240);
9      cookie_domain  varchar2(240);
10 
11   begin
12      -- strip file path from base URL
13      pos := instr(web_agent, '/', 1, 3);
14      if ( pos > 0 ) then
15        server_name := substr( web_agent, 1, pos -1 );
16      end if;
17 
18      pos := instr( server_name, ':', 1, 2);
19      if ( pos > 0 ) then
20        server_name := substr( server_name, 1, pos - 1);
21      end if;
22 
23      pos := instr( server_name, '//', 1, 1);
24      if ( pos > 0 ) then
25        server_name := substr( server_name, pos +1, length(server_name) );
26      end if;
27 
28      l_domain_count := instr(server_name,'.',-1,2);
29 
30      if l_domain_count > 0
31      then
32        l_domain_count := instr(server_name,'.',1,1);
33        server_name := substr(server_name,l_domain_count,length(server_name));
34        l_domain_count := instr(server_name,'.',-1,3);
35        IF  l_domain_count > 0 THEN
36           server_name := substr(server_name,l_domain_count,length(server_name));
37        END IF;
38        cookie_domain := server_name;
39      else
40        cookie_domain := '';
41      end if;
42 
43      return cookie_domain;
44 
45   end;
46 
47   procedure srs_url( function_name  in varchar2,
48                      c_name    in out nocopy varchar2,
49                      c_domain  in out nocopy varchar2,
50                      c_value   in out nocopy varchar2,
51                      oa_url    in out nocopy varchar2,
52 		     parameters     in varchar2) is
53 
54     l_session    number;
55     encrypt_func varchar2(30);
56     web_agent    varchar2(2000);
57     resp_appl_id number;
58     resp_id      number;
59     func_id      number;
60     l_user_id    number;
61     l_sec_grp_id number;
62     l_func       varchar2(30);
63     no_sys_priv  exception;
64     no_function  exception;
65   begin
66 
67      l_user_id := fnd_global.user_id;
68      l_sec_grp_id := fnd_global.SECURITY_GROUP_ID;
69      l_session := icx_sec.createSession(l_user_id);
70 
71      fnd_profile.get('APPS_WEB_AGENT', web_agent);
72 
73      if ( length(web_agent) > 0 ) then
74         if ( substr(web_agent,-1, 1) <> '/') then
75           web_agent := web_agent || '/';
76         end if;
77      end if;
78 
79      if ( l_session > 0 ) then
80 
81         c_name := icx_sec.getsessioncookiename;
82 
83         -- bug#:2218603, getsessioncookiedomain raising exception
84         begin
85            c_domain := icx_sec.getsessioncookiedomain;
86         exception
87            when others then
88               c_domain := '';
89         end;
90 
91         c_value := icx_call.encrypt3(l_session);
92 
93         if ((c_domain is NULL) or (c_domain = '') or (c_domain = '-1')) then
94            c_domain := get_domain(web_agent);
95         end if;
96 
97         begin
98 
99 --          select r.application_id,
100 --                 r.responsibility_id
101 --            into resp_appl_id,
102 --                 resp_id
103 --            from fnd_responsibility r,
104 --                 fnd_user_resp_groups u
105 --           where u.user_id = l_user_id
106 --             and u.responsibility_id = r.responsibility_id
107 --             and u.responsibility_application_id = r.application_id
108 --             and r.responsibility_key='SYSTEM_ADMINISTRATION'
109 --             and r.version = 'W'
110 --             and r.start_date <= sysdate
111 --             and (r.end_date is null or r.end_date > sysdate)
112 --             and u.start_date <= sysdate
113 --             and (u.end_date is null or u.end_date > sysdate);
114 --
115 -- bug5007493
116 -- performance update
117 
118 select r.application_id, r.responsibility_id
119      into resp_appl_id, resp_id
120             from fnd_responsibility r,
121                  fnd_user u, wf_local_user_roles wur
122            where r.responsibility_key = 'SYSTEM_ADMINISTRATION'
123              and r.responsibility_id = wur.role_orig_system_id
124              and r.application_id = (select application_id
125                from fnd_application
126                where application_short_name =/* Val between 1st and 2nd separator */
127                replace(
128                  substr(WUR.ROLE_NAME,
129                       INSTR(WUR.ROLE_NAME, '|', 1, 1)+1,
130                            ( INSTR(WUR.ROLE_NAME, '|', 1, 2)
131                             -INSTR(WUR.ROLE_NAME, '|', 1, 1)-1)
132                       )
133                  ,'%col', ':')
134              )
135              and wur.role_orig_system = 'FND_RESP'
136              and wur.partition_id = 2
137              and u.user_id = l_user_id
138              and wur.user_name = u.user_name
139              and r.version = 'W'
140              and r.start_date <= sysdate
141              and (r.end_date is null or r.end_date > sysdate)
142              and (wur.role_start_date is null or (trunc(wur.role_start_date) <= trunc(sysdate)))
143              and (wur.role_end_date is null or (trunc(wur.role_end_date) <= trunc(sysdate)))
144              and u.start_date <= sysdate
145              and (u.end_date is null or u.end_date > sysdate);
146 
147          exception
148            when no_data_found then
149                raise no_sys_priv;
150            when others then
151                raise;
152 
153         end;
154 
155         -- if function_name is not passed then use default FNDCPSRSSSWA
156         if ( function_name is null ) then
157           l_func := 'FNDCPSRSSSWA';
158         else
159           l_func := function_name;
160         end if;
161 
162         begin
163           select function_id
164             into func_id
165             from fnd_form_functions
166            where function_name = l_func;
167 
168           exception
169             when no_data_found then
170               raise no_function;
171             when others then
172               raise;
173 
174         end;
175 
176 --        encrypt_func := icx_call.encrypt2(resp_appl_id||'*'||resp_id||'*'||fnd_global.security_group_id||'*'||func_id||'*9999**]', l_session);
177 
178 
179 --        oa_url := web_agent || 'OracleApps.RF?F=' || encrypt_func;
180         oa_url := icx_sec.createRFURL(p_function_id=> func_id,
181                                       p_application_id=>resp_appl_id,
182                                       p_responsibility_id=>resp_id,
183                                       p_security_group_id=>l_sec_grp_id,
184                                       p_session_id=>l_session,
185                                       p_parameters=>parameters);
186 
187 
188      commit;
189 
190      end if;
191 
192      exception
193        when no_sys_priv then
194           fnd_message.set_name('FND', 'CONC-NO ICX SYSTEM ADMIN PRIV');
195        when no_function then
196           fnd_message.set_name('FND', 'CONC-FUNCTION NOT AVAILABLE');
197           fnd_message.set_token('FUNCTION', l_func, FALSE);
198        when others then
199           fnd_message.set_name ('FND', 'SQL-Generic error');
200           fnd_message.set_token ('ERRNO', sqlcode, FALSE);
201           fnd_message.set_token ('REASON', sqlerrm, FALSE);
202           fnd_message.set_token ('ROUTINE', 'FND_CONC_CONNECT: srs_url', FALSE);
203   end;
204 
205 end FND_CONC_CONNECT;