[Home] [Help]
PACKAGE BODY: APPS.ECX_STANDARD
Source
1 package body ECX_STANDARD as
2 -- $Header: ECXWACTB.pls 120.15.12020000.2 2013/03/21 11:25:35 jmaddila ship $
3
4 /** bug 3357213 */
5 /**
6 * Other errors
7 */
8 PROCESSOR_ERR CONSTANT NUMBER := -20100;
9 NULL_ERR CONSTANT NUMBER := -20103;
10 G_PKG_NAME CONSTANT VARCHAR2(15):= 'ECX_STANDARD';
11 /** bug 3357213 */
12
13 MAX_JAVA_MEMORY CONSTANT NUMBER := 1 * 1024 * 1024 *1024; -- bug 6889689
14
15
16 -- Bug 8556635. Redefine setMaxJavaMemorySize
17 procedure setMaxJavaMemorySize(num number)
18 is language java name
19 'oracle.aurora.vm.OracleRuntime.setMaxMemorySize(int) ';
20
21
22
23 procedure addItemAttributes
24 (
25 itemtype in varchar2,
26 itemkey in varchar2
27 )
28 is
29 begin
30 begin
31 wf_engine.SetItemAttrNumber(itemtype,itemkey,'ECX_ERROR_TYPE',ecx_utils.error_type);
32 exception
33 when others then
34
35 -- If item attribute does not exist then create it;
36
37 if ( wf_core.error_name = 'WFENG_ITEM_ATTR' ) then
38 wf_engine.AddItemAttr(itemtype,itemkey,'ECX_ERROR_TYPE',null,ecx_utils.error_type,null);
39 else
40 raise;
41 end if;
42 end;
43
44 begin
45 wf_engine.SetItemAttrText(itemtype,itemkey,'ECX_LOG_FILE',ecx_utils.g_logfile);
46 exception
47 when others then
48
49 -- If item attribute does not exist then create it;
50
51 if ( wf_core.error_name = 'WFENG_ITEM_ATTR' ) then
52 wf_engine.AddItemAttr(itemtype,itemkey,'ECX_LOG_FILE',ecx_utils.g_logfile,null,null);
53 else
54 raise;
55 end if;
56 end;
57 exception
58 when others then
59 raise;
60 end addItemAttributes;
61
62 procedure prepareWS(itemtype in VARCHAR2,
63 itemkey in VARCHAR2,
64 actid in NUMBER,
65 p_event in out nocopy WF_EVENT_T)
66 is
67
68 i_ws_soapaction VARCHAR2(240) := NULL;
69 i_ws_svc_namespace VARCHAR2(240) := NULL;
70 i_ws_port_operation VARCHAR2(240) := NULL;
71 i_ws_hdr_impl_class VARCHAR2(240) := NULL;
72 i_ws_res_impl_class VARCHAR2(240) := NULL;
73 i_ws_consumer VARCHAR2(240) := NULL;
74 i_parameterList WF_PARAMETER_LIST_T := NULL;
75
76 begin
77
78 if (p_event is not null) then
79 i_parameterList := wf_event_t.getParameterList(p_event);
80
81 -- Retrieve or default Web Services related event parameters if exists
82 i_ws_soapaction := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'SOAPACTION', true);
83 if (i_ws_soapaction is null) then
84 i_ws_soapaction := Wf_Engine.GetItemAttrText(itemtype, itemkey, 'SOAPACTION', true);
85 if (i_ws_soapaction is null) and (i_parameterList is not null) then
86 i_ws_soapaction := wf_event.getValueForParameter('SOAPACTION', i_parameterList);
87 end if;
88 end if;
89 if (i_ws_soapaction is null) then
90 i_ws_soapaction := ' '; -- defaulting
91 end if;
92
93 i_ws_svc_namespace := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'WS_SERVICE_NAMESPACE', true);
94 if (i_ws_svc_namespace is null) then
95 i_ws_svc_namespace := Wf_Engine.GetItemAttrText(itemtype, itemkey, 'WS_SERVICE_NAMESPACE', true);
96 if (i_ws_svc_namespace is null) and (i_parameterList is not null) then
97 i_ws_svc_namespace := wf_event.getValueForParameter('WS_SERVICE_NAMESPACE', i_parameterList);
98 end if;
99 end if;
100 if (i_ws_svc_namespace is null) then
101 i_ws_svc_namespace := 'http://xmlns.oracle.com/apps/fnd/XMLGateway'; -- defaulting
102 end if;
103
104 i_ws_port_operation := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'WS_PORT_OPERATION', true);
105 if (i_ws_port_operation is null) then
106 i_ws_port_operation := Wf_Engine.GetItemAttrText(itemtype, itemkey, 'WS_PORT_OPERATION', true);
107 if (i_ws_port_operation is null) and (i_parameterList is not null) then
108 i_ws_port_operation := wf_event.getValueForParameter('WS_PORT_OPERATION', i_parameterList);
109 end if;
110 end if;
111 if (i_ws_port_operation is null) then
112 i_ws_port_operation := 'ReceiveDocument'; -- defaulting
113 end if;
114
115 i_ws_hdr_impl_class := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'WS_HEADER_IMPL_CLASS', true);
116 if (i_ws_hdr_impl_class is null) then
117 i_ws_hdr_impl_class := Wf_Engine.GetItemAttrText(itemtype, itemkey, 'WS_HEADER_IMPL_CLASS', true);
118 if (i_ws_hdr_impl_class is null) and (i_parameterList is not null) then
119 i_ws_hdr_impl_class := wf_event.getValueForParameter('WS_HEADER_IMPL_CLASS', i_parameterList);
120 end if;
121 end if;
122 if (i_ws_hdr_impl_class is null) then
123 i_ws_hdr_impl_class := 'oracle.apps.fnd.wf.ws.client.DefaultHeaderGenerator'; -- defaulting
124 end if;
125
126 i_ws_res_impl_class := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'WS_RESPONSE_IMPL_CLASS', true);
127 if (i_ws_res_impl_class is null) then
128 i_ws_res_impl_class := Wf_Engine.GetItemAttrText(itemtype, itemkey, 'WS_RESPONSE_IMPL_CLASS', true);
129 if (i_ws_res_impl_class is null) and (i_parameterList is not null) then
130 i_ws_res_impl_class := wf_event.getValueForParameter('WS_RESPONSE_IMPL_CLASS', i_parameterList);
131 end if;
132 end if;
133 if (i_ws_res_impl_class is null) then
134 i_ws_res_impl_class := 'oracle.apps.fnd.wf.ws.client.WfWsResponse'; -- defaulting
135 end if;
136
137 i_ws_consumer := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'WS_CONSUMER', true);
138 if (i_ws_consumer is null) then
139 i_ws_consumer := Wf_Engine.GetItemAttrText(itemtype, itemkey, 'WS_CONSUMER', true);
140 if (i_ws_consumer is null) and (i_parameterList is not null) then
141 i_ws_consumer := wf_event.getValueForParameter('WS_CONSUMER', i_parameterList);
142 end if;
143 end if;
144 if (i_ws_consumer is null) then
145 i_ws_consumer := 'ecx'; -- defaulting
146 end if;
147
148 -- add these properties to p_event
149 p_event.addParameterToList('SOAPACTION', i_ws_soapaction);
150 p_event.addParameterToList('WS_SERVICE_NAMESPACE', i_ws_svc_namespace);
151 p_event.addParameterToList('WS_PORT_OPERATION', i_ws_port_operation);
152 p_event.addParameterToList('WS_HEADER_IMPL_CLASS', i_ws_hdr_impl_class);
153 p_event.addParameterToList('WS_RESPONSE_IMPL_CLASS', i_ws_res_impl_class);
154 p_event.addParameterToList('WS_CONSUMER', i_ws_consumer);
155
156 end if;
157
158 exception
159 when others then
160 raise;
161 end prepareWS;
162
163
164 procedure XMLtoXMLCover
165 (
166 i_map_code IN varchar2,
167 i_inpayload IN CLOB,
168 i_outpayload OUT NOCOPY CLOB,
169 i_debug_level IN pls_integer
170 )
171 is
172 retcode pls_integer;
173 errmsg varchar2(2000);
174 logfile varchar2(200);
175 g_instlmode varchar2(100);
176 begin
177 ecx_inbound_trig.ProcessXML
178 (
179 i_map_code,
180 i_inpayload,
181 i_debug_level,
182 retcode,
183 errmsg,
184 logfile,
185 i_outpayload
186 );
187
188 if retcode = 0
189 then
190 return;
191 elsif retcode = 1
192 then
193 g_instlmode := wf_core.translate('WF_INSTALL');
194 IF g_instlmode = 'EMBEDDED'
195 THEN
196 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
197 ecx_utils.i_errparams));
198 wf_core.token('ECX_LOGFILE',logfile);
199 wf_core.raise('ECX_PROCESS_XMLERROR_EMBD');
200 ELSE
201 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
202 ecx_utils.i_errparams));
203 wf_core.token('ECX_LOGFILE',logfile);
204 wf_core.raise('ECX_PROCESS_XMLERROR');
205 END IF;
206 else
207 g_instlmode := wf_core.translate('WF_INSTALL');
208 IF g_instlmode = 'EMBEDDED'
209 THEN
210 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
211 ecx_utils.i_errparams));
212 wf_core.token('ECX_LOGFILE',logfile);
213 wf_core.raise('ECX_PROGRAM_EXIT_EMBD');
214 ELSE
215 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
216 ecx_utils.i_errparams));
217 wf_core.token('ECX_LOGFILE',logfile);
218 wf_core.raise('ECX_PROGRAM_EXIT');
219 END IF;
220 end if;
221 exception
222 when others then
223 wf_core.context('ECX_STANDARD','XMLtoXMLCover',i_map_code,i_debug_level);
224 raise;
225 end XMLtoXMLCover;
226
227 procedure processXMLCover
228 (
229 i_map_code IN varchar2,
230 i_inpayload IN CLOB,
231 i_debug_level IN pls_integer
232 )
233 is
234 retcode pls_integer;
235 errmsg varchar2(2000);
236 logfile varchar2(200);
237 i_outpayload CLOB;
238 g_instlmode varchar2(100);
239 begin
240 ecx_inbound_trig.ProcessXML
241 (
242 i_map_code,
243 i_inpayload,
244 i_debug_level,
245 retcode,
246 errmsg,
247 logfile,
248 i_outpayload
249 );
250
251 if retcode = 0
252 then
253 return;
254 elsif retcode = 1
255 then
256 g_instlmode := wf_core.translate('WF_INSTALL');
257 IF g_instlmode = 'EMBEDDED'
258 THEN
259 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
260 ecx_utils.i_errparams));
261 wf_core.token('ECX_LOGFILE',logfile);
262 wf_core.raise('ECX_PROCESS_XMLERROR_EMBD');
263 ELSE
264 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
265 ecx_utils.i_errparams));
266 wf_core.token('ECX_LOGFILE',logfile);
267 wf_core.raise('ECX_PROCESS_XMLERROR');
268 END IF;
269 else
270 g_instlmode := wf_core.translate('WF_INSTALL');
271 IF g_instlmode = 'EMBEDDED'
272 THEN
273 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
274 ecx_utils.i_errparams));
275 wf_core.token('ECX_LOGFILE',logfile);
276 wf_core.raise('ECX_PROGRAM_EXIT_EMBD');
277 ELSE
278 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
279 ecx_utils.i_errparams));
280 wf_core.token('ECX_LOGFILE',logfile);
281 wf_core.raise('ECX_PROGRAM_EXIT');
282 END IF;
283 end if;
284 exception
285 when others then
286 wf_core.context('ECX_STANDARD','processXMLCover',i_map_code,i_debug_level);
287 raise;
288 end processXMLCover;
289
290 procedure getXMLCover
291 (
292 i_message_standard IN VARCHAR2 default null,
293 i_transaction_type IN VARCHAR2 default null,
294 i_transaction_subtype IN VARCHAR2 default null,
295 i_tp_type IN VARCHAR2 default null,
296 i_tp_id IN VARCHAR2 default null,
297 i_tp_site_id IN VARCHAR2 default null,
298 i_document_id IN VARCHAR2 default null,
299 i_map_code IN VARCHAR2,
300 i_debug_level IN pls_integer,
301 i_xmldoc IN OUT NOCOPY CLOB,
302 i_message_type IN VARCHAR2 default 'XML'
303 )
304 is
305 retcode pls_integer;
306 errmsg varchar2(2000);
307 logfile varchar2(200);
308 g_instlmode varchar2(100);
309 begin
310 ecx_outbound.getXML
311 (
312 i_message_standard => i_message_standard,
313 i_map_code => i_map_code,
314 i_transaction_type => i_transaction_type,
315 i_transaction_subtype => i_transaction_subtype,
316 i_tp_type => i_tp_type,
317 i_tp_id => i_tp_id,
318 i_tp_site_id => i_tp_site_id,
319 i_document_id => i_document_id,
320 i_debug_level => i_debug_level,
321 i_xmldoc => i_xmldoc,
322 i_ret_code => retcode,
323 i_errbuf => errmsg,
324 i_log_file => logfile,
325 i_message_type => i_message_type
326 );
327 if retcode = 0
328 then
329 return;
330 elsif retcode = 1
331 then
332 g_instlmode := wf_core.translate('WF_INSTALL');
333 IF g_instlmode = 'EMBEDDED'
334 THEN
335 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
336 ecx_utils.i_errparams));
337 wf_core.token('ECX_LOGFILE',logfile);
338 wf_core.raise('ECX_GET_XMLERROR_EMBD');
339 ELSE
340 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
341 ecx_utils.i_errparams));
342 wf_core.token('ECX_LOGFILE',logfile);
343 wf_core.raise('ECX_GET_XMLERROR');
344 END IF;
345 else
346 g_instlmode := wf_core.translate('WF_INSTALL');
347 IF g_instlmode = 'EMBEDDED'
348 THEN
349 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
350 ecx_utils.i_errparams));
351 wf_core.token('ECX_LOGFILE',logfile);
352 wf_core.raise('ECX_PROGRAM_EXIT_EMBD');
353 ELSE
354 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
355 ecx_utils.i_errparams));
356 wf_core.token('ECX_LOGFILE',logfile);
357 wf_core.raise('ECX_PROGRAM_EXIT');
358 END IF;
359 end if;
360 exception
361 when others then
362 wf_core.context('ECX_STANDARD','getXMLCover',i_message_standard,i_transaction_type,i_transaction_subtype);
363 raise;
364 end getXMLCover;
365
366 /** (Synchronous) Send Direct api to avoid racing condition **/
367 procedure sendDirectCover(
368 transaction_type IN VARCHAR2,
369 transaction_subtype IN VARCHAR2,
370 party_id IN VARCHAR2,
371 party_site_id IN VARCHAR2,
372 party_type IN VARCHAR2, --bug #2183619
373 document_id IN VARCHAR2,
374 debug_mode IN PLS_INTEGER,
375 i_msgid OUT NOCOPY RAW
376 )
377 is
378 retcode pls_integer;
379 errmsg varchar2(2000);
380 g_instlmode varchar2(100);
381 begin
382
383 ecx_document.sendDirect
384 (
385 transaction_type => transaction_type,
386 transaction_subtype => transaction_subtype,
387 party_id => party_id,
388 party_site_id => party_site_id,
389 party_type => party_type,--bug #2183619
390 document_id => document_id,
391 debug_mode => debug_mode,
392 i_msgid => i_msgid,
393 retcode => retcode,
394 errmsg => errmsg
395 );
396 if retcode = 0
397 then
398 return;
399 elsif retcode = 1
400 then
401 g_instlmode := wf_core.translate('WF_INSTALL');
402 IF g_instlmode = 'EMBEDDED'
403 THEN
404 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
405 ecx_utils.i_errparams));
406 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
407 wf_core.raise('ECX_SENDDIRECT_ERROR_EMBD');
408 ELSE
409 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
410 ecx_utils.i_errparams));
411 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
412 wf_core.raise('ECX_SENDDIRECT_ERROR');
413 END IF;
414 else
415 g_instlmode := wf_core.translate('WF_INSTALL');
416 IF g_instlmode = 'EMBEDDED'
417 THEN
418 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
419 ecx_utils.i_errparams));
420 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
421 wf_core.raise('ECX_PROGRAM_EXIT_EMBD');
422 ELSE
423 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
424 ecx_utils.i_errparams));
425 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
426 wf_core.raise('ECX_PROGRAM_EXIT');
427 END IF;
428 end if;
429 exception
430 when others then
431 wf_core.context('ECX_STANDARD','sendDirectCover',transaction_type,transaction_subtype);
432 raise;
433 end sendDirectCover;
434
435
436 -- setEventDetails (PUBLIC)
437 -- Standard XML Gateway Raise Event
438 -- IN:
439 -- eventname - Event to be processes
440 -- eventkey - Event key
441 -- parameter1..10 - Event Parameters
442 -- NOTE:
443 -- Called from the XML gateway engine as a post processing action
444 --
445 -- VS - Why only parameters 1.10? Why not the the full 100?
446 -- We will change when the pl/sql has the capability to bind the PL/SQL table as datatype.
447 procedure setEventDetails(
448 eventname in varchar2,
449 eventkey in varchar2,
450 parameter1 in varchar2,
451 parameter2 in varchar2,
452 parameter3 in varchar2,
453 parameter4 in varchar2,
454 parameter5 in varchar2,
455 parameter6 in varchar2,
456 parameter7 in varchar2,
457 parameter8 in varchar2,
458 parameter9 in varchar2,
459 parameter10 in varchar2,
460 retcode OUT NOCOPY pls_integer,
461 retmsg OUT NOCOPY varchar2)
462 is
463 x_from_agt wf_agent_t := wf_agent_t(null,null);
464 x_to_agt wf_agent_t := wf_agent_t(null,null);
465
466 begin
467 wf_event_t.initialize(ecx_utils.g_event);
468 /**
469 Set the Event Data with the passed in parameters,
470 so that the Business Event can be raised.
471 **/
472
473 ecx_utils.g_event.setEventName(ltrim(rtrim(eventName)));
474 ecx_utils.g_event.setEventKey(ltrim(rtrim(eventKey)));
475
476 /**
477 x_from_agt has to be set.
478 In this case, what is the from agent? Inbound engine?!
479 Setting it to null for now.
480 **/
481
482 ecx_utils.g_event.from_agent := x_from_agt ;
483 ecx_utils.g_event.to_agent := x_to_agt ;
484
485 ecx_utils.g_event.addParameterToList('PARAMETER1', parameter1);
486 ecx_utils.g_event.addParameterToList('PARAMETER2', parameter2);
487 ecx_utils.g_event.addParameterToList('PARAMETER3', parameter3);
488 ecx_utils.g_event.addParameterToList('PARAMETER4', parameter4);
489 ecx_utils.g_event.addParameterToList('PARAMETER5', parameter5);
490 ecx_utils.g_event.addParameterToList('PARAMETER6', parameter6);
491 ecx_utils.g_event.addParameterToList('PARAMETER7', parameter7);
492 ecx_utils.g_event.addParameterToList('PARAMETER8', parameter8);
493 ecx_utils.g_event.addParameterToList('PARAMETER9', parameter9);
494 ecx_utils.g_event.addParameterToList('PARAMETER10', parameter10);
495
496 retcode :=0;
497 retmsg := ecx_debug.getTranslatedMessage('ECX_BUSINESS_EVT_SET');
498
499 exception
500 when others then
501 retcode := 2;
502 retmsg := ecx_debug.getTranslatedMessage('ECX_BUSINESS_EVT_SET_ERROR');
503 wf_core.raise('ECX_EVENT_ERROR');
504 end setEventDetails;
505
506
507 -- Generate (PUBLIC)
508 -- Standard XML Gateway to generate event data
509 -- IN:
510 -- p_event_name - Event to be processes
511 -- p_event_key - Event key
512 -- p_parameter_list - parameter list
513 -- OUT
514 -- CLOB - Event data
515 -- NOTE:
516 -- Called from the XML gateway engine as a post processing action
517 --
518 -- KH Comment: Do we need a version of this ofr the A2A case. map_code,doc_id only
519
520 function generate
521 (
522 p_event_name in varchar2,
523 p_event_key in varchar2,
524 p_parameter_list in wf_parameter_list_t
525 ) return CLOB
526 is
527 p_ret_code pls_integer;
528 p_errbuf varchar2(2000);
529 p_xmldoc clob;
530 ecx_getxml exception;
531 transaction_type varchar2(240);
532 transaction_subtype varchar2(240);
533 party_id varchar2(240);
534 party_site_id varchar2(240);
535 document_id varchar2(240);
536 debug_level pls_integer:=0;
537 map_code varchar2(200);
538 begin
539
540
541 -- VS - map_code = event_name WHY...Lets's discuss
542 -- map_code ect. should come from paramter list
543
544 dbms_lob.createtemporary(p_xmldoc,true,dbms_lob.session);
545 map_code := wf_event.getValueForParameter('ECX_MAP_CODE',p_parameter_list);
546 debug_level := wf_event.getValueForParameter('ECX_DEBUG_LEVEL',p_parameter_list);
547 /** Which exception to use here for throwing the Error to BES **/
548 if (map_code is null ) then
549 wf_core.token('MAP_CODE','NULL');
550 wf_core.raise('WFSQL_ARGS');
551 end if;
552
553 /** Everything else is optional set of parameters **/
554 transaction_type := wf_event.getValueForParameter('ECX_TRANSACTION_TYPE',p_parameter_list);
555 transaction_subtype := wf_event.getValueForParameter('ECX_TRANSACTION_SUBTYPE',p_parameter_list);
556 party_id := wf_event.getValueForParameter('ECX_PARTY_ID',p_parameter_list);
557 party_site_id := wf_event.getValueForParameter('ECX_PARTY_SITE_ID',p_parameter_list);
558 document_id := wf_event.getValueForParameter('ECX_DOCUMENT_ID',p_parameter_list);
559
560 if ecx_utils.g_event is null
561 then
562 wf_event_t.initialize(ecx_utils.g_event);
563 end if;
564
565 ecx_utils.g_event.setparameterlist(p_parameter_list);
566
567
568 getXMLCover
569 (
570 i_map_code => map_code,
571 i_transaction_type => transaction_type,
572 i_transaction_subtype => transaction_subtype,
573 i_tp_id => party_id,
574 i_tp_site_id => party_site_id,
575 i_document_id => document_id,
576 i_debug_level => debug_level,
577 i_xmldoc => p_xmldoc
578 );
579
580 -- Removed for time being as the parameters are IN type only.
581 --wf_event.addParameterToList('ECX_ERROR_TYPE', ecx_utils.error_type,p_parameter_list);
582 --wf_event.addParameterToList('ECX_LOG_FILE', ecx_utils.g_logfile,p_parameter_list);
583 --dbms_lob.freetemporary(p_xmldoc);
584 return p_xmldoc;
585 exception
586 when others then
587 wf_core.context('ECX_STANDARD', 'Generate', p_event_name, p_event_key);
588 raise;
589 end Generate;
590
591 -- XMLtoXML
592 -- Standard Workflow Activity XMLtoXML
593 -- Processes a given XML. The Output is an XML /a API call.
594 -- OUT
595 -- result - null
596 -- ACTIVITY ATTRIBUTES REFERENCED
597 -- MAP_CODE - text value (required)
598 -- ECX_EVENT_MESSAGE_IN - event value (required )
599 -- ECX_EVENT_MESSAGE_OUT - event value (optional )
600 -- NOTE:
601
602 procedure XMLtoXML (itemtype in varchar2,
603 itemkey in varchar2,
604 actid in number,
605 funcmode in varchar2,
606 resultout in out NOCOPY varchar2 )
607 is
608 i_debug_level pls_integer;
609 i_map_code varchar2(200);
610 i_outpayload clob;
611 i_log_file varchar2(2000);
612 i_ret_code pls_integer;
613 i_errbuf varchar2(2000);
614 i_inevent wf_event_t;
615 i_outevent wf_event_t;
616 ecx_process_xml exception;
617 i_error_type pls_integer;
618 aname_error_type varchar2(30);
619 aname_log_file varchar2(30);
620 aname varchar2(30);
621 atype varchar2(8);
622 aformat varchar2(240);
623 asubtype varchar2(8);
624 a1name varchar2(30);
625 a1type varchar2(8);
626 a1format varchar2(240);
627 a1subtype varchar2(8);
628
629 begin
630 -- Set the Global itemtype,itemkey and the activity_id
631 ecx_utils.g_item_type := itemtype;
632 ecx_utils.g_item_key := itemkey;
633 ecx_utils.g_activity_id := actid;
634
635 -- Do nothing in cancel or timeout mode
636 if (funcmode <> wf_engine.eng_run) then
637 resultout := wf_engine.eng_null;
638 return;
639 end if;
640
641 -- Get ecx map code
642
643 i_map_code := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_MAP_CODE');
644 if (i_map_code is null ) then
645 wf_core.token('ECX_MAP_CODE','NULL');
646 wf_core.raise('WFSQL_ARGS');
647 end if;
648
649
650
651 i_debug_level := nvl(wf_engine.GetItemAttrText(itemtype,itemkey,'ECX_DEBUG_LEVEL',true),0);
652
653
654 -- Verify that the attr type = EVENT
655
656 i_inevent := Wf_Engine.GetActivityAttrEvent(itemtype, itemkey, actid, 'ECX_EVENT_MESSAGE_IN');
657 if (i_inevent is null ) then
658 wf_core.token('ECX_EVENT_MESSAGE_IN','NULL');
659 wf_core.raise('WFSQL_ARGS');
660 end if;
661
662 aname := wf_engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_EVENT_MESSAGE_OUT');
663 if ( aname is null ) then
664 wf_core.token('ECX_EVENT_MESSAGE_OUT','NULL');
665 wf_core.raise('WFSQL_ARGS');
666 end if;
667
668 --Wf_Engine.GetItemAttrInfo(itemtype, aname ,atype, asubtype, aformat);
669 --if (atype <> 'EVENT' ) then
670 --wf_core.token('VTYPE',atype);
671 --wf_core.raise('WFXXXV_VTYPE');
672 --end if;
673
674 i_outevent := Wf_Engine.GetItemAttrEvent(itemtype, itemkey, aname);
675
676 -- extract payload and pass to ECX
677
678 XMLtoXMLCover
679 (
680 i_map_code,
681 i_inevent.event_data,
682 i_outevent.event_data,
683 i_debug_level
684 );
685
686 addItemAttributes(itemtype,itemkey);
687 wf_engine.SetItemAttrEvent(itemtype,itemkey,aname,i_outevent);
688
689 resultout := 'COMPLETE:';
690 exception
691 when others then
692 Wf_Core.Context('ECX_STANDARD', 'XMLtoXML',itemtype,itemkey, to_char(actid), funcmode);
693 raise;
694 end XMLtoXML;
695
696 procedure ProcessXML(itemtype in varchar2,
697 itemkey in varchar2,
698 actid in number,
699 funcmode in varchar2,
700 resultout in out NOCOPY varchar2 )
701 is
702 i_debug_level pls_integer;
703 i_map_code varchar2(200);
704 i_payload clob;
705 i_outpayload clob;
706 i_log_file varchar2(2000);
707 i_ret_code pls_integer;
708 i_errbuf varchar2(2000);
709 i_event wf_event_t;
710 ecx_process_xml exception;
711 i_error_type pls_integer;
712 aname_error_type varchar2(30);
713 aname_log_file varchar2(30);
714
715 begin
716 -- Set the Global itemtype,itemkey and the activity_id
717 ecx_utils.g_item_type := itemtype;
718 ecx_utils.g_item_key := itemkey;
719 ecx_utils.g_activity_id := actid;
720
721 -- Do nothing in cancel or timeout mode
722 if (funcmode <> wf_engine.eng_run) then
723 resultout := wf_engine.eng_null;
724 return;
725 end if;
726
727 -- Get ecx map code
728
729 i_map_code := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_MAP_CODE');
730 if (i_map_code is null ) then
731 wf_core.token('ECX_MAP_CODE','NULL');
732 wf_core.raise('WFSQL_ARGS');
733 end if;
734
735
736
737 i_debug_level := nvl(wf_engine.GetItemAttrText(itemtype,itemkey,'ECX_DEBUG_LEVEL',true),0);
738 i_event := Wf_Engine.GetActivityAttrEvent(itemtype, itemkey, actid, 'ECX_EVENT_MESSAGE');
739 if (i_event is null ) then
740 wf_core.token('ECX_EVENT_MESSAGE','NULL');
741 wf_core.raise('WFSQL_ARGS');
742 end if;
743
744 -- extract payload and pass to ECX
745
746 i_payload := i_event.event_data;
747 ecx_utils.g_from_processxml := true;
748 processXMLCover
749 (
750 i_map_code,
751 i_payload,
752 i_debug_level
753 );
754
755 /*bug16442475: Returning status to notified and will set to complete from java*/
756 if ECX_UTIL_API.isInJavaProcessEnabled then
757 ecx_utils.g_from_processxml := false;
758 resultout := wf_engine.eng_notified;
759 else
760 addItemAttributes(itemtype,itemkey);
761 resultout := 'COMPLETE:';
762 end if;
763 exception
764 when others then
765 Wf_Core.Context('ECX_STANDARD', 'PROCESSXML',itemtype,itemkey, to_char(actid), funcmode);
766 raise;
767 end processXML;
768
769 -- IsDeliveryRequired
770 -- Standard ECX Workflow Activity
771 -- Determine if trading partner is enabled to recieve document
772 -- OUT
773 -- result - T - Trading Partner is enabled
774 -- F - Trading Partner is NOT enabled
775 -- ACTIVITY ATTRIBUTES REFERENCED
776 -- TRANSACTION_TYPE - text value (required)
777 -- TRANSACTION_SUBTYPE - text value (required)
778 -- PARTY_ID - text value (required)
779 -- PARTY_SITE_ID - text value (optional)
780 -- NOTE:
781
782 procedure isDeliveryRequired (itemtype in varchar2,
783 itemkey in varchar2,
784 actid in number,
785 funcmode in varchar2,
786 resultout in out NOCOPY varchar2)
787 is
788 transaction_type varchar2(240);
789 transaction_subtype varchar2(240);
790 party_id varchar2(240);
791 party_site_id varchar2(240);
792 party_type VARCHAR2(300); --Bug #2183619
793 aname varchar2(30); --Bug #2215677
794 retcode pls_integer;
795 errmsg varchar2(2000);
796 result boolean := FALSE;
797 i_confirmation number; --Bug #2215677
798 g_instlmode varchar2(100);
799 begin
800
801 -- Set the Global itemtype,itemkey and the activity_id
802 ecx_utils.g_item_type := itemtype;
803 ecx_utils.g_item_key := itemkey;
804 ecx_utils.g_activity_id := actid;
805
806 -- Do nothing in cancel or timeout mode
807
808 if (funcmode <> wf_engine.eng_run) then
809 resultout := wf_engine.eng_null;
810 return;
811 end if;
812
813 -- Retreive Activity Attributes
814
815 transaction_type := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_TRANSACTION_TYPE');
816 if ( transaction_type is null ) then
817 wf_core.token('ECX_TRANSACTION_TYPE','NULL');
818 wf_core.raise('WFSQL_ARGS');
819 end if;
820
821 transaction_subtype := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_TRANSACTION_SUBTYPE');
822 if ( transaction_subtype is null ) then
823 wf_core.token('ECX_TRANSACTION_SUBTYPE','NULL');
824 wf_core.raise('WFSQL_ARGS');
825 end if;
826
827 party_site_id := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_PARTY_SITE_ID');
828 if ( party_site_id is null ) then
829 wf_core.token('ECX_PARTY_SITE_ID','NULL');
830 wf_core.raise('WFSQL_ARGS');
831 end if;
832
833 -- party_id is optional. Only party_site_id is required
834
835 party_id := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_PARTY_ID');
836 /* Start of bug #2183619 */
837 party_type := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARTY_TYPE', true);
838 /* End of bug #2183619*/
839
840 /* Start of changes for Bug #2215677*/
841 -- Get confirmation status of the trading partner.
842 aname := wf_engine.GetActivityAttrText(itemtype, itemkey, actid,
843 'ECX_CONFIRMATION_FLAG', ignore_notfound => true);
844 if (aname is not null) then
845 ecx_document.getConfirmationStatus(
846 i_transaction_type => transaction_type,
847 i_transaction_subtype => transaction_subtype,
848 i_party_id => party_id,
849 i_party_site_id => party_site_id,
850 i_party_type => party_type,
851 o_confirmation => i_confirmation
852 );
853 wf_engine.SetItemAttrText ( itemtype => itemtype,
854 itemkey => itemkey,
855 aname => aname,
856 avalue => i_confirmation);
857 end if;
858 /* End of changes for Bug #2215677*/
859
860
861 ecx_document.isDeliveryRequired
862 (
863 transaction_type => transaction_type,
864 transaction_subtype => transaction_subtype,
865 party_id => party_id,
866 party_site_id => party_site_id,
867 party_type => party_type, --bug #2183619
868 resultout => result,
869 retcode => retcode,
870 errmsg => errmsg
871 );
872 if (result)
873 then
874 -- Reached Here. Successful execution.
875 resultout := 'COMPLETE:T';
876 else
877 resultout := 'COMPLETE:F';
878 end if;
879 exception
880 when ecx_document.ecx_transaction_not_defined then
881 wf_core.context('ECX_STANDARD','isDeliveryRequiredCover',transaction_type,transaction_subtype, party_id,party_site_id);
882 wf_core.token('ECX_TRANSACTION_TYPE', transaction_type);
883 wf_core.token('ECX_TRANSACTION_SUBTYPE', transaction_subtype);
884 wf_core.raise('ECX_TRANSACTION_NOT_DEFINED');
885 when ecx_document.ecx_delivery_setup_error then
886 wf_core.context('ECX_STANDARD','isDeliveryRequiredCover',transaction_type,transaction_subtype, party_id,party_site_id);
887 wf_core.token('ECX_PARTY_ID', party_id);
888 wf_core.token('ECX_PARTY_SITE_ID', party_site_id);
889 wf_core.token('ECX_TRANSACTION_TYPE', transaction_type);
890 wf_core.token('ECX_TRANSACTION_SUBTYPE', transaction_subtype);
891 wf_core.raise('ECX_DELIVERY_SETUP_ERROR');
892
893 when ecx_utils.program_exit then
894 wf_core.context('ECX_STANDARD','isDeliveryRequiredCover',transaction_type,transaction_subtype, party_id,party_site_id);
895 g_instlmode := wf_core.translate('WF_INSTALL');
896 IF g_instlmode = 'EMBEDDED'
897 THEN
898 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(ecx_utils.i_errbuf,
899 ecx_utils.i_errparams));
900 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
901 wf_core.raise('ECX_PROGRAM_EXIT_EMBD');
902 ELSE
903 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
904 ecx_utils.i_errparams));
905 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
906 wf_core.raise('ECX_PROGRAM_EXIT');
907 END IF;
908
909 when others then
910 raise;
911 end isDeliveryRequired;
912
913
914 -- Send
915 -- Standard ECX Workflow Activity
916 -- Send Event to AQ for delivery
917 -- OUT
918 -- result - null
919 --
920 -- ACTIVITY ATTRIBUTES REFERENCED
921 -- TRANSACTION_TYPE - text value (required)
922 -- TRANSACTION_SUBTYPE - text value (required)
923 -- PARTY_ID - text value (optional)
924 -- PARTY_SITE_ID - text value (required)
925 -- DOCUMENT_D - text value (required)
926 -- PARAMETER1..5 - text value (optional)
927 -- SEND_MODE - Text (lookup: SYNCH ASYNCH ) (required)
928 -- NOTE:
929
930 procedure send(itemtype in varchar2,
931 itemkey in varchar2,
932 actid in number,
933 funcmode in varchar2,
934 resultout in out NOCOPY varchar2)
935 is
936 transaction_type varchar2(240);
937 transaction_subtype varchar2(240);
938 party_id varchar2(240);
939 party_site_id varchar2(240);
940 party_type varchar2(200); -- bug #2183619
941 document_id varchar2(240);
942 parameter1 varchar2(240);
943 parameter2 varchar2(240);
944 parameter3 varchar2(240);
945 parameter4 varchar2(240);
946 parameter5 varchar2(240);
947
948 debug_mode pls_integer:=0;
949 send_mode varchar2(20);
950 msgid raw(16);
951 trigger_id binary_integer;
952 retcode binary_integer:=0;
953 errmsg varchar2(2000);
954 aname varchar2(30);
955 atype varchar2(8);
956 aformat varchar2(240);
957 asubtype varchar2(8);
958 result varchar2(30);
959 status varchar2(8);
960 begin
961 -- Set the Global itemtype,itemkey and the activity_id
962 ecx_utils.g_item_type := itemtype;
963 ecx_utils.g_item_key := itemkey;
964 ecx_utils.g_activity_id := actid;
965
966 -- Do nothing in cancel or timeout mode
967 if (funcmode <> wf_engine.eng_run) then
968 resultout := wf_engine.eng_null;
969 return;
970 end if;
971
972 -- We need to determine which parameters are required and which are optional
973
974 transaction_type := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_TRANSACTION_TYPE');
975 if ( transaction_type is null ) then
976 wf_core.token('ECX_TRANSACTION_TYPE','NULL');
977 wf_core.raise('WFSQL_ARGS');
978 end if;
979
980 transaction_subtype := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_TRANSACTION_SUBTYPE');
981 if ( transaction_subtype is null ) then
982 wf_core.token('ECX_TRANSACTION_SUBTYPE','NULL');
983 wf_core.raise('WFSQL_ARGS');
984 end if;
985
986 party_site_id := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_PARTY_SITE_ID');
987 if ( transaction_type <> 'ECX' and transaction_subtype <> 'CBODO' )
988 then
989 if ( party_site_id is null )
990 then
991 wf_core.token('ECX_PARTY_SITE_ID','NULL');
992 wf_core.raise('WFSQL_ARGS');
993 end if;
994 end if;
995
996 -- party_id is optional. Only party_site_id is required
997
998 party_id := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_PARTY_ID');
999 /* Start of bug #2183619 */
1000 party_type := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARTY_TYPE', ignore_notfound => true);
1001
1002 /* End of bug #2183619 */
1003
1004 -- It is an optional Field
1005 document_id := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_DOCUMENT_ID');
1006 /**
1007 if ( document_id is null ) then
1008 wf_core.token('ECX_DOCUMENT_ID','NULL');
1009 wf_core.raise('WFSQL_ARGS');
1010 end if;
1011 **/
1012
1013 debug_mode := nvl(Wf_Engine.GetItemAttrText(itemtype, itemkey, 'ECX_DEBUG_LEVEL',true),0);
1014
1015 /** Check for the Item Attribute of type ECX_EVENT_MESSAGE. If found , then use that to initialize the
1016 global variable for ecx_utils.g_event or create a local instance.
1017 **/
1018 begin
1019 -- Initialize the Event before using it.
1020 wf_event_t.initialize(ecx_utils.g_event);
1021 ecx_utils.g_event := Wf_Engine.GetItemAttrEvent(itemtype, itemkey,'ECX_EVENT_MESSAGE');
1022 exception
1023 when others then
1024 if ecx_utils.g_event is null
1025 then
1026 wf_event_t.initialize(ecx_utils.g_event);
1027 end if;
1028 end;
1029
1030
1031 /* Start of changes for bug 2120165 */
1032 parameter1 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER1');
1033 parameter2 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER2');
1034 parameter3 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER3');
1035 parameter4 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER4');
1036 parameter5 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER5');
1037 /* End of changes for bug 2120165*/
1038
1039 -- Add the above Parameters to the Global Event Message Object
1040 -- For backward compatability , we are passing ECX_PARAMETER1 -> PARAMETER1 on the Engine.
1041 ecx_utils.g_event.addparametertolist('PARAMETER1',parameter1);
1042 ecx_utils.g_event.addparametertolist('PARAMETER2',parameter2);
1043 ecx_utils.g_event.addparametertolist('PARAMETER3',parameter3);
1044 ecx_utils.g_event.addparametertolist('PARAMETER4',parameter4);
1045 ecx_utils.g_event.addparametertolist('PARAMETER5',parameter5);
1046
1047
1048 send_mode := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_SEND_MODE');
1049
1050 wf_Item_Activity_Status.Result(itemtype, itemkey, actid, status, result);
1051
1052 -- KH comment: There is a more efficient way of doing this. The execution test
1053 -- Should come before any attributes are retrived
1054
1055 if (result = wf_engine.eng_null)
1056 then
1057 -- Second execution.
1058 -- Wait is completed, return complete result.
1059 -- Call the XML gateway Outbound Engine
1060 -- party type is added as one more parameter with bug #2183619
1061 sendDirectCover
1062 (
1063 transaction_type => transaction_type,
1064 transaction_subtype => transaction_subtype,
1065 party_id => party_id,
1066 party_site_id => party_site_id,
1067 party_type => party_type,
1068 document_id => document_id,
1069 debug_mode => debug_mode,
1070 i_msgid => msgid
1071 );
1072
1073 aname := wf_engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_MSGID_ATTR');
1074 wf_engine.SetItemAttrText(itemtype,itemkey,aname,msgid);
1075
1076 addItemAttributes(itemtype,itemkey);
1077
1078 resultout := wf_engine.eng_completed||':'||wf_engine.eng_null;
1079 else
1080 -- First execution.
1081 -- Check for A-synch or Synch Mode
1082 if ( send_mode = 'ASYNCH')
1083 then
1084 -- If Async , deffer the executio
1085 resultout := wf_engine.eng_deferred;
1086 elsif ( ( send_mode is null ) or ( send_mode = 'SYNCH' ) )
1087 then
1088 -- Call the XML gateway Outbound Engine
1089 -- added party_type with bug #2183619
1090 sendDirectCover
1091 (
1092 transaction_type => transaction_type,
1093 transaction_subtype => transaction_subtype,
1094 party_id => party_id,
1095 party_site_id => party_site_id,
1096 party_type => party_type,
1097 document_id => document_id,
1098 debug_mode => debug_mode,
1099 i_msgid => msgid
1100 );
1101
1102 aname := wf_engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_MSGID_ATTR');
1103 wf_engine.SetItemAttrText(itemtype,itemkey,aname,msgid);
1104
1105 addItemAttributes(itemtype,itemkey);
1106
1107 resultout := wf_engine.eng_completed||':'||wf_engine.eng_null;
1108 end if;
1109 end if;
1110
1111 exception
1112 when others then
1113 Wf_Core.Context('ECX_STANDARD', 'Send', itemtype, itemkey, to_char(actid), funcmode);
1114 raise;
1115 end send;
1116
1117 -- GetXMLTP
1118 -- Standard ECX Workflow Activity
1119 -- Retrieve XML document
1120 -- OUT
1121 -- result - null
1122 --
1123 -- ACTIVITY ATTRIBUTES REFERENCED
1124 -- TRANSACTION_TYPE - text value (Required)
1125 -- TRANSACTION_SUBTYPE - text value (Required)
1126 -- PARTY_SITE_ID - text value (Required)
1127 -- PARTY_ID - text value (optional)
1128 -- DOCUMENT_D - text value (Required)
1129 -- EVENT_NAME - text value (optional)
1130 -- EVENT_KEY - text value (optional)
1131 -- PARAMETER1..5 - text value (optional)
1132 --
1133 -- EVENT_MESSAGE - Item ATTR (required)
1134 -- NOTE:
1135
1136 procedure GetXMLTP(itemtype in varchar2,
1137 itemkey in varchar2,
1138 actid in number,
1139 funcmode in varchar2,
1140 resultout in out NOCOPY varchar2)
1141 is
1142 i_debug_level pls_integer :=0;
1143 retcode pls_integer;
1144 errmsg varchar2(2000);
1145 transaction_type VARCHAR2(240);
1146 transaction_subtype VARCHAR2(240);
1147 party_id varchar2(240);
1148 party_site_id varchar2(240);
1149 document_id varchar2(240);
1150
1151 parameter1 varchar2(240);
1152 parameter2 varchar2(240);
1153 parameter3 varchar2(240);
1154 parameter4 varchar2(240);
1155 parameter5 varchar2(240);
1156 event_name varchar2(240);
1157 event_key varchar2(240);
1158 i_event wf_event_t;
1159 aname varchar2(30);
1160 evt_name varchar2(30);
1161 atype varchar2(8);
1162 aformat varchar2(240);
1163 asubtype varchar2(8);
1164 i_error_type pls_integer;
1165
1166 p_party_type varchar2(240);
1167 p_message_type varchar2(240);
1168 p_message_standard varchar2(240);
1169 p_ext_type varchar2(240);
1170 p_ext_subtype varchar2(240);
1171 p_source_code varchar2(240);
1172 p_destination_code varchar2(240);
1173 p_destination_type varchar2(240);
1174 p_destination_address varchar2(2000);
1175 p_username ecx_tp_details.username%TYPE;
1176 p_password ecx_tp_details.password%TYPE;
1177 p_map_code varchar2(240);
1178 p_queue_name varchar2(240);
1179 p_tp_header_id pls_integer;
1180
1181 p_party_id varchar2(240);
1182 p_party_site_id varchar2(240);
1183 i_agt_guid wf_agents.guid%TYPE;
1184 trigger_id number := 0;
1185 i_param_list wf_parameter_list_t;
1186 i_from_agent wf_agent_t;
1187 i_from_agent_name varchar2(240);
1188 i_from_system_name varchar2(240);
1189 g_instlmode varchar2(100);
1190
1191 cursor c1
1192 is
1193 select ecx_trigger_id_s.NEXTVAL
1194 from dual;
1195
1196 begin
1197 -- Set the Global itemtype,itemkey and the activity_id
1198 ecx_utils.g_item_type := itemtype;
1199 ecx_utils.g_item_key := itemkey;
1200 ecx_utils.g_activity_id := actid;
1201
1202 -- Do nothing in cancel or timeout mode
1203 if (funcmode <> wf_engine.eng_run) then
1204 resultout := wf_engine.eng_null;
1205 return;
1206 end if;
1207
1208
1209 i_debug_level := nvl(Wf_Engine.GetItemAttrText(itemtype, itemkey, 'ECX_DEBUG_LEVEL',true),0);
1210
1211
1212 -- Retreive Activity Attributes
1213
1214 transaction_type := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_TRANSACTION_TYPE');
1215 if ( transaction_type is null ) then
1216 wf_core.token('ECX_TRANSACTION_TYPE','NULL');
1217 wf_core.raise('WFSQL_ARGS');
1218 end if;
1219
1220 transaction_subtype := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_TRANSACTION_SUBTYPE');
1221 if ( transaction_subtype is null ) then
1222 wf_core.token('ECX_TRANSACTION_SUBTYPE','NULL');
1223 wf_core.raise('WFSQL_ARGS');
1224 end if;
1225
1226 party_site_id := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_PARTY_SITE_ID');
1227
1228 if ( transaction_type <> 'ECX' and transaction_subtype <> 'CBODO' )
1229 then
1230 if ( party_site_id is null ) then
1231 wf_core.token('ECX_PARTY_SITE_ID','NULL');
1232 wf_core.raise('WFSQL_ARGS');
1233 end if;
1234 end if;
1235
1236 -- party_id is optional. Only party_site_id is required
1237
1238 party_id := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_PARTY_ID');
1239
1240 /* Start of bug #2183619 */
1241
1242 p_party_type := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARTY_TYPE', true);
1243
1244 /* End of bug #2183619*/
1245
1246 document_id := Wf_Engine.GetActivityAttrTEXT(itemtype, itemkey, actid, 'ECX_DOCUMENT_ID');
1247
1248
1249 -- Verify that the attr type = EVENT
1250
1251 evt_name := wf_engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_EVENT_MESSAGE');
1252 if ( evt_name is null ) then
1253 wf_core.token('ECX_EVENT_MESSAGE','NULL');
1254 wf_core.raise('WFSQL_ARGS');
1255 end if;
1256
1257 Wf_Engine.GetItemAttrInfo(itemtype, evt_name ,atype, asubtype, aformat);
1258 if (atype <> 'EVENT' ) then
1259 wf_core.token('VTYPE',atype);
1260 wf_core.raise('WFXXXV_VTYPE');
1261 end if;
1262
1263 i_event := Wf_Engine.GetItemAttrEvent(itemtype, itemkey, evt_name);
1264 /**
1265 Populate the Parameters in the original event Object being passed. if it is null , initialize and create
1266 a new Instance and populate the variables
1267 if i_event is null
1268 then
1269 wf_event_t.initialize(ecx_utils.g_event);
1270 else
1271 ecx_utils.g_event := i_event;
1272 end if;
1273 **/
1274
1275 /* Always initialize ecx_utils.g_event before using it */
1276 wf_event_t.initialize(ecx_utils.g_event);
1277 if i_event is not null
1278 then
1279 ecx_utils.g_event := i_event;
1280 End If;
1281
1282 parameter1 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER1');
1283 parameter2 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER2');
1284 parameter3 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER3');
1285 parameter4 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER4');
1286 parameter5 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER5');
1287 -- Add the above Parameters to the Global Event Message Object
1288 -- For backward compatability , we are passing ECX_PARAMETER1 -> PARAMETER1 on the Engine.
1289 ecx_utils.g_event.addparametertolist('PARAMETER1',parameter1);
1290 ecx_utils.g_event.addparametertolist('PARAMETER2',parameter2);
1291 ecx_utils.g_event.addparametertolist('PARAMETER3',parameter3);
1292 ecx_utils.g_event.addparametertolist('PARAMETER4',parameter4);
1293 ecx_utils.g_event.addparametertolist('PARAMETER5',parameter5);
1294
1295 open c1;
1296 fetch c1 into trigger_id;
1297 close c1;
1298
1299 -- invoke trigger_outbound which will invoke outbound_trigger, getConfirmation and
1300 -- get_delivery_attribs
1301 ecx_debug.setErrorInfo(10,10,'ECX_TRIGGER_OUTBOUND');
1302 ecx_document.trigger_outbound(transaction_type, transaction_subtype,
1303 party_id, party_site_id,
1304 document_id, ecx_utils.i_ret_code,
1305 ecx_utils.i_errbuf, trigger_id,
1306 p_party_type, p_party_id, p_party_site_id,
1307 p_message_type, p_message_standard,
1308 p_ext_type, p_ext_subtype, p_source_code,
1309 p_destination_code, p_destination_type,
1310 p_destination_address, p_username, p_password,
1311 p_map_code, p_queue_name, p_tp_header_id
1312 );
1313 -- do outbound logging
1314 ecx_debug.setErrorInfo(10,10, 'ECX_PROCESSING_MESSAGE');
1315 ecx_errorlog.outbound_engine (trigger_id,
1316 ecx_utils.i_ret_code,
1317 ecx_utils.i_errbuf,
1318 null,null,p_party_type
1319 );
1320
1321 -- prepare WS related event if it is SOAP protocol type
1322 if (upper(p_destination_type) = 'SOAP') then
1323 prepareWS(itemtype, itemkey, actid, ecx_utils.g_event);
1324 end if;
1325
1326 -- if the from agent is not yet set by users, reset it based on the retrieve
1327 -- protocol_type. Otherwise, honor whatever has been set by the users.
1328 if (not ecx_utils.g_event.GetFromAgent() is null)
1329 then
1330 i_from_agent_name := ecx_utils.g_event.GetFromAgent().GetName();
1331 i_from_system_name := ecx_utils.g_event.GetFromAgent().GetSystem();
1332 end if;
1333
1334 if (i_from_agent_name is null AND i_from_system_name is null)
1335 or (i_from_agent_name = 'WF_DEFERRED')
1336 then
1337 if (upper(p_destination_type) = 'SOAP') then
1338 i_from_agent_name := 'WF_WS_JMS_OUT';
1339 else
1340 if (upper(p_destination_type) = 'JMS') then
1341 if(p_destination_address is null) then
1342 i_from_agent_name := 'WF_JMS_OUT';
1343 else
1344 i_from_agent_name := p_destination_address;
1345 end if;
1346 else
1347 i_from_agent_name := 'ECX_OUTBOUND';
1348 end if;
1349 end if;
1350
1351 begin
1352 select name
1353 into i_from_system_name
1354 from wf_systems
1355 where guid = wf_core.translate('WF_SYSTEM_GUID');
1356 exception
1357 when others then
1358 raise;
1359 end;
1360
1361 i_from_agent := wf_agent_t(i_from_agent_name, i_from_system_name);
1362 ecx_utils.g_event.setFromAgent(i_from_agent);
1363
1364 end if;
1365
1366 getXMLcover
1367 (
1368 i_message_standard => p_message_standard,
1369 i_map_code => p_map_code,
1370 i_transaction_type => transaction_type,
1371 i_transaction_subtype => transaction_subtype,
1372 i_tp_type => p_party_type,
1373 i_tp_id => p_party_id,
1374 i_tp_site_id => p_party_site_id,
1375 i_document_id => document_id,
1376 i_debug_level => i_debug_level,
1377 i_xmldoc => ecx_utils.g_event.event_data,
1378 i_message_type => p_message_type);
1379
1380 ecx_debug.setErrorInfo(0,10,'ECX_MESSAGE_CREATED');
1381 ecx_errorlog.outbound_engine (trigger_id,
1382 ecx_utils.i_ret_code,
1383 ecx_utils.i_errbuf,
1384 null,null,p_party_type
1385 );
1386
1387 -- Following part is needed only when getxmltp is used with wf_event.send
1388 -- set ecx_utils.g_event with the envelope information. This will later be used
1389 -- by the queue handler to enqueue on ECX_OUTBOUND
1390 ecx_utils.g_event.addParameterToList('PARTY_TYPE', p_party_type);
1391 ecx_utils.g_event.addParameterToList('PARTYID', p_party_id);
1392 ecx_utils.g_event.addParameterToList('PARTY_SITE_ID', p_source_code);
1393 ecx_utils.g_event.addParameterToList('DOCUMENT_NUMBER', ecx_utils.g_document_id);
1394 ecx_utils.g_event.addParameterToList('MESSAGE_TYPE', p_message_type);
1395 ecx_utils.g_event.addParameterToList('MESSAGE_STANDARD', p_message_standard);
1396 ecx_utils.g_event.addParameterToList('TRANSACTION_TYPE', p_ext_type);
1397 ecx_utils.g_event.addParameterToList('TRANSACTION_SUBTYPE', p_ext_subtype);
1398 ecx_utils.g_event.addParameterToList('PROTOCOL_TYPE', p_destination_type);
1399 ecx_utils.g_event.addParameterToList('PROTOCOL_ADDRESS', p_destination_address);
1400 ecx_utils.g_event.addParameterToList('USERNAME', p_username);
1401 ecx_utils.g_event.addParameterToList('PASSWORD', p_password);
1402 ecx_utils.g_event.addParameterToList('ATTRIBUTE1', ecx_utils.g_company_name);
1403 ecx_utils.g_event.addParameterToList('ATTRIBUTE2', null);
1404 ecx_utils.g_event.addParameterToList('ATTRIBUTE3', p_destination_code);
1405 ecx_utils.g_event.addParameterToList('ATTRIBUTE4', null);
1406 ecx_utils.g_event.addParameterToList('ATTRIBUTE5', null);
1407 ecx_utils.g_event.addParameterToList('LOGFILE', ecx_utils.g_logfile);
1408 ecx_utils.g_event.addParameterToList('TRIGGER_ID', trigger_id);
1409 ecx_utils.g_event.addParameterToList('ITEM_TYPE', itemtype);
1410 ecx_utils.g_event.addParameterToList('ITEM_KEY', itemkey);
1411
1412 -- Populate event structure and set item attribute
1413
1414 if event_name is not null
1415 then
1416 i_event.SetEventName(event_name);
1417 end if;
1418
1419 if event_key is not null
1420 then
1421 i_event.SetEventKey(event_key);
1422 end if;
1423
1424 -- set the event data back
1425 wf_engine.SetItemAttrEvent(itemtype, itemkey, evt_name, ecx_utils.g_event);
1426
1427 addItemAttributes(itemtype,itemkey);
1428
1429 resultout := 'COMPLETE:';
1430
1431 exception
1432 when ecx_document.ecx_transaction_not_defined then
1433 ecx_errorlog.outbound_trigger
1434 (
1435 trigger_id, transaction_type, transaction_subtype,
1436 p_party_id, p_party_site_id, p_party_type,
1437 document_id, ecx_utils.i_ret_code, ecx_utils.i_errbuf
1438 );
1439
1440 wf_core.context('ECX_STANDARD','getXMLTP',transaction_type,transaction_subtype,party_id,party_site_id);
1441 wf_core.token('ECX_TRANSACTION_TYPE', transaction_type);
1442 wf_core.token('ECX_TRANSACTION_SUBTYPE', transaction_subtype);
1443 wf_core.raise('ECX_TRANSACTION_NOT_DEFINED');
1444 when ecx_document.ecx_no_delivery_required then
1445 ecx_errorlog.outbound_trigger
1446 (
1447 trigger_id, transaction_type, transaction_subtype,
1448 p_party_id, p_party_site_id, p_party_type,
1449 document_id, ecx_utils.i_ret_code, ecx_utils.i_errbuf
1450 );
1451
1452 wf_core.context('ECX_STANDARD','getXMLTP',transaction_type,transaction_subtype,party_id,party_site_id);
1453 g_instlmode := wf_core.translate('WF_INSTALL');
1454 IF g_instlmode = 'EMBEDDED'
1455 THEN
1456 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(ecx_utils.i_errbuf,
1457 ecx_utils.i_errparams));
1458 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
1459 wf_core.raise('ECX_PROGRAM_EXIT_EMBD');
1460 ELSE
1461 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
1462 ecx_utils.i_errparams));
1463 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
1464 wf_core.raise('ECX_PROGRAM_EXIT');
1465 END IF;
1466 when ecx_document.ecx_no_party_setup then
1467 ecx_errorlog.outbound_trigger
1468 (
1469 trigger_id, transaction_type, transaction_subtype,
1470 p_party_id, p_party_site_id, p_party_type,
1471 document_id, ecx_utils.i_ret_code, ecx_utils.i_errbuf
1472 );
1473
1474 wf_core.context('ECX_STANDARD','getXMLTP',transaction_type,transaction_subtype,party_id,party_site_id);
1475 wf_core.token('ECX_PARTY_ID', party_id);
1476 wf_core.token('ECX_PARTY_SITE_ID', party_site_id);
1477 wf_core.token('ECX_TRANSACTION_TYPE', transaction_type);
1478 wf_core.token('ECX_TRANSACTION_SUBTYPE', transaction_subtype);
1479 wf_core.raise('ECX_NO_PARTY_SETUP');
1480 when ecx_document.ecx_delivery_setup_error then
1481 ecx_errorlog.outbound_trigger
1482 (
1483 trigger_id, transaction_type, transaction_subtype,
1484 p_party_id, p_party_site_id, p_party_type,
1485 document_id, ecx_utils.i_ret_code, ecx_utils.i_errbuf
1486 );
1487
1488 wf_core.context('ECX_STANDARD','getXMLTP',transaction_type,transaction_subtype,party_id,party_site_id);
1489 wf_core.token('ECX_PARTY_ID', party_id);
1490 wf_core.token('ECX_PARTY_SITE_ID', party_site_id);
1491 wf_core.token('ECX_TRANSACTION_TYPE', transaction_type);
1492 wf_core.token('ECX_TRANSACTION_SUBTYPE', transaction_subtype);
1493 wf_core.raise('ECX_DELIVERY_SETUP_ERROR');
1494 when ecx_utils.program_exit then
1495 ecx_errorlog.outbound_trigger
1496 (
1497 trigger_id, transaction_type, transaction_subtype,
1498 p_party_id, p_party_site_id, p_party_type,
1499 document_id, ecx_utils.i_ret_code, ecx_utils.i_errbuf
1500 );
1501
1502 wf_core.context('ECX_STANDARD','getXMLTP',transaction_type,transaction_subtype,party_id,party_site_id);
1503 g_instlmode := wf_core.translate('WF_INSTALL');
1504 IF g_instlmode = 'EMBEDDED'
1505 THEN
1506 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(ecx_utils.i_errbuf,
1507 ecx_utils.i_errparams));
1508 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
1509 wf_core.raise('ECX_PROGRAM_EXIT_EMBD');
1510 ELSE
1511 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(ecx_utils.i_errbuf,
1512 ecx_utils.i_errparams));
1513 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
1514 wf_core.raise('ECX_PROGRAM_EXIT');
1515 END IF;
1516 when others then
1517 ecx_errorlog.outbound_trigger
1518 (
1519 trigger_id, transaction_type, transaction_subtype,
1520 p_party_id, p_party_site_id, p_party_type,
1521 document_id, ecx_utils.i_ret_code, ecx_utils.i_errbuf
1522 );
1523
1524 Wf_Core.Context('ECX_STANDARD', 'getXMLTP', itemtype, itemkey, to_char(actid), funcmode);
1525 raise;
1526 end getXMLTP;
1527
1528
1529 -- GetXML
1530 -- Standard ECX Workflow Activity
1531 -- Retrieve XML document
1532 -- OUT
1533 -- result - null
1534 --
1535 -- ACTIVITY ATTRIBUTES REFERENCED
1536 -- MAP_CODE - text value (required)
1537 -- DOCUMENT_ID - text value (required)
1538 -- EVENT_NAME - text value (optional)
1539 -- EVENT_KEY - text value (optional)
1540 -- PARAMETER1..5 - text value (optional)
1541 --
1542 -- EVENT_MESSAGE - Item ATTR (required)
1543 -- NOTE:
1544
1545 procedure GetXML(itemtype in varchar2,
1546 itemkey in varchar2,
1547 actid in number,
1548 funcmode in varchar2,
1549 resultout in out NOCOPY varchar2)
1550 is
1551 i_debug_level pls_integer :=0;
1552 i_map_code varchar2(200);
1553 retcode pls_integer;
1554 errmsg varchar2(2000);
1555 transaction_type varchar2(200);
1556 transaction_subtype varchar2(200);
1557 party_id number; /* Bug 2122579 */
1558 party_site_id number;
1559 document_id varchar2(240);
1560
1561 parameter1 varchar2(240);
1562 parameter2 varchar2(240);
1563 parameter3 varchar2(240);
1564 parameter4 varchar2(240);
1565 parameter5 varchar2(240);
1566
1567 /* Variabledeclarations for Bug 2120165*/
1568 i_evt wf_event_t;
1569 i_param_name varchar2(30);
1570 i_param_value varchar2(2000);
1571 counter number ;
1572 /* End of changes for bug 2120165*/
1573
1574 event_name varchar2(240);
1575 event_key varchar2(240);
1576 i_event wf_event_t;
1577 aevent_name varchar2(240);
1578 aname varchar2(30);
1579 evt_name varchar2(30);
1580 atype varchar2(8);
1581 aformat varchar2(240);
1582 asubtype varchar2(8);
1583 i_error_type pls_integer;
1584 dummy_number number;
1585 pECX_MAX_JAVA_MEMORY varchar2(30);
1586
1587
1588 begin
1589
1590 fnd_profile.get('ECX_MAX_JAVA_MEMORY',pECX_MAX_JAVA_MEMORY);
1591
1592 if pECX_MAX_JAVA_MEMORY is null then
1593 setMaxJavaMemorySize(MAX_JAVA_MEMORY); -- bug 6889689
1594 else
1595 setMaxJavaMemorySize( to_number(pECX_MAX_JAVA_MEMORY) * 1024 * 1024 ); -- bug 7121350
1596 end if;
1597
1598
1599 -- Set the Global itemtype,itemkey and the activity_id
1600 ecx_utils.g_item_type := itemtype;
1601 ecx_utils.g_item_key := itemkey;
1602 ecx_utils.g_activity_id := actid;
1603
1604 -- Do nothing in cancel or timeout mode
1605 if (funcmode <> wf_engine.eng_run) then
1606 resultout := wf_engine.eng_null;
1607 return;
1608 end if;
1609 i_map_code := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_MAP_CODE');
1610 if (i_map_code is null ) then
1611 wf_core.token('ECX_MAP_CODE','NULL');
1612 wf_core.raise('WFSQL_ARGS');
1613 end if;
1614
1615
1616 document_id := Wf_Engine.GetActivityAttrTEXT(itemtype, itemkey, actid, 'ECX_DOCUMENT_ID');
1617 i_debug_level := nvl(Wf_Engine.GetItemAttrText(itemtype, itemkey, 'ECX_DEBUG_LEVEL',true),0);
1618 event_name := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_EVENT_NAME');
1619 event_key := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_EVENT_KEY');
1620
1621 /* Start changes for bug Bug 2120165 */
1622 parameter1 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER1');
1623 parameter2 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER2');
1624 parameter3 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER3');
1625 parameter4 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER4');
1626 parameter5 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER5');
1627
1628 -- Verify that the attr type = EVENT
1629
1630 evt_name := wf_engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_EVENT_MESSAGE');
1631 if ( evt_name is null ) then
1632 wf_core.token('ECX_EVENT_MESSAGE','NULL');
1633 wf_core.raise('WFSQL_ARGS');
1634 end if;
1635
1636 Wf_Engine.GetItemAttrInfo(itemtype, evt_name ,atype, asubtype, aformat);
1637 if (atype <> 'EVENT' ) then
1638 wf_core.token('VTYPE',atype);
1639 wf_core.raise('WFXXXV_VTYPE');
1640 end if;
1641
1642 i_event := Wf_Engine.GetItemAttrEvent(itemtype, itemkey, evt_name);
1643
1644 /**
1645 Populate the Parameters in the original event Object being passed. if it is null , initialize and create
1646 a new Instance and populate the variables
1647 if i_event is null
1648 then
1649 wf_event_t.initialize(ecx_utils.g_event);
1650 else
1651 ecx_utils.g_event := i_event;
1652 end if;
1653 **/
1654
1655 /*Always initialize ecx_utils.g_event before using it */
1656 wf_event_t.initialize(ecx_utils.g_event);
1657 if i_event is not null
1658 then
1659 ecx_utils.g_event := i_event;
1660 End If;
1661
1662
1663 -- Add the above Parameters to the Global Event Message Object
1664 -- For backward compatability , we are passing ECX_PARAMETER1 -> PARAMETER1 on the Engine.
1665 ecx_utils.g_event.addparametertolist('PARAMETER1',parameter1);
1666 ecx_utils.g_event.addparametertolist('PARAMETER2',parameter2);
1667 ecx_utils.g_event.addparametertolist('PARAMETER3',parameter3);
1668 ecx_utils.g_event.addparametertolist('PARAMETER4',parameter4);
1669 ecx_utils.g_event.addparametertolist('PARAMETER5',parameter5);
1670
1671 -- KH comment: is null values for TP info going to casue an issue in GetXMLCover
1672 getXMLcover(i_map_code => i_map_code,
1673 i_transaction_type => transaction_type,
1674 i_transaction_subtype => transaction_subtype,
1675 i_tp_id => party_id,
1676 i_tp_site_id => party_site_id,
1677 i_document_id => document_id,
1678 i_debug_level => i_debug_level,
1679 i_xmldoc => ecx_utils.g_event.event_data
1680 );
1681
1682 -- Populate event structure and set item attribute
1683
1684 if event_name is not null
1685 then
1686 i_event.SetEventName(event_name);
1687 end if;
1688
1689 if event_key is not null
1690 then
1691 i_event.SetEventKey(event_key);
1692 end if;
1693
1694 -- set the event data back
1695 wf_engine.SetItemAttrEvent(itemtype, itemkey, evt_name, ecx_utils.g_event);
1696
1697 addItemAttributes(itemtype,itemkey);
1698
1699 resultout := 'COMPLETE:';
1700
1701 exception
1702 when others then
1703 Wf_Core.Context('ECX_STANDARD', 'getXML', itemtype, itemkey, to_char(actid), funcmode);
1704 raise;
1705 end getXML;
1706
1707
1708
1709 procedure Reprocess_Inbound
1710 (
1711 itemtype in varchar2,
1712 itemkey in varchar2,
1713 actid in number,
1714 funcmode in varchar2,
1715 result in out NOCOPY varchar2
1716 )
1717 is
1718 message_id varchar2(200);
1719 retcode pls_integer;
1720 errmsg varchar2(2000);
1721 debug_level pls_integer :=0;
1722 trigger_id pls_integer;
1723 error_type pls_integer;
1724 aname varchar2(200);
1725 aname_trigger_id varchar2(200);
1726 aname_error_type varchar2(200);
1727 aname_logfile varchar2(200);
1728 g_instlmode varchar2(100);
1729 begin
1730
1731 -- Set the Global itemtype,itemkey and the activity_id
1732 ecx_utils.g_item_type := itemtype;
1733 ecx_utils.g_item_key := itemkey;
1734 ecx_utils.g_activity_id := actid;
1735
1736 -- RUN mode - normal process execution
1737
1738 if (funcmode = 'RUN') then
1739
1740 message_id := wf_engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_MSGID');
1741 debug_level := nvl(Wf_Engine.GetItemAttrText(itemtype, itemkey,'ECX_DEBUG_LEVEL',true),0);
1742
1743 ecx_inbound_trig.reprocess
1744 (
1745 i_msgid => message_id,
1746 i_debug_level => debug_level,
1747 i_trigger_id => trigger_id,
1748 i_retcode => retcode,
1749 i_errbuf => errmsg
1750 );
1751
1752 aname_trigger_id := wf_engine.GetItemAttrText(itemtype, itemkey, 'ECX_TRIGGER_ID',true);
1753
1754 if aname_trigger_id is not null
1755 then
1756 wf_engine.SetItemAttrNumber(itemtype,itemkey,aname_trigger_id,trigger_id);
1757 end if;
1758
1759
1760 addItemAttributes(itemtype,itemkey);
1761
1762 if retcode = 0
1763 then
1764 result := 'COMPLETE:';
1765 return;
1766 elsif retcode = 1
1767 then
1768 g_instlmode := wf_core.translate('WF_INSTALL');
1769 IF g_instlmode = 'EMBEDDED'
1770 THEN
1771 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
1772 ecx_utils.i_errparams));
1773 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
1774 wf_core.raise('ECX_REPROCESS_INBOUND_EMBD');
1775 ELSE
1776 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
1777 ecx_utils.i_errparams));
1778 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
1779 wf_core.raise('ECX_REPROCESS_INBOUND');
1780 END IF;
1781
1782 else
1783 g_instlmode := wf_core.translate('WF_INSTALL');
1784 IF g_instlmode = 'EMBEDDED'
1785 THEN
1786 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
1787 ecx_utils.i_errparams));
1788 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
1789 wf_core.raise('ECX_PROGRAM_EXIT_EMBD');
1790 ELSE
1791 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
1792 ecx_utils.i_errparams));
1793 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
1794 wf_core.raise('ECX_PROGRAM_EXIT');
1795 END IF;
1796 end if;
1797
1798 result := 'COMPLETE:';
1799 return;
1800
1801 end if;
1802
1803
1804 -- CANCEL mode - activity 'compensation'
1805 --
1806 -- This is in the event that the activity must be undone,
1807 -- for example when a process is reset to an earlier point
1808 -- due to a loop back.
1809
1810 if (funcmode = 'CANCEL') then
1811
1812 -- your cancel code goes here
1813 null;
1814
1815 -- no result needed
1816 result := 'COMPLETE:';
1817 return;
1818 end if;
1819
1820
1821
1822 -- Other execution modes may be created in the future. Your
1823 -- activity will indicate that it does not implement a mode
1824 -- by returning null
1825
1826 result := '';
1827 return;
1828
1829 exception
1830 when others then
1831 wf_core.context('ECX_STANDARD', 'Reprocess_Inbound',itemtype, itemkey, to_char(actid),funcmode,retcode, errmsg);
1832 raise;
1833 end Reprocess_Inbound;
1834
1835 procedure resend
1836 (
1837 itemtype in varchar2,
1838 itemkey in varchar2,
1839 actid in number,
1840 funcmode in varchar2,
1841 result in out NOCOPY varchar2
1842 )
1843 is
1844 message_id varchar2(200);
1845 retcode pls_integer;
1846 errmsg varchar2(2000);
1847 begin
1848
1849 -- Set the Global itemtype,itemkey and the activity_id
1850 ecx_utils.g_item_type := itemtype;
1851 ecx_utils.g_item_key := itemkey;
1852 ecx_utils.g_activity_id := actid;
1853
1854
1855 -- RUN mode - normal process execution
1856
1857 if (funcmode = 'RUN') then
1858
1859 message_id := wf_engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_MSGID');
1860
1861 ecx_document.resend
1862 (
1863 i_msgid => message_id,
1864 i_flag => 'Y',
1865 retcode => retcode,
1866 errmsg => errmsg
1867 );
1868
1869
1870 if retcode = 0
1871 then
1872 result := 'COMPLETE:';
1873 return;
1874 elsif retcode = 1
1875 then
1876 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
1877 ecx_utils.i_errparams));
1878 wf_core.raise('ECX_RESEND_WARNING');
1879 else
1880 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
1881 ecx_utils.i_errparams));
1882 wf_core.raise('ECX_RESEND_ERROR');
1883 end if;
1884
1885 result := 'COMPLETE:';
1886 return;
1887
1888 end if;
1889
1890
1891 -- CANCEL mode - activity 'compensation'
1892
1893 -- This is in the event that the activity must be undone,
1894 -- for example when a process is reset to an earlier point
1895 -- due to a loop back.
1896
1897 if (funcmode = 'CANCEL') then
1898
1899 -- your cancel code goes here
1900 null;
1901
1902 -- no result needed
1903 result := 'COMPLETE:';
1904 return;
1905 end if;
1906
1907
1908
1909 -- Other execution modes may be created in the future. Your
1910 -- activity will indicate that it does not implement a mode
1911 -- by returning null
1912
1913 result := '';
1914 return;
1915
1916 exception
1917 when others then
1918 wf_core.context('ECX_STANDARD', 'ReSend',itemtype, itemkey, to_char(actid),funcmode,retcode, ecx_debug.getMessage(errmsg,ecx_utils.i_errparams));
1919 raise;
1920 end resend;
1921
1922 -- getEventDetails (PUBLIC)
1923 -- Standard XML Gateway Event API
1924 -- OUT:
1925 -- eventname - Event to the processes
1926 -- eventkey - Event key
1927 -- NOTE:
1928 -- Called from the MD maintained as a GLobal parameter by the XML gateway engine
1929
1930 procedure getEventDetails
1931 (
1932 eventname out NOCOPY varchar2,
1933 eventkey out NOCOPY varchar2,
1934 itemtype out NOCOPY varchar2,
1935 itemkey out NOCOPY varchar2,
1936 parentitemtype out NOCOPY varchar2,
1937 parentitemkey out NOCOPY varchar2,
1938 retcode OUT NOCOPY pls_integer,
1939 retmsg OUT NOCOPY varchar2
1940 )
1941 is
1942 i_string varchar2(2000);
1943 i_start_pos pls_integer;
1944 p_parameter_list wf_parameter_list_t;
1945 begin
1946 retcode :=0;
1947 retmsg :=null;
1948
1949 eventname := null;
1950 eventkey := null;
1951 itemtype := null;
1952 itemkey := null;
1953 parentitemtype := null;
1954 parentitemkey := null;
1955
1956 if ecx_utils.g_event is not null
1957 then
1958 eventname := ecx_utils.g_event.event_name;
1959 eventkey := ecx_utils.g_event.event_key;
1960 itemtype := ecx_utils.g_item_type;
1961 itemkey := ecx_utils.g_item_key;
1962
1963 p_parameter_list := ecx_utils.g_event.parameter_list;
1964 if p_parameter_list is not null
1965 then
1966 i_string := wf_event.getValueForParameter('#CONTEXT',p_parameter_list);
1967 if i_string is not null
1968 then
1969 i_start_pos := instrb(i_string,':',1,1);
1970 parentitemtype := substr(i_string,1,i_start_pos-1);
1971 parentitemkey := substr(i_string,i_start_pos+1,length(i_string));
1972 end if;
1973 end if;
1974 end if;
1975
1976 exception
1977 when others then
1978 retcode := 2;
1979 retmsg := substr(SQLERRM,1,200);
1980 end getEventDetails;
1981
1982 -- getEventDetails (PUBLIC)
1983 -- Standard XML Gateway Event API
1984 -- OUT:
1985 -- eventname - Event to the processes
1986 -- eventkey - Event key
1987 -- NOTE:
1988 -- Called from the MD maintained as a GLobal parameter by the XML gateway engine
1989 procedure getEventSystem
1990 (
1991 from_agent out NOCOPY varchar2,
1992 to_agent out NOCOPY varchar2,
1993 from_system out NOCOPY varchar2,
1994 to_system out NOCOPY varchar2,
1995 retcode OUT NOCOPY pls_integer,
1996 retmsg OUT NOCOPY varchar2
1997 )
1998 is
1999 begin
2000 retcode :=0;
2001 retmsg :=null;
2002 from_agent := null;
2003 to_agent := null;
2004 from_system := null;
2005 to_system := null;
2006
2007 if ecx_utils.g_event is not null
2008 then
2009 if ecx_utils.g_event.from_agent is not null
2010 then
2011 from_agent := ecx_utils.g_event.from_agent.name;
2012 from_system := ecx_utils.g_event.from_agent.system;
2013 else
2014 -- Use the Local System
2015 from_system := wf_event.local_system_name;
2016 end if;
2017
2018 if ecx_utils.g_event.to_agent is not null
2019 then
2020 to_agent := ecx_utils.g_event.to_agent.name;
2021 to_system := ecx_utils.g_event.to_agent.system;
2022 else
2023 -- Use the Local System
2024 from_system := wf_event.local_system_name;
2025 end if;
2026 end if;
2027
2028 exception
2029 when others then
2030 retcode := 2;
2031 retmsg := substr(SQLERRM,1,200);
2032 end getEventSystem;
2033
2034 function getReferenceId
2035 return varchar2
2036 is
2037 i_eventname varchar2(240);
2038 i_eventkey varchar2(240);
2039 i_itemtype varchar2(8);
2040 i_itemkey varchar2(240);
2041 i_parentitemtype varchar2(8);
2042 i_parentitemkey varchar2(240);
2043 i_from_system varchar2(240);
2044 i_retcode pls_integer;
2045 i_retmsg varchar2(2000);
2046
2047 begin
2048 getEventDetails
2049 (
2050 eventname => i_eventname,
2051 eventkey => i_eventkey,
2052 itemtype => i_itemtype,
2053 itemkey => i_itemkey,
2054 parentitemtype => i_parentitemtype,
2055 parentitemkey => i_parentitemkey,
2056 retcode => i_retcode,
2057 retmsg => i_retmsg
2058 );
2059
2060 if ecx_utils.g_event.from_agent is not null
2061 then
2062 i_from_system := ecx_utils.g_event.from_agent.system;
2063 else
2064 i_from_system := wf_event.local_system_name;
2065 end if;
2066
2067 return i_from_system||':'||i_eventname||':'||i_eventkey;
2068
2069 end getReferenceId;
2070
2071 /**
2072 This API enables user to perform XSLT transformation on a any given xml file
2073 **/
2074 procedure perform_xslt_transformation
2075 (
2076 i_xml_file in out NOCOPY clob,
2077 i_xslt_file_name in varchar2,
2078 i_xslt_file_ver in varchar2,
2079 i_xslt_application_code in varchar2,
2080 i_retcode out NOCOPY pls_integer,
2081 i_retmsg out NOCOPY varchar2,
2082 i_dtd_file_name in varchar2,
2083 i_dtd_root_element in varchar2,
2084 i_dtd_version in varchar2
2085 )
2086 is
2087 l_parser xmlparser.parser;
2088 l_xml_doc xmlDOM.DOMDocument;
2089 i_version number;
2090 l_dtd_payload clob;
2091 l_doctype xmlDOM.DOMDocumentType;
2092
2093 cursor get_dtd is
2094 select payload
2095 from ecx_dtds
2096 where filename = i_dtd_file_name
2097 and root_element = i_dtd_root_element
2098 and (version = i_dtd_version or i_dtd_version is null);
2099
2100 dummy_number number;
2101 pECX_MAX_JAVA_MEMORY varchar2(30);
2102
2103 begin
2104 -- check for nulls
2105 if (i_xml_file is null)
2106 then
2107 i_retcode := 2;
2108 i_retmsg := ecx_debug.getTranslatedMessage('ECX_XML_FILE_NULL');
2109 return;
2110 end if;
2111
2112 if(i_xslt_file_name is null)
2113 then
2114 i_retcode := 2;
2115 i_retmsg := ecx_debug.getTranslatedMessage('ECX_XSLT_FILE_NULL');
2116 return;
2117 end if;
2118
2119 if (i_xslt_application_code is null)
2120 then
2121 i_retcode := 2;
2122 i_retmsg := ecx_debug.getTranslatedMessage('ECX_XSLT_APP_CODE_NULL');
2123 return;
2124 end if;
2125
2126 fnd_profile.get('ECX_MAX_JAVA_MEMORY',pECX_MAX_JAVA_MEMORY);
2127
2128 if pECX_MAX_JAVA_MEMORY is null then
2129 setMaxJavaMemorySize(MAX_JAVA_MEMORY); -- bug 6889689
2130 else
2131 setMaxJavaMemorySize( to_number(pECX_MAX_JAVA_MEMORY) * 1024 * 1024 ); -- bug 7121350
2132 end if;
2133
2134
2135 -- if version is null, select the max version for the provided
2136 -- details. If max version does not exists assume version to be 0.0
2137 if (i_xslt_file_ver is null)
2138 then
2139 begin
2140 select max(version)
2141 into i_version
2142 from ecx_files
2143 where application_code = i_xslt_application_code
2144 and name = i_xslt_file_name
2145 and type = 'XSLT';
2146 exception
2147 when others then
2148 i_version := 0.0;
2149 end;
2150 else
2151 i_version := to_number(i_xslt_file_ver,'999999999999999.999');
2152 end if;
2153
2154 -- get dtd information
2155 if (not (i_dtd_file_name is null) AND not (i_dtd_root_element is null))
2156 then
2157 open get_dtd;
2158 fetch get_dtd
2159 into l_dtd_payload;
2160 close get_dtd;
2161 end if;
2162
2163 -- convert i_xml_file from CLOB to DOMNode and set in ecx_utils.g_xmldoc
2164 l_parser := xmlparser.newParser;
2165
2166 if (l_dtd_payload is not null)
2167 then
2168 -- set the dtd in the parser instance
2169 xmlparser.parseDTDCLOB(l_parser, l_dtd_payload, i_dtd_root_element);
2170 xmlparser.setValidationMode (l_parser, true);
2171 l_doctype := xmlparser.getDocType (l_parser);
2172 xmlparser.setDocType (l_parser, l_doctype);
2173 end if;
2174
2175 xmlparser.parseCLOB(l_parser, i_xml_file);
2176
2177 l_xml_doc := xmlparser.getDocument(l_parser);
2178
2179 ecx_utils.g_xmldoc := xmlDOM.makeNode(l_xml_doc);
2180
2181 /* Bug #2517237 : Trim the Clob before writing the transformed xml */
2182 dbms_lob.trim(i_xml_file, 0);
2183 /* bug 10254870: Calling overloaded procedure by passing out parameter of type clob
2184 which will return transformed output */
2185 -- call transform_xml_with_xslt to do the transformation
2186 ecx_actions.transform_xml_with_xslt (i_xslt_file_name,
2187 i_version,
2188 i_xslt_application_code,
2189 i_xml_file
2190 );
2191 -- get the transformed xml from ecx_utils.g_xml_doc
2192 -- convert from DOMNode to clob and set it in original xmlfile
2193 /*bug 10254870: getting transformed i_xml_file clob and hence not required to copy from node to clob here */
2194 -- xmlDOM.writeToClob(ecx_utils.g_xmldoc, i_xml_file);
2195
2196 -- free all the used variables
2197 l_dtd_payload := null;
2198 xmlparser.freeParser(l_parser);
2199 if (not xmldom.isNull(ecx_utils.g_xmldoc)) then
2200 xmldom.freeDocument(xmldom.makeDocument(ecx_utils.g_xmldoc));
2201 end if;
2202 ecx_utils.g_logdir := null;
2203 ecx_utils.g_logfile := null;
2204 if (not xmldom.isNull(l_xml_doc))
2205 then
2206 xmldom.freeDocument(l_xml_doc);
2207 end if;
2208
2209 i_retcode := 0;
2210 i_retmsg := ecx_debug.getTranslatedMessage('ECX_XSLT_TRANSFORMED');
2211
2212 exception
2213 when ecx_utils.program_exit then
2214 i_retcode := ecx_utils.i_ret_code;
2215 i_retmsg := ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams);
2216
2217 -- free all the used variables
2218 l_dtd_payload := null;
2219 xmlparser.freeParser(l_parser);
2220 if (not xmldom.isNull(ecx_utils.g_xmldoc)) then
2221 xmldom.freeDocument(xmldom.makeDocument(ecx_utils.g_xmldoc));
2222 end if;
2223 ecx_utils.g_logdir := null;
2224 ecx_utils.g_logfile := null;
2225 ecx_utils.i_ret_code := 0;
2226 ecx_utils.i_errbuf := null;
2227 ecx_utils.i_errparams := null;
2228 if (not xmldom.isNull(l_xml_doc))
2229 then
2230 xmldom.freeDocument(l_xml_doc);
2231 end if;
2232 when others then
2233 i_retmsg:= SQLERRM || ' - ECX_STANDARD.PERFORM_XSLT_TRANSFORMATION';
2234 i_retcode := 2;
2235
2236 -- free all the used variables
2237 l_dtd_payload := null;
2238 xmlparser.freeParser(l_parser);
2239 if (not xmldom.isNull(ecx_utils.g_xmldoc)) then
2240 xmldom.freeDocument(xmldom.makeDocument(ecx_utils.g_xmldoc));
2241 end if;
2242 ecx_utils.g_logdir := null;
2243 ecx_utils.g_logfile := null;
2244 ecx_utils.i_ret_code := 0;
2245 ecx_utils.i_errbuf := null;
2246 ecx_utils.i_errparams := null;
2247 if (not xmldom.isNull(l_xml_doc))
2248 then
2249 xmldom.freeDocument(l_xml_doc);
2250 end if;
2251 end perform_xslt_transformation;
2252
2253
2254
2255 /** bug 3357213 */
2256 -- -------------------------------------------------------------------------------------------
2257 -- API name : GET_VALUE_FOR_XPATH
2258 --
2259 -- Type : Public
2260 --
2261 -- Pre-reqs : None
2262 --
2263 -- Function : Returns Value of the Node from the XML Document for the specified XPATH.
2264 -- Incase of multiple occurrences, a list of comma-separated values is returned
2265 --
2266 -- Parameters
2267 -- IN : p_api_version IN NUMBER
2268 -- : p_XML_DOCUMENT IN CLOB
2269 -- : p_XPATH_EXPRESSION IN VARCHAR2
2270 --
2271 -- OUT : x_return_status OUT VARCHAR2
2272 -- : x_msg_data OUT VARCHAR2
2273 -- : x_XPATH_VALUE OUT VARCHAR2
2274 --
2275 -- Version : Current version 1.0
2276 -- Initial version 1.0
2277 --
2278 -- Notes :
2279 --
2280 -- -------------------------------------------------------------------------------------------
2281
2282 PROCEDURE GET_VALUE_FOR_XPATH (
2283 p_api_version IN NUMBER,
2284 x_return_status OUT NOCOPY VARCHAR2,
2285 x_msg_data OUT NOCOPY VARCHAR2,
2286 p_XML_DOCUMENT IN CLOB,
2287 p_XPATH_EXPRESSION IN VARCHAR2,
2288 x_XPATH_VALUE OUT NOCOPY VARCHAR2
2289 )
2290 IS
2291 l_api_version CONSTANT NUMBER := 1.0;
2292 l_api_name CONSTANT VARCHAR2(30) := 'GET_VALUE_FOR_XPATH';
2293
2294 l_parser XMLPARSER.PARSER;
2295 l_dom_document XMLDOM.DOMDOCUMENT;
2296 l_node_list XMLDOM.DOMNODELIST;
2297 l_node XMLDOM.DOMNODE;
2298
2299 INVALID_NODE_IN_NODELIST EXCEPTION;
2300 BEGIN
2301 -- Standard call to check for call compatibility
2302 IF NOT fnd_api.Compatible_API_Call ( l_api_version, p_api_version, l_api_name, G_PKG_NAME )
2303 THEN RAISE fnd_api.G_EXC_UNEXPECTED_ERROR;
2304 END IF;
2305
2306 --Initialize API return status to success
2307 x_return_status := FND_API.G_RET_STS_SUCCESS;
2308
2309 --Associate a new instance of XML Parser
2310 l_parser := XMLPARSER.newParser;
2311
2312 --Attach the XML Clob to the XML Parser
2313 XMLPARSER.parseClob(l_parser, p_XML_DOCUMENT);
2314
2315 --Obtain the XML Clob in DOM Document Format
2316 l_dom_document := XMLPARSER.getDocument(l_parser);
2317 XMLParser.freeParser(l_parser);
2318
2319 --Obtain the nodes, present at the location specified by the XPATH Expression
2320 l_node_list := XSLPROCESSOR.selectNodes(XMLDOM.makeNode(l_dom_document),p_XPATH_EXPRESSION);
2321
2322 FOR i IN 1..XMLDOM.getLength(l_node_list) LOOP
2323 -- Fetch node with index (i-1) from nodelist
2324 l_node := XMLDOM.ITEM(l_node_list, i-1);
2325
2326 --If no nodes are present raise error
2327 IF (XMLDOM.isNull(l_node)) THEN
2328 RAISE INVALID_NODE_IN_NODELIST;
2329 END IF;
2330
2331 --Check if current node has any child nodes
2332 IF XMLDOM.hasChildNodes(l_node) THEN
2333 l_node := XMLDOM.getFirstChild(l_node);
2334 LOOP
2335 IF XMLDOM.getNodeType(l_node) = XMLDOM.TEXT_NODE THEN
2336 -- Append x_XPATH_VALUE with Previous x_XPATH_VALUE and
2337 -- include a comma at the end to generate a list of comma separated values.
2338 x_XPATH_VALUE := x_XPATH_VALUE || TRIM(XMLDOM.getNodeValue(l_node)) || ',';
2339 EXIT;
2340 END IF;
2341
2342 l_node := XMLDOM.getNextSibling(l_node);
2343 EXIT WHEN XMLDOM.isNull(l_node);
2344 END LOOP;
2345 END IF;
2346
2347 END LOOP;
2348
2349 --Removing the extra comma from the end of the string
2350 x_XPATH_VALUE := SUBSTR(x_XPATH_VALUE, 0, LENGTH(x_XPATH_VALUE)-1);
2351 XMLDOM.freeDocument(l_dom_document);
2352
2353 EXCEPTION
2354 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2355 x_XPATH_VALUE := NULL;
2356 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2357
2358 x_msg_data := 'G_EXC_UNEXPECTED_ERROR';
2359 fnd_message.Set_Name( 'EDR', 'EDR_PLS_STDMSG_GENERATED' );
2360 fnd_message.Set_Token( 'ERR_CODE', SQLCODE );
2361 fnd_message.Set_Token( 'ERR_MESG', SQLERRM );
2362 fnd_msg_pub.Add;
2363
2364 WHEN INVALID_NODE_IN_NODELIST THEN
2365 x_XPATH_VALUE := NULL;
2366 x_return_status := FND_API.G_RET_STS_ERROR;
2367
2368 x_msg_data := 'INVALID_NODE_IN_NODELIST';
2369 fnd_message.Set_Name( 'EDR', 'EDR_PLS_STDMSG_GENERATED' );
2370 fnd_message.Set_Token( 'ERR_CODE', SQLCODE );
2371 fnd_message.Set_Token( 'ERR_MESG', SQLERRM );
2372 fnd_msg_pub.Add;
2373
2374 WHEN OTHERS THEN
2375 x_XPATH_VALUE := NULL;
2376 IF SQLCODE = PROCESSOR_ERR THEN
2377 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2378
2379 x_msg_data := 'PROCESSOR_ERR';
2380 fnd_message.Set_Name( 'EDR', 'EDR_PLS_STDMSG_GENERATED' );
2381 fnd_message.Set_Token( 'ERR_CODE', SQLCODE );
2382 fnd_message.Set_Token( 'ERR_MESG', SQLERRM );
2383 fnd_msg_pub.Add;
2384 ELSIF SQLCODE = NULL_ERR THEN
2385 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2386
2387 x_msg_data := 'NULL_ERR';
2388 fnd_message.Set_Name( 'EDR', 'EDR_PLS_STDMSG_GENERATED' );
2389 fnd_message.Set_Token( 'ERR_CODE', SQLCODE );
2390 fnd_message.Set_Token( 'ERR_MESG', SQLERRM );
2391 fnd_msg_pub.Add;
2392 ELSE
2393 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2394
2395 x_msg_data := 'EDR_PLS_STDMSG_UNEXPECTED';
2396 fnd_message.Set_Name( 'EDR', 'EDR_PLS_STDMSG_GENERATED' );
2397 fnd_message.Set_Token( 'ERR_CODE', SQLCODE );
2398 fnd_message.Set_Token( 'ERR_MESG', SQLERRM );
2399 fnd_msg_pub.Add;
2400 END IF;
2401 END GET_VALUE_FOR_XPATH;
2402
2403 /** bug 3357213 */
2404
2405 end ecx_standard;