[Home] [Help]
PACKAGE BODY: APPS.OKC_ASYNC_PUB
Source
1 package body OKC_ASYNC_PUB as
2 /* $Header: OKCPASNB.pls 120.1 2005/12/14 22:14:25 npalepu noship $ */
3 l_debug VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
4
5 --
6
7
8 procedure proc_call(
9 --
10 -- common API parameters
11 --
12 p_api_version IN NUMBER,
13 p_init_msg_list IN VARCHAR2 ,
14 x_return_status OUT NOCOPY VARCHAR2,
15 x_msg_count OUT NOCOPY NUMBER,
16 x_msg_data OUT NOCOPY VARCHAR2,
17 --
18 -- specific parameters
19 --
20 p_proc IN VARCHAR2,
21 p_period_days IN NUMBER ,
22 p_stop_date IN DATE ,
23 x_key_to_stop OUT NOCOPY VARCHAR2
24 ) is
25 t OKC_ASYNC_PVT.par_tbl_typ;
26 --
27 l_proc varchar2(72) := ' OKC_ASYNC_PUB.'||'proc_call';
28 --
29
30 begin
31
32 IF (l_debug = 'Y') THEN
33 okc_debug.Set_Indentation(l_proc);
34 okc_debug.Log('10: Entering ',2);
35 END IF;
36
37 t(1).par_type := 'N';
38 t(1).par_name := 'P_PERIOD_DAYS';
39 t(1).par_value := p_period_days;
40 t(2).par_type := 'D';
41 t(2).par_name := 'P_STOP_DATE';
42 t(2).par_value := p_stop_date;
43 OKC_ASYNC_PVT.wf_call(
44 p_api_version => p_api_version,
45 p_init_msg_list => p_init_msg_list,
46 x_return_status => x_return_status,
47 x_msg_count => x_msg_count,
48 x_msg_data => x_msg_data,
49 p_proc => substr(p_proc,1,4000),
50 p_wf_par_tbl => t
51 );
52 if (x_return_status = 'S') then
53 select to_char(okc_wf_notify_s1.currval) into x_key_to_stop from dual;
54 end if;
55 IF (l_debug = 'Y') THEN
56 okc_debug.Log('1000: Leaving ',2);
57 okc_debug.Reset_Indentation;
58 END IF;
59 end;
60
61 procedure proc_stop(
62 --
63 -- common API parameters
64 --
65 p_api_version IN NUMBER,
66 p_init_msg_list IN VARCHAR2 ,
67 x_return_status OUT NOCOPY VARCHAR2,
68 x_msg_count OUT NOCOPY NUMBER,
69 x_msg_data OUT NOCOPY VARCHAR2,
70 --
71 p_stop_date IN DATE ,
72 p_key_to_stop IN VARCHAR2
73 ) is
74 l_api_name CONSTANT VARCHAR2(30) := 'PROC_STOP';
75 l_return_status varchar2(1);
76 l_wf_name varchar2(100);
77 l_end_date date;
78 cursor wf_active is
79 select end_date from WF_ITEMS
80 where item_type = l_wf_name
81 and item_key = p_key_to_stop
82 ;
83 --
84 l_proc varchar2(72) := ' OKC_ASYNC_PUB.'||'proc_stop';
85 --
86
87 begin
88
89 IF (l_debug = 'Y') THEN
90 okc_debug.Set_Indentation(l_proc);
91 okc_debug.Log('10: Entering ',2);
92 END IF;
93
94 l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
95 'OKC_ASYNC_PUB',
96 OKC_API.G_TRUE,
97 p_api_version,
98 p_api_version,
99 'PUB',
100 x_return_status);
101 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
102 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
103 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
104 RAISE OKC_API.G_EXCEPTION_ERROR;
105 END IF;
106 l_wf_name := OKC_ASYNC_PVT.G_WF_NAME;
107 open wf_active;
108 fetch wf_active into l_end_date;
109 close wf_active;
110 if (l_end_date is not NULL) then
111 if (p_stop_date > sysdate) then
112 x_return_status := 'E';
113 else
114 x_return_status := 'S';
115 end if;
116 IF (l_debug = 'Y') THEN
117 okc_debug.Reset_Indentation;
118 END IF;
119 return;
120 end if;
121 --
122 if ( trunc(NVL(p_stop_date,sysdate))
123 -NVL(wf_engine.GetItemAttrNumber (itemtype => L_WF_NAME,
124 itemkey => p_key_to_stop,
125 aname => 'P_PERIOD_DAYS'),0) <
126 trunc(sysdate)+1) then
127 wf_engine.abortprocess(L_WF_NAME,p_key_to_stop);
128 else
129 wf_engine.SetItemAttrDate (itemtype => L_WF_NAME,
130 itemkey => p_key_to_stop,
131 aname => 'P_STOP_DATE',
132 avalue => trunc(p_stop_date) );
133 end if;
134 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
135
136 IF (l_debug = 'Y') THEN
137 okc_debug.Log('1000: Leaving ',2);
138 okc_debug.Reset_Indentation;
139 END IF;
140
141 EXCEPTION
142 WHEN OKC_API.G_EXCEPTION_ERROR THEN
143 x_return_status := OKC_API.HANDLE_EXCEPTIONS
144 (substr(l_api_name,1,26),
145 'OKC_ASYNC_PUB',
146 'OKC_API.G_RET_STS_ERROR',
147 x_msg_count,
148 x_msg_data,
149 'PUB');
150 IF (l_debug = 'Y') THEN
151 okc_debug.Log('2000: Leaving ',2);
152 okc_debug.Reset_Indentation;
153 END IF;
154 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
155 x_return_status := OKC_API.HANDLE_EXCEPTIONS
156 (substr(l_api_name,1,26),
157 'OKC_ASYNC_PUB',
158 'OKC_API.G_RET_STS_UNEXP_ERROR',
159 x_msg_count,
160 x_msg_data,
161 'PUB');
162 IF (l_debug = 'Y') THEN
163 okc_debug.Log('3000: Leaving ',2);
164 okc_debug.Reset_Indentation;
165 END IF;
166 WHEN OTHERS THEN
167 x_return_status := OKC_API.HANDLE_EXCEPTIONS
168 (substr(l_api_name,1,26),
169 'OKC_ASYNC_PUB',
170 'OTHERS',
171 x_msg_count,
172 x_msg_data,
173 'PUB');
174 IF (l_debug = 'Y') THEN
175 okc_debug.Log('4000: Leaving ',2);
176 okc_debug.Reset_Indentation;
177 END IF;
178 end proc_stop;
179
180 procedure msg_call(
181 --
182 -- common API parameters
183 --
184 p_api_version IN NUMBER,
185 p_init_msg_list IN VARCHAR2 ,
186 x_return_status OUT NOCOPY VARCHAR2,
187 x_msg_count OUT NOCOPY NUMBER,
188 x_msg_data OUT NOCOPY VARCHAR2,
189 --
190 -- specific parameters
191 --
192 p_recipient IN VARCHAR2,
193 p_msg_subj IN VARCHAR2,
194 p_msg_body IN VARCHAR2,
195 --
196 -- hidden notification attributes
197 --
198 p_ntf_type IN VARCHAR2 ,
199 p_contract_id IN NUMBER ,
200 p_task_id IN NUMBER ,
201 p_extra_attr_num IN NUMBER ,
202 p_extra_attr_text IN VARCHAR2 ,
203 p_extra_attr_date IN DATE
204 ) is
205 t OKC_ASYNC_PVT.par_tbl_typ;
206 --
207 l_proc varchar2(72) := ' OKC_ASYNC_PUB.'||'msg_call';
208 --
209
210 begin
211
212 IF (l_debug = 'Y') THEN
213 okc_debug.Set_Indentation(l_proc);
214 okc_debug.Log('10: Entering ',2);
215 END IF;
216
217 t(1).par_type := 'C';
218 t(1).par_name := 'MESSAGE0';
219 t(1).par_value := substr(p_msg_subj,1,4000);
220 t(2).par_type := 'C';
221 t(2).par_name := 'MESSAGE1';
222 t(2).par_value := substr(p_msg_body,1,4000);
223 t(3).par_type := 'N';
224 t(3).par_name := 'CONTRACT_ID';
225 t(3).par_value := p_contract_id;
226 t(4).par_type := 'N';
227 t(4).par_name := 'TASK_ID';
228 t(4).par_value := p_task_id;
229 t(5).par_type := 'N';
230 t(5).par_name := 'EXTRA_ATTR_NUM';
231 t(5).par_value := p_extra_attr_num;
232 t(6).par_type := 'C';
233 t(6).par_name := 'EXTRA_ATTR_TEXT';
234 t(6).par_value := substr(p_extra_attr_text,1,4000);
235 t(7).par_type := 'D';
236 t(7).par_name := 'EXTRA_ATTR_DATE';
237 t(7).par_value := p_extra_attr_date;
238 OKC_ASYNC_PVT.wf_call(
239 p_api_version => p_api_version,
240 p_init_msg_list => p_init_msg_list,
241 x_return_status => x_return_status,
242 x_msg_count => x_msg_count,
243 x_msg_data => x_msg_data,
244 p_s_recipient => p_recipient,
245 p_ntf_type => substr(p_ntf_type,1,4000),
246 p_wf_par_tbl => t
247 );
248 IF (l_debug = 'Y') THEN
249 okc_debug.Log('1000: Leaving ',2);
250 okc_debug.Reset_Indentation;
251 END IF;
252
253 end;
254
255 procedure proc_msg_call(
256 --
257 -- common API parameters
258 --
259 p_api_version IN NUMBER,
260 p_init_msg_list IN VARCHAR2 ,
261 x_return_status OUT NOCOPY VARCHAR2,
262 x_msg_count OUT NOCOPY NUMBER,
263 x_msg_data OUT NOCOPY VARCHAR2,
264 --
265 -- specific parameters
266 --
267 p_proc IN VARCHAR2,
268 p_subj_first_msg IN VARCHAR2 ,
269 p_s_recipient IN VARCHAR2, -- normal recipient
270 p_e_recipient IN VARCHAR2, -- error recipient
271 --
272 -- hidden notification attributes
273 --
274 p_ntf_type IN VARCHAR2 ,
275 p_contract_id IN NUMBER ,
276 p_task_id IN NUMBER ,
277 p_extra_attr_num IN NUMBER ,
278 p_extra_attr_text IN VARCHAR2 ,
279 p_extra_attr_date IN DATE
280 ) is
281 t OKC_ASYNC_PVT.par_tbl_typ;
282 --
283 l_proc varchar2(72) := ' OKC_ASYNC_PUB.'||'proc_msg_call';
284 --
285
286 begin
287
288 IF (l_debug = 'Y') THEN
289 okc_debug.Set_Indentation(l_proc);
290 okc_debug.Log('10: Entering ',2);
291 END IF;
292
293 t(1).par_type := 'N';
294 t(1).par_name := 'CONTRACT_ID';
295 t(1).par_value := p_contract_id;
296 t(2).par_type := 'N';
297 t(2).par_name := 'TASK_ID';
298 t(2).par_value := p_task_id;
299 t(3).par_type := 'N';
300 t(3).par_name := 'EXTRA_ATTR_NUM';
301 t(3).par_value := p_extra_attr_num;
302 t(4).par_type := 'C';
303 t(4).par_name := 'EXTRA_ATTR_TEXT';
304 t(4).par_value := substr(p_extra_attr_text,1,4000);
305 t(5).par_type := 'D';
306 t(5).par_name := 'EXTRA_ATTR_DATE';
307 t(5).par_value := p_extra_attr_date;
308 OKC_ASYNC_PVT.wf_call(
309 p_api_version => p_api_version,
310 p_init_msg_list => p_init_msg_list,
311 x_return_status => x_return_status,
312 x_msg_count => x_msg_count,
313 x_msg_data => x_msg_data,
314 p_proc => substr(p_proc,1,4000),
315 p_subj_first_msg => p_subj_first_msg,
316 p_s_recipient => p_s_recipient,
317 p_e_recipient => p_e_recipient,
318 p_ntf_type => substr(p_ntf_type,1,4000),
319 p_wf_par_tbl => t
320 );
321 IF (l_debug = 'Y') THEN
322 okc_debug.Log('1000: Leaving ',2);
323 okc_debug.Reset_Indentation;
324 END IF;
325
326 end;
327
328 procedure resolver_call(
329 --
330 -- common API parameters
331 --
332 p_api_version IN NUMBER,
333 p_init_msg_list IN VARCHAR2 ,
334 x_return_status OUT NOCOPY VARCHAR2,
335 x_msg_count OUT NOCOPY NUMBER,
336 x_msg_data OUT NOCOPY VARCHAR2,
337 --
338 -- wf attributes
339 --
340 p_resolver IN VARCHAR2,
341 p_msg_subj IN VARCHAR2,
342 p_msg_body IN VARCHAR2,
343 p_note IN VARCHAR2 ,
344 p_accept_proc IN VARCHAR2,
345 p_reject_proc IN VARCHAR2,
346 p_timeout_proc IN VARCHAR2 ,
347 p_timeout_minutes IN NUMBER ,--month default to force wf end
348 --
349 -- hidden notification attributes
350 --
351 p_ntf_type IN VARCHAR2 ,
352 p_contract_id IN NUMBER ,
353 p_task_id IN NUMBER ,
354 p_extra_attr_num IN NUMBER ,
355 p_extra_attr_text IN VARCHAR2 ,
356 p_extra_attr_date IN DATE
357 ) is
358 --
359 l_proc varchar2(72) := ' OKC_ASYNC_PUB.'||'resolver_call';
360 --
361
362 begin
363
364 IF (l_debug = 'Y') THEN
365 okc_debug.Set_Indentation(l_proc);
366 okc_debug.Log('10: Entering ',2);
367 END IF;
368
369 OKC_ASYNC_PVT.resolver_call(
370 p_api_version => p_api_version,
371 p_init_msg_list => p_init_msg_list,
372 x_return_status => x_return_status,
373 x_msg_count => x_msg_count,
374 x_msg_data => x_msg_data,
375 --
376 p_resolver => p_resolver,
377 p_msg_subj_resolver => substr(p_msg_subj,1,4000),
378 p_msg_body_resolver => substr(p_msg_body,1,4000),
379 p_note => substr(p_note,1,4000),
380 p_accept_proc => substr(p_accept_proc,1,4000),
381 p_reject_proc => substr(p_reject_proc,1,4000),
382 p_timeout_proc => substr(p_timeout_proc,1,4000),
383 p_timeout_minutes => p_timeout_minutes,
384 --
385 p_ntf_type => substr(p_ntf_type,1,4000),
386 p_contract_id => p_contract_id,
387 p_task_id => p_task_id,
388 p_extra_attr_num => p_extra_attr_num,
389 p_extra_attr_text => substr(p_extra_attr_text,1,4000),
390 p_extra_attr_date => p_extra_attr_date
391 );
392 IF (l_debug = 'Y') THEN
393 okc_debug.Log('1000: Leaving ',2);
394 okc_debug.Reset_Indentation;
395 END IF;
396
397 end;
398
399 procedure send_doc(
400 --
401 -- common API parameters
402 --
403 p_api_version IN NUMBER,
404 p_init_msg_list IN VARCHAR2 ,
405 x_return_status OUT NOCOPY VARCHAR2,
406 x_msg_count OUT NOCOPY NUMBER,
407 x_msg_data OUT NOCOPY VARCHAR2,
408 --
409 -- specific parameters
410 --
411 p_recipient IN VARCHAR2,
412 p_msg_subj IN VARCHAR2,
413 p_msg_body IN VARCHAR2,
414 p_proc IN VARCHAR2,
415 --
416 -- hidden notification attributes
417 --
418 p_ntf_type IN VARCHAR2 ,
419 p_contract_id IN NUMBER ,
420 p_task_id IN NUMBER ,
421 p_extra_attr_num IN NUMBER ,
422 p_extra_attr_text IN VARCHAR2 ,
423 p_extra_attr_date IN DATE
424 ) is
425 t OKC_ASYNC_PVT.par_tbl_typ;
426 --
427 l_proc varchar2(72) := ' OKC_ASYNC_PUB.'||'send_doc';
428 --
429
430 begin
431
432 IF (l_debug = 'Y') THEN
433 okc_debug.Set_Indentation(l_proc);
434 okc_debug.Log('10: Entering ',2);
435 END IF;
436
437 t(1).par_type := 'C';
438 t(1).par_name := 'MESSAGE0';
439 t(1).par_value := substr(p_msg_subj,1,4000);
440 t(2).par_type := 'C';
441 t(2).par_name := 'MESSAGE1';
442 t(2).par_value := substr(p_msg_body,1,4000);
443 t(3).par_type := 'N';
444 t(3).par_name := 'CONTRACT_ID';
445 t(3).par_value := p_contract_id;
446 t(4).par_type := 'N';
447 t(4).par_name := 'TASK_ID';
448 t(4).par_value := p_task_id;
449 t(5).par_type := 'N';
450 t(5).par_name := 'EXTRA_ATTR_NUM';
451 t(5).par_value := p_extra_attr_num;
452 t(6).par_type := 'C';
453 t(6).par_name := 'EXTRA_ATTR_TEXT';
454 t(6).par_value := substr(p_extra_attr_text,1,4000);
455 t(7).par_type := 'D';
456 t(7).par_name := 'EXTRA_ATTR_DATE';
457 t(7).par_value := p_extra_attr_date;
458 t(8).par_type := 'C';
459 t(8).par_name := 'P_DOC_PROC';
460 t(8).par_value := substr(p_proc,1,4000);
461 OKC_ASYNC_PVT.wf_call(
462 p_api_version => p_api_version,
463 p_init_msg_list => p_init_msg_list,
464 x_return_status => x_return_status,
465 x_msg_count => x_msg_count,
466 x_msg_data => x_msg_data,
467 p_s_recipient => p_recipient,
468 p_ntf_type => substr(p_ntf_type,1,4000),
469 p_wf_par_tbl => t
470 );
471 IF (l_debug = 'Y') THEN
472 okc_debug.Log('1000: Leaving ',2);
473 okc_debug.Reset_Indentation;
474 END IF;
475
476 end;
477
478 procedure loop_call(
479 --
480 -- common API parameters
481 --
482 p_api_version IN NUMBER,
483 p_init_msg_list IN VARCHAR2 ,
484 x_return_status OUT NOCOPY VARCHAR2,
485 x_msg_count OUT NOCOPY NUMBER,
486 x_msg_data OUT NOCOPY VARCHAR2,
487 --
488 -- specific parameters
489 --
490 p_proc IN VARCHAR2,
491 p_s_recipient IN VARCHAR2 ,
492 p_e_recipient IN VARCHAR2 ,
493 p_timeout_minutes IN NUMBER ,
494 p_loops IN NUMBER ,
495 p_subj_first_msg IN VARCHAR2 ,
496 --
497 -- hidden notification attributes
498 --
499 p_ntf_type IN VARCHAR2 ,
500 p_contract_id IN NUMBER ,
501 p_task_id IN NUMBER ,
502 p_extra_attr_num IN NUMBER ,
503 p_extra_attr_text IN VARCHAR2 ,
504 p_extra_attr_date IN DATE
505 ) is
506 --
507 l_proc varchar2(72) := ' OKC_ASYNC_PUB.'||'loop_call';
508 --
509
510 begin
511
512 IF (l_debug = 'Y') THEN
513 okc_debug.Set_Indentation(l_proc);
514 okc_debug.Log('10: Entering ',2);
515 END IF;
516
517 OKC_ASYNC_PVT.loop_call(
518 p_api_version => p_api_version,
519 p_init_msg_list => p_init_msg_list,
520 x_return_status => x_return_status,
521 x_msg_count => x_msg_count,
522 x_msg_data => x_msg_data,
523 --
524 p_proc => substr(p_proc,1,4000),
525 p_s_recipient => p_s_recipient,
526 p_e_recipient => p_e_recipient,
527 p_timeout_minutes => p_timeout_minutes,
528 p_loops => p_loops,
529 p_subj_first_msg => p_subj_first_msg,
530 --
531 -- hidden notification attributes
532 --
533 p_ntf_type => substr(p_ntf_type,1,4000),
534 p_contract_id => p_contract_id,
535 p_task_id => p_task_id,
536 p_extra_attr_num => p_extra_attr_num,
537 p_extra_attr_text => substr(p_extra_attr_text,1,4000),
538 p_extra_attr_date => p_extra_attr_date
539 );
540 IF (l_debug = 'Y') THEN
541 okc_debug.Log('1000: Leaving ',2);
542 okc_debug.Reset_Indentation;
543 END IF;
544
545 end;
546
547 --NPALEPU
548 --14-DEC-2005
549 --For Bug # 4699009, Added Overloaded LOOP_CALL API.
550 procedure loop_call(
551 --
552 -- common API parameters
553 --
554 p_api_version IN NUMBER,
555 p_init_msg_list IN VARCHAR2 ,
556 x_return_status OUT NOCOPY VARCHAR2,
557 x_msg_count OUT NOCOPY NUMBER,
558 x_msg_data OUT NOCOPY VARCHAR2,
559 --
560 -- specific parameters
561 --
562 p_proc IN VARCHAR2,
563 p_proc_name IN VARCHAR2,
564 p_s_recipient IN VARCHAR2 ,
565 p_e_recipient IN VARCHAR2 ,
566 p_timeout_minutes IN NUMBER ,
567 p_loops IN NUMBER ,
568 p_subj_first_msg IN VARCHAR2 ,
569 --
570 -- hidden notification attributes
571 --
572 p_ntf_type IN VARCHAR2 ,
573 p_contract_id IN NUMBER ,
574 p_task_id IN NUMBER ,
575 p_extra_attr_num IN NUMBER ,
576 p_extra_attr_text IN VARCHAR2 ,
577 p_extra_attr_date IN DATE
578 ) is
579 --
580 l_proc varchar2(72) := ' OKC_ASYNC_PUB.'||'loop_call';
581 --
582
583 begin
584
585 IF (l_debug = 'Y') THEN
586 okc_debug.Set_Indentation(l_proc);
587 okc_debug.Log('10: Entering ',2);
588 END IF;
589
590 OKC_ASYNC_PVT.loop_call( p_api_version => p_api_version,
591 p_init_msg_list => p_init_msg_list,
592 x_return_status => x_return_status,
593 x_msg_count => x_msg_count,
594 x_msg_data => x_msg_data,
595 p_proc => substr(p_proc,1,4000),
596 p_proc_name => p_proc_name,
597 p_s_recipient => p_s_recipient,
598 p_e_recipient => p_e_recipient,
599 p_timeout_minutes => p_timeout_minutes,
600 p_loops => p_loops,
601 p_subj_first_msg => p_subj_first_msg,
602 --
603 -- hidden notification attributes
604 --
605 p_ntf_type => substr(p_ntf_type,1,4000),
606 p_contract_id => p_contract_id,
607 p_task_id => p_task_id,
608 p_extra_attr_num => p_extra_attr_num,
609 p_extra_attr_text => substr(p_extra_attr_text,1,4000),
610 p_extra_attr_date => p_extra_attr_date
611 );
612 IF (l_debug = 'Y') THEN
613 okc_debug.Log('1000: Leaving ',2);
614 okc_debug.Reset_Indentation;
615 END IF;
616
617 end LOOP_CALL;
618 --END NPALEPU
619
620 end OKC_ASYNC_PUB;