[Home] [Help]
PACKAGE BODY: APPS.AP_WEB_EXPORT_WF
Source
1 PACKAGE BODY AP_WEB_EXPORT_WF AS
2 /* $Header: apwexpwb.pls 120.0 2005/06/09 20:26:36 rlangi noship $ */
3
4 ------------------------
5 -- Events
6 ------------------------
7 -- Event key is used for item key
8 -- Event name is the true event name
9 -- Item/Event key is in the form of: '<Event key>:<DD-MON-RRRR HH:MI:SS>'
10 C_REJECTION_EVENT_KEY CONSTANT VARCHAR2(30) := 'export.rejection';
11 C_REJECTION_EVENT_NAME CONSTANT VARCHAR2(80) := 'oracle.apps.ap.oie.export.rejection';
12 C_REJECTION_PROCESS CONSTANT VARCHAR2(80) := 'REJECTIONS_PROCESS';
13
14 -- Item Key Delimeter
15 C_ITEM_KEY_DELIM CONSTANT VARCHAR2(1) := ':';
16
17
18 ------------------------------------------------------------------------
19 FUNCTION GenerateEventKey(
20 p_request_id IN NUMBER) RETURN VARCHAR2 IS
21 ------------------------------------------------------------------------
22 l_debug_info VARCHAR2(200);
23
24 l_timestamp varchar2(30);
25 BEGIN
26
27 select to_char(sysdate, 'DD-MON-RRRR HH:MI:SS')
28 into l_timestamp
29 from dual;
30
31 return C_REJECTION_EVENT_KEY||C_ITEM_KEY_DELIM||p_request_id||C_ITEM_KEY_DELIM||l_timestamp;
32
33 END GenerateEventKey;
34
35
36 ------------------------------------------------------------------------
37 PROCEDURE RaiseRejectionEvent(
38 p_request_id IN NUMBER,
39 p_role IN VARCHAR2) IS
40 ------------------------------------------------------------------------
41 l_debug_info VARCHAR2(200);
42
43
44 --l_parameter_list wf_parameter_list_t;
45 l_item_type wf_items.item_type%type := C_APWEXPRT;
46 l_item_key wf_items.item_key%type;
47
48 BEGIN
49
50 AP_WEB_UTILITIES_PKG.logProcedure('AP_WEB_EXPORT_WF', 'start RaiseRejectionEvent');
51
52 /*
53
54 Product teams WF BES events have been removed due to ATG R12 mandate
55
56 ----------------------------------------------------------
57 l_debug_info := 'Rejection Parameter List';
58 ----------------------------------------------------------
59 l_parameter_list := wf_parameter_list_t(
60 wf_parameter_t('REQUEST_ID', to_char(p_request_id)),
61 wf_parameter_t('REJECTIONS_ROLE', p_role));
62
63 ----------------------------------------------------------
64 l_debug_info := 'Raise Rejection Event';
65 ----------------------------------------------------------
66 wf_event.raise(p_event_name => C_REJECTION_EVENT_NAME,
67 p_event_key => GenerateEventKey(p_request_id),
68 p_parameters => l_parameter_list);
69 */
70
71
72 ----------------------------------------------------------
73 l_debug_info := 'Create Rejection Process';
74 ----------------------------------------------------------
75 l_item_key := GenerateEventKey(p_request_id);
76
77 WF_ENGINE.CreateProcess(l_item_type,
78 l_item_key,
79 C_REJECTION_PROCESS);
80
81 ----------------------------------------------------------
82 l_debug_info := 'Set Rejection Process Attr REQUEST_ID';
83 ----------------------------------------------------------
84 WF_ENGINE.SetItemAttrNumber(l_item_type,
85 l_item_key,
86 'REQUEST_ID',
87 p_request_id);
88
89 ----------------------------------------------------------
90 l_debug_info := 'Set Rejection Process Attr REJECTIONS_ROLE';
91 ----------------------------------------------------------
92 WF_ENGINE.SetItemAttrText(l_item_type,
93 l_item_key,
94 'REJECTIONS_ROLE',
95 p_role);
96
97 ----------------------------------------------------------
98 l_debug_info := 'Set the Requester as the Owner of Workflow Process.';
99 ----------------------------------------------------------
100 WF_ENGINE.SetItemOwner(l_item_type,
101 l_item_key,
102 p_role);
103
104
105 ----------------------------------------------------------
106 l_debug_info := 'Set Item User Key to Request Id for easier query ';
107 ----------------------------------------------------------
108 WF_ENGINE.SetItemUserKey(l_item_type,
109 l_item_key,
110 p_request_id);
111
112 ----------------------------------------------------------
113 l_debug_info := 'Start Rejection Process';
114 ----------------------------------------------------------
115 WF_ENGINE.StartProcess(l_item_type,
116 l_item_key);
117
118 AP_WEB_UTILITIES_PKG.logProcedure('AP_WEB_EXPORT_WF', 'end RaiseRejectionEvent');
119
120 EXCEPTION
121 WHEN OTHERS THEN
122 Wf_Core.Context('AP_WEB_EXPORT_WF', 'RaiseRejectionEvent',
123 l_debug_info);
124 raise;
125 END RaiseRejectionEvent;
126
127
128 END AP_WEB_EXPORT_WF;