1 PACKAGE BODY AP_WEB_UTIL_PKG as
2 /* $Header: apwutilb.pls 120.1 2005/10/02 20:20:51 albowicz noship $ */
3
4 --
5 -- Encryption routine
6 --
7 function encrypt(msg in varchar2) return varchar2
8 is
9 r varchar2(5);
10 begin
11 r := to_char(dbms_random.value(0, 99999), 'FM00000');
12 return icx_call.encrypt(r || msg);
13 end encrypt;
14
15 --
16 -- Decryption routine
17 --
18 function decrypt(msg in varchar2) return varchar2
19 is
20 begin
21 return substr(icx_call.decrypt(msg), 6);
22 end decrypt;
23
24 --
25 -- Gets the proxy server
26 --
27 PROCEDURE GET_PROXY(p_host_name IN VARCHAR2, p_proxy_host OUT nocopy VARCHAR2, p_proxy_port OUT nocopy NUMBER)
28 IS
29 l_proxy VARCHAR2(255);
30 l_proxy_port VARCHAR2(255);
31 BEGIN
32 -- First, attempt to get proxy value from FND. If the proxy name is not
33 -- found, try the TCA values regardless of whether the port is found.
34 fnd_profile.get('WEB_PROXY_HOST', l_proxy);
35 fnd_profile.get('WEB_PROXY_PORT', l_proxy_port);
36
37 IF l_proxy IS NULL AND l_proxy_port IS NULL THEN
38 fnd_profile.get('HZ_WEBPROXY_NAME', l_proxy);
39 fnd_profile.get('HZ_WEBPROXY_PORT', l_proxy_port);
40 END IF;
41
42 p_proxy_host := l_proxy;
43 p_proxy_port := to_number(l_proxy_port);
44 END GET_PROXY;
45
46
47 /*
48 * Updates the download columns in AP_CARD_PROGRAMS_ALL
49 */
50 PROCEDURE UPDATE_DOWNLOAD_SIZES(p_card_program_id in NUMBER, p_file_size in NUMBER)
51 IS
52 l_curr_average_size number;
53 l_curr_download_count number;
54 BEGIN
55 SELECT nvl(average_download_size, 0), nvl(download_count, 0)
56 INTO l_curr_average_size, l_curr_download_count
57 FROM ap_card_programs_all
58 WHERE card_program_id = p_card_program_id;
59
60 UPDATE ap_card_programs_all
61 SET last_download_date = SYSDATE,
62 last_download_size = p_file_size,
63 average_download_size = (l_curr_average_size * l_curr_download_count + p_file_size) / (l_curr_download_count + 1),
64 download_count = l_curr_download_count + 1
65 WHERE card_program_id = p_card_program_id;
66 END UPDATE_DOWNLOAD_SIZES;
67
68 end AP_WEB_UTIL_PKG;