[Home] [Help]
1: PACKAGE BODY JTF_UM_WF_APPROVAL as
2: /* $Header: JTFUMWFB.pls 120.19.12020000.2 2012/07/18 16:05:58 anurtrip ship $ */
3:
4: G_MODULE CONSTANT VARCHAR2(40) := 'JTF.UM.PLSQL.APPROVAL';
5: l_is_debug_parameter_on boolean := JTF_DEBUG_PUB.IS_LOG_PARAMETERS_ON(G_MODULE);
119: open getUserNameCursor;
120: fetch getUserNameCursor into requesterUsername;
121: if (getUserNameCursor%notfound) then
122: close getUserNameCursor;
123: raise_application_error (-20000, 'requester username is not found while calling JTF_UM_WF_APPROVAL.getRequesterUsername');
124: end if;
125: close getUserNameCursor;
126:
127: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Exiting getRequesterUsername API');
149: open getUserIDCursor;
150: fetch getUserIDCursor into userId;
151: if (getUserIDCursor%notfound) then
152: close getUserIDCursor;
153: raise_application_error (-20000, 'userId is not found while calling JTF_UM_WF_APPROVAL.getUserID');
154: end if;
155: close getUserIDCursor;
156:
157: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Exiting getUserID API');
358: requesterUserID || ',' || requestRegID || ') API');
359:
360: -- Check input parameter
361: if (requestType is null) then
362: raise_application_error (-20000, 'requestType is null when calling JTF_UM_WF_APPROVAL.CreateProcess.');
363: end if;
364:
365: if (requestID is null) then
366: raise_application_error (-20000, 'requestID is null when calling JTF_UM_WF_APPROVAL.CreateProcess.');
362: raise_application_error (-20000, 'requestType is null when calling JTF_UM_WF_APPROVAL.CreateProcess.');
363: end if;
364:
365: if (requestID is null) then
366: raise_application_error (-20000, 'requestID is null when calling JTF_UM_WF_APPROVAL.CreateProcess.');
367: end if;
368:
369: if (requesterUserID is null) then
370: raise_application_error (-20000, 'requesterUserID is null when calling JTF_UM_WF_APPROVAL.CreateProcess.');
366: raise_application_error (-20000, 'requestID is null when calling JTF_UM_WF_APPROVAL.CreateProcess.');
367: end if;
368:
369: if (requesterUserID is null) then
370: raise_application_error (-20000, 'requesterUserID is null when calling JTF_UM_WF_APPROVAL.CreateProcess.');
371: end if;
372:
373: if (requestRegID is null) then
374: raise_application_error (-20000, 'requestRegID is null when calling JTF_UM_WF_APPROVAL.CreateProcess.');
370: raise_application_error (-20000, 'requesterUserID is null when calling JTF_UM_WF_APPROVAL.CreateProcess.');
371: end if;
372:
373: if (requestRegID is null) then
374: raise_application_error (-20000, 'requestRegID is null when calling JTF_UM_WF_APPROVAL.CreateProcess.');
375: end if;
376:
377: -- Get the approvalID
378: if (requestType = 'USERTYPE') then
379: open usertypeApprovalCursor;
380: fetch usertypeApprovalCursor into approvalID;
381: if (usertypeApprovalCursor%notfound) then
382: close usertypeApprovalCursor;
383: raise_application_error (-20000, 'ApprovalID is not found when calling JTF_UM_WF_APPROVAL.CreateProcess requestType='||requestType||'.');
384: end if;
385: close usertypeApprovalCursor;
386: requesterUsertypeID := requestId;
387: else
388: open enrollApprovalCursor;
389: fetch enrollApprovalCursor into approvalID;
390: if (enrollApprovalCursor%notfound) then
391: close enrollApprovalCursor;
392: raise_application_error (-20000, 'ApprovalID is not found when calling JTF_UM_WF_APPROVAL.CreateProcess requestType='||requestType||'.');
393: end if;
394: close enrollApprovalCursor;
395: -- Get the requesterUsertypeID
396: open getUsertypeIdCursor;
396: open getUsertypeIdCursor;
397: fetch getUsertypeIdCursor into requesterUsertypeID;
398: if (getUsertypeIdCursor%notfound) then
399: close getUsertypeIdCursor;
400: raise_application_error (-20000, 'requesterUsertypeID is not found when calling JTF_UM_WF_APPROVAL.CreateProcess.');
401: end if;
402: close getUsertypeIdCursor;
403: end if;
404:
576: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Exiting Selector API');
577:
578: exception
579: when others then
580: wf_core.context ('JTF_UM_WF_APPROVAL', 'Selector', item_type, item_key, to_char (activity_id), command);
581: raise;
582: end selector;
583:
584: --
891: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Exiting Initialization API');
892:
893: exception
894: when MISSING_REQUESTER_USER_ID then
895: wf_core.context ('JTF_UM_WF_APPROVAL', 'Initialization', itemtype, itemkey, to_char (actid), funcmode,
896: 'Requester User ID is missing in the FND_USER');
897: raise;
898: when others then
899: wf_core.context ('JTF_UM_WF_APPROVAL', 'Initialization', itemtype, itemkey, to_char (actid), funcmode);
895: wf_core.context ('JTF_UM_WF_APPROVAL', 'Initialization', itemtype, itemkey, to_char (actid), funcmode,
896: 'Requester User ID is missing in the FND_USER');
897: raise;
898: when others then
899: wf_core.context ('JTF_UM_WF_APPROVAL', 'Initialization', itemtype, itemkey, to_char (actid), funcmode);
900: raise;
901: end Initialization;
902:
903: /**
1193: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Exiting Initialization API');
1194:
1195: exception
1196: when others then
1197: wf_core.context ('JTF_UM_WF_APPROVAL', 'SelectorApprover', itemtype,
1198: itemkey, to_char (actid), funcmode);
1199: raise;
1200: end SelectApprover;
1201:
1295: x_itemtype || ',' || x_itemkey || ') API');
1296:
1297: -- check input parameter
1298: if (x_itemtype is null) then
1299: raise_application_error (-20000, 'itemtype is null when calling JTF_UM_WF_APPROVAL.GetApprover');
1300: end if;
1301:
1302: if (x_itemkey is null) then
1303: raise_application_error (-20000, 'itemkey is null when calling JTF_UM_WF_APPROVAL.GetApprover');
1299: raise_application_error (-20000, 'itemtype is null when calling JTF_UM_WF_APPROVAL.GetApprover');
1300: end if;
1301:
1302: if (x_itemkey is null) then
1303: raise_application_error (-20000, 'itemkey is null when calling JTF_UM_WF_APPROVAL.GetApprover');
1304: end if;
1305:
1306: x_resultType := 'OK';
1307: -- Get the APPROVER_ID and APPROVAL_ID
1386: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Exiting GetApprover API');
1387:
1388: exception
1389: when others then
1390: wf_core.context ('JTF_UM_WF_APPROVAL', 'GetApprover', x_itemtype, x_itemkey);
1391: raise;
1392: end GetApprover;
1393:
1394: --
1448: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Exiting SelectRequestType API');
1449:
1450: exception
1451: when others then
1452: wf_core.context ('JTF_UM_WF_APPROVAL', 'SelectRequestType', itemtype, itemkey, to_char (actid), funcmode);
1453: raise;
1454: end SelectRequestType;
1455:
1456: --
1486: p_itemtype || ',' || p_itemkey || ') API');
1487:
1488: -- check input parameter
1489: if (p_itemtype is null) then
1490: raise_application_error (-20000, 'itemtype is null when calling JTF_UM_WF_APPROVAL.cancel_notification');
1491: end if;
1492:
1493: if (p_itemkey is null) then
1494: raise_application_error (-20000, 'itemkey is null when calling JTF_UM_WF_APPROVAL.cancel_notification');
1490: raise_application_error (-20000, 'itemtype is null when calling JTF_UM_WF_APPROVAL.cancel_notification');
1491: end if;
1492:
1493: if (p_itemkey is null) then
1494: raise_application_error (-20000, 'itemkey is null when calling JTF_UM_WF_APPROVAL.cancel_notification');
1495: end if;
1496:
1497: -- Need to end all open notifications.
1498: open getNotificationID;
1593: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Exiting initialize_fail_escalate API');
1594:
1595: exception
1596: when others then
1597: wf_core.context ('JTF_UM_WF_APPROVAL', 'initialize_fail_escalate', itemtype, itemkey, to_char (actid), funcmode);
1598: raise;
1599: end initialize_fail_escalate;
1600:
1601: --
1663: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Exiting WaitForApproval API');
1664:
1665: exception
1666: when others then
1667: wf_core.context ('JTF_UM_WF_APPROVAL', 'WaitForApproval', itemtype, itemkey, to_char (actid), funcmode);
1668: raise;
1669: end WaitForApproval;
1670:
1671: --
1776: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Exiting post_notification API');
1777:
1778: exception
1779: when others then
1780: wf_core.context ('JTF_UM_WF_APPROVAL', 'post_notification', itemtype, itemkey, to_char (actid), funcmode);
1781: raise;
1782: end post_notification;
1783:
1784: --
1845: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Exiting store_delegate_flag API');
1846:
1847: exception
1848: when others then
1849: -- wf_core.context ('JTF_UM_WF_APPROVAL', 'store_delegate_flag', itemtype, itemkey, to_char (actid), funcmode);
1850: raise;
1851:
1852: end store_delegate_flag;
1853:
1910: itemtype || ',' || itemkey || ') API');
1911:
1912:
1913: if itemtype is null then
1914: raise_application_error (-20000, 'itemtype is null while calling JTF_UM_WF_APPROVAL.Do_Approve_Req.');
1915: end if;
1916:
1917: if itemkey is null then
1918: raise_application_error (-20000, 'itemkey is null while calling JTF_UM_WF_APPROVAL.Do_Approve_Req.');
1914: raise_application_error (-20000, 'itemtype is null while calling JTF_UM_WF_APPROVAL.Do_Approve_Req.');
1915: end if;
1916:
1917: if itemkey is null then
1918: raise_application_error (-20000, 'itemkey is null while calling JTF_UM_WF_APPROVAL.Do_Approve_Req.');
1919: end if;
1920:
1921: requesterUserID := wf_engine.GetItemAttrNumber (
1922: itemtype => itemtype,
2068: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Exiting Approve_Req API');
2069:
2070: exception
2071: when others then
2072: wf_core.context ('JTF_UM_WF_APPROVAL', 'Approve_Req', itemtype, itemkey, to_char(actid), funcmode);
2073: raise;
2074: end Approve_Req;
2075:
2076: --
2292: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Exiting Reject_Req API');
2293:
2294: exception
2295: when others then
2296: wf_core.context ('JTF_UM_WF_APPROVAL', 'Reject_Req', itemtype, itemkey, to_char(actid), funcmode);
2297: raise;
2298: end Reject_Req;
2299:
2300: --
2384: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Exiting Can_Delegate API');
2385:
2386: exception
2387: when others then
2388: wf_core.context ('JTF_UM_WF_APPROVAL', 'Can_Delegate', itemtype, itemkey, to_char (actid), funcmode, 'l_approver_userID='||to_char (l_approver_userID));
2389: raise;
2390: end Can_Delegate;
2391:
2392: --
2460: p_message => l_procedure_name);
2461:
2462: exception
2463: when others then
2464: wf_core.context ('JTF_UM_WF_APPROVAL', 'CAN_ENROLLMENT_DELEGATE', itemtype, itemkey, to_char (actid), funcmode);
2465: raise;
2466: end can_enrollment_delegate;
2467:
2468: --
2555: p_message => l_procedure_name);
2556:
2557: exception
2558: when others then
2559: wf_core.context ('JTF_UM_WF_APPROVAL', l_procedure_name, itemtype, itemkey, to_char (actid), funcmode);
2560: raise;
2561: end universal_approvers_exists;
2562:
2563: --
2667: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Exiting CHECK_EMAIL_NOTIFI_TYPE API');
2668:
2669: exception
2670: when MISSING_USERTYPE_INFO then
2671: wf_core.context ('JTF_UM_WF_APPROVAL', 'CHECK_EMAIL_NOTIFI_TYPE', itemtype, itemkey, to_char (actid), funcmode, 'Usertype info is missing');
2672: raise;
2673: when others then
2674: wf_core.context ('JTF_UM_WF_APPROVAL', 'CHECK_EMAIL_NOTIFI_TYPE', itemtype, itemkey, to_char (actid), funcmode);
2675: raise;
2670: when MISSING_USERTYPE_INFO then
2671: wf_core.context ('JTF_UM_WF_APPROVAL', 'CHECK_EMAIL_NOTIFI_TYPE', itemtype, itemkey, to_char (actid), funcmode, 'Usertype info is missing');
2672: raise;
2673: when others then
2674: wf_core.context ('JTF_UM_WF_APPROVAL', 'CHECK_EMAIL_NOTIFI_TYPE', itemtype, itemkey, to_char (actid), funcmode);
2675: raise;
2676: end CHECK_EMAIL_NOTIFI_TYPE;
2677:
2678: --
2741: approverComment || ') API');
2742:
2743: -- check on the input
2744: if itemtype is null then
2745: raise_application_error (-20000, 'itemtype is null while calling JTF_UM_WF_APPROVAL.CompleteApprovalActivity.');
2746: end if;
2747:
2748: if itemkey is null then
2749: raise_application_error (-20000, 'itemkey is null while calling JTF_UM_WF_APPROVAL.CompleteApprovalActivity.');
2745: raise_application_error (-20000, 'itemtype is null while calling JTF_UM_WF_APPROVAL.CompleteApprovalActivity.');
2746: end if;
2747:
2748: if itemkey is null then
2749: raise_application_error (-20000, 'itemkey is null while calling JTF_UM_WF_APPROVAL.CompleteApprovalActivity.');
2750: end if;
2751:
2752: if resultCode is null then
2753: raise_application_error (-20000, 'resultCode is null while calling JTF_UM_WF_APPROVAL.CompleteApprovalActivity.');
2749: raise_application_error (-20000, 'itemkey is null while calling JTF_UM_WF_APPROVAL.CompleteApprovalActivity.');
2750: end if;
2751:
2752: if resultCode is null then
2753: raise_application_error (-20000, 'resultCode is null while calling JTF_UM_WF_APPROVAL.CompleteApprovalActivity.');
2754: end if;
2755:
2756: -- Check Request type
2757: request_type := wf_engine.GetItemAttrText (
2840: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Exiting CompleteApprovalActivity API');
2841:
2842: exception
2843: when UNKNOWN_REQUEST_TYPE then
2844: wf_core.context ('JTF_UM_WF_APPROVAL', 'CompleteApprovalActivity',
2845: itemtype, itemkey, resultCode, approverComment);
2846: raise;
2847: when others then
2848: wf_core.context ('JTF_UM_WF_APPROVAL', 'CompleteApprovalActivity', itemtype, itemkey, resultCode, approverComment);
2844: wf_core.context ('JTF_UM_WF_APPROVAL', 'CompleteApprovalActivity',
2845: itemtype, itemkey, resultCode, approverComment);
2846: raise;
2847: when others then
2848: wf_core.context ('JTF_UM_WF_APPROVAL', 'CompleteApprovalActivity', itemtype, itemkey, resultCode, approverComment);
2849: raise;
2850:
2851: end CompleteApprovalActivity;
2852:
3069: wf_engine.CompleteActivity (p_itemtype, p_itemkey, act, wf_resultCode);
3070:
3071: else
3072:
3073: raise_application_error (-20000, 'No Activity Found Failed at JTF_UM_WF_APPROVAL.Do_Complete_Approval_Activity ('
3074: ||p_itemtype||','||p_itemkey||','||p_resultCode||','||p_approverComment
3075: ||','||p_act1||','||p_act2||','||p_act3||','||p_act4||','||p_act5||','||
3076: p_act6||','||p_act7||','||p_act8||')');
3077:
3102: JTF_DEBUG_PUB.LOG_DEBUG (2, G_MODULE, 'Entering abort_process (' ||
3103: p_itemtype || ',' || p_itemkey || ') API');
3104:
3105: if p_itemtype is null then
3106: raise_application_error (-20000, 'itemtype is null while calling JTF_UM_WF_APPROVAL.abort_process.');
3107: end if;
3108:
3109: if p_itemtype is null then
3110: raise_application_error (-20000, 'itemkey is null while calling JTF_UM_WF_APPROVAL.abort_process.');
3106: raise_application_error (-20000, 'itemtype is null while calling JTF_UM_WF_APPROVAL.abort_process.');
3107: end if;
3108:
3109: if p_itemtype is null then
3110: raise_application_error (-20000, 'itemkey is null while calling JTF_UM_WF_APPROVAL.abort_process.');
3111: end if;
3112:
3113: wf_engine.ItemStatus (p_itemtype, p_itemkey, status, result);
3114: if (status <> 'COMPLETE') then
3653:
3654: end get_approver_comment;
3655:
3656:
3657: end JTF_UM_WF_APPROVAL;