1 PACKAGE AS_LEAD_ROUTING_WF AS
2 /* $Header: asxldrts.pls 120.0 2005/06/02 17:16:38 appldev noship $ */
3
4 /*-------------------------------------------------------------------------*
5 |
6 | PRIVATE DATATYPES
7 |
8 *-------------------------------------------------------------------------*/
9 TYPE NUMBER_TABLE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
10 TYPE FLAG_TABLE IS TABLE OF VARCHAR2(1) INDEX BY BINARY_INTEGER;
11
12 TYPE Resource_Record_type IS RECORD
13 (
14 RESOURCE_ID NUMBER,
15 GROUP_ID NUMBER,
16 WORKLOAD NUMBER
17 );
18
19 G_MISS_LEAD_RESOURCE_REC Resource_Record_type;
20
21 TYPE available_resource_table IS TABLE OF Resource_record_type
22 INDEX BY BINARY_INTEGER;
23
24 G_AVAILABLE_RESOURCE_TABLE available_resource_table;
25
26 /*-------------------------------------------------------------------------*
27 |
28 | PUBLIC APIS
29 |
30 *-------------------------------------------------------------------------*/
31 -- PROCEDURE StartProcess
32 --
33 -- DESCRIPTION Procedure is called to start the structured inbound workflow
34 -- process. Assigns attributes such as message ID, message size, sender name,
35 -- domain name, user id , pwd and priority. Creates and kicks of the workflow.
36 --
37 -- IN
38 -- sales_lead_id - unique identifier of the sales_lead.
39 -- OUT
40 --
41 -- None
42
43 PROCEDURE StartProcess(
44 p_sales_lead_id IN NUMBER,
45 p_salesgroup_id IN NUMBER,
46 p_reject_reason_code IN VARCHAR2 := NULL,
47 x_return_status IN OUT NOCOPY VARCHAR2,
48 x_item_type OUT NOCOPY VARCHAR2,
49 x_item_key OUT NOCOPY VARCHAR2
50 ) ;
51
52 -- PROCEDURE GetAvailableResource
53 --
54 -- DESCRIPTION Retrieves available resources to work on lead.
55 --
56 -- IN
57 -- itemtype - type of the current item
58 -- itemkey - key of the current item
59 -- actid - process activity instance id
60 -- funcmode - function execution mode. Set by the engine as either 'RUN',
61 -- 'CANCEL', or 'TIMEOUT'
62 -- OUT
63 -- result
64 -- - COMPLETE[:<result>]
65 -- activity has completed with the indicated result
66 -- - WAITING
67 -- activity is waiting for additional transitions
68 -- - DEFERED
69 -- execution should be defered to background
70 -- - NOTIFIED[:<notification_id>:<assigned_user>]
71 -- activity has notified an external entity that this
72 -- step must be performed. A call to wf_engine.CompleteActivty
73 -- will signal when this step is complete. Optional
74 -- return of notification ID and assigned user.
75 -- - ERROR[:<error_code>]
76 -- function encountered an error.
77 -- None
78
79 PROCEDURE GetAvailableResource (
80 itemtype IN VARCHAR2,
81 itemkey IN VARCHAR2,
82 actid IN NUMBER,
83 funcmode IN VARCHAR2,
84 result OUT NOCOPY VARCHAR2 );
85
86
87 -- PROCEDURE GetAvailableResources
88 --
89 -- DESCRIPTION Retrieves available resources to work on lead.
90 --
91 -- IN
92 -- itemtype - type of the current item
93 -- itemkey - key of the current item
94 -- actid - process activity instance id
95 -- funcmode - function execution mode. Set by the engine as either 'RUN',
96 -- 'CANCEL', or 'TIMEOUT'
97 -- OUT
98 -- result
99 -- - COMPLETE[:<result>]
100 -- activity has completed with the indicated result
101 -- - WAITING
102 -- activity is waiting for additional transitions
103 -- - DEFERED
104 -- execution should be defered to background
105 -- - NOTIFIED[:<notification_id>:<assigned_user>]
106 -- activity has notified an external entity that this
107 -- step must be performed. A call to wf_engine.CompleteActivty
108 -- will signal when this step is complete. Optional
109 -- return of notification ID and assigned user.
110 -- - ERROR[:<error_code>]
111 -- function encountered an error.
112 -- None
113
114 PROCEDURE GetAvailableResources (
115 itemtype IN VARCHAR2,
116 itemkey IN VARCHAR2,
117 actid IN NUMBER,
118 funcmode IN VARCHAR2,
119 result OUT NOCOPY VARCHAR2 );
120
121
122 -- PROCEDURE GetOwner
123 --
124 -- DESCRIPTION Decide the owner of sales lead
125 --
126 -- IN
127 -- itemtype - type of the current item
128 -- itemkey - key of the current item
129 -- actid - process activity instance id
130 -- funcmode - function execution mode. Set by the engine as either 'RUN',
131 -- 'CANCEL', or 'TIMEOUT'
132 -- OUT
133 -- result
134 -- - COMPLETE[:<result>]
135 -- activity has completed with the indicated result
136 -- - WAITING
137 -- activity is waiting for additional transitions
138 -- - DEFERED
139 -- execution should be defered to background
140 -- - NOTIFIED[:<notification_id>:<assigned_user>]
141 -- activity has notified an external entity that this
142 -- step must be performed. A call to wf_engine.CompleteActivty
143 -- will signal when this step is complete. Optional
144 -- return of notification ID and assigned user.
145 -- - ERROR[:<error_code>]
146 -- function encountered an error.
147 -- None
148
149 PROCEDURE GetOwner(
150 itemtype IN VARCHAR2,
151 itemkey IN VARCHAR2,
152 actid IN NUMBER,
153 funcmode IN VARCHAR2,
154 result OUT NOCOPY VARCHAR2 );
155
156
157 -- PROCEDURE GetResourceWorkload
158 --
159 -- DESCRIPTION Retrieves current workload for each resource
160 --
161 -- IN
162 -- itemtype - type of the current item
163 -- itemkey - key of the current item
164 -- actid - process activity instance id
165 -- funcmode - function execution mode. Set by the engine as either 'RUN',
166 -- 'CANCEL', or 'TIMEOUT'
167 -- OUT
168 -- result
169 -- - COMPLETE[:<result>]
170 -- activity has completed with the indicated result
171 -- - WAITING
172 -- activity is waiting for additional transitions
173 -- - DEFERED
174 -- execution should be defered to background
175 -- - NOTIFIED[:<notification_id>:<assigned_user>]
176 -- activity has notified an external entity that this
177 -- step must be performed. A call to wf_engine.CompleteActivty
178 -- will signal when this step is complete. Optional
179 -- return of notification ID and assigned user.
180 -- - ERROR[:<error_code>]
181 -- function encountered an error.
182 -- None
183
184 PROCEDURE GetResourceWorkload (
185 itemtype in VARCHAR2,
186 itemkey in VARCHAR2,
187 actid in NUMBER,
188 funcmode in VARCHAR2,
189 result OUT NOCOPY VARCHAR2 );
190
191
192 -- PROCEDURE BalanceWorkload
193 --
194 -- DESCRIPTION Selects resource based on balanced workload
195 --
196 -- IN
197 -- itemtype - type of the current item
198 -- itemkey - key of the current item
199 -- actid - process activity instance id
200 -- funcmode - function execution mode. Set by the engine as either 'RUN',
201 -- 'CANCEL', or 'TIMEOUT'
202 -- OUT
203 -- result
204 -- - COMPLETE[:<result>]
205 -- activity has completed with the indicated result
206 -- - WAITING
207 -- activity is waiting for additional transitions
208 -- - DEFERED
209 -- execution should be defered to background
210 -- - NOTIFIED[:<notification_id>:<assigned_user>]
211 -- activity has notified an external entity that this
212 -- step must be performed. A call to wf_engine.CompleteActivty
213 -- will signal when this step is complete. Optional
214 -- return of notification ID and assigned user.
215 -- - ERROR[:<error_code>]
216 -- function encountered an error.
217 -- None
218
219 PROCEDURE BalanceWorkload (
220 itemtype in VARCHAR2,
221 itemkey in VARCHAR2,
222 actid in NUMBER,
223 funcmode in VARCHAR2,
224 result OUT NOCOPY VARCHAR2 );
225
226
227 -- PROCEDURE UpdateSalesLeads
228 --
229 -- DESCRIPTION Use Sales Lead APIs to update sales leads
230 --
231 -- IN
232 -- itemtype - type of the current item
233 -- itemkey - key of the current item
234 -- actid - process activity instance id
235 -- funcmode - function execution mode. Set by the engine as either 'RUN',
236 -- 'CANCEL', or 'TIMEOUT'
237 -- OUT
238 -- result
239 -- - COMPLETE[:<result>]
240 -- activity has completed with the indicated result
241 -- - WAITING
242 -- activity is waiting for additional transitions
243 -- - DEFERED
244 -- execution should be defered to background
245 -- - NOTIFIED[:<notification_id>:<assigned_user>]
246 -- activity has notified an external entity that this
247 -- step must be performed. A call to wf_engine.CompleteActivty
248 -- will signal when this step is complete. Optional
249 -- return of notification ID and assigned user.
250 -- - ERROR[:<error_code>]
251 -- function encountered an error.
252 -- None
253
254 PROCEDURE UpdateSalesLeads (
255 itemtype IN VARCHAR2,
256 itemkey IN VARCHAR2,
257 actid IN NUMBER,
258 funcmode IN VARCHAR2,
259 result OUT NOCOPY VARCHAR2 );
260
261
262 -- PROCEDURE EscalatetoManager
263 --
264 -- DESCRIPTION If a resource is not found, escalate to the manager
265 --
266 -- IN
267 -- itemtype - type of the current item
268 -- itemkey - key of the current item
269 -- actid - process activity instance id
270 -- funcmode - function execution mode. Set by the engine as either 'RUN', 'CANCEL', or 'TIMEOUT'
271 -- OUT
272 -- result
273 -- - COMPLETE[:<result>]
274 -- activity has completed with the indicated result
275 -- - WAITING
276 -- activity is waiting for additional transitions
277 -- - DEFERED
278 -- execution should be defered to background
279 -- - NOTIFIED[:<notification_id>:<assigned_user>]
280 -- activity has notified an external entity that this
281 -- step must be performed. A call to wf_engine.CompleteActivty
282 -- will signal when this step is complete. Optional
283 -- return of notification ID and assigned user.
284 -- - ERROR[:<error_code>]
285 -- function encountered an error.
286 -- None
287
288 PROCEDURE EscalatetoManager (
289 itemtype in VARCHAR2,
290 itemkey in VARCHAR2,
291 actid in NUMBER,
292 funcmode in VARCHAR2,
293 result OUT NOCOPY VARCHAR2 );
294
295
296 END AS_LEAD_ROUTING_WF ;
297