DBA Data[Home] [Help]

PACKAGE BODY: APPS.FND_SESSION_UTILITIES

Source


1 package body FND_SESSION_UTILITIES as
2 /* $Header: AFICXSUB.pls 115.8 2004/06/21 13:55:57 dlorah noship $ */
3 
4   function SessionID_to_XSID(p_session_id in number) return varchar2
5   is
6     l_XSID varchar2(32);
7   begin
8     select XSID
9     into   l_XSID
10     from   ICX_SESSIONS
11     where  SESSION_ID = p_session_id;
12     if l_XSID is null
13     then
14       l_XSID := icx_call.encrypt3(p_session_id);
15     end if;
16 
17     return l_XSID;
18 
19   exception
20     when no_data_found then
21       l_XSID := NULL;
22       return l_XSID;
23   end SessionID_to_XSID;
24 
25   function XSID_to_SessionID(p_XSID in varchar2) return number
26   is
27     l_SessionID number;
28   begin
29     if substrb(p_XSID,-2,2) <> ':S'
30     then
31       l_SessionID := icx_call.decrypt3(p_XSID);
32     else
33       select SESSION_ID
34       into   l_SessionID
35       from   ICX_SESSIONS
36       where  XSID = p_XSID;
37     end if;
38 
39     return l_SessionID;
40 
41   exception
42     when no_data_found then
43       l_SessionID := NULL;
44       return l_SessionID;
45   end XSID_to_SessionID;
46 
47   function TransactionID_to_XTID(p_transaction_id in number) return varchar2
48   is
49   -- l_XTID varchar2(32);
50   begin
51 
52     return p_transaction_id;
53 
54   end TransactionID_to_XTID;
55 
56 
57   function XTID_to_TransactionID(p_XTID in varchar2) return number
58   is
59     l_TransactionID number;
60   begin
61 
62     -- nlbarlow, have to still support backward compatibility.
63     begin
64 
65   if (translate(p_XTID, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
66         'xxxxxxxxxxxxxxxxxxxxxxxxxx') <> p_XTID)
67        then
68      l_TransactionID := icx_call.decrypt3(p_XTID);
69 
70    else
71 
72       select TRANSACTION_ID
73       into   l_TransactionID
74       from   ICX_TRANSACTIONS
75       where  TRANSACTION_ID = p_XTID;
76 
77   end if;
78 
79 /*
80 
81     exception
82       when no_data_found then
83         l_TransactionID := NULL;
84       when others then
85         l_TransactionID := icx_call.decrypt3(p_XTID);
86 */
87 
88 
89      exception
90      when no_data_found then
91       l_TransactionID := NULL;
92 
93     end;
94 
95     return l_TransactionID;
96 
97   end XTID_to_TransactionID;
98 
99 
100 
101 
102 
103 
104 
105   function MAC(p_source in varchar2,
106                p_session_id in number) return varchar2 is
107     l_source raw(2000);
108     l_key    raw(20);
109     l_mac    raw(16);
110   begin
111 
112     l_source := utl_raw.cast_to_raw(p_source);
113 
114     select MAC_KEY
115     into   l_key
116     from   ICX_SESSIONS
117     where  SESSION_ID = p_session_id;
118 
119     l_mac := fnd_crypto.mac(source => l_source,
120                             mac_type => fnd_crypto.HMAC_MD5,
121                             key => l_key);
122 
123     return fnd_crypto.encode(source => l_mac,
124                              fmt_type => fnd_crypto.ENCODE_URL);
125 
126    exception
127      when no_data_found then
128      l_mac := NULL;
129      return l_mac;
130 
131   end;
132 
133 end FND_SESSION_UTILITIES;