172: status PLS_INTEGER;
173:
174: begin
175: -- Retrieve parent activity name
176: WF_CACHE.GetProcessActivity(activity_parent_process.actid, status);
177:
178: if (status <> WF_CACHE.task_SUCCESS) then
179:
180: select WPA.PROCESS_ITEM_TYPE, WPA.PROCESS_NAME, WPA.PROCESS_VERSION,
174: begin
175: -- Retrieve parent activity name
176: WF_CACHE.GetProcessActivity(activity_parent_process.actid, status);
177:
178: if (status <> WF_CACHE.task_SUCCESS) then
179:
180: select WPA.PROCESS_ITEM_TYPE, WPA.PROCESS_NAME, WPA.PROCESS_VERSION,
181: WPA.ACTIVITY_ITEM_TYPE, WPA.ACTIVITY_NAME, WPA.INSTANCE_ID,
182: WPA.INSTANCE_LABEL, WPA.PERFORM_ROLE, WPA.PERFORM_ROLE_TYPE,
180: select WPA.PROCESS_ITEM_TYPE, WPA.PROCESS_NAME, WPA.PROCESS_VERSION,
181: WPA.ACTIVITY_ITEM_TYPE, WPA.ACTIVITY_NAME, WPA.INSTANCE_ID,
182: WPA.INSTANCE_LABEL, WPA.PERFORM_ROLE, WPA.PERFORM_ROLE_TYPE,
183: WPA.START_END, WPA.DEFAULT_RESULT
184: into WF_CACHE.ProcessActivities(activity_parent_process.actid)
185: from WF_PROCESS_ACTIVITIES WPA
186: where WPA.INSTANCE_ID = activity_parent_process.actid;
187:
188: end if;
196: if ((nvl(wf_engine_util.app_level, 0) > 0) and
197: (itemtype = wf_engine_util.app_itemtype) and
198: (itemkey = wf_engine_util.app_itemkey)) then
199: for i in reverse 1 .. wf_engine_util.app_level loop
200: if ((WF_CACHE.ProcessActivities(actid).PROCESS_ITEM_TYPE =
201: wf_engine_util.app_parent_itemtype(i)) and
202: (WF_CACHE.ProcessActivities(actid).PROCESS_NAME =
203: wf_engine_util.app_parent_name(i))) then
204: -- Found a match.
198: (itemkey = wf_engine_util.app_itemkey)) then
199: for i in reverse 1 .. wf_engine_util.app_level loop
200: if ((WF_CACHE.ProcessActivities(actid).PROCESS_ITEM_TYPE =
201: wf_engine_util.app_parent_itemtype(i)) and
202: (WF_CACHE.ProcessActivities(actid).PROCESS_NAME =
203: wf_engine_util.app_parent_name(i))) then
204: -- Found a match.
205: return(wf_engine_util.app_parent_id(i));
206: end if;
235: INTO parentid
236: FROM WF_ITEM_ACTIVITY_STATUSES WIAS,
237: WF_PROCESS_ACTIVITIES WPA
238: WHERE WPA.ACTIVITY_ITEM_TYPE =
239: WF_CACHE.ProcessActivities(actid).PROCESS_ITEM_TYPE
240: AND WPA.ACTIVITY_NAME = WF_CACHE.ProcessActivities(actid).PROCESS_NAME
241: AND WPA.INSTANCE_ID = WIAS.PROCESS_ACTIVITY
242: AND WIAS.ITEM_TYPE = activity_parent_process.itemtype
243: AND WIAS.ITEM_KEY = activity_parent_process.itemkey;
236: FROM WF_ITEM_ACTIVITY_STATUSES WIAS,
237: WF_PROCESS_ACTIVITIES WPA
238: WHERE WPA.ACTIVITY_ITEM_TYPE =
239: WF_CACHE.ProcessActivities(actid).PROCESS_ITEM_TYPE
240: AND WPA.ACTIVITY_NAME = WF_CACHE.ProcessActivities(actid).PROCESS_NAME
241: AND WPA.INSTANCE_ID = WIAS.PROCESS_ACTIVITY
242: AND WIAS.ITEM_TYPE = activity_parent_process.itemtype
243: AND WIAS.ITEM_KEY = activity_parent_process.itemkey;
244:
243: AND WIAS.ITEM_KEY = activity_parent_process.itemkey;
244:
245: -- Re-initialize process stack, starting with the new value
246: Wf_Engine_Util.AddProcessStack(itemtype, itemkey,
247: WF_CACHE.ProcessActivities(actid).PROCESS_ITEM_TYPE,
248: WF_CACHE.ProcessActivities(actid).PROCESS_NAME, parentid, TRUE);
249:
250: return parentid;
251: exception
244:
245: -- Re-initialize process stack, starting with the new value
246: Wf_Engine_Util.AddProcessStack(itemtype, itemkey,
247: WF_CACHE.ProcessActivities(actid).PROCESS_ITEM_TYPE,
248: WF_CACHE.ProcessActivities(actid).PROCESS_NAME, parentid, TRUE);
249:
250: return parentid;
251: exception
252: when no_data_found then
437: -- The result for the parent process will always be the default_result
438: -- of the ending activity, regardless of the result of the activity
439: -- itself.
440:
441: WF_CACHE.GetProcessActivity(complete_activity.actid, status);
442:
443: if (status <> WF_CACHE.task_SUCCESS) then
444: select WPA.PROCESS_ITEM_TYPE, WPA.PROCESS_NAME, WPA.PROCESS_VERSION,
445: WPA.ACTIVITY_ITEM_TYPE, WPA.ACTIVITY_NAME, WPA.INSTANCE_ID,
439: -- itself.
440:
441: WF_CACHE.GetProcessActivity(complete_activity.actid, status);
442:
443: if (status <> WF_CACHE.task_SUCCESS) then
444: select WPA.PROCESS_ITEM_TYPE, WPA.PROCESS_NAME, WPA.PROCESS_VERSION,
445: WPA.ACTIVITY_ITEM_TYPE, WPA.ACTIVITY_NAME, WPA.INSTANCE_ID,
446: WPA.INSTANCE_LABEL, WPA.PERFORM_ROLE, WPA.PERFORM_ROLE_TYPE,
447: WPA.START_END, WPA.DEFAULT_RESULT
444: select WPA.PROCESS_ITEM_TYPE, WPA.PROCESS_NAME, WPA.PROCESS_VERSION,
445: WPA.ACTIVITY_ITEM_TYPE, WPA.ACTIVITY_NAME, WPA.INSTANCE_ID,
446: WPA.INSTANCE_LABEL, WPA.PERFORM_ROLE, WPA.PERFORM_ROLE_TYPE,
447: WPA.START_END, WPA.DEFAULT_RESULT
448: into WF_CACHE.ProcessActivities(complete_activity.actid)
449: from WF_PROCESS_ACTIVITIES WPA
450: where WPA.INSTANCE_ID = complete_activity.actid;
451:
452: end if;
453:
454: -- Complete the parent process and return immediately.
455: Wf_Engine_Util.Complete_Activity(itemtype, itemkey,
456: Wf_Engine_Util.Activity_Parent_Process(itemtype, itemkey, actid),
457: WF_CACHE.ProcessActivities(complete_activity.actid).DEFAULT_RESULT);
458: return;
459: end if;
460:
461: --
458: return;
459: end if;
460:
461: --
462: -- Check WF_CACHE
463: WF_CACHE.GetActivityTransitions(FromActID=>actid,
464: result=>lresult,
465: status=>status,
466: watIND=>watIND);
459: end if;
460:
461: --
462: -- Check WF_CACHE
463: WF_CACHE.GetActivityTransitions(FromActID=>actid,
464: result=>lresult,
465: status=>status,
466: watIND=>watIND);
467:
465: status=>status,
466: watIND=>watIND);
467:
468:
469: if (status <> WF_CACHE.task_SUCCESS) then
470: -- The transitions for this activity/result is not in cache, so we will
471: -- store them using a for loop to get all the next transition activities.
472: -- Then we will access the list from cache to avoid maximum open cursor
473: -- problem. First we need to retain the base index to be used later.
478: --We will locally store the record index from the last loop iteration.
479: l_prevLnk := watIND;
480: --We will now generate an index for the next transition from the
481: --actid, lresult, and the current TO_PROCESS_ACTIVITY.
482: watIND := WF_CACHE.HashKey(actid||':'||lresult||':'||
483: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY);
484: --Check to make sure a record is not already here.
485: if (WF_CACHE.ActivityTransitions.EXISTS(watIND)) then
486: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
479: l_prevLnk := watIND;
480: --We will now generate an index for the next transition from the
481: --actid, lresult, and the current TO_PROCESS_ACTIVITY.
482: watIND := WF_CACHE.HashKey(actid||':'||lresult||':'||
483: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY);
484: --Check to make sure a record is not already here.
485: if (WF_CACHE.ActivityTransitions.EXISTS(watIND)) then
486: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
487: child.FROM_PROCESS_ACTIVITY) or
481: --actid, lresult, and the current TO_PROCESS_ACTIVITY.
482: watIND := WF_CACHE.HashKey(actid||':'||lresult||':'||
483: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY);
484: --Check to make sure a record is not already here.
485: if (WF_CACHE.ActivityTransitions.EXISTS(watIND)) then
486: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
487: child.FROM_PROCESS_ACTIVITY) or
488: (WF_CACHE.ActivityTransitions(watIND).RESULT_CODE <>
489: child.RESULT_CODE) or
482: watIND := WF_CACHE.HashKey(actid||':'||lresult||':'||
483: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY);
484: --Check to make sure a record is not already here.
485: if (WF_CACHE.ActivityTransitions.EXISTS(watIND)) then
486: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
487: child.FROM_PROCESS_ACTIVITY) or
488: (WF_CACHE.ActivityTransitions(watIND).RESULT_CODE <>
489: child.RESULT_CODE) or
490: (WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY <>
484: --Check to make sure a record is not already here.
485: if (WF_CACHE.ActivityTransitions.EXISTS(watIND)) then
486: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
487: child.FROM_PROCESS_ACTIVITY) or
488: (WF_CACHE.ActivityTransitions(watIND).RESULT_CODE <>
489: child.RESULT_CODE) or
490: (WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY <>
491: child.TO_PROCESS_ACTIVITY)) then
492: l_linkCollision := TRUE; --We will continue
486: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
487: child.FROM_PROCESS_ACTIVITY) or
488: (WF_CACHE.ActivityTransitions(watIND).RESULT_CODE <>
489: child.RESULT_CODE) or
490: (WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY <>
491: child.TO_PROCESS_ACTIVITY)) then
492: l_linkCollision := TRUE; --We will continue
493: --populating this linked list, but after
494: --we use it, we will clear the pl/sql table.
498: --Now the PL/SQL table index has moved to the next link, so we will
499: --populate the prev_lnk with our locally stored index. This feature,
500: --not yet used, allows us to traverse backwards through the link list
501: --if needed. Since it is not yet used, it is commented out.
502: --WF_CACHE.ActivityTransitions(watIND).PREV_LNK := l_prevLnk;
503:
504: --l_prevLnk represents the index of the previous record, and we need
505: --to update its NEXT_LNK field with the current index.
506: WF_CACHE.ActivityTransitions(l_prevLnk).NEXT_LNK := watIND;
502: --WF_CACHE.ActivityTransitions(watIND).PREV_LNK := l_prevLnk;
503:
504: --l_prevLnk represents the index of the previous record, and we need
505: --to update its NEXT_LNK field with the current index.
506: WF_CACHE.ActivityTransitions(l_prevLnk).NEXT_LNK := watIND;
507: -- else
508: -- WF_CACHE.ActivityTransitions(watIND).PREV_LNK := -1;
509:
510: end if;
504: --l_prevLnk represents the index of the previous record, and we need
505: --to update its NEXT_LNK field with the current index.
506: WF_CACHE.ActivityTransitions(l_prevLnk).NEXT_LNK := watIND;
507: -- else
508: -- WF_CACHE.ActivityTransitions(watIND).PREV_LNK := -1;
509:
510: end if;
511:
512: WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY :=
508: -- WF_CACHE.ActivityTransitions(watIND).PREV_LNK := -1;
509:
510: end if;
511:
512: WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY :=
513: child.FROM_PROCESS_ACTIVITY;
514:
515: WF_CACHE.ActivityTransitions(watIND).RESULT_CODE := child.RESULT_CODE;
516:
511:
512: WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY :=
513: child.FROM_PROCESS_ACTIVITY;
514:
515: WF_CACHE.ActivityTransitions(watIND).RESULT_CODE := child.RESULT_CODE;
516:
517: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY :=
518: child.TO_PROCESS_ACTIVITY;
519:
513: child.FROM_PROCESS_ACTIVITY;
514:
515: WF_CACHE.ActivityTransitions(watIND).RESULT_CODE := child.RESULT_CODE;
516:
517: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY :=
518: child.TO_PROCESS_ACTIVITY;
519:
520: TransitionCount := TransitionCount+1;
521: end loop;
518: child.TO_PROCESS_ACTIVITY;
519:
520: TransitionCount := TransitionCount+1;
521: end loop;
522: WF_CACHE.ActivityTransitions(watIND).NEXT_LNK := -1;
523: watIND := l_baseLnk; --Reset the index back to the beginning.
524: status := WF_CACHE.task_SUCCESS; --We now have the records successfully
525: --in cache.
526:
520: TransitionCount := TransitionCount+1;
521: end loop;
522: WF_CACHE.ActivityTransitions(watIND).NEXT_LNK := -1;
523: watIND := l_baseLnk; --Reset the index back to the beginning.
524: status := WF_CACHE.task_SUCCESS; --We now have the records successfully
525: --in cache.
526:
527: end if;
528:
529: -- Load a local InstanceArrayTyp, we do this because of the recursion that
530: -- occurs. Since the ActivityTransitions Cache is global, any hashCollision
531: -- would clear the cache and could cause problems as we process activities.
532: while (watIND <> -1) loop
533: childarr(i) := WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY;
534: i := i+1;
535: watIND := WF_CACHE.ActivityTransitions(watIND).NEXT_LNK;
536: end loop;
537: childarr(i) := '';
531: -- would clear the cache and could cause problems as we process activities.
532: while (watIND <> -1) loop
533: childarr(i) := WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY;
534: i := i+1;
535: watIND := WF_CACHE.ActivityTransitions(watIND).NEXT_LNK;
536: end loop;
537: childarr(i) := '';
538:
539: if (l_linkCollision) then
540: --When populating the linked list, we discovered that a hash collision
541: --caused us to overwrite a link belonging to another list. This would
542: --cause the other list to be incorrect. We will clear the table so the
543: --lists will be rebuilt after this transaction.
544: WF_CACHE.ActivityTransitions.DELETE;
545:
546: end if;
547: --
548:
683: end if;
684:
685: --
686: -- Retrieve the starting activities from cache.
687: WF_CACHE.GetProcessStartActivities(itemType=>itemtype,
688: name=>process,
689: version=>version,
690: status=>status,
691: psaIND=>psaIND);
689: version=>version,
690: status=>status,
691: psaIND=>psaIND);
692:
693: if (status <> WF_CACHE.task_SUCCESS) then
694: -- Starting activities are not in cache, so we will store them using a for
695: -- loop to get all the next transition activities.
696: -- Then we will access the list from cache to avoid maximum open cursor
697: -- problem. First we need to retain the base index to be used later.
702: --We will locally store the record index from the last loop iteration.
703: l_prevLnk := psaIND;
704: --We will now generate an index for the start activity from the
705: --itemType, name, version, and the current INSTANCE_ID
706: psaIND := WF_CACHE.HashKey(itemType||':'||process||':'||version||
707: ':'||WF_CACHE.ProcessStartActivities(psaIND).INSTANCE_ID);
708:
709: --Check to make sure a record is not already here.
710: if (WF_CACHE.ProcessStartActivities.EXISTS(psaIND)) then
703: l_prevLnk := psaIND;
704: --We will now generate an index for the start activity from the
705: --itemType, name, version, and the current INSTANCE_ID
706: psaIND := WF_CACHE.HashKey(itemType||':'||process||':'||version||
707: ':'||WF_CACHE.ProcessStartActivities(psaIND).INSTANCE_ID);
708:
709: --Check to make sure a record is not already here.
710: if (WF_CACHE.ProcessStartActivities.EXISTS(psaIND)) then
711: l_linkCollision := TRUE; --There should be no record here, so this
706: psaIND := WF_CACHE.HashKey(itemType||':'||process||':'||version||
707: ':'||WF_CACHE.ProcessStartActivities(psaIND).INSTANCE_ID);
708:
709: --Check to make sure a record is not already here.
710: if (WF_CACHE.ProcessStartActivities.EXISTS(psaIND)) then
711: l_linkCollision := TRUE; --There should be no record here, so this
712: --is a hash collision. We will continue
713: --populating this linked list, but after
714: --we use it, we will clear the pl/sql table
717: --Now the PL/SQL table index has moved to the next link, so we will
718: --populate the prev_lnk with our locally stored index. This feature,
719: --not yet used, allows us to traverse backwards through the link list
720: --if needed. Since it is not yet used, it is commented out.
721: --WF_CACHE.ProcessStartActivities(psaIND).PREV_LNK := l_prevLnk;
722:
723: --l_prevLnk represents the index of the previous record, and we need
724: --to update its NEXT_LNK field with the current index.
725: WF_CACHE.ProcessStartActivities(l_prevLnk).NEXT_LNK := psaIND;
721: --WF_CACHE.ProcessStartActivities(psaIND).PREV_LNK := l_prevLnk;
722:
723: --l_prevLnk represents the index of the previous record, and we need
724: --to update its NEXT_LNK field with the current index.
725: WF_CACHE.ProcessStartActivities(l_prevLnk).NEXT_LNK := psaIND;
726: --else
727: -- WF_CACHE.ProcessStartActivities(psaIND).PREV_LNK := -1;
728:
729: end if;
723: --l_prevLnk represents the index of the previous record, and we need
724: --to update its NEXT_LNK field with the current index.
725: WF_CACHE.ProcessStartActivities(l_prevLnk).NEXT_LNK := psaIND;
726: --else
727: -- WF_CACHE.ProcessStartActivities(psaIND).PREV_LNK := -1;
728:
729: end if;
730:
731: WF_CACHE.ProcessStartActivities(psaIND).PROCESS_ITEM_TYPE :=
727: -- WF_CACHE.ProcessStartActivities(psaIND).PREV_LNK := -1;
728:
729: end if;
730:
731: WF_CACHE.ProcessStartActivities(psaIND).PROCESS_ITEM_TYPE :=
732: child.PROCESS_ITEM_TYPE;
733:
734: WF_CACHE.ProcessStartActivities(psaIND).PROCESS_NAME :=
735: child.PROCESS_NAME;
730:
731: WF_CACHE.ProcessStartActivities(psaIND).PROCESS_ITEM_TYPE :=
732: child.PROCESS_ITEM_TYPE;
733:
734: WF_CACHE.ProcessStartActivities(psaIND).PROCESS_NAME :=
735: child.PROCESS_NAME;
736:
737: WF_CACHE.ProcessStartActivities(psaIND).PROCESS_VERSION :=
738: child.PROCESS_VERSION;
733:
734: WF_CACHE.ProcessStartActivities(psaIND).PROCESS_NAME :=
735: child.PROCESS_NAME;
736:
737: WF_CACHE.ProcessStartActivities(psaIND).PROCESS_VERSION :=
738: child.PROCESS_VERSION;
739:
740: WF_CACHE.ProcessStartActivities(psaIND).INSTANCE_ID := child.INSTANCE_ID;
741:
736:
737: WF_CACHE.ProcessStartActivities(psaIND).PROCESS_VERSION :=
738: child.PROCESS_VERSION;
739:
740: WF_CACHE.ProcessStartActivities(psaIND).INSTANCE_ID := child.INSTANCE_ID;
741:
742: --While we are here, we can populate the ProcessActivities cache hoping
743: --that a later request of any of these process activities will save us
744: --another trip to the DB.
741:
742: --While we are here, we can populate the ProcessActivities cache hoping
743: --that a later request of any of these process activities will save us
744: --another trip to the DB.
745: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PROCESS_ITEM_TYPE :=
746: child.PROCESS_ITEM_TYPE;
747: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PROCESS_NAME :=
748: child.PROCESS_NAME;
749: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PROCESS_VERSION :=
743: --that a later request of any of these process activities will save us
744: --another trip to the DB.
745: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PROCESS_ITEM_TYPE :=
746: child.PROCESS_ITEM_TYPE;
747: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PROCESS_NAME :=
748: child.PROCESS_NAME;
749: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PROCESS_VERSION :=
750: child.PROCESS_VERSION;
751: WF_CACHE.ProcessActivities(child.INSTANCE_ID).ACTIVITY_ITEM_TYPE :=
745: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PROCESS_ITEM_TYPE :=
746: child.PROCESS_ITEM_TYPE;
747: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PROCESS_NAME :=
748: child.PROCESS_NAME;
749: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PROCESS_VERSION :=
750: child.PROCESS_VERSION;
751: WF_CACHE.ProcessActivities(child.INSTANCE_ID).ACTIVITY_ITEM_TYPE :=
752: child.ACTIVITY_ITEM_TYPE;
753: WF_CACHE.ProcessActivities(child.INSTANCE_ID).ACTIVITY_NAME :=
747: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PROCESS_NAME :=
748: child.PROCESS_NAME;
749: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PROCESS_VERSION :=
750: child.PROCESS_VERSION;
751: WF_CACHE.ProcessActivities(child.INSTANCE_ID).ACTIVITY_ITEM_TYPE :=
752: child.ACTIVITY_ITEM_TYPE;
753: WF_CACHE.ProcessActivities(child.INSTANCE_ID).ACTIVITY_NAME :=
754: child.ACTIVITY_NAME;
755: WF_CACHE.ProcessActivities(child.INSTANCE_ID).INSTANCE_ID :=
749: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PROCESS_VERSION :=
750: child.PROCESS_VERSION;
751: WF_CACHE.ProcessActivities(child.INSTANCE_ID).ACTIVITY_ITEM_TYPE :=
752: child.ACTIVITY_ITEM_TYPE;
753: WF_CACHE.ProcessActivities(child.INSTANCE_ID).ACTIVITY_NAME :=
754: child.ACTIVITY_NAME;
755: WF_CACHE.ProcessActivities(child.INSTANCE_ID).INSTANCE_ID :=
756: child.INSTANCE_ID;
757: WF_CACHE.ProcessActivities(child.INSTANCE_ID).INSTANCE_LABEL :=
751: WF_CACHE.ProcessActivities(child.INSTANCE_ID).ACTIVITY_ITEM_TYPE :=
752: child.ACTIVITY_ITEM_TYPE;
753: WF_CACHE.ProcessActivities(child.INSTANCE_ID).ACTIVITY_NAME :=
754: child.ACTIVITY_NAME;
755: WF_CACHE.ProcessActivities(child.INSTANCE_ID).INSTANCE_ID :=
756: child.INSTANCE_ID;
757: WF_CACHE.ProcessActivities(child.INSTANCE_ID).INSTANCE_LABEL :=
758: child.INSTANCE_LABEL;
759: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PERFORM_ROLE :=
753: WF_CACHE.ProcessActivities(child.INSTANCE_ID).ACTIVITY_NAME :=
754: child.ACTIVITY_NAME;
755: WF_CACHE.ProcessActivities(child.INSTANCE_ID).INSTANCE_ID :=
756: child.INSTANCE_ID;
757: WF_CACHE.ProcessActivities(child.INSTANCE_ID).INSTANCE_LABEL :=
758: child.INSTANCE_LABEL;
759: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PERFORM_ROLE :=
760: child.PERFORM_ROLE;
761: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PERFORM_ROLE_TYPE :=
755: WF_CACHE.ProcessActivities(child.INSTANCE_ID).INSTANCE_ID :=
756: child.INSTANCE_ID;
757: WF_CACHE.ProcessActivities(child.INSTANCE_ID).INSTANCE_LABEL :=
758: child.INSTANCE_LABEL;
759: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PERFORM_ROLE :=
760: child.PERFORM_ROLE;
761: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PERFORM_ROLE_TYPE :=
762: child.PERFORM_ROLE_TYPE;
763: WF_CACHE.ProcessActivities(child.INSTANCE_ID).START_END :=
757: WF_CACHE.ProcessActivities(child.INSTANCE_ID).INSTANCE_LABEL :=
758: child.INSTANCE_LABEL;
759: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PERFORM_ROLE :=
760: child.PERFORM_ROLE;
761: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PERFORM_ROLE_TYPE :=
762: child.PERFORM_ROLE_TYPE;
763: WF_CACHE.ProcessActivities(child.INSTANCE_ID).START_END :=
764: child.START_END;
765: WF_CACHE.ProcessActivities(child.INSTANCE_ID).DEFAULT_RESULT :=
759: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PERFORM_ROLE :=
760: child.PERFORM_ROLE;
761: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PERFORM_ROLE_TYPE :=
762: child.PERFORM_ROLE_TYPE;
763: WF_CACHE.ProcessActivities(child.INSTANCE_ID).START_END :=
764: child.START_END;
765: WF_CACHE.ProcessActivities(child.INSTANCE_ID).DEFAULT_RESULT :=
766: child.DEFAULT_RESULT;
767:
761: WF_CACHE.ProcessActivities(child.INSTANCE_ID).PERFORM_ROLE_TYPE :=
762: child.PERFORM_ROLE_TYPE;
763: WF_CACHE.ProcessActivities(child.INSTANCE_ID).START_END :=
764: child.START_END;
765: WF_CACHE.ProcessActivities(child.INSTANCE_ID).DEFAULT_RESULT :=
766: child.DEFAULT_RESULT;
767:
768: TransitionCount := TransitionCount+1;
769: end loop;
766: child.DEFAULT_RESULT;
767:
768: TransitionCount := TransitionCount+1;
769: end loop;
770: WF_CACHE.ProcessStartActivities(psaIND).NEXT_LNK := -1;
771: psaIND := l_baseLnk; --Reset the index back to the beginning.
772: status := WF_CACHE.task_SUCCESS; --We now have the records successfully
773: --in cache.
774:
768: TransitionCount := TransitionCount+1;
769: end loop;
770: WF_CACHE.ProcessStartActivities(psaIND).NEXT_LNK := -1;
771: psaIND := l_baseLnk; --Reset the index back to the beginning.
772: status := WF_CACHE.task_SUCCESS; --We now have the records successfully
773: --in cache.
774:
775: end if;
776:
778: -- occurs. Since the ProcessStartActivities Cache is global, any
779: -- hashCollision would clear the cache and could cause problems as we
780: -- process activities in recursive calls.
781: while (psaIND <> -1) loop
782: childarr(i) := WF_CACHE.ProcessStartActivities(psaIND).INSTANCE_ID;
783: i := i+1;
784: psaIND := WF_CACHE.ProcessStartActivities(psaIND).NEXT_LNK;
785: end loop;
786: childarr(i) := '';
780: -- process activities in recursive calls.
781: while (psaIND <> -1) loop
782: childarr(i) := WF_CACHE.ProcessStartActivities(psaIND).INSTANCE_ID;
783: i := i+1;
784: psaIND := WF_CACHE.ProcessStartActivities(psaIND).NEXT_LNK;
785: end loop;
786: childarr(i) := '';
787:
788: if (l_linkCollision) then
789: --When populating the linked list, we discovered that a hash collision
790: --caused us to overwrite a link belonging to another list. This would
791: --cause the other list to be incorrect. We will clear the table so the
792: --lists will be rebuilt after this transaction.
793: WF_CACHE.ProcessStartActivities.DELETE;
794:
795: end if;
796: --
797:
1252: -- Reset all activities following this one in current process,
1253: -- but only if this activity really completed.
1254: if (status = wf_engine.eng_completed) then
1255: --
1256: -- Check WF_CACHE
1257: WF_CACHE.GetActivityTransitions(FromActID=>actid,
1258: result=>result,
1259: status=>status,
1260: watIND=>watIND);
1253: -- but only if this activity really completed.
1254: if (status = wf_engine.eng_completed) then
1255: --
1256: -- Check WF_CACHE
1257: WF_CACHE.GetActivityTransitions(FromActID=>actid,
1258: result=>result,
1259: status=>status,
1260: watIND=>watIND);
1261:
1259: status=>status,
1260: watIND=>watIND);
1261:
1262:
1263: if (status <> WF_CACHE.task_SUCCESS) then
1264: -- The transitions for this activity/result is not in cache, so we will
1265: -- store them using a for loop to get all the next transition activities.
1266: -- Then we will access the list from cache to avoid maximum open cursor
1267: -- problem. First we need to retain the base index to be used later.
1273: --We will locally store the record index from the last loop iteration.
1274: l_prevLnk := watIND;
1275: --We will now generate an index for the next transition from the
1276: --actid, result, and the current TO_PROCESS_ACTIVITY.
1277: watIND := WF_CACHE.HashKey(actid||':'||result||':'||
1278: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY);
1279:
1280: --Check to make sure a record is not already here.
1281: if (WF_CACHE.ActivityTransitions.EXISTS(watIND)) then
1274: l_prevLnk := watIND;
1275: --We will now generate an index for the next transition from the
1276: --actid, result, and the current TO_PROCESS_ACTIVITY.
1277: watIND := WF_CACHE.HashKey(actid||':'||result||':'||
1278: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY);
1279:
1280: --Check to make sure a record is not already here.
1281: if (WF_CACHE.ActivityTransitions.EXISTS(watIND)) then
1282: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
1277: watIND := WF_CACHE.HashKey(actid||':'||result||':'||
1278: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY);
1279:
1280: --Check to make sure a record is not already here.
1281: if (WF_CACHE.ActivityTransitions.EXISTS(watIND)) then
1282: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
1283: to_activity.FROM_PROCESS_ACTIVITY) or
1284: (WF_CACHE.ActivityTransitions(watIND).RESULT_CODE <>
1285: to_activity.RESULT_CODE) or
1278: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY);
1279:
1280: --Check to make sure a record is not already here.
1281: if (WF_CACHE.ActivityTransitions.EXISTS(watIND)) then
1282: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
1283: to_activity.FROM_PROCESS_ACTIVITY) or
1284: (WF_CACHE.ActivityTransitions(watIND).RESULT_CODE <>
1285: to_activity.RESULT_CODE) or
1286: (WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY <>
1280: --Check to make sure a record is not already here.
1281: if (WF_CACHE.ActivityTransitions.EXISTS(watIND)) then
1282: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
1283: to_activity.FROM_PROCESS_ACTIVITY) or
1284: (WF_CACHE.ActivityTransitions(watIND).RESULT_CODE <>
1285: to_activity.RESULT_CODE) or
1286: (WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY <>
1287: to_activity.TO_PROCESS_ACTIVITY)) then
1288: l_linkCollision := TRUE; --We will continue
1282: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
1283: to_activity.FROM_PROCESS_ACTIVITY) or
1284: (WF_CACHE.ActivityTransitions(watIND).RESULT_CODE <>
1285: to_activity.RESULT_CODE) or
1286: (WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY <>
1287: to_activity.TO_PROCESS_ACTIVITY)) then
1288: l_linkCollision := TRUE; --We will continue
1289: --populating this linked list, but after
1290: --we use it, we will clear the pl/sql table.
1294: --Now the PL/SQL table index has moved to the next link, so we will
1295: --populate the prev_lnk with our locally stored index. This feature,
1296: --not yet used, allows us to traverse backwards through the link list
1297: --if needed. Since it is not yet used, it is commented out.
1298: -- WF_CACHE.ActivityTransitions(watIND).PREV_LNK := l_prevLnk;
1299:
1300: --l_prevLnk represents the index of the previous record, and we need
1301: --to update its NEXT_LNK field with the current index.
1302: WF_CACHE.ActivityTransitions(l_prevLnk).NEXT_LNK := watIND;
1298: -- WF_CACHE.ActivityTransitions(watIND).PREV_LNK := l_prevLnk;
1299:
1300: --l_prevLnk represents the index of the previous record, and we need
1301: --to update its NEXT_LNK field with the current index.
1302: WF_CACHE.ActivityTransitions(l_prevLnk).NEXT_LNK := watIND;
1303: -- else
1304: -- WF_CACHE.ActivityTransitions(watIND).PREV_LNK := -1;
1305:
1306: end if;
1300: --l_prevLnk represents the index of the previous record, and we need
1301: --to update its NEXT_LNK field with the current index.
1302: WF_CACHE.ActivityTransitions(l_prevLnk).NEXT_LNK := watIND;
1303: -- else
1304: -- WF_CACHE.ActivityTransitions(watIND).PREV_LNK := -1;
1305:
1306: end if;
1307:
1308: WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY :=
1304: -- WF_CACHE.ActivityTransitions(watIND).PREV_LNK := -1;
1305:
1306: end if;
1307:
1308: WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY :=
1309: to_activity.FROM_PROCESS_ACTIVITY;
1310:
1311: WF_CACHE.ActivityTransitions(watIND).RESULT_CODE :=
1312: to_activity.RESULT_CODE;
1307:
1308: WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY :=
1309: to_activity.FROM_PROCESS_ACTIVITY;
1310:
1311: WF_CACHE.ActivityTransitions(watIND).RESULT_CODE :=
1312: to_activity.RESULT_CODE;
1313:
1314: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY :=
1315: to_activity.TO_PROCESS_ACTIVITY;
1310:
1311: WF_CACHE.ActivityTransitions(watIND).RESULT_CODE :=
1312: to_activity.RESULT_CODE;
1313:
1314: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY :=
1315: to_activity.TO_PROCESS_ACTIVITY;
1316:
1317: TransitionCount := TransitionCount+1;
1318: end loop;
1315: to_activity.TO_PROCESS_ACTIVITY;
1316:
1317: TransitionCount := TransitionCount+1;
1318: end loop;
1319: WF_CACHE.ActivityTransitions(watIND).NEXT_LNK := -1;
1320: watIND := l_baseLnk; --Reset the index back to the beginning.
1321: status := WF_CACHE.task_SUCCESS; --We now have the records successfully
1322: --in cache.
1323:
1317: TransitionCount := TransitionCount+1;
1318: end loop;
1319: WF_CACHE.ActivityTransitions(watIND).NEXT_LNK := -1;
1320: watIND := l_baseLnk; --Reset the index back to the beginning.
1321: status := WF_CACHE.task_SUCCESS; --We now have the records successfully
1322: --in cache.
1323:
1324: end if;
1325:
1326: -- Load a local InstanceArrayTyp, we do this because of the recursion that
1327: -- occurs. Since the ActivityTransitions Cache is global, any hashCollision
1328: -- would clear the cache and could cause problems as we process activities.
1329: while (watIND <> -1) loop
1330: childarr(i) := WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY;
1331: i := i+1;
1332: watIND := WF_CACHE.ActivityTransitions(watIND).NEXT_LNK;
1333: end loop;
1334: childarr(i) := '';
1328: -- would clear the cache and could cause problems as we process activities.
1329: while (watIND <> -1) loop
1330: childarr(i) := WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY;
1331: i := i+1;
1332: watIND := WF_CACHE.ActivityTransitions(watIND).NEXT_LNK;
1333: end loop;
1334: childarr(i) := '';
1335:
1336: i := 0;
1344: --When populating the linked list, we discovered that a hash collision
1345: --caused us to overwrite a link belonging to another list. This would
1346: --cause the other list to be incorrect. We will clear the table so the
1347: --lists will be rebuilt after this transaction.
1348: WF_CACHE.ActivityTransitions.DELETE;
1349:
1350: end if;
1351: --
1352: exception
1456: -- were already reset in the recursive call.
1457: -- Likewise, do not reset actual child - it has already been reset.
1458: if (status = wf_engine.eng_completed) then
1459: --
1460: -- Check WF_CACHE
1461: WF_CACHE.GetActivityTransitions(FromActID=>rootid,
1462: result=>result,
1463: status=>status,
1464: watIND=>watIND);
1457: -- Likewise, do not reset actual child - it has already been reset.
1458: if (status = wf_engine.eng_completed) then
1459: --
1460: -- Check WF_CACHE
1461: WF_CACHE.GetActivityTransitions(FromActID=>rootid,
1462: result=>result,
1463: status=>status,
1464: watIND=>watIND);
1465:
1462: result=>result,
1463: status=>status,
1464: watIND=>watIND);
1465:
1466: if (status <> WF_CACHE.task_SUCCESS) then
1467: -- The transitions for this activity/result is not in cache, so we will
1468: -- store them using a for loop to get all the next transition
1469: -- activities. Then we will access the list from cache to avoid
1470: -- maximum open cursor problem. First we need to retain the base index
1478: l_prevLnk := watIND;
1479:
1480: --We will now generate an index for the next transition from the
1481: --actid, result, and the current TO_PROCESS_ACTIVITY.
1482: watIND := WF_CACHE.HashKey(rootid||':'||result||':'||
1483: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY);
1484: --Check to make sure a record is not already here.
1485: if (WF_CACHE.ActivityTransitions.EXISTS(watIND)) then
1486: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
1479:
1480: --We will now generate an index for the next transition from the
1481: --actid, result, and the current TO_PROCESS_ACTIVITY.
1482: watIND := WF_CACHE.HashKey(rootid||':'||result||':'||
1483: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY);
1484: --Check to make sure a record is not already here.
1485: if (WF_CACHE.ActivityTransitions.EXISTS(watIND)) then
1486: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
1487: to_activity.FROM_PROCESS_ACTIVITY) or
1481: --actid, result, and the current TO_PROCESS_ACTIVITY.
1482: watIND := WF_CACHE.HashKey(rootid||':'||result||':'||
1483: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY);
1484: --Check to make sure a record is not already here.
1485: if (WF_CACHE.ActivityTransitions.EXISTS(watIND)) then
1486: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
1487: to_activity.FROM_PROCESS_ACTIVITY) or
1488: (WF_CACHE.ActivityTransitions(watIND).RESULT_CODE <>
1489: to_activity.RESULT_CODE) or
1482: watIND := WF_CACHE.HashKey(rootid||':'||result||':'||
1483: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY);
1484: --Check to make sure a record is not already here.
1485: if (WF_CACHE.ActivityTransitions.EXISTS(watIND)) then
1486: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
1487: to_activity.FROM_PROCESS_ACTIVITY) or
1488: (WF_CACHE.ActivityTransitions(watIND).RESULT_CODE <>
1489: to_activity.RESULT_CODE) or
1490: (WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY <>
1484: --Check to make sure a record is not already here.
1485: if (WF_CACHE.ActivityTransitions.EXISTS(watIND)) then
1486: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
1487: to_activity.FROM_PROCESS_ACTIVITY) or
1488: (WF_CACHE.ActivityTransitions(watIND).RESULT_CODE <>
1489: to_activity.RESULT_CODE) or
1490: (WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY <>
1491: to_activity.TO_PROCESS_ACTIVITY)) then
1492: l_linkCollision := TRUE; --We will continue
1486: if ((WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY <>
1487: to_activity.FROM_PROCESS_ACTIVITY) or
1488: (WF_CACHE.ActivityTransitions(watIND).RESULT_CODE <>
1489: to_activity.RESULT_CODE) or
1490: (WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY <>
1491: to_activity.TO_PROCESS_ACTIVITY)) then
1492: l_linkCollision := TRUE; --We will continue
1493: --populating this linked list, but after
1494: --we use it, we will clear the pl/sql
1500: --will populate the prev_lnk with our locally stored index.
1501: --This feature, not yet used, allows us to traverse backwards
1502: --through the link list if needed. Since it is not yet used,
1503: --it is commented out.
1504: -- WF_CACHE.ActivityTransitions(watIND).PREV_LNK := l_prevLnk;
1505:
1506: --l_prevLnk represents the index of the previous record, and we
1507: --need to update its NEXT_LNK field with the current index.
1508: WF_CACHE.ActivityTransitions(l_prevLnk).NEXT_LNK := watIND;
1504: -- WF_CACHE.ActivityTransitions(watIND).PREV_LNK := l_prevLnk;
1505:
1506: --l_prevLnk represents the index of the previous record, and we
1507: --need to update its NEXT_LNK field with the current index.
1508: WF_CACHE.ActivityTransitions(l_prevLnk).NEXT_LNK := watIND;
1509: -- else
1510: -- WF_CACHE.ActivityTransitions(watIND).PREV_LNK := -1;
1511:
1512: end if;
1506: --l_prevLnk represents the index of the previous record, and we
1507: --need to update its NEXT_LNK field with the current index.
1508: WF_CACHE.ActivityTransitions(l_prevLnk).NEXT_LNK := watIND;
1509: -- else
1510: -- WF_CACHE.ActivityTransitions(watIND).PREV_LNK := -1;
1511:
1512: end if;
1513:
1514: WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY :=
1510: -- WF_CACHE.ActivityTransitions(watIND).PREV_LNK := -1;
1511:
1512: end if;
1513:
1514: WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY :=
1515: to_activity.FROM_PROCESS_ACTIVITY;
1516:
1517: WF_CACHE.ActivityTransitions(watIND).RESULT_CODE :=
1518: to_activity.RESULT_CODE;
1513:
1514: WF_CACHE.ActivityTransitions(watIND).FROM_PROCESS_ACTIVITY :=
1515: to_activity.FROM_PROCESS_ACTIVITY;
1516:
1517: WF_CACHE.ActivityTransitions(watIND).RESULT_CODE :=
1518: to_activity.RESULT_CODE;
1519:
1520: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY :=
1521: to_activity.TO_PROCESS_ACTIVITY;
1516:
1517: WF_CACHE.ActivityTransitions(watIND).RESULT_CODE :=
1518: to_activity.RESULT_CODE;
1519:
1520: WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY :=
1521: to_activity.TO_PROCESS_ACTIVITY;
1522:
1523: TransitionCount := TransitionCount+1;
1524: end loop;
1521: to_activity.TO_PROCESS_ACTIVITY;
1522:
1523: TransitionCount := TransitionCount+1;
1524: end loop;
1525: WF_CACHE.ActivityTransitions(watIND).NEXT_LNK := -1;
1526: watIND := l_baseLnk; --Reset the index back to the beginning.
1527: status := WF_CACHE.task_SUCCESS; --We now have the records
1528: --successfully in cache.
1529: end if;
1523: TransitionCount := TransitionCount+1;
1524: end loop;
1525: WF_CACHE.ActivityTransitions(watIND).NEXT_LNK := -1;
1526: watIND := l_baseLnk; --Reset the index back to the beginning.
1527: status := WF_CACHE.task_SUCCESS; --We now have the records
1528: --successfully in cache.
1529: end if;
1530:
1531: j := 0;
1533: -- that occurs. Since the ActivityTransitions Cache is global, any
1534: -- hashCollision would clear the cache and could cause problems as we
1535: -- process activities.
1536: while (watIND <> -1) loop
1537: actarr(j) := WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY;
1538: j := j+1;
1539: watIND := WF_CACHE.ActivityTransitions(watIND).NEXT_LNK;
1540: end loop;
1541: actarr(j) := '';
1535: -- process activities.
1536: while (watIND <> -1) loop
1537: actarr(j) := WF_CACHE.ActivityTransitions(watIND).TO_PROCESS_ACTIVITY;
1538: j := j+1;
1539: watIND := WF_CACHE.ActivityTransitions(watIND).NEXT_LNK;
1540: end loop;
1541: actarr(j) := '';
1542:
1543: j := 0;
1551: --When populating the linked list, we discovered that a hash collision
1552: --caused us to overwrite a link belonging to another list. This would
1553: --cause the other list to be incorrect. We will clear the table so the
1554: --lists will be rebuilt after this transaction.
1555: WF_CACHE.ActivityTransitions.DELETE;
1556:
1557: end if;
1558: --
1559:
2080:
2081: begin
2082: -- Look for selector function.
2083: begin
2084: WF_CACHE.GetItemType(itemtype, status, witIND);
2085:
2086: if (status <> WF_CACHE.task_SUCCESS) then
2087:
2088: SELECT NAME, WF_SELECTOR
2082: -- Look for selector function.
2083: begin
2084: WF_CACHE.GetItemType(itemtype, status, witIND);
2085:
2086: if (status <> WF_CACHE.task_SUCCESS) then
2087:
2088: SELECT NAME, WF_SELECTOR
2089: INTO WF_CACHE.ItemTypes(witIND)
2090: FROM WF_ITEM_TYPES
2085:
2086: if (status <> WF_CACHE.task_SUCCESS) then
2087:
2088: SELECT NAME, WF_SELECTOR
2089: INTO WF_CACHE.ItemTypes(witIND)
2090: FROM WF_ITEM_TYPES
2091: WHERE NAME = itemtype;
2092:
2093: end if;
2098: Wf_Core.Raise('WFENG_ITEM_TYPE');
2099: end;
2100:
2101: -- If no selector found, then nothing to do
2102: if (WF_CACHE.ItemTypes(witIND).WF_SELECTOR is null) then
2103: return(null);
2104: end if;
2105:
2106: -- Call selector function
2104: end if;
2105:
2106: -- Call selector function
2107: begin
2108: Wf_Engine_Util.Function_Call(WF_CACHE.ItemTypes(witIND).WF_SELECTOR,
2109: itemtype, itemkey, null, runmode, result);
2110: exception
2111: when others then
2112: -- If this is setctx call and the function failed, unset the setctx
3361: Wf_Core.Token('ACTID', nvl(actid, 'NULL'));
3362: Wf_Core.Raise('WFSQL_ARGS');
3363: end if;
3364: -- Check value_type flag for possible item_attribute ref.
3365: WF_CACHE.GetActivityAttrValue(actid, '#TIMEOUT', status, waavIND);
3366:
3367: if (status <> WF_CACHE.task_SUCCESS) then
3368: open curs_activityattr (actid, '#TIMEOUT');
3369: fetch curs_activityattr into WF_CACHE.ActivityAttrValues(waavIND);
3363: end if;
3364: -- Check value_type flag for possible item_attribute ref.
3365: WF_CACHE.GetActivityAttrValue(actid, '#TIMEOUT', status, waavIND);
3366:
3367: if (status <> WF_CACHE.task_SUCCESS) then
3368: open curs_activityattr (actid, '#TIMEOUT');
3369: fetch curs_activityattr into WF_CACHE.ActivityAttrValues(waavIND);
3370: close curs_activityattr;
3371: end if;
3365: WF_CACHE.GetActivityAttrValue(actid, '#TIMEOUT', status, waavIND);
3366:
3367: if (status <> WF_CACHE.task_SUCCESS) then
3368: open curs_activityattr (actid, '#TIMEOUT');
3369: fetch curs_activityattr into WF_CACHE.ActivityAttrValues(waavIND);
3370: close curs_activityattr;
3371: end if;
3372:
3373: if (WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE is not null) then
3369: fetch curs_activityattr into WF_CACHE.ActivityAttrValues(waavIND);
3370: close curs_activityattr;
3371: end if;
3372:
3373: if (WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE is not null) then
3374: return(to_char(WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE));
3375: elsif (WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE is not null) then
3376: return(to_char(WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE)||' '||
3377: to_char(WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE,
3370: close curs_activityattr;
3371: end if;
3372:
3373: if (WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE is not null) then
3374: return(to_char(WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE));
3375: elsif (WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE is not null) then
3376: return(to_char(WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE)||' '||
3377: to_char(WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE,
3378: 'HH24:MI:SS'));
3371: end if;
3372:
3373: if (WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE is not null) then
3374: return(to_char(WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE));
3375: elsif (WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE is not null) then
3376: return(to_char(WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE)||' '||
3377: to_char(WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE,
3378: 'HH24:MI:SS'));
3379:
3372:
3373: if (WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE is not null) then
3374: return(to_char(WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE));
3375: elsif (WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE is not null) then
3376: return(to_char(WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE)||' '||
3377: to_char(WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE,
3378: 'HH24:MI:SS'));
3379:
3380: elsif (WF_CACHE.ActivityAttrValues(waavIND).VALUE_TYPE = 'ITEMATTR') then
3373: if (WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE is not null) then
3374: return(to_char(WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE));
3375: elsif (WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE is not null) then
3376: return(to_char(WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE)||' '||
3377: to_char(WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE,
3378: 'HH24:MI:SS'));
3379:
3380: elsif (WF_CACHE.ActivityAttrValues(waavIND).VALUE_TYPE = 'ITEMATTR') then
3381: return(substrb(WF_CACHE.ActivityAttrValues(waavIND).TEXT_VALUE, 1, 30));
3376: return(to_char(WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE)||' '||
3377: to_char(WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE,
3378: 'HH24:MI:SS'));
3379:
3380: elsif (WF_CACHE.ActivityAttrValues(waavIND).VALUE_TYPE = 'ITEMATTR') then
3381: return(substrb(WF_CACHE.ActivityAttrValues(waavIND).TEXT_VALUE, 1, 30));
3382:
3383: else
3384: return(null);
3377: to_char(WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE,
3378: 'HH24:MI:SS'));
3379:
3380: elsif (WF_CACHE.ActivityAttrValues(waavIND).VALUE_TYPE = 'ITEMATTR') then
3381: return(substrb(WF_CACHE.ActivityAttrValues(waavIND).TEXT_VALUE, 1, 30));
3382:
3383: else
3384: return(null);
3385:
3391: if (curs_activityattr%ISOPEN) then
3392: CLOSE curs_activityattr;
3393: end if;
3394:
3395: WF_CACHE.ActivityAttrValues(waavIND).PROCESS_ACTIVITY_ID := actid;
3396: WF_CACHE.ActivityAttrValues(waavIND).NAME := '#TIMEOUT';
3397: WF_CACHE.ActivityAttrValues(waavIND).VALUE_TYPE := 'CONSTANT';
3398: WF_CACHE.ActivityAttrValues(waavIND).TEXT_VALUE := '';
3399: WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE := '';
3392: CLOSE curs_activityattr;
3393: end if;
3394:
3395: WF_CACHE.ActivityAttrValues(waavIND).PROCESS_ACTIVITY_ID := actid;
3396: WF_CACHE.ActivityAttrValues(waavIND).NAME := '#TIMEOUT';
3397: WF_CACHE.ActivityAttrValues(waavIND).VALUE_TYPE := 'CONSTANT';
3398: WF_CACHE.ActivityAttrValues(waavIND).TEXT_VALUE := '';
3399: WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE := '';
3400: WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE := to_date(NULL);
3393: end if;
3394:
3395: WF_CACHE.ActivityAttrValues(waavIND).PROCESS_ACTIVITY_ID := actid;
3396: WF_CACHE.ActivityAttrValues(waavIND).NAME := '#TIMEOUT';
3397: WF_CACHE.ActivityAttrValues(waavIND).VALUE_TYPE := 'CONSTANT';
3398: WF_CACHE.ActivityAttrValues(waavIND).TEXT_VALUE := '';
3399: WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE := '';
3400: WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE := to_date(NULL);
3401: return(null);
3394:
3395: WF_CACHE.ActivityAttrValues(waavIND).PROCESS_ACTIVITY_ID := actid;
3396: WF_CACHE.ActivityAttrValues(waavIND).NAME := '#TIMEOUT';
3397: WF_CACHE.ActivityAttrValues(waavIND).VALUE_TYPE := 'CONSTANT';
3398: WF_CACHE.ActivityAttrValues(waavIND).TEXT_VALUE := '';
3399: WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE := '';
3400: WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE := to_date(NULL);
3401: return(null);
3402:
3395: WF_CACHE.ActivityAttrValues(waavIND).PROCESS_ACTIVITY_ID := actid;
3396: WF_CACHE.ActivityAttrValues(waavIND).NAME := '#TIMEOUT';
3397: WF_CACHE.ActivityAttrValues(waavIND).VALUE_TYPE := 'CONSTANT';
3398: WF_CACHE.ActivityAttrValues(waavIND).TEXT_VALUE := '';
3399: WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE := '';
3400: WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE := to_date(NULL);
3401: return(null);
3402:
3403: when others then
3396: WF_CACHE.ActivityAttrValues(waavIND).NAME := '#TIMEOUT';
3397: WF_CACHE.ActivityAttrValues(waavIND).VALUE_TYPE := 'CONSTANT';
3398: WF_CACHE.ActivityAttrValues(waavIND).TEXT_VALUE := '';
3399: WF_CACHE.ActivityAttrValues(waavIND).NUMBER_VALUE := '';
3400: WF_CACHE.ActivityAttrValues(waavIND).DATE_VALUE := to_date(NULL);
3401: return(null);
3402:
3403: when others then
3404: --Check to ensure that cursor is not open