1 PACKAGE BODY CCT_RoutingActivities_PUB as
2 /* $Header: cctraccb.pls 120.0 2005/06/02 09:43:34 appldev noship $ */
3 G_PKG_NAME CONSTANT VARCHAR2(30) := 'CCT_RoutingActivities_PUB';
4
5
6 /*------------------------------------------------------------------------
7 Routing Workflow Activities
8 *------------------------------------------------------------------------*/
9
10 /*------------------------------------------------------------------------
11 Group : Environmental Conditions
12 *------------------------------------------------------------------------*/
13 /*------------------------------------------------------------------------
14 SubGroup : Time Based
15 *------------------------------------------------------------------------*/
16
17 /* -----------------------------------------------------------------------
18 Activity Name : DuringBusinessHours
19 -- Function to return Yes or No depending on whether DATETIME
20 -- (when caller called) between two Ref Times
21 -- IN
22 - itemtype - item type
23 -- itemkey - item key
24 -- actid - process activity instance id
25 -- funmode - execution mode
26 -- OUT
27 -- result (Yes or No)
28 -- ITEM ATTRIBUTES REFERENCED
29 -- DATETIME - Test Value
30 *-----------------------------------------------------------------------*/
31 procedure DuringBusinessHours (
32 itemtype in varchar2
33 , itemkey in varchar2
34 , actid in number
35 , funmode in varchar2
36 , resultout in out nocopy varchar2)
37 IS
38 l_proc_name VARCHAR2(30) := 'DuringBusinessHours';
39 l_startTime date;
40 l_endTime date;
41 l_TimeOfCall date;
42 BEGIN
43 resultout := wf_engine.eng_null;
44
45 -- Do nothing in cancel or timeout mode
46 if (funmode <> wf_engine.eng_run) then
47 return;
48 end if;
49
50 l_startTime := Wf_Engine.GetActivityAttrDate(itemtype,itemkey,actid,
51 'START-TIME');
52
53 l_endTime := Wf_Engine.GetActivityAttrDate(itemtype,itemkey,actid ,
54 'END-TIME');
55
56 l_TimeOfCall := Wf_Engine.GetItemAttrDate(itemtype,itemkey,
57 'OCCTCREATIONTIME');
58
59 -- Compare time of call to business open and close times
60 IF (l_startTime is null or l_endTime is null) THEN
61 resultout := wf_engine.eng_completed||':' || wf_engine.eng_null;
62 ELSIF ( (l_TimeOfCall - TRUNC(l_TimeOfCall)) >=
63 (l_startTime - TRUNC(l_startTime )) AND
64 (l_TimeOfCall - TRUNC(l_TimeOfCall)) <=
65 (l_endTime - TRUNC(l_endTime))) THEN
66
67 resultout := wf_engine.eng_completed||':Y';
68
69 ELSE
70 resultout := wf_engine.eng_completed||':N';
71
72 END IF;
73
74
75 EXCEPTION
76 WHEN OTHERS THEN
77 -- if the customer id is not found
78 IF (WF_CORE.Error_Name = 'WFENG_ITEM_ATTR') then
79 WF_CORE.CLEAR;
80 -- default result returned
81 RETURN;
82 END IF;
83
84 -- for other errors
85 Wf_Core.Context(G_PKG_NAME, l_proc_name, itemtype,
86 itemkey, to_char(actid), funmode);
87 RAISE;
88 END DuringBusinessHours;
89
90
91
92 /* -----------------------------------------------------------------------
93 Activity Name : HourOfDay
94 -- Function to return hour of the day
95 -- IN
96 - itemtype - item type
97 -- itemkey - item key
98 -- actid - process activity instance id
99 -- funmode - execution mode
100 -- OUT
101 -- result (WFSTD_DAY_OF_WEEK lookup code)
102 -- ITEM ATTRIBUTES REFERENCED
103 -- DATETIME - Test Value
104 *-----------------------------------------------------------------------*/
105 procedure HourOfDay (
106 itemtype in varchar2
107 , itemkey in varchar2
108 , actid in number
109 , funmode in varchar2
110 , resultout in out nocopy varchar2)
111 is
112 l_proc_name VARCHAR2(30) := 'HourOfDay';
113 l_dateval1 date;
114 l_hour varchar2(20);
115 begin
116 resultout := wf_engine.eng_null;
117
118 -- Do nothing in cancel or timeout mode
119 if (funmode <> wf_engine.eng_run) then
120 return;
121 end if;
122
123 l_dateval1 := Wf_Engine.GetItemAttrDate(itemtype,itemkey,
124 'OCCTCREATIONTIME');
125
126 -- Need to make a 24 hour clock
127 l_hour := to_char(l_dateval1, 'HOUR') ;
128 resultout := wf_engine.eng_completed||':'||l_hour;
129
130 exception
131 when others then
132 -- if the customer id is not found
133 if (WF_CORE.Error_Name = 'WFENG_ITEM_ATTR') then
134 WF_CORE.CLEAR;
135 -- default result returned
136 return;
137 end if;
138
139 -- for other errors
140 Wf_Core.Context(G_PKG_NAME, l_proc_name, itemtype,
141 itemkey, to_char(actid), funmode);
142 raise;
143 end HourOfDay;
144
145 /* -----------------------------------------------------------------------
146 Activity Name : BeforeTime
147 To compare if DATETIME (time of call) is before REF-TIME
148 IN
149 itemtype - item type
150 itemkey - item key
151 actid - process activity instance id
152 funmode - execution mode
153 OUT
154 comparison result (WFSTD_YES_NO lookup code)
155 ITEM ATTRIBUTES REFERENCED
156 DATETIME - Test Value
157 ACTIVITY ATTRIBUTES REFERENCED
158 REF-TIME - Reference Value
159 *--------------------------------------------------------------------*/
160 procedure BeforeTime (
161 itemtype in varchar2
162 , itemkey in varchar2
163 , actid in number
164 , funmode in varchar2
165 , resultout in out nocopy varchar2)
166 is
167
168 l_proc_name VARCHAR2(30) := 'BeforeTime';
169 l_TimeOfCall date;
170 l_refTime date;
171 begin
172 -- Do nothing in cancel or timeout mode
173 if (funmode <> wf_engine.eng_run) then
174 resultout := wf_engine.eng_null;
175 return;
176 end if;
177 /* **************** */
178 -- Get the two date values
179 l_TimeOfCall := Wf_Engine.GetItemAttrDate(itemtype,itemkey,
180 'OCCTCREATIONTIME');
181 l_refTime := Wf_Engine.GetActivityAttrDate(itemtype,itemkey,actid,
182 'REF-TIME');
183
184 -- Compare
185 if (l_TimeOfCall is null or l_refTime is null) then
186 resultout := wf_engine.eng_completed||':NULL';
187 elsif ( (l_TimeOfCall - TRUNC(l_TimeOfCall)) <
188 (l_refTime - TRUNC(l_refTime)) ) then
189 resultout := wf_engine.eng_completed||':Y';
190 else
191 resultout := wf_engine.eng_completed||':N';
192 end if;
193
194 /* ************ */
195
196 Exception
197 when others then
198 Wf_Core.Context(G_PKG_NAME, l_proc_name, itemtype,
199 itemkey, to_char(actid), funmode);
200 raise;
201 end BeforeTime;
202
203 /* -----------------------------------------------------------------------
204 Activity Name : AfterTime
205 To compare if DATETIME (time of call) is after REF-TIME
206 IN
207 itemtype - item type
208 itemkey - item key
209 actid - process activity instance id
210 funmode - execution mode
211 OUT
212 comparison result (WFSTD_YES_NO lookup code)
213 ITEM ATTRIBUTES REFERENCED
214 DATETIME - Test Value
215 ACTIVITY ATTRIBUTES REFERENCED
216 REF-TIME - Reference Value
217 *--------------------------------------------------------------------*/
218 procedure AfterTime (
219 itemtype in varchar2
220 , itemkey in varchar2
221 , actid in number
222 , funmode in varchar2
223 , resultout in out nocopy varchar2)
224 is
225
226 l_proc_name VARCHAR2(30) := 'AfterTime';
227 l_timeOfCall date;
228 l_refTime date;
229 begin
230 -- Do nothing in cancel or timeout mode
231 if (funmode <> wf_engine.eng_run) then
232 resultout := wf_engine.eng_null;
233 return;
234 end if;
235 /* **************** */
236 -- Get the two date values
237 l_timeOfCall := Wf_Engine.GetItemAttrDate(itemtype,itemkey,
238 'OCCTCREATIONTIME');
239 l_refTime := Wf_Engine.GetActivityAttrDate(itemtype,itemkey,actid,
240 'REF-TIME');
241
242 -- Compare
243 if (l_timeOfCall is null or l_refTime is null) then
244 resultout := wf_engine.eng_completed||':NULL';
245 elsif ( (l_timeOfCall - TRUNC(l_timeOfCall)) >
246 (l_refTime - TRUNC(l_refTime)) ) then
247 resultout := wf_engine.eng_completed||':Y';
248 else
249 resultout := wf_engine.eng_completed||':N';
250 end if;
251
252 /* ************ */
253
254 Exception
255 when others then
256 Wf_Core.Context(G_PKG_NAME, l_proc_name, itemtype,
257 itemkey, to_char(actid), funmode);
258 raise;
259 end AfterTime;
260
261
262 /*------------------------------------------------------------------------
263 SubGroup : Date Based
264 *------------------------------------------------------------------------*/
265 /* -----------------------------------------------------------------------
266 Activity Name : DayOfWeek
267 -- Function to return day of the week
268 -- IN
269 - itemtype - item type
270 -- itemkey - item key
271 -- actid - process activity instance id
272 -- funmode - execution mode
273 -- OUT
274 -- result (WFSTD_DAY_OF_WEEK lookup code)
275 -- ITEM ATTRIBUTES REFERENCED
276 -- DATETIME - Test Value
277 *-----------------------------------------------------------------------*/
278 procedure DayOfWeek (
279 itemtype in varchar2
280 , itemkey in varchar2
281 , actid in number
282 , funmode in varchar2
283 , resultout in out nocopy varchar2)
284 is
285 l_proc_name VARCHAR2(30) := 'DayOfWeek';
286 l_dateval1 date;
287 l_day varchar2(20);
288 begin
289 resultout := wf_engine.eng_null;
290
291 -- Do nothing in cancel or timeout mode
292 if (funmode <> wf_engine.eng_run) then
293 return;
294 end if;
295
296 l_dateval1 := Wf_Engine.GetItemAttrDate(itemtype,itemkey,
297 'OCCTCREATIONTIME');
298
299 if (l_dateval1 IS NULL) then
300 return;
301 end if;
302
303 l_day := RTRIM(to_char(l_dateval1, 'DAY')) ;
304 resultout := wf_engine.eng_completed||':'||l_day;
305 exception
306 when others then
307 Wf_Core.Context(G_PKG_NAME, l_proc_name, itemtype,
308 itemkey, to_char(actid), funmode);
309 raise;
310 end DayOfWeek;
311
312 /* -----------------------------------------------------------------------
313 Activity Name : DayOfMonth
314 -- Function to return the day of the month
315 -- IN
316 - itemtype - item type
317 -- itemkey - item key
318 -- actid - process activity instance id
319 -- funmode - execution mode
320 -- OUT
321 -- result (WFSTD_DAY_OF_MONTH lookup code)
322 -- ITEM ATTRIBUTES REFERENCED
323 -- DATETIME - Test Value
324 *-----------------------------------------------------------------------*/
325 procedure DayOfMonth (
326 itemtype in varchar2
327 , itemkey in varchar2
328 , actid in number
329 , funmode in varchar2
330 , resultout in out nocopy varchar2)
331 is
332 l_proc_name VARCHAR2(30) := 'DayOfMonth';
333 l_dateval1 date;
334 l_day varchar2(20);
335 begin
336 resultout := wf_engine.eng_null;
337
338 -- Do nothing in cancel or timeout mode
339 if (funmode <> wf_engine.eng_run) then
340 return;
341 end if;
342
343 l_dateval1 := Wf_Engine.GetItemAttrDate(itemtype,itemkey,
344 'OCCTCREATIONTIME');
345
346 l_day := to_char(l_dateval1, 'DD') ;
347 l_day := LTRIM(RTRIM(l_day));
348 resultout := wf_engine.eng_completed||':'||l_day;
349
350 exception
351 when others then
352 -- if the customer id is not found
353 if (WF_CORE.Error_Name = 'WFENG_ITEM_ATTR') then
354 WF_CORE.CLEAR;
355 -- default result returned
356 return;
357 end if;
358
359 -- for other errors
360 Wf_Core.Context(G_PKG_NAME, l_proc_name, itemtype,
361 itemkey, to_char(actid), funmode);
362 raise;
363 end DayOfMonth;
364
365 /* -----------------------------------------------------------------------
366 Activity Name : BeforeDate
367 To compare if DATETIME (time of call) is before REF-DATE
368 IN
369 itemtype - item type
370 itemkey - item key
371 actid - process activity instance id
372 funmode - execution mode
373 OUT
374 comparison result (WFSTD_YES_NO lookup code)
375 ITEM ATTRIBUTES REFERENCED
376 DATETIME - Test Value
377 ACTIVITY ATTRIBUTES REFERENCED
378 REF-DATE - Reference Value
379 *-----------------------------------------------------------------------*/
380 procedure BeforeDate (
381 itemtype in varchar2
382 , itemkey in varchar2
383 , actid in number
384 , funmode in varchar2
385 , resultout in out nocopy varchar2)
386 is
387
388 l_proc_name VARCHAR2(30) := 'BeforeDate';
389 l_dateOfCall date;
390 l_refDate date;
391 begin
392 -- Do nothing in cancel or timeout mode
393 if (funmode <> wf_engine.eng_run) then
394 resultout := wf_engine.eng_null;
395 return;
396 end if;
397
398 -- Get the two date values
399 l_dateOfCall := Wf_Engine.GetItemAttrDate(itemtype,itemkey,
400 'OCCTCREATIONTIME');
401
402 l_refDate := Wf_Engine.GetActivityAttrDate(itemtype,itemkey,actid,
403 'REF-DATE');
404
405 -- Compare l_dateOfCall (date of call) with l_refDate (REF-DATE)
406 if (l_dateOfCall is null) or (l_refDate is null) then
407 resultout := wf_engine.eng_completed||':NULL';
408 elsif ( l_dateOfCall < l_refDate ) then
409 resultout := wf_engine.eng_completed||':Y';
410 else
411 resultout := wf_engine.eng_completed||':N';
412 end if;
413
414 Exception
415 when others then
416 Wf_Core.Context(G_PKG_NAME, l_proc_name, itemtype,
417 itemkey, to_char(actid), funmode);
418 raise;
419 end BeforeDate;
420
421 /* -----------------------------------------------------------------------
422 Activity Name : AfterDate
423 To compare if DATETIME (time of call) is after REF-DATE
424 IN
425 itemtype - item type
426 itemkey - item key
427 actid - process activity instance id
428 funmode - execution mode
429 OUT
430 comparison result (WFSTD_YES_NO lookup code)
431 ITEM ATTRIBUTES REFERENCED
432 DATETIME - Test Value
433 ACTIVITY ATTRIBUTES REFERENCED
434 REF-DATE - Reference Value
435 *-----------------------------------------------------------------------*/
436 procedure AfterDate (
437 itemtype in varchar2
438 , itemkey in varchar2
439 , actid in number
440 , funmode in varchar2
441 , resultout in out nocopy varchar2)
442 is
443
444 l_proc_name VARCHAR2(30) := 'AfterDate';
445 l_dateOfCall date;
446 l_refDate date;
447 begin
448 -- Do nothing in cancel or timeout mode
449 if (funmode <> wf_engine.eng_run) then
450 resultout := wf_engine.eng_null;
451 return;
452 end if;
453 -- Get the two date values
454 l_dateOfCall := Wf_Engine.GetItemAttrDate(itemtype,itemkey,
455 'OCCTCREATIONTIME');
459 -- Compare l_dateOfCall (date of call) with l_refDate (REF-DATE)
456 l_refDate := Wf_Engine.GetActivityAttrDate(itemtype,itemkey,actid,
457 'REF-DATE');
458
460 if (l_dateOfCall is null) or (l_refDate is null) then
461 resultout := wf_engine.eng_completed||':NULL';
462 elsif ( l_dateOfCall > l_refDate ) then
463 resultout := wf_engine.eng_completed||':Y';
464 else
465 resultout := wf_engine.eng_completed||':N';
466 end if;
467
468
469 Exception
470 when others then
471 Wf_Core.Context(G_PKG_NAME, l_proc_name, itemtype,
472 itemkey, to_char(actid), funmode);
473 raise;
474 end AfterDate;
475
476
477 /* -----------------------------------------------------------------------
478 Activity Name : BetweenDates
479 To compare if DATETIME (time of call) is between START-DATE and
480 END-DATE
481 IN
482 itemtype - item type
483 itemkey - item key
484 actid - process activity instance id
485 funmode - execution mode
486 OUT
487 comparison result (WFSTD_YES_NO lookup code)
488 ITEM ATTRIBUTES REFERENCED
489 DATETIME - Test Value
490 ACTIVITY ATTRIBUTES REFERENCED
491 START-DATE - Start Date Reference Value
492 END-DATE - End Date Reference Value
493 *-----------------------------------------------------------------------*/
494 procedure BetweenDates (
495 itemtype in varchar2
496 , itemkey in varchar2
497 , actid in number
498 , funmode in varchar2
499 , resultout in out nocopy varchar2)
500 is
501 l_proc_name VARCHAR2(30) := 'BetweenDates';
502 l_startDate date;
503 l_endDate date;
504 l_dateOfCall date;
505 begin
506 -- Do nothing in cancel or timeout mode
507 if (funmode <> wf_engine.eng_run) then
508 resultout := wf_engine.eng_null;
509 return;
510 end if;
511 -- Get the two date values
512 l_dateOfCall := Wf_Engine.GetItemAttrDate(itemtype,itemkey,
513 'OCCTCREATIONTIME');
514 l_startDate := Wf_Engine.GetActivityAttrDate(itemtype,itemkey,actid,
515 'START-DATE');
516 l_endDate := Wf_Engine.GetActivityAttrDate(itemtype,itemkey,actid,
517 'END-DATE');
518
519 -- Compare l_dateOfCall with START-DATE and END-DATE
520 if (l_startDate is null) or (l_endDate is null) then
521 resultout := wf_engine.eng_completed||':NULL';
522 elsif ( (TRUNC(l_dateOfCall) <= TRUNC(l_endDate)) AND
523 (TRUNC(l_dateOfCall) >= TRUNC(l_startDate))) then
524 resultout := wf_engine.eng_completed||':Y';
525 else
526 resultout := wf_engine.eng_completed||':N';
527 end if;
528
529 Exception
530 when others then
531 Wf_Core.Context(G_PKG_NAME, l_proc_name, itemtype,
532 itemkey, to_char(actid), funmode);
533 raise;
534 end BetweenDates;
535 -- Line 503
536
537
538
539 /* -----------------------------------------------------------------------
540 Activity Name : Set_Lang_Comp_Filter
541 To filter the agents by Language Comptency
542 IN
543 itemtype - item type
544 itemkey - item key
545 actid - process activity instance id
546 funmode - execution mode
547 OUT
548 No output
549 ITEM ATTRIBUTES REFERENCED
550 LANGUAGE - the language ID
551 COMPETENCY-LANG-F - the language competency filter flag
552 CALLID - the call ID
553 *-----------------------------------------------------------------------*/
554 procedure Set_Lang_Comp_Filter (
555 itemtype in varchar2
556 , itemkey in varchar2
557 , actid in number
558 , funmode in varchar2
559 , resultout in out nocopy varchar2)
560 IS
561 l_proc_name VARCHAR2(30) := 'Set_Lang_Comp_Filter';
562 l_agents_tbl CCT_RoutingWorkflow_UTL.agent_tbl_type;
563 l_num_agents NUMBER := 0;
564 l_competency_name VARCHAR2(32);
565 l_call_ID VARCHAR2(32);
566 i INTEGER;
567 l_competency_type VARCHAR2(32):= 'LANG'; -- Changed Jun 27 2000
568 BEGIN
569 -- set default result
570 resultout := wf_engine.eng_completed ;
571
572 if (funmode = 'RUN') then
573 l_competency_name := WF_ENGINE.GetItemAttrText(
574 itemtype, itemkey, 'LANGUAGECOMPETENCY');
575
576 l_call_ID := WF_ENGINE.GetItemAttrText(
577 itemtype, itemkey, 'OCCTMEDIAITEMID');
578
579 IF ( (l_competency_name IS NULL) OR (l_call_ID IS NULL) ) THEN
580 return;
581 END IF;
582
583 -- call CCT API
584 l_num_agents := CCT_JTFRESOURCEROUTING_PUB.Get_Agents_For_Competency(
585 l_competency_type, l_competency_name , l_agents_tbl);
586 IF (l_num_agents = 0) THEN
587 return;
588 END IF;
589
590 -- insert the agents into the CCT_TEMPAGENTS table
591 CCT_RoutingWorkflow_UTL.InsertResults
592 (l_call_ID, 'CCT_COMPETENCY_LANG_FILTER' , l_agents_tbl);
593
594 end if;
595 EXCEPTION
596 WHEN OTHERS THEN
597 WF_CORE.Context(G_PKG_NAME, l_proc_name,
598 itemtype, itemkey, to_char(actid), funmode);
602
599 RAISE;
600
601 END Set_Lang_Comp_Filter;
603
604 /* -----------------------------------------------------------------------
605 Activity Name : Set_Know_Comp_Filter
606 To filter the agents by Knowledge Comptency
607 IN
608 itemtype - item type
609 itemkey - item key
610 actid - process activity instance id
611 funmode - execution mode
612 OUT
613 No output
614 ITEM ATTRIBUTES REFERENCED
615 KNOWLEDGE - the knowledge
616 COMPETENCY-KNOW-F - the knowledge competency filter flag
617 CALLID - the call ID
618 *-----------------------------------------------------------------------*/
619 procedure Set_Know_Comp_Filter (
620 itemtype in varchar2
621 , itemkey in varchar2
622 , actid in number
623 , funmode in varchar2
624 , resultout in out nocopy varchar2)
625 IS
626 l_proc_name VARCHAR2(30) := 'Set_Know_Comp_Filter';
627 l_agents_tbl CCT_RoutingWorkflow_UTL.agent_tbl_type;
628 l_num_agents NUMBER := 0;
629 l_competency_name VARCHAR2(32);
630 l_call_ID VARCHAR2(32);
631 i INTEGER;
632 l_competency_type VARCHAR2(32):= 'KNOWLEDGE';
633
634 BEGIN
635 -- set default result
636 resultout := wf_engine.eng_completed ;
637
638 if (funmode = 'RUN') then
639 l_competency_name := WF_ENGINE.GetItemAttrText(
640 itemtype, itemkey, 'KNOWLEDGECOMPETENCY');
641
642 l_call_ID := WF_ENGINE.GetItemAttrText(
643 itemtype, itemkey, 'OCCTMEDIAITEMID');
644
645 IF ( (l_competency_name IS NULL) OR (l_call_ID IS NULL) ) THEN
646 return;
647 END IF;
648
649 -- call CCT API
650 l_num_agents := CCT_JTFRESOURCEROUTING_PUB.Get_Agents_For_Competency(
651 l_competency_type, l_competency_name , l_agents_tbl);
652 IF (l_num_agents = 0) THEN
653 return;
654 END IF;
655
656 -- insert the agents into the CCT_TEMPAGENTS table
657 CCT_RoutingWorkflow_UTL.InsertResults
658 (l_call_ID, 'CCT_COMPETENCY_KNOW_FILTER' , l_agents_tbl);
659
660 end if;
661 EXCEPTION
662 WHEN OTHERS THEN
663 WF_CORE.Context(G_PKG_NAME, l_proc_name,
664 itemtype, itemkey, to_char(actid), funmode);
665 RAISE;
666
667 END Set_Know_Comp_Filter;
668
669
670
671 /* -----------------------------------------------------------------------
672 Activity Name : Set_Prod_Comp_Filter
673 To filter the agents by Product Comptency
674 IN
675 itemtype - item type
676 itemkey - item key
677 actid - process activity instance id
678 funmode - execution mode
679 OUT
680 No output
681 ITEM ATTRIBUTES REFERENCED
682 PRODUCT - the product
683 COMPETENCY-KNOW-F - the product competency filter flag
684 CALLID - the call ID
685 *-----------------------------------------------------------------------*/
686 procedure Set_Prod_Comp_Filter (
687 itemtype in varchar2
688 , itemkey in varchar2
689 , actid in number
690 , funmode in varchar2
691 , resultout in out nocopy varchar2)
692 IS
693 l_proc_name VARCHAR2(30) := 'Set_Prod_Comp_Filter';
694 l_agents_tbl CCT_RoutingWorkflow_UTL.agent_tbl_type;
695 l_num_agents NUMBER := 0;
696 l_competency_name VARCHAR2(32);
697 l_call_ID VARCHAR2(32);
698 i INTEGER;
699 l_competency_type VARCHAR2(32):= 'PRODUCT';
700 BEGIN
701 -- set default result
702 resultout := wf_engine.eng_completed ;
703
704 if (funmode = 'RUN') then
705 l_competency_name := WF_ENGINE.GetItemAttrText(
706 itemtype, itemkey, 'PRODUCTCOMPETENCY');
707
708 l_call_ID := WF_ENGINE.GetItemAttrText(
709 itemtype, itemkey, 'OCCTMEDIAITEMID');
710
711 IF ( (l_competency_name IS NULL) OR (l_call_ID IS NULL) ) THEN
712 return;
713 END IF;
714
715 -- call CCT API
716 l_num_agents := CCT_JTFRESOURCEROUTING_PUB.Get_Agents_For_Competency(
717 l_competency_type, l_competency_name , l_agents_tbl);
718 IF (l_num_agents = 0) THEN
719 return;
720 END IF;
721
722 -- insert the agents into the CCT_TEMPAGENTS table
723 CCT_RoutingWorkflow_UTL.InsertResults
724 (l_call_ID, 'CCT_COMPETENCY_PROD_FILTER' , l_agents_tbl);
725
726 end if;
727 EXCEPTION
728 WHEN OTHERS THEN
729 WF_CORE.Context(G_PKG_NAME, l_proc_name,
730 itemtype, itemkey, to_char(actid), funmode);
731 RAISE;
732
733 END Set_Prod_Comp_Filter;
734
735
736 /* -----------------------------------------------------------------------
737 Activity Name : Set_DNIS_Comp_Filter
738 To filter the agents by DNIS Comptency
739 IN
740 itemtype - item type
741 itemkey - item key
742 actid - process activity instance id
743 funmode - execution mode
744 OUT
748 COMPETENCY-DNIS-F - the DNIS competency filter flag
745 No output
746 ITEM ATTRIBUTES REFERENCED
747 DNIS - the DNIS
749 CALLID - the call ID
750 *-----------------------------------------------------------------------*/
751 procedure Set_DNIS_Comp_Filter (
752 itemtype in varchar2
753 , itemkey in varchar2
754 , actid in number
755 , funmode in varchar2
756 , resultout in out nocopy varchar2)
757 IS
758 l_proc_name VARCHAR2(30) := 'Set_DNIS_Comp_Filter';
759 l_agents_tbl CCT_RoutingWorkflow_UTL.agent_tbl_type;
760 l_num_agents NUMBER := 0;
761 l_competency_name VARCHAR2(32);
762 l_call_ID VARCHAR2(32);
763 i INTEGER;
764 l_competency_type VARCHAR2(32):= 'OCCTDNIS';
765 BEGIN
766 -- set default result
767 resultout := wf_engine.eng_completed ;
768
769 if (funmode = 'RUN') then
770 l_competency_name := WF_ENGINE.GetItemAttrText(
771 itemtype, itemkey, 'OCCTDNIS');
772
773 l_call_ID := WF_ENGINE.GetItemAttrText(
774 itemtype, itemkey, 'OCCTMEDIAITEMID');
775
776 IF ( (l_competency_name IS NULL) OR (l_call_ID IS NULL) ) THEN
777 return;
778 END IF;
779
780 -- call CCT API
781 l_num_agents := CCT_JTFRESOURCEROUTING_PUB.Get_Agents_For_Competency(
782 l_competency_type, l_competency_name , l_agents_tbl);
783 IF (l_num_agents = 0) THEN
784 return;
785 END IF;
786
787 -- insert the agents into the CCT_TEMPAGENTS table
788 CCT_RoutingWorkflow_UTL.InsertResults
789 (l_call_ID, 'CCT_COMPETENCY_PROD_FILTER' , l_agents_tbl);
790
791 end if;
792 EXCEPTION
793 WHEN OTHERS THEN
794 WF_CORE.Context(G_PKG_NAME, l_proc_name,
795 itemtype, itemkey, to_char(actid), funmode);
796 RAISE;
797
798 END Set_DNIS_Comp_Filter;
799
800 /* -----------------------------------------------------------------------
801 Activity Name : Get_Srv_Group_From_MCMID (branch node)
802 Get the Server Group Name for a given MCM_ID
803 IN
804 itemtype - item type
805 itemkey - item key
806 actid - process activity instance id
807 funmode - execution mode
808 OUT
809 comparison result (WFSTD_YES_NO lookup code)
810 ITEM ATTRIBUTES REFERENCED
811 SRVGROUP - the Server Group Name
812 MCMID - the MCMID
813 *-----------------------------------------------------------------------*/
814 procedure Get_Srv_Group_from_MCMID (
815 itemtype in varchar2
816 , itemkey in varchar2
817 , actid in number
818 , funmode in varchar2
819 , resultout in out nocopy varchar2
820 ) IS
821 l_proc_name VARCHAR2(30) := 'Get_Srv_Group_from_MCMID' ;
822 l_SrvGroup VARCHAR2(50);
823 l_MCM_ID NUMBER;
824 l_resultcode VARCHAR2(30);
825 BEGIN
826 -- set default result
827 resultout := wf_engine.eng_completed;
828
829 IF (funmode = 'RUN') THEN
830
831 l_MCM_ID := WF_ENGINE.GetItemAttrNumber(
832 itemtype,itemkey,'MCM_ID' );
833
834 IF (l_MCM_ID IS NOT NULL) THEN
835 l_SrvGroup :=
836 CCT_SERVERGROUPROUTING_PUB.Get_Srv_Group_From_MCMID
837 ( p_MCMID => l_MCM_ID ) ;
838
839 IF (l_SrvGroup IS NOT NULL) THEN
840 l_resultcode := CCT_RoutingWorkflow_UTL.Get_Result_Code(
841 p_result_lookup_type => 'CCT_ServerGroup_Names'
842 , p_result_display_name => l_SrvGroup
843 );
844
845 if (l_resultcode IS NULL) then
846 l_resultcode := 'DEFAULT_ServerGroup';
847 end if;
848
849 resultout := wf_engine.eng_completed || ':' || l_resultcode ;
850
851 WF_ENGINE.SetItemAttrText(itemtype,itemkey,'SRVGROUP',
852 l_SrvGroup );
853 END IF;
854 END IF;
855 END IF;
856
857 EXCEPTION
858 WHEN OTHERS THEN
859 WF_CORE.Context(G_PKG_NAME, l_proc_name, itemtype,
860 itemkey, to_char(actid), funmode);
861 RAISE;
862
863 END Get_Srv_Group_From_MCMID;
864
865 /* -----------------------------------------------------------------------
866 Activity Name : Get_logged_in_Agents
867 To filter the agents and return all logged in agents
868 IN
869 itemtype - item type
870 itemkey - item key
871 actid - process activity instance id
872 funmode - execution mode
873 OUT
874 No output
875 ITEM ATTRIBUTES REFERENCED
876 CALLID - the call ID
877 *-----------------------------------------------------------------------*/
878 procedure Get_agents_logged_in (
879 itemtype in varchar2
880 , itemkey in varchar2
881 , actid in number
882 , funmode in varchar2
883 , resultout in out nocopy varchar2) IS
884
885 l_num_agents NUMBER := 0;
886 l_call_ID VARCHAR2(32);
887 l_MCM_ID VARCHAR2(32);
888 l_agents_tbl CCT_RoutingWorkflow_UTL.agent_tbl_type;
889 BEGIN
893 IF (funmode = 'RUN') THEN
890 -- set default result
891 resultout := wf_engine.eng_completed ;
892
894 l_call_ID := WF_ENGINE.GetItemAttrText(
895 itemtype, itemkey, 'OCCTMEDIAITEMID');
896 l_MCM_ID := WF_ENGINE.GetItemAttrText(
897 itemtype, itemkey, 'MCM_ID');
898
899 IF (l_MCM_ID IS NULL) OR (l_call_ID IS NULL) THEN
900 return;
901 END IF;
902
903 -- call CCT API
904 l_num_agents := CCT_SERVERGROUPROUTING_PUB.Get_agents_logged_in(
905 l_MCM_ID, l_agents_tbl);
906 IF (l_num_agents = 0) THEN
907 return;
908 END IF;
909
910 -- insert the agents into the CCT_TEMPAGENTS table
911 CCT_RoutingWorkflow_UTL.InsertResults
912 (l_call_ID, 'CCT_AGENTS_LOGGED_IN_FILTER' , l_agents_tbl);
913 END IF;
914 END Get_Agents_logged_in;
915
916
917 /* -----------------------------------------------------------------------
918 Activity Name : Get_agents_from_stat_grp_nam
919 To filter the agents and return agents in a static group name
920 IN
921 itemtype - item type
922 itemkey - item key
923 actid - process activity instance id
924 funmode - execution mode
925 OUT
926 No output
927 ITEM ATTRIBUTES REFERENCED
928 CALLID - the call ID
929 STATICGROUPNAME - Static Group Name
930 *-----------------------------------------------------------------------*/
931 procedure Get_agents_from_stat_grp_nam (
932 itemtype in varchar2
933 , itemkey in varchar2
934 , actid in number
935 , funmode in varchar2
936 , resultout in out nocopy varchar2) IS
937
938 l_num_agents NUMBER := 0;
939 l_call_ID VARCHAR2(32);
940 l_group_name VARCHAR2(200);
941 l_agents_tbl CCT_RoutingWorkflow_UTL.agent_tbl_type;
942 BEGIN
943 -- set default result
944 resultout := wf_engine.eng_completed ;
945
946 IF (funmode = 'RUN') THEN
947 l_call_ID := WF_ENGINE.GetItemAttrText(
948 itemtype, itemkey, 'OCCTMEDIAITEMID');
949 l_group_name := Wf_Engine.GetActivityAttrText(itemtype,itemkey
950 ,actid,'STATICGROUPNAME');
951
952
953
954 IF (l_call_ID IS NULL) OR (l_group_name IS NULL) THEN
955 return;
956 END IF;
957
958 -- call CCT API
959 l_num_agents := CCT_JTFRESOURCEROUTING_PUB.Get_agents_from_stat_grp_nam(
960 l_group_name, l_agents_tbl);
961 IF (l_num_agents = 0) THEN
962 return;
963 END IF;
964
965 -- insert the agents into the CCT_TEMPAGENTS table
966 CCT_RoutingWorkflow_UTL.InsertResults
967 (l_call_ID, 'CCT_AGENTS_FROM_STAT_GRP_NAM_FILTER' , l_agents_tbl);
968 END IF;
969 END Get_agents_from_stat_grp_nam;
970
971 /* -----------------------------------------------------------------------
972 Activity Name : Get_agents_from_stat_grp_num
973 To filter the agents and return agents who are defined for a
974 static group number
975 IN
976 itemtype - item type
977 itemkey - item key
978 actid - process activity instance id
979 funmode - execution mode
980 OUT
981 No output
982 ITEM ATTRIBUTES REFERENCED
983 CALLID - the call ID
984 STATICGROUPNUMBER - Static Group Number
985 *-----------------------------------------------------------------------*/
986 procedure Get_agents_from_stat_grp_num (
987 itemtype in varchar2
988 , itemkey in varchar2
989 , actid in number
990 , funmode in varchar2
991 , resultout in out nocopy varchar2) IS
992
993 l_num_agents NUMBER := 0;
994 l_group_number NUMBER default NULL;
995 l_call_ID VARCHAR2(32);
996 l_agents_tbl CCT_RoutingWorkflow_UTL.agent_tbl_type;
997 BEGIN
998 -- set default result
999 resultout := wf_engine.eng_completed ;
1000
1001 IF (funmode = 'RUN') THEN
1002 l_call_ID := WF_ENGINE.GetItemAttrText(
1003 itemtype, itemkey, 'OCCTMEDIAITEMID');
1004 l_group_number := Wf_Engine.GetActivityAttrNumber(itemtype,itemkey
1005 ,actid,'STATICGROUPNUMBER');
1006
1007
1008 IF ((l_group_number IS NULL) OR (l_call_ID IS NULL)) THEN
1009 return;
1010 END IF;
1011
1012 -- call CCT API
1013 l_num_agents := CCT_JTFRESOURCEROUTING_PUB.Get_agents_from_stat_grp_num(
1014 l_group_number,l_agents_tbl);
1015 IF (l_num_agents = 0) THEN
1016 return;
1017 END IF;
1018
1019 -- insert the agents into the CCT_TEMPAGENTS table
1020 CCT_RoutingWorkflow_UTL.InsertResults
1021 (l_call_ID, 'CCT_AGENTS_FROM_STAT_GRP_NUM_FILTER' , l_agents_tbl);
1022 END IF;
1023 END Get_agents_from_stat_grp_num;
1024
1025 /* -----------------------------------------------------------------------
1026 Activity Name : Get_agents_from_dyn_grp_nam
1027 To filter the agents and return agents who are defined in defined
1028 group num
1029 IN
1030 itemtype - item type
1034 OUT
1031 itemkey - item key
1032 actid - process activity instance id
1033 funmode - execution mode
1035 No output
1036 ITEM ATTRIBUTES REFERENCED
1037 CALLID - the call ID
1038 DYNAMICGROUPNAME - Dynamic Group Name
1039 *-----------------------------------------------------------------------*/
1040 procedure Get_agents_from_dyn_grp_nam (
1041 itemtype in varchar2
1042 , itemkey in varchar2
1043 , actid in number
1044 , funmode in varchar2
1045 , resultout in out nocopy varchar2) IS
1046
1047 l_group_name VARCHAR2(200);
1048 l_num_agents NUMBER := 0;
1049 l_call_ID VARCHAR2(32);
1050 l_agents_tbl CCT_RoutingWorkflow_UTL.agent_tbl_type;
1051 BEGIN
1052 -- set default result
1053 resultout := wf_engine.eng_completed ;
1054
1055 IF (funmode = 'RUN') THEN
1056 l_call_ID := WF_ENGINE.GetItemAttrText(
1057 itemtype, itemkey, 'OCCTMEDIAITEMID');
1058 l_group_name := Wf_Engine.GetActivityAttrText(itemtype,itemkey
1059 ,actid, 'DYNAMICGROUPNAME');
1060
1061 IF (l_group_name IS NULL ) OR (l_call_ID IS NULL) THEN
1062 return;
1063 END IF;
1064
1065 -- call CCT API
1066 l_num_agents := CCT_JTFRESOURCEROUTING_PUB.Get_agents_from_dyn_grp_nam(
1067 l_group_name, l_agents_tbl);
1068 IF (l_num_agents = 0) THEN
1069 return;
1070 END IF;
1071
1072 -- insert the agents into the CCT_TEMPAGENTS table
1073 CCT_RoutingWorkflow_UTL.InsertResults
1074 (l_call_ID, 'CCT_AGENTS_FROM_DYN_GRP_NAM_FILTER' , l_agents_tbl);
1075 END IF;
1076 END Get_agents_from_dyn_grp_nam;
1077 /* -----------------------------------------------------------------------
1078 Activity Name : Get_agents_from_dyn_grp_num
1079 To filter the agents and return agents who are defined in dynamic
1080 group number
1081 IN
1082 itemtype - item type
1083 itemkey - item key
1084 actid - process activity instance id
1085 funmode - execution mode
1086 OUT
1087 No output
1088 ITEM ATTRIBUTES REFERENCED
1089 CALLID - the call ID
1090 DYNAMICGROUPNUMBER - Dynamic Group Number
1091 *-----------------------------------------------------------------------*/
1092 procedure Get_agents_from_dyn_grp_num (
1093 itemtype in varchar2
1094 , itemkey in varchar2
1095 , actid in number
1096 , funmode in varchar2
1097 , resultout in out nocopy varchar2) IS
1098
1099 l_num_agents NUMBER := 0;
1100 l_group_number VARCHAR2(200);
1101 l_call_ID VARCHAR2(32);
1102 l_agents_tbl CCT_RoutingWorkflow_UTL.agent_tbl_type;
1103 BEGIN
1104 -- set default result
1105 resultout := wf_engine.eng_completed ;
1106
1107 IF (funmode = 'RUN') THEN
1108 l_call_ID := WF_ENGINE.GetItemAttrText(
1109 itemtype, itemkey, 'OCCTMEDIAITEMID');
1110 l_group_number := Wf_Engine.GetActivityAttrNumber(itemtype,itemkey
1111 ,actid,'DYNAMICGROUPNUMBER');
1112
1113 IF (l_group_number IS NULL) OR (l_call_ID IS NULL) THEN
1114 return;
1115 END IF;
1116
1117 -- call CCT API
1118 l_num_agents := CCT_JTFRESOURCEROUTING_PUB.Get_agents_from_dyn_grp_num(
1119 l_group_number, l_agents_tbl);
1120 IF (l_num_agents = 0) THEN
1121 return;
1122 END IF;
1123
1124 -- insert the agents into the CCT_TEMPAGENTS table
1125 CCT_RoutingWorkflow_UTL.InsertResults
1126 (l_call_ID, 'CCT_AGENTS_FROM_DYN_GRP_NUM_FILTER' , l_agents_tbl);
1127 END IF;
1128 END Get_agents_from_dyn_grp_num;
1129
1130 /* -----------------------------------------------------------------------
1131 Activity Name : Get_agents_not_in_stat_grp_nam
1132 To filter the agents and return agents who are defined not in static
1133 group name
1134 IN
1135 itemtype - item type
1136 itemkey - item key
1137 actid - process activity instance id
1138 funmode - execution mode
1139 OUT
1140 No output
1141 ITEM ATTRIBUTES REFERENCED
1142 CALLID - the call ID
1143 STATICGROUPNAME - Static Group Name
1144 *-----------------------------------------------------------------------*/
1145 procedure Get_agents_not_in_stat_grp_nam (
1146 itemtype in varchar2
1147 , itemkey in varchar2
1148 , actid in number
1149 , funmode in varchar2
1150 , resultout in out nocopy varchar2) IS
1151
1152 l_group_name VARCHAR2(200);
1153 l_num_agents NUMBER := 0;
1154 l_call_ID VARCHAR2(32);
1155 l_agents_tbl CCT_RoutingWorkflow_UTL.agent_tbl_type;
1156 BEGIN
1157 -- set default result
1158 resultout := wf_engine.eng_completed ;
1159
1160 IF (funmode = 'RUN') THEN
1161 l_call_ID := WF_ENGINE.GetItemAttrText(
1162 itemtype, itemkey, 'OCCTMEDIAITEMID');
1163
1164 l_group_name := Wf_Engine.GetActivityAttrText(itemtype,itemkey
1165 ,actid, 'STATICGROUPNAME');
1166
1167 IF (l_group_name IS NULL ) OR (l_call_ID IS NULL) THEN
1171 -- call CCT API
1168 return;
1169 END IF;
1170
1172 l_num_agents := CCT_JTFRESOURCEROUTING_PUB.Get_agents_not_in_stat_grp_nam(
1173 l_group_name, l_agents_tbl);
1174 IF (l_num_agents = 0) THEN
1175 return;
1176 END IF;
1177
1178 -- insert the agents into the CCT_TEMPAGENTS table
1179 CCT_RoutingWorkflow_UTL.InsertResults
1180 (l_call_ID, 'CCT_AGENTS_NOT_IN_STAT_GRP_NAM_FILTER' , l_agents_tbl);
1181 END IF;
1182 END Get_agents_not_in_stat_grp_nam;
1183
1184 /* -----------------------------------------------------------------------
1185 Activity Name : Get_agents_not_in_stat_grp_num
1186 To filter the agents and return agents who are defined not in static
1187 group number
1188 IN
1189 itemtype - item type
1190 itemkey - item key
1191 actid - process activity instance id
1192 funmode - execution mode
1193 OUT
1194 No output
1195 ITEM ATTRIBUTES REFERENCED
1196 CALLID - the call ID
1197 STATICGROUPNUMBER - Static Group Number
1198 *-----------------------------------------------------------------------*/
1199 procedure Get_agents_not_in_stat_grp_num (
1200 itemtype in varchar2
1201 , itemkey in varchar2
1202 , actid in number
1203 , funmode in varchar2
1204 , resultout in out nocopy varchar2) IS
1205
1206 l_num_agents NUMBER := 0;
1207 l_group_number VARCHAR2(200);
1208 l_call_ID VARCHAR2(32);
1209 l_agents_tbl CCT_RoutingWorkflow_UTL.agent_tbl_type;
1210 BEGIN
1211 -- set default result
1212 resultout := wf_engine.eng_completed ;
1213
1214 IF (funmode = 'RUN') THEN
1215 l_call_ID := WF_ENGINE.GetItemAttrText(
1216 itemtype, itemkey, 'OCCTMEDIAITEMID');
1217 l_group_number := Wf_Engine.GetActivityAttrNumber(itemtype,itemkey
1218 ,actid, 'STATICGROUPNUMBER');
1219
1220 IF (l_group_number IS NULL) OR (l_call_ID IS NULL) THEN
1221 return;
1222 END IF;
1223
1224 -- call CCT API
1225 l_num_agents := CCT_JTFRESOURCEROUTING_PUB.Get_agents_not_in_stat_grp_num(
1226 l_group_number,l_agents_tbl);
1227 IF (l_num_agents = 0) THEN
1228 return;
1229 END IF;
1230
1231 -- insert the agents into the CCT_TEMPAGENTS table
1232 CCT_RoutingWorkflow_UTL.InsertResults
1233 (l_call_ID, 'CCT_AGENTS_NOT_IN_STAT_GRP_NUM_FILTER' , l_agents_tbl);
1234 END IF;
1235 END Get_agents_not_in_stat_grp_num;
1236
1237 /* -----------------------------------------------------------------------
1238 Activity Name : Get_agents_not_in_dyn_grp_nam
1239 To filter the agents and return agents who are defined not in dynamic
1240 group name
1241 IN
1242 itemtype - item type
1243 itemkey - item key
1244 actid - process activity instance id
1245 funmode - execution mode
1246 OUT
1247 No output
1248 ITEM ATTRIBUTES REFERENCED
1249 CALLID - the call ID
1250 DYNAMICGROUPNAME - Dynamic Group Name
1251 *-----------------------------------------------------------------------*/
1252 procedure Get_agents_not_in_dyn_grp_nam (
1253 itemtype in varchar2
1254 , itemkey in varchar2
1255 , actid in number
1256 , funmode in varchar2
1257 , resultout in out nocopy varchar2) IS
1258
1259 l_num_agents NUMBER := 0;
1260 l_group_name VARCHAR2(200);
1261 l_call_ID VARCHAR2(32);
1262 l_agents_tbl CCT_RoutingWorkflow_UTL.agent_tbl_type;
1263 BEGIN
1264 -- set default result
1265 resultout := wf_engine.eng_completed ;
1266
1267 IF (funmode = 'RUN') THEN
1268 l_call_ID := WF_ENGINE.GetItemAttrText(
1269 itemtype, itemkey, 'OCCTMEDIAITEMID');
1270 l_group_name := Wf_Engine.GetActivityAttrText(itemtype,itemkey
1271 ,actid, 'DYNAMICGROUPNAME');
1272 IF (l_group_name IS NULL) OR (l_call_ID IS NULL) THEN
1273 return;
1274 END IF;
1275
1276 -- call CCT API
1277 l_num_agents := CCT_JTFRESOURCEROUTING_PUB.Get_agents_not_in_dyn_grp_nam(
1278 l_group_name, l_agents_tbl);
1279 IF (l_num_agents = 0) THEN
1280 return;
1281 END IF;
1282
1283 -- insert the agents into the CCT_TEMPAGENTS table
1284 CCT_RoutingWorkflow_UTL.InsertResults
1285 (l_call_ID, 'CCT_AGENTS_NOT_IN_DYN_GRP_NUM_FILTER' , l_agents_tbl);
1286 END IF;
1287 END Get_agents_not_in_dyn_grp_nam;
1288 /* -----------------------------------------------------------------------
1289 Activity Name : Get_agents_not_in_dyn_grp_num
1290 To filter the agents and return agents who are defined not in
1291 dynamic group number
1292 IN
1293 itemtype - item type
1294 itemkey - item key
1295 actid - process activity instance id
1296 funmode - execution mode
1297 OUT
1298 No output
1299 ITEM ATTRIBUTES REFERENCED
1300 CALLID - the call ID
1301 DYNAMICGROUPNUMBER - Dynamic Group Number
1302 *-----------------------------------------------------------------------*/
1303 procedure Get_agents_not_in_dyn_grp_num (
1307 , funmode in varchar2
1304 itemtype in varchar2
1305 , itemkey in varchar2
1306 , actid in number
1308 , resultout in out nocopy varchar2) IS
1309
1310 l_num_agents NUMBER := 0;
1311 l_group_number VARCHAR2(200);
1312 l_call_ID VARCHAR2(32);
1313 l_agents_tbl CCT_RoutingWorkflow_UTL.agent_tbl_type;
1314 BEGIN
1315 -- set default result
1316 resultout := wf_engine.eng_completed ;
1317
1318 IF (funmode = 'RUN') THEN
1319 l_call_ID := WF_ENGINE.GetItemAttrText(
1320 itemtype, itemkey, 'OCCTMEDIAITEMID');
1321 l_group_number := Wf_Engine.GetActivityAttrNumber(itemtype,itemkey
1322 ,actid, 'DYNAMICGROUPNUMBER');
1323
1324 IF (l_group_number IS NULL) OR (l_call_ID IS NULL) THEN
1325 return;
1326 END IF;
1327
1328 -- call CCT API
1329 l_num_agents := CCT_JTFRESOURCEROUTING_PUB.Get_agents_not_in_dyn_grp_num(
1330 l_group_number, l_agents_tbl);
1331 IF (l_num_agents = 0) THEN
1332 return;
1333 END IF;
1334
1335 -- insert the agents into the CCT_TEMPAGENTS table
1336 CCT_RoutingWorkflow_UTL.InsertResults
1337 (l_call_ID, 'CCT_AGENTS_NOT_IN_DYN_GRP_NUM_FILTER' , l_agents_tbl);
1338 END IF;
1339 END Get_agents_not_in_dyn_grp_num;
1340
1341 /* -----------------------------------------------------------------------
1342 Activity Name : Get_Media_type
1343 To determine the media_type of the inbound call
1344 IN
1345 itemtype - item type
1346 itemkey - item key
1347 actid - process activity instance id
1348 funmode - execution mode
1349 OUT
1350 No output
1351 ITEM ATTRIBUTES REFERENCED
1352 CALLID - the call ID
1353 OCCTMEDIATYPE - Media type string (unique media type id)
1354 *-----------------------------------------------------------------------*/
1355 Procedure Get_Media_Type (
1356 itemtype in varchar2
1357 , itemkey in varchar2
1358 , actid in number
1359 , funmode in varchar2
1360 , resultout in out nocopy varchar2)
1361 is
1362
1363 l_proc_name VARCHAR2(30) := 'Get_Media_Type';
1364 l_email VARCHAR2(35) := '6010DA40B6F511D3A05000C04F53FBA6';
1365 l_phone VARCHAR2(35) := '50BFCF20B6F511D3A05000C04F53FBA6';
1366 l_call_ID VARCHAR2(32);
1367 l_media_type VARCHAR2(50) := 'OTHER';
1368 begin
1369
1370 IF (funmode = 'RUN') THEN
1371 l_call_ID := WF_ENGINE.GetItemAttrText(
1372 itemtype, itemkey, 'OCCTMEDIAITEMID');
1373 l_media_type := WF_ENGINE.GetItemAttrText(
1374 itemtype, itemkey, 'OCCTMEDIATYPE');
1375 IF l_call_id IS NOT NULL THEN
1376 -- Compare
1377 IF l_media_type = l_email THEN
1378 resultout := wf_engine.eng_completed||':EMAIL';
1379 ELSIF l_media_type = l_phone then
1380 resultout := wf_engine.eng_completed||':PHONE';
1381 ELSE
1382 resultout := wf_engine.eng_completed||':OTHER';
1383 end if;
1384 END IF;
1385 END IF;
1386 Exception
1387 when others then
1388 Wf_Core.Context(G_PKG_NAME, l_proc_name, itemtype,
1389 itemkey, to_char(actid), funmode);
1390 raise;
1391 end Get_Media_Type;
1392
1393 /* -----------------------------------------------------------------------
1394 Activity Name : WF_AppFromClassification
1395 To determine the screenpop application of the inbound call
1396 IN
1397 itemtype - item type
1398 itemkey - item key
1399 actid - process activity instance id
1400 funmode - execution mode
1401 OUT
1402 No output
1403 ITEM ATTRIBUTES REFERENCED
1404 Classification- Classification
1405 OCCTMEDIATYPE - Media type string (unique media type id)
1406 *-----------------------------------------------------------------------*/
1407 procedure WF_AppFromClassification(
1408 itemtype in varchar2
1409 , itemkey in varchar2
1410 , actid in number
1411 , funmode in varchar2
1412 , resultout in out nocopy varchar2)is
1413 l_proc_name VARCHAR2(64) := 'WF_AppFromClassification';
1414 l_mediaType VARCHAR2(255);
1415 l_classification VARCHAR2(255);
1416 l_appID NUMBER;
1417 l_appName VARCHAR2(64);
1418 Begin
1419 resultout := wf_engine.eng_completed||':OTHER';
1420 IF (funmode = 'RUN') THEN
1421 l_mediaType :=WF_ENGINE.GetItemAttrText(
1422 itemtype, itemkey, 'OCCTMEDIATYPE');
1423 l_Classification := WF_ENGINE.GetItemAttrText(
1424 itemtype, itemkey, 'OCCTCLASSIFICATION');
1425 If ((l_mediaType is not null) AND (l_classification is not null)) THEN
1426 CCT_SERVERGROUPROUTING_PUB.Get_AppForClassification(l_classification
1427 ,l_mediaType
1428 ,l_appID
1429 ,l_appName);
1430 If (l_appName is not Null) Then
1431 WF_ENGINE.SetItemAttrText(itemtype,itemkey,'SCREENPOPAPP',l_appName);
1432 resultout:=wf_engine.eng_completed||':'||l_appName;
1433 End If;
1434 End if;
1435 End if;
1436 Exception
1437 when others then
1438 Wf_Core.Context(G_PKG_NAME, l_proc_name, itemtype,
1439 itemkey, to_char(actid), funmode);
1440 raise;
1441 end;
1442
1443
1444 END CCT_RoutingActivities_PUB;