DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_KPI

Source


1 PACKAGE BODY HR_KPI as
2 /* $Header: hrkpi02.pkb 120.0.12010000.1 2008/07/28 03:27:59 appldev ship $ */
3 
4 
5 -- AOL logging info
6 
7 l_module_name CONSTANT VARCHAR2(20)  := 'per.client.';
8 
9 
10 procedure debug_start(package_name in varchar2,method_name in varchar2)
11 is
12 	begin
13 
14 		if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
15 
16 			 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,package_name||'.'||method_name,'start');
17 
18 		end if;
19 end debug_start;
20 
21 procedure debug_end(package_name in varchar2,method_name in varchar2)
22 is
23 	begin
24 		if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
25 
26 			  FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,package_name||'.'||method_name,'end');
27 
28 		end if;
29 end debug_end;
30 
31 procedure debug_text(package_name in varchar2,method_name in varchar2,message_text in varchar2)
32 is
33 	begin
34 		if( FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
35 
36 			  FND_LOG.STRING (FND_LOG.LEVEL_STATEMENT,package_name||'.'||method_name,message_text);
37 
38 		end if;
39 end debug_text;
40 
41 procedure debug_event(package_name in varchar2,method_name in varchar2,message_text in varchar2)
42 is
43 	begin
44 		if( FND_LOG.LEVEL_EVENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
45 
46 			  FND_LOG.STRING (FND_LOG.LEVEL_EVENT,package_name||'.'||method_name,message_text);
47 
48 		end if;
49 end debug_event;
50 
51 
52 procedure debug_exception(routine in varchar2,
53                         errcode in number,
54                         errmsg in varchar2)
55  is
56 begin
57     fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
58     fnd_message.set_token('ROUTINE', routine);
59     fnd_message.set_token('ERRNO', errcode);
60     fnd_message.set_token('REASON', errmsg);
61     if( FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
62       fnd_log.message(FND_LOG.LEVEL_EXCEPTION,routine, TRUE);
63     end if;
64     fnd_message.raise_error;
65 end debug_exception;
66 
67 
68   function request_pvt (context in varchar2, cookie in out nocopy varchar2,sid in varchar2)
69      return varchar2 as language java name
70   'oracle.apps.per.ki.dbclient.DBClient.callServer(java.lang.String, java.lang.String[],java.lang.String) return String' ;
71 
72   --
73   -- We make request() an autonmous tranaction so that it can be called
74   -- from sql. In particular in the getadapters() routine
75   --
76   function request (context in varchar2, cookie in out nocopy varchar2,sid in varchar2)
77   return varchar2 is
78   pragma autonomous_transaction ;
79   l_result varchar2(2000);
80   begin
81 
82    debug_start(l_module_name||'hr_kpi','request');
83    debug_text(l_module_name||'hr_kpi','request','context =' || context||'session_id='||sid);
84    debug_text(l_module_name||'hr_kpi','request','cookie =' || cookie);
85 
86    l_result := request_pvt('&'||context, cookie,sid);
87 
88    if l_result is null then
89      l_result := 'type=ERROR' || '&' || 'sub=' || '&' ||
90                  'value=A null response was received from the servlet';
91    end if;
92 
93    debug_end(l_module_name||'hr_kpi','request');
94 
95    return(l_result);
96   end ;
97 
98   procedure parseResponse_pvt (response  in     varchar2,
99 			   l_type      in out nocopy varchar2,
100                            l_sub       in out nocopy varchar2,
101                            l_value     in out nocopy varchar2,
102                            l_error     in out nocopy varchar2
103                            )
104     as language java name
105       'oracle.apps.per.ki.dbclient.DBMessageParser.parseResponse(java.lang.String, java.lang.String[],java.lang.String[],java.lang.String[],java.lang.String[])';
106 
107   procedure parseResponse (response  in     varchar2,
108                            l_type       in out nocopy varchar2,
109                            l_sub    in out nocopy varchar2,
110                            l_value   in out nocopy varchar2,
111                            l_error    in out nocopy varchar2
112                            ) is
113   begin
114 
115        parseResponse_pvt(response,l_type,l_sub,l_value,l_error);
116 
117    exception when others
118    then
119         --null;
120         debug_exception(routine=>l_module_name||'.'||'hr_kpi'||'parseResponse_pvt' ,
121                       errcode=>null,
122                       errmsg=> 'error occured in parseResponse_pvt' ) ;
123   end parseResponse;
124 
125   -- qqq Move to java side ??
126   procedure save_user_preference ( p_name  in varchar2,
127                                    p_value in varchar2 ) is
128   pragma autonomous_transaction;
129   begin
130 
131     if fnd_profile.save_user(p_name,p_value)
132     then
133        commit;
134     else
135        -- qqq should raise an error ?
136        null;
137     end if;
138 
139   end ;
140 
141 end hr_kpi;