[Home] [Help]
PACKAGE BODY: APPS.XLA_CONTEXT_PKG
Source
1 PACKAGE BODY XLA_CONTEXT_PKG AS
2 -- $Header: xlacmctx.pkb 120.7 2011/01/12 03:12:26 vkasina ship $
3 /*===========================================================================+
4 | Copyright (c) 2001-2002 Oracle Corporation |
5 | Redwood Shores, CA, USA |
6 | All rights reserved. |
7 +============================================================================+
8 | FILENAME |
9 | xlacmctx.pkb |
10 | |
11 | PACKAGE NAME |
12 | xla_context_pkg |
13 | |
14 | DESCRIPTION |
15 | This context package is used to set the attribute values for the |
16 | application context namespace "XLA" |
17 | |
18 | HISTORY |
19 | 23-Jan-03 S. Singhania Created |
20 | 17-Apr-03 S. Singhania Added body for the following: |
21 | - set_acct_err_context |
22 | - get_acct_err_context |
23 | - clear_acct_err_context |
24 | 12-Oct-05 A.Wan 4645092 - MPA report changes |
25 | |
26 +===========================================================================*/
27
28 --=============================================================================
29 -- *********** public procedures and functions **********
30 --=============================================================================
31 --=============================================================================
32 --
33 --
34 --
35 --
36 --
37 --
38 --
39 --
40 --
41 --
42 -- Following are the public routines that can be called to set attributes
43 -- for a naempsace (application context)
44 --
45 -- 1. set_security_context
46 -- 2. set_acct_err_contex
47 -- 3. get_acct_err_contex
48 -- 4. clear_acct_err_contex
49 -- 5. set_event_set_id_context
50 --
51 --
52 --
53 --
54 --
55 --
56 --
57 --
58 --
59 --
60 --
61 --
62 --=============================================================================
63 --=============================================================================
64 --
65 --
66 --
67 --=============================================================================
68 PROCEDURE set_security_context
69 (p_security_group IN VARCHAR2) IS
70 BEGIN
71 ----------------------------------------------------------------------------
72 -- Following sets the value for the attribute 'SECURITY_GROUP' for the
73 -- application context namespace 'XLA'
74 ----------------------------------------------------------------------------
75 dbms_session.set_context
76 ('XLA','SECURITY_GROUP',p_security_group);
77 EXCEPTION
78 WHEN xla_exceptions_pkg.application_exception THEN
79 RAISE;
80 WHEN OTHERS THEN
81 xla_exceptions_pkg.raise_message
82 (p_location => 'xla_context_pkgset_security_context');
83 END set_security_context;
84
85 --=============================================================================
86 --
87 --
88 --
89 --=============================================================================
90 PROCEDURE set_acct_err_context
91 (p_error_count IN NUMBER
92 ,p_client_id IN VARCHAR2) IS
93 BEGIN
94 ----------------------------------------------------------------------------
95 -- Following sets the value for the attribute 'ACCOUNTING_ERRORS_COUNT' for the
96 -- application context namespace 'XLA_GLOBAL'
97 ----------------------------------------------------------------------------
98 dbms_session.set_context
99 (namespace => 'XLA_GLOBAL'
100 ,attribute => 'ACCOUNTING_ERRORS_COUNT'
101 ,value => TO_CHAR(p_error_count)
102 ,username => NULL
103 ,client_id => p_client_id);
104
105 EXCEPTION
106 WHEN xla_exceptions_pkg.application_exception THEN
107 RAISE;
108 WHEN OTHERS THEN
109 xla_exceptions_pkg.raise_message
110 (p_location => 'xla_context_pkgset_security_context');
111 END set_acct_err_context;
112
113 --=============================================================================
114 --
115 --
116 --
117 --=============================================================================
118 FUNCTION get_acct_err_context
119 RETURN NUMBER IS
120 BEGIN
121 RETURN NVL(sys_context('XLA_GLOBAL','ACCOUNTING_ERRORS_COUNT'),0);
122 EXCEPTION
123 WHEN xla_exceptions_pkg.application_exception THEN
124 RAISE;
125 WHEN OTHERS THEN
126 xla_exceptions_pkg.raise_message
127 (p_location => 'xla_context_pkg.get_acct_err_context');
128 END get_acct_err_context;
129
130
131 FUNCTION increment_acct_err_context
132 (p_error_count_increment IN NUMBER
133 ,p_client_id IN VARCHAR2) RETURN NUMBER IS
134 l_current_count NUMBER;
135 BEGIN
136 l_current_count := xla_context_pkg.get_acct_err_context()
137 + p_error_count_increment;
138
139 xla_context_pkg.set_acct_err_context(l_current_count,
140 p_client_id);
141
142 RETURN(l_current_count);
143 EXCEPTION
144 WHEN xla_exceptions_pkg.application_exception THEN
145 RAISE;
146 WHEN OTHERS THEN
147 xla_exceptions_pkg.raise_message
148 (p_location => 'xla_context_pkg.increment_acct_err_context');
149 END increment_acct_err_context;
150
151 --=============================================================================
152 --
153 --
154 --
155 --=============================================================================
156 PROCEDURE clear_acct_err_context
157 (p_client_id IN VARCHAR2) IS
158 BEGIN
159 ----------------------------------------------------------------------------
160 -- Following sets the value for the attribute 'ACCOUNTING_ERRORS_COUNT' for the
161 -- application context namespace 'XLA_GLOBAL'
162 ----------------------------------------------------------------------------
163 dbms_session.clear_context
164 (namespace => 'XLA_GLOBAL'
165 ,attribute => 'ACCOUNTING_ERRORS_COUNT'
166 ,client_id => p_client_id);
167
168 EXCEPTION
169 WHEN xla_exceptions_pkg.application_exception THEN
170 RAISE;
171 WHEN OTHERS THEN
172 xla_exceptions_pkg.raise_message
173 (p_location => 'xla_context_pkgset_security_context');
174 END clear_acct_err_context;
175
176
177 ------------------------------------------------------------------------------
178 -- 4645092 To set MPA-Accrual context
179 ------------------------------------------------------------------------------
180 PROCEDURE set_mpa_accrual_context
181 (p_mpa_accrual_exists IN VARCHAR2
182 ,p_client_id IN VARCHAR2 DEFAULT NULL) IS
183 BEGIN
184 ----------------------------------------------------------------------------
185 -- Following sets the value for the attribute 'MPA_ACCRUAL_EXISTS' for the
186 -- application context namespace 'XLA_GLOBAL'
187 ----------------------------------------------------------------------------
188 dbms_session.set_context
189 (namespace => 'XLA_GLOBAL'
190 ,attribute => 'MPA_ACCRUAL_EXISTS'
191 ,value => p_mpa_accrual_exists
192 ,username => NULL
193 ,client_id => p_client_id);
194 EXCEPTION
195 WHEN xla_exceptions_pkg.application_exception THEN
196 RAISE;
197 WHEN OTHERS THEN
198 xla_exceptions_pkg.raise_message
199 (p_location => 'xla_context_pkg.set_mpa_accrual_context');
200 END set_mpa_accrual_context;
201
202 ------------------------------------------------------------------------------
203 -- 4645092 To get MPA-accrual context
204 ------------------------------------------------------------------------------
205 FUNCTION get_mpa_accrual_context
206 RETURN VARCHAR2 IS
207 BEGIN
208 RETURN NVL(sys_context('XLA_GLOBAL','MPA_ACCRUAL_EXISTS'),'N');
209 EXCEPTION
210 WHEN xla_exceptions_pkg.application_exception THEN
211 RAISE;
212 WHEN OTHERS THEN
213 xla_exceptions_pkg.raise_message
214 (p_location => 'xla_context_pkgget_mpa_accrual_context');
215 END get_mpa_accrual_context;
216
217
218 ------------------------------------------------------------------------------
219 -- 4645092 To clear MPA-accrual context
220 ------------------------------------------------------------------------------
221 PROCEDURE clear_mpa_accrual_context
222 (p_client_id IN VARCHAR2) IS
223 BEGIN
224 ----------------------------------------------------------------------------
225 -- Following sets the value for the attribute 'MPA_ACCRUAL_EXISTS' for the
226 -- application context namespace 'XLA_GLOBAL'
227 ----------------------------------------------------------------------------
228 dbms_session.clear_context
229 (namespace => 'XLA_GLOBAL'
230 ,attribute => 'MPA_ACCRUAL_EXISTS'
231 ,client_id => p_client_id);
232 EXCEPTION
233 WHEN xla_exceptions_pkg.application_exception THEN
234 RAISE;
235 WHEN OTHERS THEN
236 xla_exceptions_pkg.raise_message
237 (p_location => 'xla_context_pkgclear_mpa_accrual_context');
238 END clear_mpa_accrual_context;
239
240 ---------------------------------------------------------------------
241 -- 4865292 Event context
242 ---------------------------------------------------------------------
243 PROCEDURE set_event_count_context
244 (p_event_count IN NUMBER
245 ,p_client_id IN VARCHAR2 DEFAULT NULL) IS
246
247 BEGIN
248 ----------------------------------------------------------------------------
249 -- Following sets the value for the attribute 'EVENT_COUNT' for the
250 -- application context namespace 'XLA'
251 ----------------------------------------------------------------------------
252
253 --changed namespace parameter from global to local bug8744290
254
255 dbms_session.set_context
256 (namespace => 'XLA'
257 ,attribute => 'EVENT_COUNT'
258 ,value => TO_CHAR(p_event_count)
259 ,username => NULL
260 ,client_id => p_client_id);
261
262 EXCEPTION
263 WHEN xla_exceptions_pkg.application_exception THEN
264 RAISE;
265 WHEN OTHERS THEN
266 xla_exceptions_pkg.raise_message
267 (p_location => 'xla_context_pkg.set_event_count_context');
268 END set_event_count_context;
269
270 FUNCTION get_event_count_context
271 RETURN NUMBER IS
272 BEGIN
273
274 RETURN NVL(sys_context('XLA','EVENT_COUNT'),0);
275
276 END get_event_count_context;
277
278 PROCEDURE set_event_nohdr_context
279 (p_nohdr_extract_flag IN VARCHAR2
280 ,p_client_id IN VARCHAR2 DEFAULT NULL) IS
281 BEGIN
282 ----------------------------------------------------------------------------
283 -- Following sets the value for the attribute 'NO_HDR_EXTRACT_FLAG' for
284 -- the application context namespace 'XLA_GLOBAL'
285 ----------------------------------------------------------------------------
286 dbms_session.set_context
287 (namespace => 'XLA_GLOBAL'
288 ,attribute => 'NO_HDR_EXTRACT_FLAG'
289 ,value => p_nohdr_extract_flag
290 ,username => NULL
291 ,client_id => p_client_id);
292
293 EXCEPTION
294 WHEN xla_exceptions_pkg.application_exception THEN
295 RAISE;
296 WHEN OTHERS THEN
297 xla_exceptions_pkg.raise_message
298 (p_location => 'xla_context_pkg.set_event_nohdr_context');
299 END set_event_nohdr_context;
300
301 FUNCTION get_event_nohdr_context
302 RETURN VARCHAR2 IS
303 BEGIN
304
305 RETURN NVL(SYS_CONTEXT('XLA_GLOBAL','NO_HDR_EXTRACT_FLAG'),'N');
306
307 EXCEPTION
308 WHEN xla_exceptions_pkg.application_exception THEN
309 RAISE;
310 WHEN OTHERS THEN
311 xla_exceptions_pkg.raise_message
312 (p_location => 'xla_context_pkg.get_event_nohdr_context');
313 END get_event_nohdr_context;
314
315 PROCEDURE clear_event_context
316 (p_client_id IN VARCHAR2) IS
317 BEGIN
318 ---------------------------------------------------------------------------
319 -- Following sets the value for the attribute 'EVENT_COUNT' for the
320 -- application context namespace 'XLA' and
321 -- 'NO_HDR_EXTRACT_FLAG' for the application context namespace
322 -- 'XLA_GLOBAL'
323 ---------------------------------------------------------------------------
324 dbms_session.clear_context
325 (namespace => 'XLA'
326 ,attribute => 'EVENT_COUNT'
327 ,client_id => p_client_id);
328
329 dbms_session.clear_context
330 (namespace => 'XLA_GLOBAL'
331 ,attribute => 'NO_HDR_EXTRACT_FLAG'
332 ,client_id => p_client_id);
333
334 EXCEPTION
335 WHEN xla_exceptions_pkg.application_exception THEN
336 RAISE;
337 WHEN OTHERS THEN
338 xla_exceptions_pkg.raise_message
339 (p_location => 'xla_context_pkg.clear_event_context');
340 END clear_event_context;
341
342 --=============================================================================
343 --
344 --
345 --
346 --=============================================================================
347 PROCEDURE set_event_set_id_context
348 (p_event_set_id IN NUMBER) IS
349 BEGIN
350 ----------------------------------------------------------------------------
351 -- Following sets the value for the attribute 'EVENT_SET_ID' for the
352 -- application context namespace 'XLA'
353 ----------------------------------------------------------------------------
354 dbms_session.set_context
355 ('XLA','EVENT_SET_ID',to_char(p_event_set_id));
356 EXCEPTION
357 WHEN xla_exceptions_pkg.application_exception THEN
358 RAISE;
359 WHEN OTHERS THEN
360 xla_exceptions_pkg.raise_message
361 (p_location => 'xla_context_pkg.set_event_set_id_context');
362 END set_event_set_id_context;
363
364 --=============================================================================
365 --
366 --
367 --
368 --=============================================================================
369 PROCEDURE set_request_id_context
370 (p_request_id IN NUMBER) IS
371 BEGIN
372 ----------------------------------------------------------------------------
373 -- Following sets the value for the attribute 'REQUEST_ID' for the
374 -- application context namespace 'XLA'
375 ----------------------------------------------------------------------------
376 dbms_session.set_context
377 ('XLA','REQUEST_ID',to_char(p_request_id));
378 EXCEPTION
379 WHEN xla_exceptions_pkg.application_exception THEN
380 RAISE;
381 WHEN OTHERS THEN
382 xla_exceptions_pkg.raise_message
383 (p_location => 'xla_context_pkg.set_request_id_context');
384 END set_request_id_context;
385
386 --=============================================================================
387 --
388 --
389 --
390 --=============================================================================
391 PROCEDURE set_report_request_id_context
392 (p_request_id IN NUMBER) IS
393 BEGIN
394 ----------------------------------------------------------------------------
395 -- Following sets the value for the attribute 'REPORT_REQUEST_ID' for the
396 -- application context namespace 'XLA'
397 ----------------------------------------------------------------------------
398 dbms_session.set_context
399 ('XLA','REPORT_REQUEST_ID',to_char(p_request_id));
400 EXCEPTION
401 WHEN xla_exceptions_pkg.application_exception THEN
402 RAISE;
403 WHEN OTHERS THEN
404 xla_exceptions_pkg.raise_message
405 (p_location => 'xla_context_pkg.set_report_request_id_context');
406 END set_report_request_id_context;
407
411 --
408 --=============================================================================
409 --
410 --
412 --=============================================================================
413 PROCEDURE set_processing_order_context
414 (p_processing_order IN NUMBER) IS
415 BEGIN
416 ----------------------------------------------------------------------------
417 -- Following sets the value for the attribute 'PROCESSING_ORDER' for the
418 -- application context namespace 'XLA'
419 ----------------------------------------------------------------------------
420 dbms_session.set_context
421 ('XLA','PROCESSING_ORDER',to_char(p_processing_order));
422 EXCEPTION
423 WHEN xla_exceptions_pkg.application_exception THEN
424 RAISE;
425 WHEN OTHERS THEN
426 xla_exceptions_pkg.raise_message
427 (p_location => 'xla_context_pkg.set_processing_order_context');
428 END set_processing_order_context;
429
430 ---------------------------------------------------------------------
431 -- 4865292 Event context
432 ---------------------------------------------------------------------
433 PROCEDURE set_gen_bal_context
434 (p_generate_balances IN VARCHAR2
435 ,p_client_id IN VARCHAR2 DEFAULT NULL) IS
436
437 BEGIN
438 ----------------------------------------------------------------------------
439 -- Following sets the value for the attribute 'GENERATE_BALANCES' for the
440 -- application context namespace 'XLA_GLOBAL'
441 ----------------------------------------------------------------------------
442 dbms_session.set_context
443 (namespace => 'XLA_GLOBAL'
444 ,attribute => 'GENERATE_BALANCES'
445 ,value => TO_CHAR(p_generate_balances)
446 ,username => NULL
447 ,client_id => p_client_id);
448
449 EXCEPTION
450 WHEN xla_exceptions_pkg.application_exception THEN
451 RAISE;
452 WHEN OTHERS THEN
453 xla_exceptions_pkg.raise_message
454 (p_location => 'xla_context_pkg.set_gen_bal_context');
455 END set_gen_bal_context;
456
457 FUNCTION get_gen_bal_context RETURN VARCHAR2 IS
458 BEGIN
459
460 RETURN NVL(sys_context('XLA_GLOBAL', 'GENERATE_BALANCES'),'Y');
461
462 END get_gen_bal_context;
463
464 PROCEDURE clear_gen_bal_context
465 (p_client_id IN VARCHAR2) IS
466 BEGIN
467 dbms_session.clear_context
468 (namespace => 'XLA_GLOBAL'
469 ,attribute => 'GENERATE_BALANCES'
470 ,client_id => p_client_id);
471
472 EXCEPTION
473 WHEN xla_exceptions_pkg.application_exception THEN
474 RAISE;
475 WHEN OTHERS THEN
476 xla_exceptions_pkg.raise_message
477 (p_location => 'xla_context_pkg.clear_gen_bal_context');
478 END clear_gen_bal_context;
479
480 --=============================================================================
481 --
482 --
483 --
484 --=============================================================================
485 PROCEDURE set_msg_count_context
486 (p_msg_count IN NUMBER
487 ,p_client_id IN VARCHAR2) IS
488 BEGIN
489 ----------------------------------------------------------------------------
490 -- Following sets the value for the attribute 'ENTITY_MESSAGES_COUNT' for the
491 -- application context namespace 'XLA_GLOBAL'
492 ----------------------------------------------------------------------------
493 dbms_session.set_context
494 (namespace => 'XLA_GLOBAL'
495 ,attribute => 'ENTITY_MESSAGES_COUNT'
496 ,value => TO_CHAR(p_msg_count)
497 ,username => NULL
498 ,client_id => p_client_id);
499
500 EXCEPTION
501 WHEN xla_exceptions_pkg.application_exception THEN
502 RAISE;
503 WHEN OTHERS THEN
504 xla_exceptions_pkg.raise_message
505 (p_location => 'xla_context_pkg.set_msg_count_context');
506 END set_msg_count_context;
507
508 --=============================================================================
509 --
510 --
511 --
512 --=============================================================================
513 FUNCTION get_msg_count_context
514 RETURN NUMBER IS
515 BEGIN
516 RETURN NVL(sys_context('XLA_GLOBAL','ENTITY_MESSAGES_COUNT'),0);
517 EXCEPTION
518 WHEN xla_exceptions_pkg.application_exception THEN
519 RAISE;
520 WHEN OTHERS THEN
521 xla_exceptions_pkg.raise_message
522 (p_location => 'xla_context_pkg.get_msg_count_context');
523 END get_msg_count_context;
524
525
526 PROCEDURE increment_msg_count_context
527 (p_msg_count_increment IN NUMBER
528 ,p_client_id IN VARCHAR2) IS
529 l_current_count NUMBER;
530 handle VARCHAR2(128);
531 retval NUMBER;
532 BEGIN
533 dbms_lock.allocate_unique('XLA_MESG_COUNT_LOCK', handle);
534 retval := dbms_lock.request(handle, 6, 300, TRUE);
535
536 l_current_count := xla_context_pkg.get_msg_count_context()
537 + p_msg_count_increment;
538
539 xla_context_pkg.set_msg_count_context(l_current_count,
540 p_client_id);
541
542 retval := dbms_lock.release(handle);
543
544 RETURN;
545 EXCEPTION
546 WHEN xla_exceptions_pkg.application_exception THEN
547 RAISE;
548 WHEN OTHERS THEN
549 xla_exceptions_pkg.raise_message
550 (p_location => 'xla_context_pkg.increment_msg_count_context');
551 END increment_msg_count_context;
552
553 FUNCTION get_and_clr_msg_count_context
557 retval NUMBER;
554 (p_client_id IN VARCHAR2) RETURN NUMBER IS
555 l_current_count NUMBER;
556 handle VARCHAR2(128);
558 BEGIN
559 dbms_lock.allocate_unique('XLA_MESG_COUNT_LOCK', handle);
560 retval := dbms_lock.request(handle, 6, 300, TRUE);
561
562 l_current_count := xla_context_pkg.get_msg_count_context;
563
564 xla_context_pkg.set_msg_count_context(0,
565 p_client_id);
566
567 retval := dbms_lock.release(handle);
568
569 RETURN(l_current_count);
570 EXCEPTION
571 WHEN xla_exceptions_pkg.application_exception THEN
572 RAISE;
573 WHEN OTHERS THEN
574 xla_exceptions_pkg.raise_message
575 (p_location => 'xla_context_pkg.get_and_clr_msg_count_context');
576 END get_and_clr_msg_count_context;
577
578 --=============================================================================
579 --
580 --
581 --
582 --=============================================================================
583 PROCEDURE clear_msg_count_context
584 (p_client_id IN VARCHAR2) IS
585 BEGIN
586 ----------------------------------------------------------------------------
587 -- Following sets the value for the attribute 'SECURITY_GROUP' for the
588 -- application context namespace 'XLA'
589 ----------------------------------------------------------------------------
590 dbms_session.clear_context
591 (namespace => 'XLA_GLOBAL'
592 ,attribute => 'ENTITY_MESSAGES_COUNT'
593 ,client_id => p_client_id);
594
595 EXCEPTION
596 WHEN xla_exceptions_pkg.application_exception THEN
597 RAISE;
598 WHEN OTHERS THEN
599 xla_exceptions_pkg.raise_message
600 (p_location => 'xla_context_pkgset_security_context');
601 END clear_msg_count_context;
602
603
604 END xla_context_pkg;