1 package body FND_WF_ENGINE as
2 /* $Header: afwfengb.pls 120.1.12010000.2 2009/08/19 15:37:38 ctilley ship $ */
3
4
5
6
7 --
8 -- AddItemAttr (PUBLIC)
9 -- Add a new unvalidated run-time item attribute.
10 -- IN:
11 -- itemtype - item type
12 -- itemkey - item key
13 -- aname - attribute name
14 -- text_value - add text value to it if provided.
15 -- number_value - add number value to it if provided.
16 -- date_value - add date value to it if provided.
17 -- NOTE:
18 -- The new attribute has no type associated. Get/set usages of the
19 -- attribute must insure type consistency.
20 --
21 procedure AddItemAttr(itemtype in varchar2,
22 itemkey in varchar2,
23 aname in varchar2,
24 text_value in varchar2,
25 number_value in number,
26 date_value in date)
27 is
28 begin
29 wf_engine.AddItemAttr(itemtype,
30 itemkey,
31 aname,
32 text_value,
33 number_value,
34 date_value);
35 end AddItemAttr;
36
37
38
39 --
40 -- SetItemAttrText (PUBLIC)
41 -- Set the value of a text item attribute.
42 -- If the attribute is a NUMBER or DATE type, then translate the
43 -- text-string value to a number/date using attribute format.
44 -- For all other types, store the value directly.
45 -- IN:
46 -- itemtype - Item type
47 -- itemkey - Item key
48 -- aname - Attribute Name
49 -- avalue - New value for attribute
50 --
51 procedure SetItemAttrText(itemtype in varchar2,
52 itemkey in varchar2,
53 aname in varchar2,
54 avalue in varchar2)
55 is
56
57 begin
58 wf_engine.SetItemAttrText(itemtype,
59 itemkey,
60 aname,
61 avalue);
62 end SetItemAttrText;
63
64 --
65 -- SetItemAttrNumber (PUBLIC)
66 -- Set the value of a number item attribute.
67 -- Attribute must be a NUMBER-type attribute.
68 -- IN:
69 -- itemtype - Item type
70 -- itemkey - Item key
71 -- aname - Attribute Name
72 -- avalue - New value for attribute
73 --
74 procedure SetItemAttrNumber(itemtype in varchar2,
75 itemkey in varchar2,
76 aname in varchar2,
77 avalue in number)
78 is
79 begin
80 wf_engine.SetItemAttrNumber(itemtype,
81 itemkey,
82 aname,
83 avalue);
84 end SetItemAttrNumber;
85
86 --
87 -- SetItemAttrDate (PUBLIC)
88 -- Set the value of a date item attribute.
89 -- Attribute must be a DATE-type attribute.
90 -- IN:
91 -- itemtype - Item type
92 -- itemkey - Item key
93 -- aname - Attribute Name
94 -- avalue - New value for attribute
95 --
96 procedure SetItemAttrDate(itemtype in varchar2,
97 itemkey in varchar2,
98 aname in varchar2,
99 avalue in date)
100 is
101 begin
102 wf_engine.SetItemAttrDate(itemtype,
103 itemkey,
104 aname,
105 avalue);
106
107 end SetItemAttrDate;
108
109 --
110 -- SetItemAttrDocument (PUBLIC)
111 -- Set the value of a document item attribute.
112 -- IN:
113 -- itemtype - Item type
114 -- itemkey - Item key
115 -- aname - Attribute Name
116 -- documentid - Document Identifier - full concatenated document attribute
117 -- strings:
118 -- nodeid:libraryid:documentid:version:document_name
119 --
120 --
121 procedure SetItemAttrDocument(itemtype in varchar2,
122 itemkey in varchar2,
123 aname in varchar2,
124 documentid in varchar2)
125 is
126 begin
127 wf_engine.SetItemAttrDocument(itemtype,
128 itemkey,
129 aname,
130 documentid);
131 end SetItemAttrDocument;
132
133
134 --
135 -- GetItemAttrInfo (PUBLIC)
136 -- Get type information about a item attribute.
137 -- IN:
138 -- itemtype - Item type
139 -- aname - Attribute name
140 -- OUT:
141 -- atype - Attribute type
142 -- subtype - 'SEND' or 'RESPOND'
143 -- format - Attribute format
144 --
145 procedure GetItemAttrInfo(itemtype in varchar2,
146 aname in varchar2,
147 atype out NOCOPY varchar2,
148 subtype out NOCOPY varchar2,
149 format out NOCOPY varchar2)
150 is
151 begin
152 wf_engine.GetItemAttrInfo(itemtype,
153 aname,
154 atype,
155 subtype,
156 format);
157 end GetItemAttrInfo;
158
159 --
160 -- GetItemAttrText (PUBLIC)
161 -- Get the value of a text item attribute.
162 -- If the attribute is a NUMBER or DATE type, then translate the
163 -- number/date value to a text-string representation using attrbute format.
164 -- For all other types, get the value directly.
165 -- IN:
166 -- itemtype - Item type
167 -- itemkey - Item key
168 -- aname - Attribute Name
169 -- RETURNS:
170 -- Attribute value
171 --
172 function GetItemAttrText(itemtype in varchar2,
173 itemkey in varchar2,
174 aname in varchar2)
175 return varchar2 is
176 lvalue varchar2(4000);
177 begin
178 lvalue := wf_engine.GetItemAttrText(itemtype,
179 itemkey,
180 aname);
181 return lvalue;
182 end GetItemAttrText;
183
184 --
185 -- GetItemAttrNumber (PUBLIC)
186 -- Get the value of a number item attribute.
187 -- Attribute must be a NUMBER-type attribute.
188 -- IN:
189 -- itemtype - Item type
190 -- itemkey - Item key
191 -- aname - Attribute Name
192 -- RETURNS:
193 -- Attribute value
194 --
195 function GetItemAttrNumber(itemtype in varchar2,
196 itemkey in varchar2,
197 aname in varchar2)
198 return number is
199 lvalue number;
200 begin
201 lvalue := wf_engine.GetItemAttrNumber(itemtype,
202 itemkey,
203 aname);
204 return lvalue;
205 end GetItemAttrNumber;
206
207 --
208 -- GetItemAttrDate (PUBLIC)
209 -- Get the value of a date item attribute.
210 -- Attribute must be a DATE-type attribute.
211 -- IN:
212 -- itemtype - Item type
213 -- itemkey - Item key
214 -- aname - Attribute Name
215 -- RETURNS:
216 -- Attribute value
217 --
218 function GetItemAttrDate (itemtype in varchar2,
219 itemkey in varchar2,
220 aname in varchar2)
221 return date is
222 lvalue date;
223 begin
224 lvalue := wf_engine.GetItemAttrDate(itemtype,
225 itemkey,
226 aname);
227 end GetItemAttrDate;
228
229 --
230 -- GetItemAttrDocument (PUBLIC)
231 -- Get the value of a document item attribute.
232 -- IN:
233 -- itemtype - Item type
234 -- itemkey - Item key
235 -- aname - Attribute Name
236 -- RETURNS:
237 -- documentid - Document Identifier - full concatenated document attribute
238 -- strings:
239 -- nodeid:libraryid:documentid:version:document_name
240 --
241 Function GetItemAttrDocument(itemtype in varchar2,
242 itemkey in varchar2,
243 aname in varchar2) RETURN VARCHAR2 IS
244
245 lvalue varchar2(4000);
246 begin
247 lvalue := wf_engine.GetItemAttrDocument(itemtype,
248 itemkey,
249 aname);
250 return lvalue;
251 end GetItemAttrDocument;
252
253 --
254 -- GetActivityAttrInfo (PUBLIC)
255 -- Get type information about an activity attribute.
256 -- IN:
257 -- itemtype - Item type
258 -- itemkey - Item key
259 -- actid - Process activity id
260 -- aname - Attribute name
261 -- OUT:
262 -- atype - Attribute type
263 -- subtype - 'SEND' or 'RESPOND'
264 -- format - Attribute format
265 --
266 procedure GetActivityAttrInfo(itemtype in varchar2,
267 itemkey in varchar2,
268 actid in number,
269 aname in varchar2,
270 atype out NOCOPY varchar2,
271 subtype out NOCOPY varchar2,
272 format out NOCOPY varchar2)
273 is
274 actdate date;
275 begin
276 wf_engine.GetActivityAttrInfo(itemtype,
277 itemkey,
278 actid,
279 aname,
280 atype,
281 subtype,
282 format);
283 end GetActivityAttrInfo;
284
285
286 --
287 -- GetActivityAttrText (PUBLIC)
288 -- Get the value of a text item attribute.
289 -- If the attribute is a NUMBER or DATE type, then translate the
290 -- number/date value to a text-string representation using attrbute format.
291 -- For all other types, get the value directly.
292 -- IN:
293 -- itemtype - Item type
294 -- itemkey - Item key
295 -- actid - Process activity id
296 -- aname - Attribute Name
297 -- RETURNS:
298 -- Attribute value
299 --
300 function GetActivityAttrText(itemtype in varchar2,
301 itemkey in varchar2,
302 actid in number,
303 aname in varchar2)
304 return varchar2 is
305 lvalue varchar2(4000);
306 begin
307 lvalue := wf_engine.GetActivityAttrText(itemtype,
308 itemkey,
309 actid,
310 aname);
311 return lvalue;
312 end GetActivityAttrText;
313
314 --
315 -- GetActivityAttrNumber (PUBLIC)
316 -- Get the value of a number item attribute.
317 -- Attribute must be a NUMBER-type attribute.
318 -- IN:
319 -- itemtype - Item type
320 -- itemkey - Item key
321 -- actid - Process activity id
322 -- aname - Attribute Name
323 -- RETURNS:
324 -- Attribute value
325 --
326 function GetActivityAttrNumber(itemtype in varchar2,
327 itemkey in varchar2,
328 actid in number,
329 aname in varchar2)
330 return number is
331 lvalue number;
332 begin
333 lvalue := wf_engine.GetActivityAttrNumber(itemtype,
334 itemkey,
335 actid,
336 aname);
337 return lvalue;
338 end GetActivityAttrNumber;
339
340 --
341 -- GetActivityAttrDate (PUBLIC)
342 -- Get the value of a date item attribute.
343 -- Attribute must be a DATE-type attribute.
344 -- IN:
345 -- itemtype - Item type
346 -- itemkey - Item key
347 -- actid - Process activity id
348 -- aname - Attribute Name
349 -- RETURNS:
350 -- Attribute value
351 --
352 function GetActivityAttrDate(itemtype in varchar2,
353 itemkey in varchar2,
354 actid in number,
355 aname in varchar2)
356 return date is
357 lvalue date;
358 begin
359 lvalue := wf_engine.GetActivityAttrDate(itemtype,
360 itemkey,
361 actid,
362 aname);
363 return lvalue;
364 end GetActivityAttrDate;
365
366 --
367 -- Set_Item_Parent (PUBLIC)
368 -- *** OBSOLETE - Use SetItemParent instead ***
369 --
370 procedure Set_Item_Parent(itemtype in varchar2,
371 itemkey in varchar2,
372 parent_itemtype in varchar2,
373 parent_itemkey in varchar2,
374 parent_context in varchar2)
375 is
376 begin
377 wf_engine.Set_Item_Parent(itemtype,
378 itemkey,
379 parent_itemtype,
380 parent_itemkey,
381 parent_context);
382 end Set_Item_Parent;
383
384 --
385 -- SetItemParent (PUBLIC)
386 -- Set the parent info of an item
387 -- IN
388 -- itemtype - Item type
389 -- itemkey - Item key
390 -- parent_itemtype - Itemtype of parent
391 -- parent_itemkey - Itemkey of parent
392 -- parent_context - Context info about parent
393 --
394 procedure SetItemParent(itemtype in varchar2,
395 itemkey in varchar2,
396 parent_itemtype in varchar2,
397 parent_itemkey in varchar2,
398 parent_context in varchar2)
399 is
400 begin
401 wf_engine.SetItemParent(itemtype,
402 itemkey,
403 parent_itemtype,
404 parent_itemkey,
405 parent_context);
406 end SetItemParent;
407
408 procedure SetItemOwner(itemtype in varchar2,
409 itemkey in varchar2,
410 owner in varchar2)
411 is
412 begin
413 wf_engine.SetItemOwner(itemtype,
414 itemkey,
415 owner);
416 end;
417
418 --
419 -- GetItemUserKey (PUBLIC)
420 -- Get the user key of an item
421 -- IN
422 -- itemtype - Item type
423 -- itemkey - Item key
424 -- RETURNS
425 -- User key of the item
426 --
427 function GetItemUserKey(itemtype in varchar2,
428 itemkey in varchar2)
429 return varchar2 is
430 lvalue varchar2(4000);
431 begin
432 lvalue := wf_engine.GetItemUserKey(itemtype,
433 itemkey);
434 return lvalue;
435 end GetItemUserKey;
436
437 --
438 -- SetItemUserKey (PUBLIC)
439 -- Set the user key of an item
440 -- IN
441 -- itemtype - Item type
442 -- itemkey - Item key
443 -- userkey - User key to be set
444 --
445 procedure SetItemUserKey(itemtype in varchar2,
446 itemkey in varchar2,
447 userkey in varchar2)
448 is
449 begin
450 wf_engine.SetItemUserKey(itemtype,
451 itemkey,
452 userkey);
453 end SetItemUserKey;
454
455 --
456 -- GetActivityLabel (PUBLIC)
457 -- Get activity instance label given id, in a format
458 -- suitable for passing to other wf_engine apis.
459 -- IN
460 -- actid - activity instance id
461 -- RETURNS
462 -- <process_name>||':'||<instance_label>
463 --
464 function GetActivityLabel(actid in number)
465 return varchar2
466 is
467 lvalue varchar2(62);
468 begin
469 lvalue := wf_engine.GetActivityLabel(actid);
470 return lvalue;
471 end GetActivityLabel;
472
473 --
474 -- CB (PUBLIC)
475 -- This is the callback function used by the notification system to
476 -- get and set process attributes, and mark a process complete.
477 --
478 -- The command may be one of:
479 -- GET - Get the value of an attribute
480 -- SET - Set the value of an attribute
481 -- COMPLETE - Mark the activity as complete
482 -- ERROR - Mark the activity as error status
483 -- TESTCTX - Test current context via selector function
484 -- FORWARD - Execute notification function for FORWARD
485 -- TRANSFER - Execute notification function for TRANSFER
486 -- RESPOND - Execute notification function for RESPOND
487 --
488 -- The context is in the format <itemtype>:<itemkey>:<activityid>.
489 --
490 -- The text_value/number_value/date_value fields are mutually exclusive.
491 -- It is assumed that only one will be used, depending on the value of
492 -- the attr_type argument ('VARCHAR2', 'NUMBER', or 'DATE').
493 --
494 -- IN:
495 -- command - Action requested. Must be one of 'GET', 'SET', or 'COMPLETE'.
496 -- context - Context data in the form '<item_type>:<item_key>:<activity>'
497 -- attr_name - Attribute name to set/get for 'GET' or 'SET'
498 -- attr_type - Attribute type for 'SET'
499 -- text_value - Text Attribute value for 'SET'
500 -- number_value - Number Attribute value for 'SET'
501 -- date_value - Date Attribute value for 'SET'
502 -- OUT:
503 -- text_value - Text Attribute value for 'GET'
504 -- number_value - Number Attribute value for 'GET'
505 -- date_value - Date Attribute value for 'GET'
506 --
507 procedure CB(command in varchar2,
508 context in varchar2,
509 attr_name in varchar2,
510 attr_type in varchar2,
511 text_value in out NOCOPY varchar2,
512 number_value in out NOCOPY number,
513 date_value in out NOCOPY date)
514 is
515 begin
516 wf_engine.CB(command,
517 context,
518 attr_name,
519 attr_type,
520 text_value,
521 number_value,
522 date_value);
523 end CB;
524
525 --
526 -- ProcessDeferred (PUBLIC)
527 -- Process all deferred activities
528 -- IN
529 -- itemtype - Item type to process. If null process all item types.
530 -- minthreshold - Minimum cost activity to process. No minimum if null.
531 -- maxthreshold - Maximum cost activity to process. No maximum if null.
532 --
533 procedure ProcessDeferred(itemtype in varchar2,
534 minthreshold in number,
535 maxthreshold in number) is
536
537
538 begin
539 wf_engine.ProcessDeferred(itemtype,
540 minthreshold,
541 maxthreshold);
542 end ProcessDeferred;
543
544 --
545 -- ProcessTimeout (PUBLIC)
546 -- Pick up one timed out activity and execute timeout transition.
547 -- IN
548 -- itemtype - Item type to process. If null process all item types.
549 --
550 procedure ProcessTimeOut(itemtype in varchar2)
551 is
552 begin
553 wf_engine.ProcessTimeOut(itemtype);
554 end ProcessTimeOut;
555
556 --
557 -- ProcessStuckProcess (PUBLIC)
558 -- Pick up one stuck process, mark error status, and execute error process.
559 -- IN
560 -- itemtype - Item type to process. If null process all item types.
561 --
562 procedure ProcessStuckProcess(itemtype in varchar2)
563 is
564 begin
565 wf_engine.ProcessStuckProcess(itemtype);
566 end ProcessStuckProcess;
567
568 --
569 -- Background (PUBLIC)
570 -- Process all current deferred and/or timeout activities within
571 -- threshold limits.
572 -- IN
573 -- itemtype - Item type to process. If null process all item types.
574 -- minthreshold - Minimum cost activity to process. No minimum if null.
575 -- maxthreshold - Maximum cost activity to process. No maximum if null.
576 -- process_deferred - Run deferred or waiting processes
577 -- process_timeout - Handle timeout and stuck process errors
578 --
579 procedure Background (itemtype in varchar2,
580 minthreshold in number,
581 maxthreshold in number,
582 process_deferred in boolean,
583 process_timeout in boolean)
584 is
585 begin
586 wf_engine.Background(itemtype,
587 minthreshold,
588 maxthreshold,
589 process_deferred,
590 process_timeout);
591 end Background;
592
593 --
594 -- BackgroundConcurrent (PUBLIC)
595 -- Run background process for deferred and/or timeout activities
596 -- from Concurrent Manager.
597 -- This is a cover of Background() with different argument types to
598 -- be used by the Concurrent Manager.
599 -- IN
600 -- errbuf - CPM error message
601 -- retcode - CPM return code (0 = success, 1 = warning, 2 = error)
602 -- itemtype - Item type to process. If null process all item types.
603 -- minthreshold - Minimum cost activity to process. No minimum if null.
604 -- maxthreshold - Maximum cost activity to process. No maximum if null.
605 -- process_deferred - Run deferred or waiting processes
606 -- process_timeout - Handle timeout errors
607 --
608 procedure BackgroundConcurrent (errbuf out NOCOPY varchar2,
609 retcode out NOCOPY varchar2,
610 itemtype in varchar2,
611 minthreshold in varchar2,
612 maxthreshold in varchar2,
613 process_deferred in varchar2,
614 process_timeout in varchar2)
615 is
616 begin
617 wf_engine.BackgroundConcurrent(errbuf,
618 retcode,
619 itemtype,
620 minthreshold,
621 maxthreshold,
622 process_deferred,
623 process_timeout);
624 end BackgroundConcurrent;
625
626 --
627 -- CreateProcess (PUBLIC)
628 -- Create a new runtime process (for an application item).
629 -- IN
630 -- itemtype - A valid item type
631 -- itemkey - A string generated from the application object's primary key.
632 -- process - A valid root process for this item type
633 -- (or null to use the item's selector function)
634 --
635 procedure CreateProcess(itemtype in varchar2,
636 itemkey in varchar2,
637 process in varchar2)
638 is
639 begin
640 wf_engine.CreateProcess(itemtype,
641 itemkey,
642 process);
643 end CreateProcess;
644
645 --
646 -- StartProcess (PUBLIC)
647 -- Begins execution of the process. The process will be identified by the
648 -- itemtype and itemkey. The engine locates the starting activities
649 -- of the root process and executes them.
650 -- IN
651 -- itemtype - A valid item type
652 -- itemkey - A string generated from the application object's primary key.
653 --
654 procedure StartProcess(itemtype in varchar2,
655 itemkey in varchar2)
656 is
657 begin
658 wf_engine.StartProcess(itemtype,
659 itemkey);
660 end StartProcess;
661
662 --
663 -- LaunchProcess (PUBLIC)
664 -- Launch a process both creates and starts it.
665 -- This is a wrapper for friendlier UI
666 -- IN
667 -- itemtype - A valid item type
668 -- itemkey - A string generated from the application object's primary key.
669 -- process - A valid root process for this item type
670 -- (or null to use the item's selector function)
671 -- userkey - User key to be set
672 -- owner - Role designated as owner of the item
673 --
674 procedure LaunchProcess(itemtype in varchar2,
675 itemkey in varchar2,
676 process in varchar2,
677 userkey in varchar2,
678 owner in varchar2) is
679
680 begin
681 wf_engine.LaunchProcess(itemtype,
682 itemkey,
683 process,
684 userkey,
685 owner);
686 end LaunchProcess;
687
688 --
689 -- SuspendProcess (PUBLIC)
690 -- Suspends process execution, meaning no new transitions will occur.
691 -- Outstanding notifications will be allowed to complete, but they will not
692 -- cause activity transitions. If the process argument is null, the root
693 -- process for the item is suspended, otherwise the named process is
694 -- suspended.
695 -- IN
696 -- itemtype - A valid item type
697 -- itemkey - A string generated from the application object's primary key.
698 -- process - Process to suspend, specified in the form
699 -- [<parent process_name>:]<process instance_label>
700 -- If null suspend the root process.
701 --
702 procedure SuspendProcess(itemtype in varchar2,
703 itemkey in varchar2,
704 process in varchar2) is
705 begin
706 wf_engine.SuspendProcess(itemtype,
707 itemkey,
708 process);
709 end SuspendProcess;
710
711 --
712 -- AbortProcess (PUBLIC)
713 -- Abort process execution. Outstanding notifications are canceled. The
714 -- process is then considered complete, with a status specified by the
715 -- result argument.
716 -- IN
717 -- itemtype - A valid item type
718 -- itemkey - A string generated from the application object's primary key.
719 -- process - Process to abort, specified in the form
720 -- [<parent process_name>:]<process instance_label>
721 -- If null abort the root process.
722 -- result - Result to complete process with
723 --
724 procedure AbortProcess(itemtype in varchar2,
725 itemkey in varchar2,
726 process in varchar2,
727 result in varchar2) is
728 begin
729 wf_engine.AbortProcess(itemtype,
730 itemkey,
731 process,
732 result);
733 end AbortProcess;
734
735 --
736 -- ResumeProcess (PUBLIC)
737 -- Returns a process to normal execution status. Any transitions which
738 -- were deferred by SuspendProcess() will now be processed.
739 -- IN
740 -- itemtype - A valid item type
741 -- itemkey - A string generated from the application object's primary key.
742 -- process - Process to resume, specified in the form
743 -- [<parent process_name>:]<process instance_label>
744 -- If null resume the root process.
745 --
746 procedure ResumeProcess(itemtype in varchar2,
747 itemkey in varchar2,
748 process in varchar2)
749 is
750 begin
751 wf_engine.ResumeProcess(itemtype,
752 itemkey,
753 process);
754 end ResumeProcess;
755
756
757 Procedure CreateForkProcess (copy_itemtype in varchar2,
758 copy_itemkey in varchar2,
759 new_itemkey in varchar2,
760 same_version in boolean) is
761 begin
762 wf_engine.CreateForkProcess(copy_itemtype,
763 copy_itemkey,
764 new_itemkey,
765 same_version);
766 end CreateForkProcess;
767
768
769
770 --
771 -- StartForkProcess (PUBLIC)
772 -- Start a process that has been forked. Depending on the way this was forked,
773
774
775 -- this will execute startprocess if its to start with the latest version or
776 -- it copies the forked process activty by activity.
777 -- IN
778 -- itemtype - Item type
779 -- itemkey - item key to start
780 --
781 procedure StartForkProcess(itemtype in varchar2,
782 itemkey in varchar2) as
783 begin
784 wf_engine.StartForkProcess(itemtype,
785 itemkey);
786 end StartForkProcess;
787
788
789 --
790 --
791 -- BeginActivity (PUBLIC)
792 -- Determines if the specified activity may currently be performed on the
793 -- work item. This is a test that the performer may proactively determine
794 -- that their intent to perform an activity on an item is, in fact, allowed.
795 -- IN
796 -- itemtype - A valid item type
797 -- itemkey - A string generated from the application object's primary key.
798 -- activity - Completed activity, specified in the form
799 -- [<parent process_name>:]<process instance_label>
800 --
801 procedure BeginActivity(itemtype in varchar2,
802 itemkey in varchar2,
803 activity in varchar2)
804 is
805 begin
806 wf_engine.BeginActivity(itemtype,
807 itemkey,
808 activity);
809 end BeginActivity;
810
811 --
812 -- CompleteActivity (PUBLIC)
813 -- Notifies the workflow engine that an activity has been completed for a
814 -- particular process(item). This procedure can have one or more of the
815 -- following effects:
816 -- o Creates a new item. If the completed activity is the start of a process,
817 -- then a new item can be created by this call. If the completed activity
818 -- is not the start of a process, it would be an invalid activity error.
819 -- o Complete an activity with an optional result. This signals the
820 -- workflow engine that an asynchronous activity has been completed.
821 -- An optional activity completion result can also be passed.
822 -- IN
823 -- itemtype - A valid item type
824 -- itemkey - A string generated from the application object's primary key.
825 -- activity - Completed activity, specified in the form
826 -- [<parent process_name>:]<process instance_label>
827 -- <result> - An optional result.
828 --
829 procedure CompleteActivity(itemtype in varchar2,
830 itemkey in varchar2,
831 activity in varchar2,
832 result in varchar2)
833 is
834 begin
835 wf_engine.CompleteActivity(itemtype,
836 itemkey,
837 activity,
838 result);
839 end CompleteActivity;
840
841 --
842 -- CompleteActivityInternalName (PUBLIC)
843 -- Identical to CompleteActivity, except that the internal name of
844 -- completed activity is passed instead of the activity instance label.
845 -- NOTES:
846 -- 1. There must be exactly ONE instance of this activity with NOTIFIED
847 -- status.
848 -- 2. Using this api to start a new process is not supported.
849 -- 3. Synchronous processes are not supported in this api.
850 -- 4. This should only be used if for some reason the instance label is
851 -- not known. CompleteActivity should be used if the instance
852 -- label is known.
853 -- IN
854 -- itemtype - A valid item type
855 -- itemkey - A string generated from the application object's primary key.
856 -- activity - Internal name of completed activity, in the format
857 -- [<parent process_name>:]<process activity_name>
858 -- <result> - An optional result.
859 --
860 procedure CompleteActivityInternalName(itemtype in varchar2,
861 itemkey in varchar2,
862 activity in varchar2,
863 result in varchar2)
864 is
865 begin
866 wf_engine.CompleteActivityInternalName(itemtype,
867 itemkey,
868 activity,
869 result);
870 end CompleteActivityInternalName;
871
872 --
873 -- AssignActivity (PUBLIC)
874 -- Assigns or re-assigns the user who will perform an activity. It may be
875 -- called before the activity has been enabled(transitioned to). If a user
876 -- is assigned to an activity that already has an outstanding notification,
877 -- that notification will be forwarded to the new user.
878 -- IN
879 -- itemtype - A valid item type
880 -- itemkey - A string generated from the application object's primary key.
881 -- activity - Activity to assign, specified in the form
882 -- [<parent process_name>:]<process instance_label>
883 -- performer - User who will perform this activity.
884 --
885 procedure AssignActivity(itemtype in varchar2,
886 itemkey in varchar2,
887 activity in varchar2,
888 performer in varchar2) is
889 begin
890 wf_engine.AssignActivity(itemtype,
891 itemkey,
892 activity,
893 performer);
894 end AssignActivity;
895
896 --
897 -- HandleError (PUBLIC)
898 -- Reset the process thread to the given activity and begin execution
899 -- again from that point. If command is:
900 -- SKIP - mark the activity complete with given result and continue
901 -- RETRY - re-execute the activity before continuing
902 -- IN
903 -- itemtype - A valid item type.
904 -- itemkey - The item key of the process.
905 -- activity - Activity to reset, specified in the form
906 -- [<parent process_name>:]<process instance_label>
907 -- command - SKIP or RETRY.
908 -- <result> - Activity result for the 'SKIP' command.
909 --
910 procedure HandleError(itemtype in varchar2,
911 itemkey in varchar2,
912 activity in varchar2,
913 command in varchar2,
914 result in varchar2)
915 is
916 begin
917 wf_engine.HandleError(itemtype,
918 itemkey,
919 activity,
920 command,
921 result);
922 end HandleError;
923
924
925 --
926 -- ItemStatus (Public)
927 -- This is a public cover for WF_ITEM_ACTIVITY_STATUS.ROOT_STATUS
928 -- Returns the status and result for the root process of this item.
929 -- If the item does not exist an exceprion will be raised.
930 -- IN
931 -- itemtype - Activity item type.
932 -- itemkey - The item key.
933 -- OUT
934 -- status - Activity status for root process of this item
935 -- result - Result code for root process of this item
936 --
937 procedure ItemStatus(itemtype in varchar2,
938 itemkey in varchar2,
939 status out NOCOPY varchar2,
940 result out NOCOPY varchar2) is
941 begin
942 wf_engine.ItemStatus(itemtype,
943 itemkey,
944 status,
945 result);
946 end ItemStatus;
947
948 --
949 -- Activity_Exist_In_Process
950 -- Check if an activity exist in a process
951 -- IN
952 -- p_item_type
953 -- p_item_key
954 -- p_activity_item_type
955 -- p_anctivity_name
956 -- RET
957 -- TRUE if activity exist, FALSE otherwise
958 --
959 function Activity_Exist_In_Process (p_item_type in varchar2,
960 p_item_key in varchar2,
961 p_activity_item_type in varchar2,
962 p_activity_name in varchar2)
963 return boolean
964 is
965 begin
966 return (wf_engine.Activity_Exist_In_Process(p_item_type,
967 p_item_key,
968 p_activity_item_type,
969 p_activity_name));
970 end Activity_Exist_In_Process;
971
972 --
973 -- Activity_Exist
974 -- Check if an activity exist in a process
975 -- IN
976 -- p_process_item_type
977 -- p_process_name
978 -- p_activity_item_type
979 -- p_anctivity_name
980 -- active_date
981 -- iteration - maximum 8 level deep (0-7)
982 -- RET
983 -- TRUE if activity exist, FALSE otherwise
984 --
985 function Activity_Exist (p_process_item_type in varchar2,
986 p_process_name in varchar2,
987 p_activity_item_type in varchar2,
988 p_activity_name in varchar2,
989 active_date in date,
990 iteration in number)
991 return boolean
992 is
993 begin
994 return (wf_engine.Activity_Exist(p_process_item_type,
995 p_process_name,
996 p_activity_item_type,
997 p_activity_name,
998 active_date,
999 iteration));
1000 end Activity_Exist;
1001
1002 --
1003 -- user_synch
1004 -- Wrapper for fnd_user_pkg.user_synch()
1005 -- IN
1006 -- p_user_name
1007 --
1008 procedure user_synch (p_user_name in varchar2)
1009 is
1010 begin
1011 fnd_user_pkg.user_synch(p_user_name);
1012 end;
1013
1014 --
1015 -- default_event_raise
1016 -- Wrapper for wf_event.raise()
1017 -- IN
1018 -- p_event_name
1019 -- p_event_key
1020 --
1021 procedure default_event_raise(p_event_name in varchar2,
1022 p_event_key in varchar2)
1023 is
1024 begin
1025 wf_event.raise(p_event_name, p_event_key, null, null, null);
1026 end;
1027
1028 --
1029 -- propagate_user_role
1030 -- Wrapper for wf_local_synch.propagate_user_role()
1031 -- IN
1032 -- p_user_orig_system
1033 -- p_user_orig_system_id
1034 -- p_role_orig_system
1035 -- p_role_orig_system_id
1036 -- p_start_date
1037 -- p_expiration_date
1038 --
1039 procedure propagate_user_role(p_user_orig_system in varchar2,
1040 p_user_orig_system_id in number,
1041 p_role_orig_system in varchar2,
1042 p_role_orig_system_id in number,
1043 p_start_date in date,
1044 p_expiration_date in date)
1045 is
1046 begin
1047
1048 --Bug 2880053
1049 --This API will just be a wrapper to propagate_user_role2
1050 --Call propagate_user_role2 with the new signature for
1051 --wf_local_synch.propagate_user_role2
1052
1053 fnd_wf_engine.propagate_user_role2(p_user_orig_system,
1054 p_user_orig_system_id,
1055 p_role_orig_system,
1056 p_role_orig_system_id,
1057 p_start_date,
1058 p_expiration_date,
1059 TRUE);
1060 end;
1061
1062 Function DisableOrLaunch(l_item_type in varchar2,
1063 l_itemkey in varchar2,
1064 c_instid in varchar2,
1065 l_username in varchar2,
1066 l_name in varchar2)
1067 return number is
1068 disable_or_launch number;
1069 colon pls_integer;
1070
1071 begin
1072
1073 colon := instr(l_username, ':');
1074 if (colon = 0) then
1075 select count(1)
1076 into disable_or_launch
1077 from WF_ITEM_ACTIVITY_STATUSES WIAS,
1078 WF_NOTIFICATIONS WN,
1079 WF_NOTIFICATION_ATTRIBUTES NATTR
1080 where WIAS.ITEM_TYPE = l_item_type
1081 and WIAS.ITEM_KEY = l_itemkey
1082 and WIAS.PROCESS_ACTIVITY = c_instid
1083 and WIAS.NOTIFICATION_ID = WN.GROUP_ID
1084 and NATTR.NOTIFICATION_ID = WN.NOTIFICATION_ID
1085 and NATTR.NAME = l_name
1086 and WN.RECIPIENT_ROLE in
1087 (select WUR.ROLE_NAME
1088 from WF_USER_ROLES WUR
1089 where WUR.USER_NAME = l_username);
1090 else
1091 select count(1)
1092 into disable_or_launch
1093 from WF_ITEM_ACTIVITY_STATUSES WIAS,
1094 WF_NOTIFICATIONS WN,
1095 WF_NOTIFICATION_ATTRIBUTES NATTR
1096 where WIAS.ITEM_TYPE = l_item_type
1097 and WIAS.ITEM_KEY = l_itemkey
1098 and WIAS.PROCESS_ACTIVITY = c_instid
1099 and WIAS.NOTIFICATION_ID = WN.GROUP_ID
1100 and NATTR.NOTIFICATION_ID = WN.NOTIFICATION_ID
1101 and NATTR.NAME = l_name
1102 and WN.RECIPIENT_ROLE in
1103 (select WUR.ROLE_NAME
1104 from WF_USER_ROLES WUR
1105 where WUR.USER_ORIG_SYSTEM = substr(l_username, 1, colon-1)
1106 and WUR.USER_ORIG_SYSTEM_ID = substr(l_username, colon+1)
1107 and WUR.USER_NAME = l_username
1108 and WUR.USER_ORIG_SYSTEM not in
1109 ('HZ_PARTY','CUST_CONT'));
1110 end if;
1111
1112 return disable_or_launch;
1113 end;
1114
1115 --
1116 -- SetItemAttrTextAuto (PUBLIC)
1117 -- Set the value of a text item attribute. - Autonomously. Needed for ERES
1118 -- If the attribute is a NUMBER or DATE type, then translate the
1119 -- text-string value to a number/date using attribute format.
1120 -- For all other types, store the value directly.
1121 -- IN:
1122 -- itemtype - Item type
1123 -- itemkey - Item key
1124 -- aname - Attribute Name
1125 -- avalue - New value for attribute
1126 --
1127 procedure SetItemAttrTextAuto(itemtype in varchar2,
1128 itemkey in varchar2,
1129 aname in varchar2,
1130 avalue in varchar2) is
1131
1132 PRAGMA AUTONOMOUS_TRANSACTION;
1133
1134 begin
1135 SetItemAttrText(itemtype, itemkey, aname, avalue);
1136 commit;
1137 end;
1138
1139
1140 --
1141 -- AbortProcessAuto (PUBLIC)
1142 -- Abort process execution. - Autonomously. Needed for ERES.
1143 -- Outstanding notifications are canceled. The process is then considered
1144 -- complete, with a status specified by the result argument.
1145 -- IN
1146 -- itemtype - A valid item type
1147 -- itemkey - A string generated from the application object's primary key.
1148 -- process - Process to abort, specified in the form
1149 -- [<parent process_name>:]<process instance_label>
1150 -- If null abort the root process.
1151 -- result - Result to complete process with
1152 --
1153 procedure AbortProcessAuto(itemtype in varchar2,
1154 itemkey in varchar2,
1155 process in varchar2 default '',
1156 result in varchar2 default '#FORCE') is
1157
1158 PRAGMA AUTONOMOUS_TRANSACTION;
1159
1160 begin
1161 AbortProcess(itemtype, itemkey, process, result);
1162 commit;
1163 end;
1164
1165 --Bug 2880053
1166 --New API which matches the signature of wf_local_synch.propagate_user_role
1167
1168 PROCEDURE propagate_user_role2(p_user_orig_system in varchar2,
1169 p_user_orig_system_id in number,
1170 p_role_orig_system in varchar2,
1171 p_role_orig_system_id in number,
1172 p_start_date in date,
1173 p_expiration_date in date,
1174 p_overwrite in boolean,
1175 p_raiseErrors in boolean)
1176 is
1177 begin
1178 execute immediate
1179 'begin wf_local_synch.propagate_user_role(:1, :2, :3, :4, :5, :6 , TRUE); end;'
1180 using p_user_orig_system,
1181 p_user_orig_system_id,
1182 p_role_orig_system,
1183 p_role_orig_system_id,
1184 p_start_date,
1185 p_expiration_date;
1186
1187 end;
1188
1189 --
1190 -- event_raise_params
1191 -- Wrapper for wf_event.raise() passing all parameters
1192 -- IN
1193 -- p_event_name
1194 -- p_event_key
1195 -- p_event_data
1196 -- p_parameter - name value pairs 1-20
1197 -- p_send_date
1198 --
1199 procedure event_raise_params(p_event_name in varchar2,
1200 p_event_key in varchar2,
1201 p_event_data in clob,
1202 p_parameter_name1 in varchar2,
1203 p_parameter_value1 in varchar2,
1204 p_parameter_name2 in varchar2,
1205 p_parameter_value2 in varchar2,
1206 p_parameter_name3 in varchar2,
1207 p_parameter_value3 in varchar2,
1208 p_parameter_name4 in varchar2,
1209 p_parameter_value4 in varchar2,
1210 p_parameter_name5 in varchar2,
1211 p_parameter_value5 in varchar2,
1212 p_parameter_name6 in varchar2,
1213 p_parameter_value6 in varchar2,
1214 p_parameter_name7 in varchar2,
1215 p_parameter_value7 in varchar2,
1216 p_parameter_name8 in varchar2,
1217 p_parameter_value8 in varchar2,
1218 p_parameter_name9 in varchar2,
1219 p_parameter_value9 in varchar2,
1220 p_parameter_name10 in varchar2,
1221 p_parameter_value10 in varchar2,
1222 p_parameter_name11 in varchar2,
1223 p_parameter_value11 in varchar2,
1224 p_parameter_name12 in varchar2,
1225 p_parameter_value12 in varchar2,
1226 p_parameter_name13 in varchar2,
1227 p_parameter_value13 in varchar2,
1228 p_parameter_name14 in varchar2,
1229 p_parameter_value14 in varchar2,
1230 p_parameter_name15 in varchar2,
1231 p_parameter_value15 in varchar2,
1232 p_parameter_name16 in varchar2,
1233 p_parameter_value16 in varchar2,
1234 p_parameter_name17 in varchar2,
1235 p_parameter_value17 in varchar2,
1236 p_parameter_name18 in varchar2,
1237 p_parameter_value18 in varchar2,
1238 p_parameter_name19 in varchar2,
1239 p_parameter_value19 in varchar2,
1240 p_parameter_name20 in varchar2,
1241 p_parameter_value20 in varchar2,
1242 p_send_date in date)
1243 is
1244 begin
1245 wf_event.raise2(p_event_name,
1246 p_event_key,
1247 p_event_data,
1248 p_parameter_name1,
1249 p_parameter_value1,
1250 p_parameter_name2,
1251 p_parameter_value2,
1252 p_parameter_name3,
1253 p_parameter_value3,
1254 p_parameter_name4,
1255 p_parameter_value4,
1256 p_parameter_name5,
1257 p_parameter_value5,
1258 p_parameter_name6,
1259 p_parameter_value6,
1260 p_parameter_name7,
1261 p_parameter_value7,
1262 p_parameter_name8,
1263 p_parameter_value8,
1264 p_parameter_name9,
1265 p_parameter_value9,
1266 p_parameter_name10,
1267 p_parameter_value10,
1268 p_parameter_name11,
1269 p_parameter_value11,
1270 p_parameter_name12,
1271 p_parameter_value12,
1272 p_parameter_name13,
1273 p_parameter_value13,
1274 p_parameter_name14,
1275 p_parameter_value14,
1276 p_parameter_name15,
1277 p_parameter_value15,
1278 p_parameter_name16,
1279 p_parameter_value16,
1280 p_parameter_name17,
1281 p_parameter_value17,
1282 p_parameter_name18,
1283 p_parameter_value18,
1284 p_parameter_name19,
1285 p_parameter_value19,
1286 p_parameter_name20,
1287 p_parameter_value20,
1288 p_send_date);
1289 end;
1290
1291
1292 end FND_WF_ENGINE;