[Home] [Help]
PACKAGE BODY: APPS.PVX_TIMEOUT_SETUP_PVT
Source
1 Package Body PVX_timeout_setup_PVT AS
2 /* $Header: pvxvtmob.pls 115.14 2002/12/11 11:12:53 anubhavk ship $ */
3
4
5 g_pkg_name CONSTANT VARCHAR2(30):='PVX_timeout_setup_PVT';
6
7 ---------------------------------------------------------------------
8 -- PROCEDURE
9 -- Create_timeout_setup
10 --
11 -- PURPOSE
12 -- Create a new timeout entry record
13 --
14 -- PARAMETERS
15 -- p_timeout_setup_rec: the new record to be inserted
16 -- x_timeout_setup_id: return the timeout_id of the new record.
17 --
18 -- NOTES
19 -- 1. object_version_number will be set to 1.
20 -- 2. If timeout_id is not passed in, generate a unique one from
21 -- the sequence.
22 -- 3. Please don't pass in any FND_API.g_mess_char/num/date.
23 ---------------------------------------------------------------------
24 PROCEDURE Create_timeout_setup(
25 p_api_version IN NUMBER
26 ,p_init_msg_list IN VARCHAR2 := FND_API.g_false
27 ,p_commit IN VARCHAR2 := FND_API.g_false
28 ,p_validation_level IN NUMBER := FND_API.g_valid_level_full
29
30 ,x_return_status OUT NOCOPY VARCHAR2
31 ,x_msg_count OUT NOCOPY NUMBER
32 ,x_msg_data OUT NOCOPY VARCHAR2
33
34 ,p_timeout_setup_rec IN timeout_setup_rec_type
35 ,x_timeout_setup_id OUT NOCOPY NUMBER
36 )
37 IS
38
39 l_api_version CONSTANT NUMBER := 1.0;
40 l_api_name CONSTANT VARCHAR2(30) := 'Create_timeout_setup';
41 l_full_name CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
42
43 l_return_status VARCHAR2(1);
44 l_timeout_setup_rec timeout_setup_rec_type := p_timeout_setup_rec;
45
46 l_object_version_number NUMBER := 1;
47
48 l_uniqueness_check VARCHAR2(10);
49
50 -- Cursor to get the sequence for enty_attr_value
51 CURSOR c_timout_setup_seq IS
52 SELECT PV_COUNTRY_TIMEOUTS_S.NEXTVAL
53 FROM DUAL;
54
55 -- Cursor to validate the uniqueness
56 CURSOR c_count(cv_timeout_setup_id IN NUMBER) IS
57 SELECT 'ANYTHING'
58 FROM PV_COUNTRY_TIMEOUTS
59 WHERE timeout_id = cv_timeout_setup_id;
60
61
62 BEGIN
63
64 --------------------- initialize -----------------------
65 SAVEPOINT Create_timeout_setup;
66
67 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
68 PVX_Utility_PVT.debug_message(l_full_name||': start');
69 END IF;
70
71
72
73 --DBMS_output.put_line(l_full_name||': start');
74
75 IF FND_API.to_boolean(p_init_msg_list) THEN
76 FND_MSG_PUB.initialize;
77 END IF;
78
79 IF NOT FND_API.compatible_api_call(
80 l_api_version,
81 p_api_version,
82 l_api_name,
83 g_pkg_name
84 ) THEN
85 RAISE FND_API.g_exc_unexpected_error;
86 END IF;
87
88 x_return_status := FND_API.g_ret_sts_success;
89
90 ----------------------- validate -----------------------
91 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
92 PVX_Utility_PVT.debug_message(l_full_name ||': validate');
93 END IF;
94
95
96
97 --DBMS_output.put_line(l_full_name||': validate');
98 Validate_timeout_setup(
99 p_api_version => l_api_version,
100 p_init_msg_list => p_init_msg_list,
101 p_validation_level => p_validation_level,
102 x_return_status => l_return_status,
103 x_msg_count => x_msg_count,
104 x_msg_data => x_msg_data,
105 p_timeout_setup_rec => l_timeout_setup_rec
106 );
107
108 IF l_return_status = FND_API.g_ret_sts_error THEN
109 RAISE FND_API.g_exc_error;
110 ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
111 RAISE FND_API.g_exc_unexpected_error;
112 END IF;
113
114
115 --DBMS_output.put_line(l_full_name||': back validate');
116
117 -------------------------- insert --------------------------
118 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
119 PVX_Utility_PVT.debug_message(l_full_name ||': insert');
120 END IF;
121
122
123
124 IF l_timeout_setup_rec.timeout_id IS NULL THEN
125 LOOP
126 -- Get the identifier
127 OPEN c_timout_setup_seq;
128 FETCH c_timout_setup_seq INTO l_timeout_setup_rec.timeout_id;
129 CLOSE c_timout_setup_seq;
130
131 -- Check the uniqueness of the identifier
132 OPEN c_count(l_timeout_setup_rec.timeout_id);
133 FETCH c_count INTO l_uniqueness_check;
134 -- Exit when the identifier uniqueness is established
135 EXIT WHEN c_count%ROWCOUNT = 0;
136 CLOSE c_count;
137 END LOOP;
138 END IF;
139
140
141 --DBMS_output.put_line(l_full_name||': start insert');
142 INSERT INTO PV_COUNTRY_TIMEOUTS (
143 timeout_id
144 ,last_update_date
145 ,last_updated_by
146 ,creation_date
147 ,created_by
148 ,last_update_login
149 ,timeout_period
150 ,timeout_type
151 ,country_code
152 ,object_version_number
153 )
154 VALUES (
155 l_timeout_setup_rec.timeout_id
156 ,SYSDATE -- LAST_UPDATE_DATE
157 ,NVL(FND_GLOBAL.user_id,-1) -- LAST_UPDATED_BY
158 ,SYSDATE -- CREATION_DATE
159 ,NVL(FND_GLOBAL.user_id,-1) -- CREATED_BY
160 ,NVL(FND_GLOBAL.conc_login_id,-1) -- LAST_UPDATE_LOGIN
161 ,l_timeout_setup_rec.timeout_period
162 ,l_timeout_setup_rec.timeout_type
163 ,l_timeout_setup_rec.country_code
164 ,l_object_version_number -- object_version_number
165 );
166
167
168 ------------------------- finish -------------------------------
169 x_timeout_setup_id := l_timeout_setup_rec.timeout_id;
170
171 IF l_return_status = FND_API.g_ret_sts_error THEN
172 RAISE FND_API.g_exc_error;
173 ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
174 RAISE FND_API.g_exc_unexpected_error;
175 END IF;
176
177
178 -- Check for commit
179 IF FND_API.to_boolean(p_commit) THEN
180 COMMIT;
181 END IF;
182
183 FND_MSG_PUB.count_and_get(
184 p_encoded => FND_API.g_false,
185 p_count => x_msg_count,
186 p_data => x_msg_data
187 );
188
189 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
190 PVX_Utility_PVT.debug_message(l_full_name ||': end');
191 END IF;
192
193
194
195 EXCEPTION
196
197 WHEN FND_API.g_exc_error THEN
198 ROLLBACK TO Create_timeout_setup;
199 x_return_status := FND_API.g_ret_sts_error;
200 FND_MSG_PUB.count_and_get (
201 p_encoded => FND_API.g_false
202 ,p_count => x_msg_count
203 ,p_data => x_msg_data
204 );
205
206 WHEN FND_API.g_exc_unexpected_error THEN
207 ROLLBACK TO Create_timeout_setup;
208 x_return_status := FND_API.g_ret_sts_unexp_error ;
209 FND_MSG_PUB.count_and_get (
210 p_encoded => FND_API.g_false
211 ,p_count => x_msg_count
212 ,p_data => x_msg_data
213 );
214
215 WHEN OTHERS THEN
216 ROLLBACK TO Create_timeout_setup;
217 x_return_status := FND_API.g_ret_sts_unexp_error ;
218
219 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
220 THEN
221 FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
222 END IF;
223
224 FND_MSG_PUB.count_and_get(
225 p_encoded => FND_API.g_false
226 ,p_count => x_msg_count
227 ,p_data => x_msg_data
228 );
229
230 END Create_timeout_setup;
231
232
233 ---------------------------------------------------------------
234 -- PROCEDURE
235 -- Delete_timeout_setup
236 --
237 ---------------------------------------------------------------
238 PROCEDURE Delete_timeout_setup(
239 p_api_version IN NUMBER
240 ,p_init_msg_list IN VARCHAR2 := FND_API.g_false
241 ,p_commit IN VARCHAR2 := FND_API.g_false
242
243 ,x_return_status OUT NOCOPY VARCHAR2
244 ,x_msg_count OUT NOCOPY NUMBER
245 ,x_msg_data OUT NOCOPY VARCHAR2
246
247 ,p_timeout_id IN NUMBER
248 ,p_object_version IN NUMBER
249
250 )
251 IS
252
253 l_api_version CONSTANT NUMBER := 1.0;
254 l_api_name CONSTANT VARCHAR2(30) := 'Delete_timeout_setup';
255 l_full_name CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
256
257 BEGIN
258
259 --------------------- initialize -----------------------
260 SAVEPOINT Delete_timeout_setup;
261
262 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
263 PVX_Utility_PVT.debug_message(l_full_name||': start');
264 END IF;
265
266
267 IF FND_API.to_boolean(p_init_msg_list) THEN
268 FND_MSG_PUB.initialize;
269 END IF;
270
271 IF NOT FND_API.compatible_api_call(
272 l_api_version,
273 p_api_version,
274 l_api_name,
275 g_pkg_name
276 ) THEN
277 RAISE FND_API.g_exc_unexpected_error;
278 END IF;
279
280 x_return_status := FND_API.G_RET_STS_SUCCESS;
281
282 ------------------------ delete ------------------------
283 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
284 PVX_Utility_PVT.debug_message(l_full_name ||': delete');
285 END IF;
286
287
288
289 DELETE FROM PV_country_timeouts
290 WHERE timeout_id = p_timeout_id
291 AND object_version_number = p_object_version;
292
293 IF (SQL%NOTFOUND) THEN
294 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error)
295 THEN
296 FND_MESSAGE.set_name('PV', 'PV_RECORD_NOT_FOUND');
297 FND_MSG_PUB.add;
298 END IF;
299 RAISE FND_API.g_exc_error;
300 END IF;
301
302 -------------------- finish --------------------------
303 IF FND_API.to_boolean(p_commit) THEN
304 COMMIT;
305 END IF;
306
307 FND_MSG_PUB.count_and_get(
308 p_encoded => FND_API.g_false,
309 p_count => x_msg_count,
310 p_data => x_msg_data
311 );
312
313 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
314 PVX_Utility_PVT.debug_message(l_full_name ||': end');
315 END IF;
316
317
318
319 EXCEPTION
320
321 WHEN FND_API.g_exc_error THEN
322 ROLLBACK TO Delete_timeout_setup;
323 x_return_status := FND_API.g_ret_sts_error;
324 FND_MSG_PUB.count_and_get(
325 p_encoded => FND_API.g_false,
326 p_count => x_msg_count,
327 p_data => x_msg_data
328 );
329
330 WHEN FND_API.g_exc_unexpected_error THEN
331 ROLLBACK TO Delete_timeout_setup;
332 x_return_status := FND_API.g_ret_sts_unexp_error ;
333 FND_MSG_PUB.count_and_get(
334 p_encoded => FND_API.g_false,
335 p_count => x_msg_count,
336 p_data => x_msg_data
337 );
338
339 WHEN OTHERS THEN
340 ROLLBACK TO Delete_timeout_setup;
341 x_return_status := FND_API.g_ret_sts_unexp_error ;
342
343 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
344 THEN
345 FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
346 END IF;
347
348 FND_MSG_PUB.count_and_get(
349 p_encoded => FND_API.g_false,
350 p_count => x_msg_count,
351 p_data => x_msg_data
352 );
353
354 END Delete_timeout_setup;
355
356
357 ---------------------------------------------------------------------
358 -- PROCEDURE
359 -- Update_timeout_setup
360 ----------------------------------------------------------------------
361 PROCEDURE Update_timeout_setup(
362 p_api_version IN NUMBER
363 ,p_init_msg_list IN VARCHAR2 := FND_API.g_false
364 ,p_commit IN VARCHAR2 := FND_API.g_false
365 ,p_validation_level IN NUMBER := FND_API.g_valid_level_full
366
367 ,x_return_status OUT NOCOPY VARCHAR2
368 ,x_msg_count OUT NOCOPY NUMBER
369 ,x_msg_data OUT NOCOPY VARCHAR2
370 ,p_timeout_setup_rec IN timeout_setup_rec_type
371 )
372 IS
373
374 l_api_version CONSTANT NUMBER := 1.0;
375 l_api_name CONSTANT VARCHAR2(30) := 'Update_timeout_setup';
376 l_full_name CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
377
378 l_timeout_setup_rec timeout_setup_rec_type;
379 l_return_status VARCHAR2(1);
380 l_mode VARCHAR2(30) := 'UPDATE';
381
382
383 BEGIN
384
385 -------------------- initialize -------------------------
386 SAVEPOINT Update_timeout_setup;
387
388 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
389 PVX_Utility_PVT.debug_message(l_full_name||': start');
390 END IF;
391
392
393
394 IF FND_API.to_boolean(p_init_msg_list) THEN
395 FND_MSG_PUB.initialize;
396 END IF;
397
398 -- dbms_output.put_line('Start 2' || to_char(l_api_version) || 'p_api ; ' || p_api_version || 'l_api " ' || p_api_version || 'pkg :' || g_pkg_name);
399
400 IF NOT FND_API.compatible_api_call(
401 l_api_version,
402 p_api_version,
403 l_api_name,
404 g_pkg_name
405 ) THEN
406 RAISE FND_API.g_exc_unexpected_error;
407 END IF;
408
409 x_return_status := FND_API.G_RET_STS_SUCCESS;
410
411 ----------------------- validate ----------------------
412 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
413 PVX_Utility_PVT.debug_message(l_full_name ||': validate');
414 END IF;
415
416
417 IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
418 Check_timeout_items(
419 p_timeout_setup_rec => p_timeout_setup_rec,
420 p_validation_mode => JTF_PLSQL_API.g_update,
421 x_return_status => l_return_status
422 );
423
424 IF l_return_status = FND_API.g_ret_sts_unexp_error THEN
425 RAISE FND_API.g_exc_unexpected_error;
426 ELSIF l_return_status = FND_API.g_ret_sts_error THEN
427 RAISE FND_API.g_exc_error;
428 END IF;
429 END IF;
430
431 -- replace g_miss_char/num/date with current column values
432 Complete_timeout_rec(p_timeout_setup_rec, l_timeout_setup_rec);
433
434 IF p_validation_level >= JTF_PLSQL_API.g_valid_level_record THEN
435 Check_timeout_rec(
436 p_timeout_setup_rec => p_timeout_setup_rec,
437 p_complete_rec => l_timeout_setup_rec,
438 p_mode => l_mode,
439 x_return_status => l_return_status
440 );
441
442 IF l_return_status = FND_API.g_ret_sts_unexp_error THEN
443 RAISE FND_API.g_exc_unexpected_error;
444 ELSIF l_return_status = FND_API.g_ret_sts_error THEN
445 RAISE FND_API.g_exc_error;
446 END IF;
447 END IF;
448
449 -------------------------- update --------------------
450 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
454
451 PVX_Utility_PVT.debug_message(l_full_name ||': update');
452 END IF;
453
455 UPDATE PV_COUNTRY_TIMEOUTS
456 SET
457 last_update_date = SYSDATE
458 ,last_updated_by = NVL(FND_GLOBAL.user_id,-1)
459 ,last_update_login = NVL(FND_GLOBAL.conc_login_id,-1)
460 ,timeout_period = l_timeout_setup_rec.timeout_period
461 ,timeout_type = l_timeout_setup_rec.timeout_type
462 ,country_code = l_timeout_setup_rec.country_code
463 ,object_version_number = l_timeout_setup_rec.object_version_number + 1
464 WHERE timeout_id = l_timeout_setup_rec.timeout_id
465 AND object_version_number = l_timeout_setup_rec.object_version_number;
466
467 IF (SQL%NOTFOUND) THEN
468 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
469 FND_MESSAGE.set_name('PV', 'PV_NO_RECORD_FOUND');
470 FND_MSG_PUB.add;
471 END IF;
472 RAISE FND_API.g_exc_error;
473 END IF;
474
475 -------------------- finish --------------------------
476
477 -- Check for commit
478 IF FND_API.to_boolean(p_commit) THEN
479 COMMIT;
480 END IF;
481
482 FND_MSG_PUB.count_and_get(
483 p_encoded => FND_API.g_false,
484 p_count => x_msg_count,
485 p_data => x_msg_data
486 );
487
488 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
489 PVX_Utility_PVT.debug_message(l_full_name ||': end');
490 END IF;
491
492
493
494 EXCEPTION
495
496 WHEN FND_API.g_exc_error THEN
497 ROLLBACK TO Update_timeout_setup;
498 x_return_status := FND_API.g_ret_sts_error;
499 FND_MSG_PUB.count_and_get(
500 p_encoded => FND_API.g_false,
501 p_count => x_msg_count,
502 p_data => x_msg_data
503 );
504
505 WHEN FND_API.g_exc_unexpected_error THEN
506 ROLLBACK TO Update_timeout_setup;
507 x_return_status := FND_API.g_ret_sts_unexp_error ;
508 FND_MSG_PUB.count_and_get(
509 p_encoded => FND_API.g_false,
510 p_count => x_msg_count,
511 p_data => x_msg_data
512 );
513
514 WHEN OTHERS THEN
515 ROLLBACK TO Update_timeout_setup;
516 x_return_status := FND_API.g_ret_sts_unexp_error ;
517
518 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
519 THEN
520 FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
521 END IF;
522
523 FND_MSG_PUB.count_and_get(
524 p_encoded => FND_API.g_false,
525 p_count => x_msg_count,
526 p_data => x_msg_data
527 );
528
529 END Update_timeout_setup;
530
531
532 ---------------------------------------------------------------------
533 -- PROCEDURE
534 -- Check_timeout_rec
535 --
536 ---------------------------------------------------------------------
537 PROCEDURE Check_timeout_rec(
538 p_timeout_setup_rec IN timeout_setup_rec_type
539 ,p_complete_rec IN timeout_setup_rec_type := NULL
540 ,p_mode IN VARCHAR2 := 'INSERT'
541 ,x_return_status OUT NOCOPY VARCHAR2
542 )
543 IS
544 BEGIN
545 x_return_status := FND_API.g_ret_sts_success;
546 -- do other record level checkings
547
548 END Check_timeout_rec;
549
550
551 --------------------------------------------------------------------
552 -- PROCEDURE
553 -- Validate_timeout_setup
554 --
555 --------------------------------------------------------------------
556 PROCEDURE Validate_timeout_setup(
557 p_api_version IN NUMBER
558 ,p_init_msg_list IN VARCHAR2 := FND_API.g_false
559 ,p_validation_level IN NUMBER := FND_API.g_valid_level_full
560
561 ,x_return_status OUT NOCOPY VARCHAR2
562 ,x_msg_count OUT NOCOPY NUMBER
563 ,x_msg_data OUT NOCOPY VARCHAR2
564
565 ,p_timeout_setup_rec IN timeout_setup_rec_type
566 )
567 IS
568
569 l_api_version CONSTANT NUMBER := 1.0;
570 l_api_name CONSTANT VARCHAR2(30) := 'Validate_enty_attr_value';
571 l_full_name CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
572 l_return_status VARCHAR2(1);
573
574 l_uniqueness_check VARCHAR2(10);
575 -- check for uniqueness
576 CURSOR c_unique_timeout IS
577 SELECT 'ANYTHING'
578 FROM PV_COUNTRY_TIMEOUTS
579 WHERE country_code = p_timeout_setup_rec.country_code
580 AND timeout_type = p_timeout_setup_rec.timeout_type;
581
582
583 BEGIN
584
585 ----------------------- initialize --------------------
586 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
587 PVX_Utility_PVT.debug_message(l_full_name||': start');
588 END IF;
589
590
591 IF FND_API.to_boolean(p_init_msg_list) THEN
592 FND_MSG_PUB.initialize;
593 END IF;
594
595 IF NOT FND_API.compatible_api_call(
596 l_api_version,
597 p_api_version,
598 l_api_name,
599 g_pkg_name
600 ) THEN
604 x_return_status := FND_API.g_ret_sts_success;
601 RAISE FND_API.g_exc_unexpected_error;
602 END IF;
603
605
606 ---------------------- validate ------------------------
607 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
608 PVX_Utility_PVT.debug_message(l_full_name||': check items');
609 END IF;
610
611
612 --DBMS_output.put_line(l_full_name||': start item validate');
613 IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
614 Check_timeout_items(
615 p_timeout_setup_rec => p_timeout_setup_rec,
616 p_validation_mode => JTF_PLSQL_API.g_create,
617 x_return_status => l_return_status
618 );
619
620 IF l_return_status = FND_API.g_ret_sts_unexp_error THEN
621 RAISE FND_API.g_exc_unexpected_error;
622 ELSIF l_return_status = FND_API.g_ret_sts_error THEN
623 RAISE FND_API.g_exc_error;
624 END IF;
625 END IF;
626
627 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
628 PVX_Utility_PVT.debug_message(l_full_name||': check record');
629 END IF;
630
631
632
633 --DBMS_output.put_line(l_full_name||': start record validate');
634
635 IF p_validation_level >= JTF_PLSQL_API.g_valid_level_record THEN
636 Check_timeout_rec(
637 p_timeout_setup_rec => p_timeout_setup_rec,
638 p_complete_rec => NULL,
639 x_return_status => l_return_status
640 );
641
642 IF l_return_status = FND_API.g_ret_sts_unexp_error THEN
643 RAISE FND_API.g_exc_unexpected_error;
644 ELSIF l_return_status = FND_API.g_ret_sts_error THEN
645 RAISE FND_API.g_exc_error;
646 END IF;
647 END IF;
648
649
650 --------------- check for unique row -----------------
651
652 -- Cursor to validate the uniqueness
653 OPEN c_unique_timeout;
654 FETCH c_unique_timeout INTO l_uniqueness_check;
655 -- RAISE EXCEPTION when the identifier uniqueness is established
656 IF (c_unique_timeout%ROWCOUNT = 0) THEN
657 return;
658 ELSE
659 FND_MESSAGE.set_name('PV', 'PV_DUPLICATE_RECORD');
660 FND_MSG_PUB.add;
661 RAISE FND_API.g_exc_unexpected_error;
662 END IF;
663
664 -------------------- finish --------------------------
665 FND_MSG_PUB.count_and_get(
666 p_encoded => FND_API.g_false,
667 p_count => x_msg_count,
668 p_data => x_msg_data
669 );
670
671 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
672 PVX_Utility_PVT.debug_message(l_full_name ||': end');
673 END IF;
674
675
676 EXCEPTION
677
678 WHEN FND_API.g_exc_error THEN
679 x_return_status := FND_API.g_ret_sts_error;
680 FND_MSG_PUB.count_and_get(
681 p_encoded => FND_API.g_false,
682 p_count => x_msg_count,
683 p_data => x_msg_data
684 );
685
686 WHEN FND_API.g_exc_unexpected_error THEN
687 x_return_status := FND_API.g_ret_sts_unexp_error ;
688 FND_MSG_PUB.count_and_get(
689 p_encoded => FND_API.g_false,
690 p_count => x_msg_count,
691 p_data => x_msg_data
692 );
693
694 WHEN OTHERS THEN
695 x_return_status := FND_API.g_ret_sts_unexp_error;
696 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
697 THEN
698 FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
699 END IF;
700
701 FND_MSG_PUB.count_and_get(
702 p_encoded => FND_API.g_false,
703 p_count => x_msg_count,
704 p_data => x_msg_data
705 );
706
707 END Validate_timeout_setup;
708
709 ---------------------------------------------------------------------
710 -- PROCEDURE
711 -- Check_Req_Items
712 --
713 ---------------------------------------------------------------------
714 PROCEDURE Check_Req_Items(
715 p_timeout_setup_rec IN timeout_setup_rec_type
716 ,x_return_status OUT NOCOPY VARCHAR2
717 )
718 IS
719 BEGIN
720
721 x_return_status := FND_API.g_ret_sts_success;
722
723 ------------------------ entity --------------------------
724 IF p_timeout_setup_rec.timeout_period IS NULL THEN
725 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error)
726 THEN
727 FND_MESSAGE.set_name('PV', 'PV_NO_ENTITY');
728 FND_MSG_PUB.add;
729 END IF;
730
731 x_return_status := FND_API.g_ret_sts_error;
732 RETURN;
733 END IF;
734
735 END Check_Req_Items;
736
737 ---------------------------------------------------------------------
738 -- PROCEDURE
739 -- Check_timeout_items
740 --
741 ---------------------------------------------------------------------
742 PROCEDURE Check_timeout_items(
743 p_validation_mode IN VARCHAR2 := JTF_PLSQL_API.g_create
744 ,x_return_status OUT NOCOPY VARCHAR2
745 ,p_timeout_setup_rec IN timeout_setup_rec_type
746 )
747 IS
748 BEGIN
749
753 ,x_return_status => x_return_status
750 --DBMS_output.put_line(': start req items validate');
751 Check_Req_Items(
752 p_timeout_setup_rec => p_timeout_setup_rec
754 );
755
756 IF x_return_status <> FND_API.g_ret_sts_success THEN
757 RETURN;
758 END IF;
759
760 END Check_timeout_items;
761
762 ---------------------------------------------------------------------
763 -- PROCEDURE
764 -- Init_attr_value_Rec
765 --
766 ---------------------------------------------------------------------
767 PROCEDURE Init_timeout_Rec(
768 x_timeout_setup_rec OUT NOCOPY timeout_setup_rec_type
769 )
770 IS
771 BEGIN
772
773 x_timeout_setup_rec.timeout_id := FND_API.G_MISS_NUM;
774 x_timeout_setup_rec.last_update_date := FND_API.G_MISS_DATE;
775 x_timeout_setup_rec.last_updated_by := FND_API.G_MISS_NUM;
776 x_timeout_setup_rec.creation_date := FND_API.G_MISS_DATE;
777 x_timeout_setup_rec.created_by := FND_API.G_MISS_NUM;
778 x_timeout_setup_rec.last_update_login := FND_API.G_MISS_NUM;
779 x_timeout_setup_rec.object_version_number := FND_API.G_MISS_NUM;
780 x_timeout_setup_rec.timeout_period := FND_API.G_MISS_NUM;
781 x_timeout_setup_rec.timeout_type := FND_API.G_MISS_CHAR;
782 x_timeout_setup_rec.country_code := FND_API.G_MISS_CHAR;
783
784 END Init_timeout_Rec;
785
786 -------------------------------------------------------------------
787 -- PROCEDURE
788 -- Lock_timeout_setup
789 --
790 --------------------------------------------------------------------
791 PROCEDURE Lock_timeout_setup(
792 p_api_version IN NUMBER
793 ,p_init_msg_list IN VARCHAR2 := FND_API.g_false
794 ,x_return_status OUT NOCOPY VARCHAR2
795 ,x_msg_count OUT NOCOPY NUMBER
796 ,x_msg_data OUT NOCOPY VARCHAR2
797 ,p_timeout_id IN NUMBER
798 ,p_object_version IN NUMBER
799 )
800 IS
801
802 l_api_version CONSTANT NUMBER := 1.0;
803 l_api_name CONSTANT VARCHAR2(30) := 'Lock_timeout_setup';
804 l_full_name CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
805
806 l_timeout_id NUMBER;
807
808 CURSOR c_timeout_setup IS
809 SELECT timeout_id
810 FROM PV_COUNTRY_TIMEOUTS
811 WHERE timeout_id = p_timeout_id
812 AND object_version_number = p_object_version
813 FOR UPDATE OF timeout_id NOWAIT;
814
815 BEGIN
816
817 -------------------- initialize ------------------------
818 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
819 PVX_Utility_PVT.debug_message(l_full_name||': start');
820 END IF;
821
822
823 IF FND_API.to_boolean(p_init_msg_list) THEN
824 FND_MSG_PUB.initialize;
825 END IF;
826
827 IF NOT FND_API.compatible_api_call(
828 l_api_version,
829 p_api_version,
830 l_api_name,
831 g_pkg_name
832 ) THEN
833 RAISE FND_API.g_exc_unexpected_error;
834 END IF;
835
836 x_return_status := FND_API.G_RET_STS_SUCCESS;
837
838 ------------------------ lock -------------------------
839 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
840 PVX_Utility_PVT.debug_message(l_full_name||': lock');
841 END IF;
842
843
844 OPEN c_timeout_setup;
845 FETCH c_timeout_setup INTO l_timeout_id;
846 IF (c_timeout_setup%NOTFOUND) THEN
847 CLOSE c_timeout_setup;
848 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
849 FND_MESSAGE.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
850 FND_MSG_PUB.add;
851 END IF;
852 RAISE FND_API.g_exc_error;
853 END IF;
854 CLOSE c_timeout_setup;
855
856
857 -------------------- finish --------------------------
858 FND_MSG_PUB.count_and_get(
859 p_encoded => FND_API.g_false,
860 p_count => x_msg_count,
861 p_data => x_msg_data
862 );
863
864 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
865 PVX_Utility_PVT.debug_message(l_full_name ||': end');
866 END IF;
867
868
869 EXCEPTION
870
871 WHEN PVX_Utility_PVT.resource_locked THEN
872 x_return_status := FND_API.g_ret_sts_error;
873 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
874 FND_MESSAGE.set_name('PV', 'PV_RESOURCE_LOCKED');
875 FND_MSG_PUB.add;
876 END IF;
877
878 FND_MSG_PUB.count_and_get(
879 p_encoded => FND_API.g_false,
880 p_count => x_msg_count,
881 p_data => x_msg_data
882 );
883
884 WHEN FND_API.g_exc_error THEN
885 x_return_status := FND_API.g_ret_sts_error;
886 FND_MSG_PUB.count_and_get(
887 p_encoded => FND_API.g_false,
888 p_count => x_msg_count,
889 p_data => x_msg_data
890 );
891
892 WHEN FND_API.g_exc_unexpected_error THEN
893 x_return_status := FND_API.g_ret_sts_unexp_error ;
894 FND_MSG_PUB.count_and_get(
895 p_encoded => FND_API.g_false,
896 p_count => x_msg_count,
897 p_data => x_msg_data
898 );
899
900 WHEN OTHERS THEN
901 x_return_status := FND_API.g_ret_sts_unexp_error ;
902 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
903 THEN
904 FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
905 END IF;
906
907 FND_MSG_PUB.count_and_get(
908 p_encoded => FND_API.g_false,
909 p_count => x_msg_count,
910 p_data => x_msg_data
911 );
912
913 END Lock_timeout_setup;
914
915
916 ---------------------------------------------------------------------
917 -- PROCEDURE
918 -- Complete_timeout_setup_Rec
919 --
920 ---------------------------------------------------------------------
921 PROCEDURE Complete_timeout_Rec(
922 p_timeout_setup_rec IN timeout_setup_rec_type
923 ,x_complete_rec OUT NOCOPY timeout_setup_rec_type
924 )
925 IS
926
927 CURSOR c_timeout_setup IS
928 SELECT *
929 FROM PV_COUNTRY_TIMEOUTS
930 WHERE timeout_id = p_timeout_setup_rec.timeout_id;
931
932 l_timeout_setup_rec c_timeout_setup%ROWTYPE;
933
934 BEGIN
935
936 x_complete_rec := p_timeout_setup_rec;
937
938 OPEN c_timeout_setup;
939 FETCH c_timeout_setup INTO l_timeout_setup_rec;
940 IF c_timeout_setup%NOTFOUND THEN
941 CLOSE c_timeout_setup;
942 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
943 FND_MESSAGE.set_name('PV', 'PV_NO_RECORD_FOUND');
944 FND_MSG_PUB.add;
945 END IF;
946 RAISE FND_API.g_exc_error;
947 END IF;
948 CLOSE c_timeout_setup;
949
950 --dbms_output.put_line('Start 2' || to_char(p_timeout_setup_rec.timeout_period) || 'TYPE ; ' || p_timeout_setup_rec.timeout_type || 'CNTRY " ' || p_timeout_setup_rec.country_code || 'pkg :' ));
951
952
953 IF p_timeout_setup_rec.timeout_period = FND_API.G_MISS_NUM THEN
954 x_complete_rec.timeout_period := l_timeout_setup_rec.timeout_period;
955 END IF;
956
957 IF p_timeout_setup_rec.timeout_type = FND_API.G_MISS_CHAR THEN
958 x_complete_rec.timeout_type := l_timeout_setup_rec.timeout_type;
959 END IF;
960
961 IF p_timeout_setup_rec.country_code = FND_API.G_MISS_CHAR THEN
962 x_complete_rec.country_code := l_timeout_setup_rec.country_code;
963 END IF;
964
965
966 IF p_timeout_setup_rec.object_version_number = FND_API.G_MISS_NUM THEN
967 x_complete_rec.object_version_number := l_timeout_setup_rec.object_version_number;
968 END IF;
969
970 END Complete_timeout_Rec;
971
972 END PVX_timeout_setup_PVT;
973