[Home] [Help]
PACKAGE BODY: APPS.WF_WS_GEN
Source
1 package body WF_WS_GEN as
2 /* $Header: WFWSGENB.pls 120.12 2006/06/14 22:43:40 jdang noship $ */
3
4
5 procedure create_derived_class_entry
6 (
7 p_base_class_id in number,
8 p_class_name in varchar2,
9 p_irep_name in varchar2,
10 p_created_by in pls_integer,
11 p_creation_date in date,
12 p_security_group_id in number,
13 p_class_type in varchar2,
14 p_product_code in varchar,
15 p_implementation_name in varchar2,
16 p_deployed_flag in varchar2,
17 p_generated_flag in varchar2,
18 p_compatibility_flag in varchar,
19 p_assoc_class_id in pls_integer,
20 p_scope_type in varchar,
21 p_lifecycle_mode in varchar,
22 p_source_file_product in varchar,
23 p_source_file_path in varchar,
24 p_source_file_name in varchar,
25 p_source_file_version in varchar,
26 p_description in varchar,
27 p_xml_description in clob,
28 p_standard_type in varchar,
29 p_standard_version in varchar,
30 p_standard_spec in varchar2,
31 p_load_err in varchar2,
32 p_load_err_msgs in varchar2,
33 p_open_interface_flag in varchar2,
34 p_map_code in varchar2,
35 p_class_id_out OUT NOCOPY pls_integer,
36 p_err_code OUT NOCOPY pls_integer,
37 p_err_message OUT NOCOPY varchar2
38 ) ;
39
40 procedure create_class_lang_entries
41 (
42 p_base_class_id in number,
43 p_class_id in number,
44 p_err_code OUT NOCOPY pls_integer,
45 p_err_message OUT NOCOPY varchar2
46 );
47
48
49 procedure create_class_language
50 (
51 p_class_id in number,
52 p_language in varchar2,
53 p_source_lang in varchar2,
54 p_display_name in varchar2,
55 p_short_description in varchar2,
56 p_security_group_id in number,
57 p_err_code OUT NOCOPY pls_integer,
58 p_err_message OUT NOCOPY varchar2
59 ) ;
60
61
62 procedure create_derived_method_entry
63 (
64 p_function_name in varchar,
65 p_application_id in number,
66 p_form_id in number,
67 p_parameters in varchar2,
68 p_creation_date in date,
69 p_created_by in pls_integer,
70 p_type in varchar2,
71 p_web_host_name in varchar2,
72 p_web_agent_name in varchar2,
73 p_web_html_call in varchar2,
74 p_web_encrypt_parameters in varchar2,
75 p_web_secured in varchar2,
76 p_web_icon in varchar2,
77 p_object_id in pls_integer,
78 p_region_application_id in pls_integer,
79 p_region_code in varchar2,
80 p_maintenance_mode_support in varchar2,
81 p_context_dependence in varchar2,
82 p_jrad_ref_path in varchar2,
83 p_irep_method_name in varchar2,
84 p_irep_overload_sequence in pls_integer,
85 p_irep_scope in varchar2,
86 p_irep_lifecycle in varchar2,
87 p_irep_description in clob,
88 p_irep_compatibility in varchar2,
89 p_irep_inbound_xml_desc in clob,
90 p_irep_outbound_xml_desc in clob,
91 p_irep_synchro in varchar2,
92 p_irep_direction in varchar2,
93 p_irep_assoc_function_name in varchar2,
94 p_irep_class_id in pls_integer,
95 p_base_function_id in number,
96 p_err_code OUT NOCOPY pls_integer,
97 p_err_message OUT NOCOPY varchar2
98 ) ;
99
100 procedure create_function_lang_entries
101 (
102 p_base_function_id in number,
103 p_function_id in number,
104 p_err_code OUT NOCOPY pls_integer,
105 p_err_message OUT NOCOPY varchar2
106 );
107
108
109 procedure create_function_language
110 (
111 p_function_id in number,
112 p_language in varchar2,
113 p_user_function_name in varchar2,
114 p_description in varchar2,
115 p_source_lang in varchar2,
116 p_err_code OUT NOCOPY pls_integer,
117 p_err_message OUT NOCOPY varchar2
118 ) ;
119
120 procedure create_xmlg_schema
121 (
122 p_clob OUT NOCOPY clob,
123 p_root_element in varchar,
124 p_product_code in varchar2,
125 p_direction in varchar,
126 p_port_type in varchar,
127 p_operation in varchar,
128 p_err_code OUT NOCOPY pls_integer,
129 p_err_message OUT NOCOPY varchar2
130 ) ;
131
132 procedure to_upper
133 (
134 p_name in varchar2,
135 p_new_name OUT NOCOPY varchar2,
136 p_err_code OUT NOCOPY pls_integer,
137 p_err_message OUT NOCOPY varchar2
138 ) ;
139
140 procedure assign_business_entities
141 (
142 p_base_class_id in number,
143 p_derived_class_id in number,
144 p_err_code OUT NOCOPY pls_integer,
145 p_err_message OUT NOCOPY varchar2
146 ) ;
147 procedure ws_base_method_overload
148 (
149 p_function_id in number,
150 p_description in varchar2,
151 p_scope_type in varchar2,
152 p_irep_lifecycle in varchar2,
153 p_irep_compatibility_flag in varchar2,
154 p_err_code OUT NOCOPY pls_integer,
155 p_err_message OUT NOCOPY varchar2
156 );
157
158 procedure wf_ws_create
159 (
160 p_module_name in varchar,
161 p_err_code OUT NOCOPY pls_integer,
162 p_err_message OUT NOCOPY varchar2
163 )
164 is
165
166 cursor c_classes(c_module_name in varchar) is
167 select class_id,class_type
168 from fnd_irep_classes
169 where class_type = c_module_name ;
170
171 l_count pls_integer := 0;
172
173 begin
174 for c1 in c_classes(p_module_name)
175 loop
176 l_count := l_count + 1;
177 begin
178 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
179 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', 'Processing Base Class='||c1.class_id);
180 end if;
181
182 create_derived_entry(c1.class_id,p_err_code,p_err_message);
183
184 if ( p_err_code = -1 ) then
185 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
186 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', ' Error Code='||p_err_code||', Error Message='||p_err_message);
187 end if;
188 end if;
189 exception
190 when program_exit then
191 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
192 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', 'Error Code='||p_err_code||', Error Message='||p_err_message);
193 end if;
194 end;
195 end loop;
196
197 if l_count = 0 then
198
199 p_err_code := -1;
200 wf_core.token('Module',p_module_name);
201 p_err_message := wf_core.translate('WF_WS_MODULE_NO_ENTRIES');
202 else
203 p_err_code := 0;
204 wf_core.token('Module',p_module_name);
205 p_err_message := wf_core.translate('WF_WS_MODULE_SUCCESS');
206
207 end if;
208
209 exception
210 when program_exit then
211 null;
212 when others then
213 p_err_code := -1;
214 wf_core.token('Module',p_module_name);
215 wf_core.token('SqlErr',SQLERRM);
216 p_err_message := wf_core.translate('WF_WS_MODULE_FAILED');
217 end wf_ws_create;
218
219 procedure create_derived_entry
220 (
221 p_interface_irep_name IN varchar2,
222 p_err_code OUT NOCOPY pls_integer,
223 p_err_message OUT NOCOPY varchar2
224 )
225 is
226 cursor c_class_id(c_irep_class_name in varchar2) is
227 select class_id
228 from fnd_irep_classes
229 where irep_name = c_irep_class_name;
230
231 l_derived_interface_name varchar2(2000) := null;
232 l_count pls_integer := 0;
233
234 begin
235 l_derived_interface_name := 'WEBSERVICEDOC:'||p_interface_irep_name;
236
237 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
238 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', 'Derived Interface Name='||l_derived_interface_name);
239 end if;
240
241 for c1 in c_class_id(p_interface_irep_name)
242 loop
243 l_count := l_count + 1;
244 create_derived_entry(c1.class_id,p_err_code,p_err_message);
245 end loop;
246
247 if l_count = 0 then
248
249 p_err_code := -1;
250 wf_core.token('BaseInterface',p_interface_irep_name);
251 p_err_message := wf_core.translate('WF_WS_BASE_INTF_NOT_EXIST');
252
253 elsif ( p_err_code = -1 ) then
254 null;
255 else
256
257 p_err_code := 0;
258 p_err_message := wf_core.translate('WF_WS_SUCCESS');
259
260 end if;
261
262
263 exception
264 when program_exit then
265 raise program_exit;
266 when others then
267 p_err_code := -1;
268 p_err_message := SQLERRM;
269 raise;
270 end create_derived_entry;
271
272
273
274
275 /**
276 Procedure for creating a Web Service Entry for a given Base Entry Interface
277 **/
278 procedure create_derived_entry
279 (
280 p_base_class_id in pls_integer,
281 x_derived_class_id OUT NOCOPY pls_integer,
282 x_irep_name OUT NOCOPY varchar2,
283 p_err_code OUT NOCOPY pls_integer,
284 p_err_message OUT NOCOPY varchar2
285 )
286
287 is
288 cursor c_class(c_class_id in number) is
289 select count(*) l_count
290 from fnd_irep_classes
291 where class_id = c_class_id;
292
293 cursor c_class_name(c_class_id in number) is
294 select class_name ,irep_name
295 from fnd_irep_classes
296 where class_id = c_class_id;
297
298 c_class_rec c_class%ROWTYPE;
299
300 cursor c_methods(c_class_id in number) is
301 select function_id
302 from fnd_form_functions
303 where irep_class_id = c_class_id ;
304
305 method_count pls_integer := 0;
306 p_base_class_name varchar2(430) := null;
307 begin
308 if (p_base_class_id is null ) then
309 p_err_code := -1;
310 p_err_message := wf_core.translate('WF_WS_MISSING_CLASS_ID');
311 raise program_exit;
312 end if;
313
314 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
315 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', 'Process Class ID='||p_base_class_id);
316 end if;
317
318 open c_class(p_base_class_id);
319 fetch c_class into c_class_rec;
320 close c_class;
321
322 open c_class_name(p_base_class_id);
323 fetch c_class_name into p_base_class_name,x_irep_name;
324 close c_class_name;
325
326 if c_class_rec.l_count = 0 then
327 p_err_code := -1;
328 wf_core.token('BaseClassId',p_base_class_id);
329 p_err_message := wf_core.translate('WF_WS_BASE_CLASS_NOT_EXIST');
330 raise program_exit;
331 end if;
332
333 for c1 in c_methods(p_base_class_id)
334 loop
335 method_count := method_count + 1;
336
337 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
338 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', 'Processing FunctionID='||c1.function_id);
339 end if;
340
341
342 begin
343 create_derived_entry(p_base_class_id,c1.function_id,x_derived_class_id,p_err_code,p_err_message);
344 exception
345 when ignore_rec then
346 null;
347 when program_exit then
348 raise program_exit;
349 when others then
350 p_err_code := -1;
351 wf_core.token('BaseClassId',p_base_class_id);
352 wf_core.token('BaseClassName', p_base_class_name);
353 wf_core.token('FunctionId',c1.function_id);
354 wf_core.token('SqlErr',SQLERRM);
355 p_err_message := wf_core.translate('WF_WS_CLASS_FUNC_ITER');
356 raise program_exit;
357 end;
358
359 end loop;
360
361 wf_core.token('BaseClassId',p_base_class_id);
362 wf_core.token('BaseClassName', p_base_class_name);
363 if (method_count = 0 ) then
364 p_err_code := -1;
365 p_err_message := wf_core.translate('WF_WS_NO_BASE_METHODS');
366 elsif ( method_count > 0 ) then
367 p_err_code := 0;
368 p_err_message := wf_core.translate('WF_WS_SUCCESS');
369 end if;
370
371 exception
372 when program_exit then
373 null;
374 when others then
375 p_err_code := -1;
376 wf_core.token('BaseClassId',p_base_class_id);
377 wf_core.token('BaseClassName', p_base_class_name);
378 wf_core.token('SqlErr',SQLERRM);
379 p_err_message := wf_core.translate('WF_WS_CLASS_DERIVED');
380 end create_derived_entry;
381
382
383 /**
384 Procedure for creating a Web Service Entry for a given Base Entry
385 This will create the derived entries by grouping for XMLGateway
386 **/
387 procedure create_derived_entry
388 (
389 p_base_class_id in pls_integer,
390 p_base_function_id in pls_integer,
391 l_derived_class_id OUT NOCOPY pls_integer,
392 p_err_code OUT NOCOPY pls_integer,
393 p_err_message OUT NOCOPY varchar2
394 )
395
396 is
397
398 cursor c_base_class_entry(c_base_class_id in number) is
399 select *
400 from fnd_irep_classes_vl
401 where class_id = c_base_class_id;
402
403 c_base_class_entry_rec c_base_class_entry%ROWTYPE;
404
405 cursor c_base_function_entry(c_base_function_id in number) is
406 select *
407 from fnd_form_functions_vl
408 where function_id = c_base_function_id;
409
410 c_base_function_entry_rec c_base_function_entry%ROWTYPE;
411
412 i_function_name varchar2(2000) :=null;
413 i_port_type varchar2(2000) := null;
414 i_operation varchar2(2000) := null;
415 i_delimitor pls_integer;
416 i_delimitor2 pls_integer;
417 i_derived_class_name varchar2(2000) := null;
418 i_xmlg_prefix varchar2(2000) := null;
419 i_root_element varchar2(255) := null;
420
421 -- l_derived_class_id pls_integer;
422 in_xml clob := null;
423 out_xml clob := null;
424
425 begin
426 /**Get the base entry**
427 **If its XML Gateway then care about grouping otherwise don't**
428 **/
429
430
431 if ( (p_base_class_id is null) or (p_base_function_id is null)) then
432 p_err_code := -1;
433 p_err_message := wf_core.translate('WF_WS_MISSING_CLASS_FUNC_ID');
434 raise program_exit;
435 end if;
436
437
438 /*Get the Base Entry class**/
439 open c_base_class_entry(p_base_class_id);
440 fetch c_base_class_entry into c_base_class_entry_rec;
441
442 if c_base_class_entry%NOTFOUND then
443
444 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
445 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', 'Base Class ID='||p_base_class_id||' does not exist');
446 end if;
447
448 p_err_code := -1;
449 p_err_message := wf_core.translate('WF_WS_BASE_CLASS_NOT_EXIST');
450 raise program_exit;
451
452 elsif c_base_class_entry%FOUND then
453
454
455 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
456 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', 'Base Class ID='||p_base_class_id||' exists');
457 end if;
458
459 open c_base_function_entry(p_base_function_id);
460 fetch c_base_function_entry into c_base_function_entry_rec;
461
462 if c_base_function_entry%FOUND then
463
464 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
465 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', 'Base Function='||p_base_function_id||' exist');
466 end if;
467
468 if ( c_base_function_entry_rec.irep_class_id <> p_base_class_id ) then
469 p_err_code :=-1;
470 p_err_message := wf_core.translate('WF_WS_CLASS_FUNC_MISMATCH');
471 raise program_exit;
472 end if;
473
474 if ( c_base_class_entry_rec.scope_type = 'PUBLIC' AND c_base_function_entry_rec.irep_scope = 'PUBLIC' ) then
475
476 if ( c_base_class_entry_rec.class_type = 'XMLGATEWAY' ) then
477
478 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
479 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', 'Class Type:XMLGATEWAY ');
480 end if;
481
482 if ( upper(c_base_function_entry_rec.irep_direction) = 'O' ) then
483
484 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
485 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', 'Ignoring Outbound Entry ');
486 end if;
487
488
489 p_err_code :=-1;
490 p_err_message := wf_core.translate('WF_WS_XMLG_OUTBOUND');
491 raise ignore_rec;
492 end if;
493
494 /**
495 Base
496 class Name irep_name
497 XMLGATEWAY:AR:PROCESS_INVOICE AR:PROCESS_INVOICE
498
499 Function Name
500 XMLGATEWAY:AR:PROCESS_INVOICE:PROCESS_INVOICE PROCESS_INVOICE
501
502 Derived
503 WEBSERVICEDOC:oracle.apps.ar.Ar.ProcessInvoice oracle.apps.ar.Ar
504
505 Function Name
506 WEBSERVICEDOC:oracle.apps.ar.Ar.ProcessInvoice.ProcessInvoice oracle.apps.ar.Ar.ProcessInvoice
507 **/
508
509 i_function_name := c_base_class_entry_rec.irep_name;
510
514
511 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
512 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', 'Function Name='||c_base_function_entry_rec.function_name||', Irep Name='||i_function_name );
513 end if;
515 i_delimitor := instr(i_function_name,':',1);
516 --i_delimitor2 := instr(c_base_function_entry_rec.function_name,':',1,2);
517
518
519 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
520 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', 'Delimitor1 ='||i_delimitor||', Delimitor2='||i_delimitor2 );
521 end if;
522
523
524 if ( i_delimitor <> 0 ) then
525
526 i_port_type := substr(i_function_name,1,i_delimitor-1);
527 i_port_type := replace(initcap(i_port_type),'_','');
528 i_operation := substr(i_function_name,i_delimitor+1,length(i_function_name)-i_delimitor);
529 i_operation := replace(initcap(i_operation),'_','');
530
531 i_xmlg_prefix := 'oracle.apps.'||lower(c_base_class_entry_rec.product_code);
532 i_derived_class_name :=i_xmlg_prefix||'.'||i_port_type||'.'||i_operation;
533
534 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
535 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry','Port Type='||i_port_type||',Operation='||i_operation);
536 end if;
537
538 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
539 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry','Description='||c_base_class_entry_rec.description);
540 end if;
541
542 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
543 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry','Method Description='||c_base_function_entry_rec.irep_description);
544 end if;
545
546 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
547 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry','Derived Class Name='||i_derived_class_name);
548 end if;
549
550 create_derived_class_entry
551 (
552 c_base_class_entry_rec.class_id,
553 'WEBSERVICEDOC:'||i_derived_class_name,
554 i_derived_class_name,
555 c_base_class_entry_rec.created_by,
556 c_base_class_entry_rec.creation_date,
557 c_base_class_entry_rec.security_group_id,
558 'WEBSERVICEDOC',
559 c_base_class_entry_rec.product_code,
560 c_base_class_entry_rec.implementation_name,
561 c_base_class_entry_rec.deployed_flag,
562 c_base_class_entry_rec.generated_flag,
563 c_base_class_entry_rec.compatibility_flag,
564 c_base_class_entry_rec.class_id,
565 c_base_class_entry_rec.scope_type,
566 c_base_class_entry_rec.lifecycle_mode,
567 c_base_class_entry_rec.source_file_product,
568 c_base_class_entry_rec.source_file_path,
569 c_base_class_entry_rec.source_file_name,
570 c_base_class_entry_rec.source_file_version,
571 c_base_class_entry_rec.description,
572 c_base_class_entry_rec.xml_description,
573 c_base_class_entry_rec.standard_type,
574 c_base_class_entry_rec.standard_version,
575 c_base_class_entry_rec.standard_spec,
576 null,
577 null,
578 null,
579 c_base_class_entry_rec.map_code,
580 l_derived_class_id,
581 p_err_code,
582 p_err_message
583 );
584
585 /**
586 assign_business_entities
587 (
588 c_base_class_entry_rec.class_id,
589 l_derived_class_id,
590 p_err_code,
591 p_err_message);
592 **/
593
594 /**
595 1.Description for the Class/description and
596 user function is an issue for XMLG entries
597 2.Get the new field for root element
598 **/
599 get_root_element
600 (
601 c_base_class_entry_rec.map_code,
602 i_root_element,
603 p_err_code,
604 p_err_message
605 );
606
607 if c_base_function_entry_rec.irep_inbound_xml_description is null then
608 create_xmlg_schema
609 (
610 in_xml,
611 i_root_element,
612 c_base_class_entry_rec.product_code,
613 'IN',
614 i_port_type,
615 i_operation,
616 p_err_code,
617 p_err_message
618 );
619 else
620 in_xml :=c_base_function_entry_rec.irep_inbound_xml_description;
621 end if;
622
623 if c_base_function_entry_rec.irep_outbound_xml_description is null then
624 create_xmlg_schema
625 (
626 out_xml,
627 i_root_element,
628 c_base_class_entry_rec.product_code,
629 'OUT',
630 i_port_type,
631 i_operation,
632 p_err_code,
633 p_err_message
634 );
635 else
636 out_xml :=c_base_function_entry_rec.irep_outbound_xml_description;
637 end if;
638
639 create_derived_method_entry
640 (
641 'WEBSERVICEDOC:'||i_derived_class_name||':'||i_operation,
642 c_base_function_entry_rec.application_id,
643 c_base_function_entry_rec.form_id,
647 c_base_function_entry_rec.type,
644 c_base_function_entry_rec.parameters,
645 c_base_function_entry_rec.creation_date,
646 c_base_function_entry_rec.created_by,
648 c_base_function_entry_rec.web_host_name,
649 c_base_function_entry_rec.web_agent_name,
650 c_base_function_entry_rec.web_html_call,
651 c_base_function_entry_rec.web_encrypt_parameters,
652 c_base_function_entry_rec.web_secured,
653 c_base_function_entry_rec.web_icon,
654 c_base_function_entry_rec.object_id,
655 c_base_function_entry_rec.region_application_id,
656 c_base_function_entry_rec.region_code,
657 c_base_function_entry_rec.maintenance_mode_support,
658 c_base_function_entry_rec.context_dependence,
659 c_base_function_entry_rec.jrad_ref_path,
660 i_derived_class_name||'.'||i_operation,
661 c_base_function_entry_rec.irep_overload_sequence,
662 c_base_function_entry_rec.irep_scope,
663 c_base_function_entry_rec.irep_lifecycle,
664 c_base_function_entry_rec.irep_description,
665 c_base_function_entry_rec.irep_compatibility,
666 in_xml,
667 out_xml,
668 c_base_function_entry_rec.irep_synchro,
669 c_base_function_entry_rec.irep_direction,
670 c_base_function_entry_rec.function_name,
671 l_derived_class_id,
672 p_base_function_id,
673 p_err_code,
674 p_err_message
675 );
676
677 else
678 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
679 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', 'Invalid Function Name does not have : ');
680 end if;
681
682 p_err_code := -1;
683 p_err_message :=wf_core.translate('WF_WS_XMLG_INVALID_ENTRY');
684 end if;
685
686 elsif ( c_base_class_entry_rec.class_type = 'SERVICEBEAN') then
687
688 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
689 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', 'Class Type:SERVICEBEAN ');
690 end if;
691
692 i_function_name := c_base_class_entry_rec.irep_name;
693
694
695
696 i_port_type := i_function_name;
697 i_derived_class_name := i_port_type;
698
699 i_operation := c_base_function_entry_rec.irep_method_name;
700 dbms_output.put_line('I_Operation='||i_operation||'x');
701 dbms_output.put_line('I_Operation length='||length(i_operation)||'x');
702 if ( (i_operation is null ) or (length(i_operation) is NULL ) ) then
703 p_err_code := -1;
704 p_err_message :=wf_core.translate('WF_WS_MISSING_IREP_METHOD_NAME');
705 raise program_exit;
706 end if;
707
708 create_derived_class_entry
709 (
710 c_base_class_entry_rec.class_id,
711 'WEBSERVICEDOC:'||i_derived_class_name,
712 i_derived_class_name,
713 c_base_class_entry_rec.created_by,
714 c_base_class_entry_rec.creation_date,
715 c_base_class_entry_rec.security_group_id,
716 'WEBSERVICEDOC',
717 c_base_class_entry_rec.product_code,
718 c_base_class_entry_rec.implementation_name,
719 c_base_class_entry_rec.deployed_flag,
720 c_base_class_entry_rec.generated_flag,
721 c_base_class_entry_rec.compatibility_flag,
722 c_base_class_entry_rec.class_id,
723 c_base_class_entry_rec.scope_type,
724 c_base_class_entry_rec.lifecycle_mode,
725 c_base_class_entry_rec.source_file_product,
726 c_base_class_entry_rec.source_file_path,
727 c_base_class_entry_rec.source_file_name,
728 c_base_class_entry_rec.source_file_version,
729 c_base_class_entry_rec.description,
730 c_base_class_entry_rec.xml_description,
731 c_base_class_entry_rec.standard_type,
732 c_base_class_entry_rec.standard_version,
733 c_base_class_entry_rec.standard_spec,
734 null,
735 null,
736 null,
737 c_base_class_entry_rec.map_code,
738 l_derived_class_id,
739 p_err_code,
740 p_err_message
741 );
742 /**
743 assign_business_entities
744 (
745 c_base_class_entry_rec.class_id,
746 l_derived_class_id,
747 p_err_code,
748 p_err_message
749 );
750 **/
751
752
753 /**What should be the value for description and user_function in method tl table**/
754 i_operation := upper(substr(i_operation,0,1))||substr(i_operation,2,length(i_operation));
755 create_derived_method_entry
756 (
757 'WEBSERVICEDOC:'||i_derived_class_name||':'||i_operation,
758 c_base_function_entry_rec.application_id,
759 c_base_function_entry_rec.form_id,
760 c_base_function_entry_rec.parameters,
761 c_base_function_entry_rec.creation_date,
762 c_base_function_entry_rec.created_by,
763 c_base_function_entry_rec.type,
764 c_base_function_entry_rec.web_host_name,
765 c_base_function_entry_rec.web_agent_name,
766 c_base_function_entry_rec.web_html_call,
767 c_base_function_entry_rec.web_encrypt_parameters,
768 c_base_function_entry_rec.web_secured,
769 c_base_function_entry_rec.web_icon,
770 c_base_function_entry_rec.object_id,
771 c_base_function_entry_rec.region_application_id,
772 c_base_function_entry_rec.region_code,
773 c_base_function_entry_rec.maintenance_mode_support,
774 c_base_function_entry_rec.context_dependence,
775 c_base_function_entry_rec.jrad_ref_path,
776 i_operation,
777 c_base_function_entry_rec.irep_overload_sequence,
778 c_base_function_entry_rec.irep_scope,
779 c_base_function_entry_rec.irep_lifecycle,
780 c_base_function_entry_rec.irep_description,
784 c_base_function_entry_rec.irep_synchro,
781 c_base_function_entry_rec.irep_compatibility,
782 c_base_function_entry_rec.irep_inbound_xml_description,
783 c_base_function_entry_rec.irep_outbound_xml_description,
785 c_base_function_entry_rec.irep_direction,
786 c_base_function_entry_rec.function_name,
787 l_derived_class_id,
788 p_base_function_id,
789 p_err_code,
790 p_err_message
791 );
792
793 end if;
794 else
795 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
796 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', 'ClassID,FunctionID:'||c_base_class_entry_rec.class_id||','||c_base_function_entry_rec.function_id||' Not a public interface/method to be exposed');
797 end if;
798
799 p_err_code := -1;
800 p_err_message := wf_core.translate('WF_WS_NOT_PUBLIC');
801 raise program_exit;
802 end if;
803 else
804 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
805 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.create_derived_entry', ' No records found for FunctionID='||c_base_function_entry_rec.function_id);
806 end if;
807
808 p_err_code := -1;
809 p_err_message := wf_core.translate('WF_WS_BASE_FUNC_NOT_EXIST');
810 raise program_exit;
811 end if;
812
813 close c_base_function_entry;
814 end if;
815
816 close c_base_class_entry;
817
818 p_err_code := 0;
819 wf_core.token('ClassId',p_base_class_id);
820 p_err_message :=wf_core.translate('WF_WS_SUCCESS');
821
822 exception
823 when ignore_rec then
824 raise ignore_rec;
825 when program_exit then
826 raise program_exit;
827 when others then
828 p_err_code := -1;
829 p_err_message :=wf_core.translate('WF_WS_GENERIC_CLASS_ERROR')||'Error in Creating Derived Entry for Base FUNCTION_ID='||p_base_function_id||SQLERRM;
830 raise program_exit;
831 end create_derived_entry;
832
833 procedure create_derived_class_entry
834 (
835 p_base_class_id in number,
836 p_class_name in varchar2,
837 p_irep_name in varchar2,
838 p_created_by in pls_integer,
839 p_creation_date in date,
840 p_security_group_id in number,
841 p_class_type in varchar2,
842 p_product_code in varchar,
843 p_implementation_name in varchar2,
844 p_deployed_flag in varchar2,
845 p_generated_flag in varchar2,
846 p_compatibility_flag in varchar,
847 p_assoc_class_id in pls_integer,
848 p_scope_type in varchar,
849 p_lifecycle_mode in varchar,
850 p_source_file_product in varchar,
851 p_source_file_path in varchar,
852 p_source_file_name in varchar,
853 p_source_file_version in varchar,
854 p_description in varchar,
855 p_xml_description in clob,
856 p_standard_type in varchar,
857 p_standard_version in varchar,
858 p_standard_spec in varchar2,
859 p_load_err in varchar2,
860 p_load_err_msgs in varchar2,
861 p_open_interface_flag in varchar2,
862 p_map_code in varchar2,
863 p_class_id_out OUT NOCOPY pls_integer,
864 p_err_code OUT NOCOPY pls_integer,
865 p_err_message OUT NOCOPY varchar2
866 )
867 is
868 cursor c_derived_class(c_class_name in varchar) is
869 select *
870 from fnd_irep_classes
871 where class_name = c_class_name
872 and class_type = 'WEBSERVICEDOC'
873 for update ;
874
875 cursor c_irep_class_id is
876 select fnd_objects_s.nextval
877 from dual;
878
879 l_class_id number;
880
881
882 c_derived_class_rec c_derived_class%ROWTYPE;
883
884 begin
885
886 if ( (p_class_name is null) or (p_base_class_id is null) ) then
887 p_err_code := -1;
888 p_err_message := wf_core.translate('WF_WS_CLASS_NAME_IS_NULL');
889 raise program_exit;
890 end if;
891
892 open c_derived_class(p_class_name);
893 fetch c_derived_class into c_derived_class_rec;
894
895 if c_derived_class%NOTFOUND then
896
897 begin
898
899 open c_irep_class_id;
900 fetch c_irep_class_id into l_class_id;
901 close c_irep_class_id;
902
903 insert into FND_IREP_CLASSES
904 (
905 CLASS_ID,
906 CLASS_NAME,
907 IREP_NAME,
908 CREATED_BY,
909 CREATION_DATE,
910 LAST_UPDATED_BY,
911 LAST_UPDATE_DATE,
912 LAST_UPDATE_LOGIN,
913 SECURITY_GROUP_ID,
914 CLASS_TYPE,
915 PRODUCT_CODE,
916 IMPLEMENTATION_NAME,
917 DEPLOYED_FLAG,
918 GENERATED_FLAG,
919 COMPATIBILITY_FLAG,
920 ASSOC_CLASS_ID,
921 SCOPE_TYPE,
922 LIFECYCLE_MODE,
923 SOURCE_FILE_PRODUCT,
924 SOURCE_FILE_PATH,
925 SOURCE_FILE_NAME,
926 SOURCE_FILE_VERSION,
927 DESCRIPTION,
928 XML_DESCRIPTION,
929 STANDARD_TYPE,
930 STANDARD_VERSION,
931 STANDARD_SPEC,
932 LOAD_ERR,
933 LOAD_ERR_MSGS,
934 OPEN_INTERFACE_FLAG,
935 MAP_CODE
936 )
937 values
938 (
939 l_class_id,
940 p_class_name,
941 p_irep_name,
942 0,
943 sysdate,
944 0,
945 sysdate,
946 0,
947 0,
948 'WEBSERVICEDOC',
949 p_product_code,
950 p_implementation_name,
951 'Y', -- p_deployed_flag,
952 p_generated_flag,
953 p_compatibility_flag,
954 p_assoc_class_id,
955 p_scope_type,
956 p_lifecycle_mode,
957 p_source_file_product,
958 p_source_file_path,
959 p_source_file_name,
960 p_source_file_version,
961 p_description,
965 p_standard_spec,
962 p_xml_description,
963 p_standard_type,
964 p_standard_version,
966 p_load_err,
967 p_load_err_msgs,
968 p_open_interface_flag,
969 p_map_code
970 );
971
972 create_class_lang_entries
973 (
974 p_base_class_id ,
975 l_class_id ,
976 p_err_code,
977 p_err_message
978 );
979
980 exception
981 when program_exit then
982 raise program_exit;
983 when others then
984 p_err_code := -1;
985 p_err_message := wf_core.translate('WF_WS_CLASS_INSERT')||SQLERRM;
986 end;
987
988 p_class_id_out := l_class_id;
989
990 elsif c_derived_class%FOUND then
991 --Update the existing record
992
993 begin
994 update fnd_irep_classes
995 set irep_name = p_irep_name,
996 last_updated_by = 0,
997 last_update_date = sysdate,
998 last_update_login = 0,
999 security_group_id = p_security_group_id,
1000 class_type = p_class_type,
1001 product_code = p_product_code,
1002 implementation_name = p_implementation_name,
1003 deployed_flag = 'Y', -- p_deployed_flag,
1004 generated_flag = p_generated_flag,
1005 compatibility_flag = p_compatibility_flag,
1006 assoc_class_id = p_assoc_class_id,
1007 scope_type = p_scope_type,
1008 lifecycle_mode = p_lifecycle_mode,
1009 source_file_product = p_source_file_product,
1010 source_file_path = p_source_file_path,
1011 source_file_name = p_source_file_name,
1012 source_file_version = p_source_file_version,
1013 description = p_description,
1014 xml_description = p_xml_description,
1015 standard_type = p_standard_type,
1016 standard_version = p_standard_version,
1017 standard_spec = p_standard_spec,
1018 load_err = p_load_err,
1019 load_err_msgs = p_load_err_msgs,
1020 open_interface_flag = p_open_interface_flag
1021
1022 where current of c_derived_class;
1023
1024 create_class_lang_entries
1025 (
1026 p_base_class_id ,
1027 c_derived_class_rec.class_id ,
1028 p_err_code,
1029 p_err_message
1030 );
1031 exception
1032 when program_exit then
1033 raise program_exit;
1034 when others then
1035 p_err_code := -1;
1036 p_err_message := wf_core.translate('WF_WS_CLASS_UPDATE')||SQLERRM;
1037 end;
1038
1039 p_class_id_out := c_derived_class_rec.class_id;
1040 end if;
1041
1042 close c_derived_class;
1043
1044 p_err_code := 0;
1045 p_err_message := wf_core.translate('WF_WS_SUCCESS');
1046 exception
1047 when program_exit then
1048 raise program_exit;
1049 when others then
1050 p_err_code := -1;
1051 wf_core.token('BaseClassName',p_class_name);
1052 wf_core.token('SqlErr',SQLERRM);
1053 p_err_message := wf_core.translate('WF_WS_CLASS_CREATE');
1054 raise program_exit;
1055 end create_derived_class_entry;
1056
1057
1058 procedure create_derived_method_entry
1059 (
1060 p_function_name in varchar,
1061 p_application_id in number,
1062 p_form_id in number,
1063 p_parameters in varchar2,
1064 p_creation_date in date,
1065 p_created_by in pls_integer,
1066 p_type in varchar2,
1067 p_web_host_name in varchar2,
1068 p_web_agent_name in varchar2,
1069 p_web_html_call in varchar2,
1070 p_web_encrypt_parameters in varchar2,
1071 p_web_secured in varchar2,
1072 p_web_icon in varchar2,
1073 p_object_id in pls_integer,
1074 p_region_application_id in pls_integer,
1075 p_region_code in varchar2,
1076 p_maintenance_mode_support in varchar2,
1077 p_context_dependence in varchar2,
1078 p_jrad_ref_path in varchar2,
1079 p_irep_method_name in varchar2,
1080 p_irep_overload_sequence in pls_integer,
1081 p_irep_scope in varchar2,
1082 p_irep_lifecycle in varchar2,
1083 p_irep_description in clob,
1084 p_irep_compatibility in varchar2,
1085 p_irep_inbound_xml_desc in clob,
1086 p_irep_outbound_xml_desc in clob,
1087 p_irep_synchro in varchar2,
1088 p_irep_direction in varchar2,
1089 p_irep_assoc_function_name in varchar2,
1090 p_irep_class_id in pls_integer,
1091 p_base_function_id in number,
1092 p_err_code OUT NOCOPY pls_integer,
1093 p_err_message OUT NOCOPY varchar2
1094 )
1095 is
1096 cursor c_derived_method(c_function_name in varchar) is
1097 select *
1098 from fnd_form_functions
1099 where function_name = c_function_name
1100 and type = 'INTERFACE'
1101 for update;
1102
1103 cursor c_irep_function_id is
1104 select fnd_form_functions_s.nextval
1105 from dual;
1106
1107 l_function_id number := 0;
1108
1109
1110 c_derived_method_rec c_derived_method%ROWTYPE;
1111
1112 begin
1113 open c_derived_method(p_function_name);
1114 fetch c_derived_method into c_derived_method_rec;
1115
1116 if c_derived_method%NOTFOUND then
1117
1118 begin
1119
1120 open c_irep_function_id;
1121 fetch c_irep_function_id into l_function_id;
1122 close c_irep_function_id;
1123
1124 insert into FND_FORM_FUNCTIONS
1125 (
1126 FUNCTION_ID,
1127 FUNCTION_NAME,
1128 APPLICATION_ID,
1129 FORM_ID,
1130 PARAMETERS,
1131 CREATION_DATE,
1132 CREATED_BY,
1133 LAST_UPDATE_DATE,
1134 LAST_UPDATED_BY,
1135 LAST_UPDATE_LOGIN,
1136 TYPE,
1137 WEB_HOST_NAME,
1138 WEB_AGENT_NAME,
1139 WEB_HTML_CALL,
1140 WEB_ENCRYPT_PARAMETERS,
1141 WEB_SECURED,
1142 WEB_ICON,
1143 OBJECT_ID,
1144 REGION_APPLICATION_ID,
1145 REGION_CODE,
1149 IREP_METHOD_NAME,
1146 MAINTENANCE_MODE_SUPPORT,
1147 CONTEXT_DEPENDENCE,
1148 JRAD_REF_PATH,
1150 IREP_DESCRIPTION,
1151 IREP_OVERLOAD_SEQUENCE,
1152 IREP_SCOPE,
1153 IREP_LIFECYCLE,
1154 IREP_COMPATIBILITY,
1155 IREP_INBOUND_XML_DESCRIPTION,
1156 IREP_OUTBOUND_XML_DESCRIPTION,
1157 IREP_SYNCHRO,
1158 IREP_DIRECTION,
1159 IREP_CLASS_ID,
1160 IREP_ASSOC_FUNCTION_NAME
1161 )
1162 values
1163 (
1164 l_function_id,
1165 p_function_name,
1166 p_application_id,
1167 null,
1168 null,
1169 sysdate,
1170 0,
1171 sysdate,
1172 0,
1173 0,
1174 'INTERFACE',
1175 null,
1176 null,
1177 null,
1178 null,
1179 null,
1180 null,
1181 p_object_id,
1182 null,
1183 null,
1184 'NONE',
1185 'NONE',
1186 null,
1187 p_irep_method_name,
1188 p_irep_description,
1189 p_irep_overload_sequence,
1190 p_irep_scope,
1191 p_irep_lifecycle,
1192 p_irep_compatibility,
1193 p_irep_inbound_xml_desc,
1194 p_irep_outbound_xml_desc,
1195 p_irep_synchro,
1196 p_irep_direction,
1197 p_irep_class_id,
1198 p_irep_assoc_function_name
1199 );
1200 /**We don't really need this**/
1201 /**
1202 ws_base_method_overload
1203 (
1204 l_function_id,
1205 p_irep_description,
1206 p_irep_scope,
1207 p_irep_lifecycle,
1208 p_irep_compatibility,
1209 p_err_code,
1210 p_err_message
1211 );
1212 **/
1213
1214 create_function_lang_entries
1215 (
1216 p_base_function_id,
1217 l_function_id,
1218 p_err_code,
1219 p_err_message
1220 );
1221 exception
1222 when program_exit then
1223 raise program_exit;
1224 when others then
1225 p_err_code := -1;
1226 p_err_message := 'Error in inserting to fnd_form_functions'||SQLERRM;
1227 raise program_exit;
1228 end;
1229
1230
1231
1232 elsif c_derived_method%FOUND then
1233 --Update the existing entry
1234 begin
1235 update fnd_form_functions
1236 set
1237 APPLICATION_ID = p_application_id,
1238 FORM_ID = p_form_id,
1239 PARAMETERS = p_parameters,
1240 CREATION_DATE = p_creation_date,
1241 CREATED_BY = p_created_by,
1242 LAST_UPDATE_DATE = sysdate,
1243 LAST_UPDATED_BY = 0,
1244 LAST_UPDATE_LOGIN = 0,
1245 TYPE = p_type,
1246 WEB_HOST_NAME = p_web_host_name,
1247 WEB_AGENT_NAME = p_web_agent_name,
1248 WEB_HTML_CALL = p_web_html_call,
1249 WEB_ENCRYPT_PARAMETERS = p_web_encrypt_parameters,
1250 WEB_SECURED = p_web_secured,
1251 WEB_ICON = p_web_icon,
1252 OBJECT_ID = p_object_id,
1253 REGION_APPLICATION_ID = p_region_application_id,
1254 REGION_CODE = p_region_code,
1255 MAINTENANCE_MODE_SUPPORT = p_maintenance_mode_support,
1256 CONTEXT_DEPENDENCE = p_context_dependence,
1257 JRAD_REF_PATH = p_jrad_ref_path,
1258 IREP_METHOD_NAME = p_irep_method_name,
1259 IREP_DESCRIPTION = p_irep_description,
1260 IREP_OVERLOAD_SEQUENCE = p_irep_overload_sequence,
1261 IREP_SCOPE = p_irep_scope,
1262 IREP_LIFECYCLE = p_irep_lifecycle,
1263 IREP_COMPATIBILITY = p_irep_compatibility,
1264 IREP_INBOUND_XML_DESCRIPTION = p_irep_inbound_xml_desc,
1265 IREP_OUTBOUND_XML_DESCRIPTION = p_irep_outbound_xml_desc,
1266 IREP_SYNCHRO = p_irep_synchro,
1267 IREP_DIRECTION = p_irep_direction,
1268 IREP_CLASS_ID =p_irep_class_id,
1269 IREP_ASSOC_FUNCTION_NAME = p_irep_assoc_function_name
1270 where current of c_derived_method;
1271 /**
1272 ws_base_method_overload
1273 (
1274 c_derived_method_rec.function_id,
1275 p_irep_description,
1276 p_irep_scope,
1277 p_irep_lifecycle,
1278 p_irep_compatibility,
1279 p_err_code,
1280 p_err_message
1281 );
1282 **/
1283
1284 create_function_lang_entries
1285 (
1286 p_base_function_id,
1287 c_derived_method_rec.function_id,
1288 p_err_code,
1289 p_err_message
1290 );
1291
1292 exception
1293 when program_exit then
1294 raise program_exit;
1295 when others then
1296 p_err_code := -1;
1297 p_err_message := 'Error in Updating fnd_form_functions'||SQLERRM;
1298 raise program_exit;
1299 end;
1300
1301 end if;
1302
1303 close c_derived_method;
1304
1305 p_err_code := 0;
1306 p_err_message := wf_core.translate('WF_WS_SUCCESS');
1307 exception
1308 when program_exit then
1309 raise program_exit;
1310 when others then
1311 p_err_code := -1;
1312 wf_core.token('FunctionName',p_function_name);
1313 wf_core.token('BaseFunctionId',p_base_function_id);
1314 wf_core.token('DerivedClassId',p_irep_class_id);
1315 wf_core.token('SqlErr',SQLERRM);
1316 p_err_message := wf_core.translate('WF_WS_FUNCTION_CREATE');
1317 raise program_exit;
1318 end create_derived_method_entry;
1319
1320
1321 procedure create_function_lang_entries
1322 (
1323 p_base_function_id in number,
1324 p_function_id in number,
1325 p_err_code OUT NOCOPY pls_integer,
1326 p_err_message OUT NOCOPY varchar2
1327 )
1328
1329 is
1330 cursor c_base_function_tl(c_base_function_id in pls_integer) is
1331 select *
1332 from fnd_form_functions_tl
1333 where function_id = c_base_function_id;
1334
1335 cursor c_function_name(c_function_id in number) is
1336 select function_name
1337 from fnd_form_functions
1341 c_base_function_tl_rec c_base_function_tl%ROWTYPE;
1338 where function_id = c_function_id;
1339
1340 p_function_name varchar2(430) := null;
1342
1343 begin
1344 if ( (p_base_function_id is null) or (p_function_id is null) ) then
1345 p_err_code := -1;
1346 p_err_message := 'Base Function ID or Function ID is null';
1347 raise program_exit;
1348 end if;
1349
1350 open c_function_name(p_function_id);
1351 fetch c_function_name into p_function_name;
1352 close c_function_name;
1353
1354 for c_base_function_tl_rec in c_base_function_tl(p_base_function_id)
1355 loop
1356 create_function_language
1357 (
1358 p_function_id,
1359 c_base_function_tl_rec.language,
1360 c_base_function_tl_rec.user_function_name,
1361 c_base_function_tl_rec.description,
1362 c_base_function_tl_rec.source_lang,
1363 p_err_code,
1364 p_err_message
1365 );
1366 end loop;
1367 p_err_code := 0;
1368 p_err_message := wf_core.translate('WF_WS_SUCCESS');
1369
1370 exception
1371 when program_exit then
1372 raise program_exit;
1373 when others then
1374 p_err_code := -1;
1375 wf_core.token('BaseFunctionId',p_base_function_id);
1376 wf_core.token('DerivedFunctionId',p_function_id);
1377 wf_core.token('DerivedFunctionName',p_function_name);
1378 wf_core.token('SqlErr',SQLERRM);
1379 p_err_message := wf_core.translate('WF_WS_FUNC_LANG_ENTRIES');
1380 raise program_exit;
1381 end create_function_lang_entries;
1382
1383
1384
1385 procedure create_function_language
1386 (
1387 p_function_id in number,
1388 p_language in varchar2,
1389 p_user_function_name in varchar2,
1390 p_description in varchar2,
1391 p_source_lang in varchar2,
1392 p_err_code OUT NOCOPY pls_integer,
1393 p_err_message OUT NOCOPY varchar2
1394 )
1395 is
1396 cursor c_function_language
1397 (
1398 c_function_id number,
1399 c_language in varchar2
1400 ) is
1401 select *
1402 from fnd_form_functions_tl
1403 where function_id = c_function_id
1404 and language = c_language
1405 for update ;
1406
1407 c_function_language_rec c_function_language%ROWTYPE;
1408
1409 cursor c_function_name(c_function_id in number) is
1410 select function_name
1411 from fnd_form_functions
1412 where function_id = c_function_id;
1413
1414 p_function_name varchar2(430) := null;
1415
1416 begin
1417
1418 if ( (p_function_id is null) or (p_language is null) ) then
1419 p_err_code := -1;
1420 p_err_message := 'Function ID or Language is null';
1421 raise program_exit;
1422 end if;
1423
1424 open c_function_name(p_function_id);
1425 fetch c_function_name into p_function_name;
1426 close c_function_name;
1427
1428 open c_function_language(p_function_id,p_language);
1429 fetch c_function_language into c_function_language_rec;
1430
1431 if c_function_language%NOTFOUND then
1432
1433 insert into FND_FORM_FUNCTIONS_TL
1434 (
1435 LANGUAGE,
1436 FUNCTION_ID,
1437 USER_FUNCTION_NAME,
1438 CREATION_DATE,
1439 CREATED_BY,
1440 LAST_UPDATE_DATE,
1441 LAST_UPDATED_BY,
1442 LAST_UPDATE_LOGIN,
1443 DESCRIPTION,
1444 SOURCE_LANG
1445 )
1446 values
1447 (
1448 p_language,
1449 p_function_id,
1450 p_user_function_name,
1451 sysdate,
1452 0,
1453 sysdate,
1454 0,
1455 0,
1456 p_description,
1457 p_source_lang
1458 );
1459
1460 elsif c_function_language%FOUND then
1461
1462 update fnd_form_functions_tl
1463 set user_function_name = p_user_function_name,
1464 description = p_description,
1465 source_lang = p_source_lang,
1466 last_update_date = sysdate,
1467 last_updated_by = 0,
1468 last_update_login = 0
1469 where current of c_function_language;
1470
1471 end if;
1472
1473 close c_function_language;
1474
1475 p_err_message :=wf_core.translate('WF_WS_SUCCESS');
1476 p_err_code :=0;
1477 exception
1478 when program_exit then
1479 raise program_exit;
1480 when others then
1481 p_err_code := -1;
1482 wf_core.token('DerivedFunctionName', p_function_name);
1483 wf_core.token('DerivedFunctionId',p_function_id);
1484 wf_core.token('Lang',p_language);
1485 wf_core.token('SqlErr',SQLERRM);
1486 p_err_message := wf_core.translate('WF_WS_FUNC_LANG');
1487 raise program_exit;
1488 end create_function_language;
1489
1490 procedure create_class_language
1491 (
1492 p_class_id in number,
1493 p_language in varchar2,
1494 p_source_lang in varchar2,
1495 p_display_name in varchar2,
1496 p_short_description in varchar2,
1497 p_security_group_id in number,
1498 p_err_code OUT NOCOPY pls_integer,
1499 p_err_message OUT NOCOPY varchar2
1500 )
1501 is
1502 cursor c_class_language
1503 (
1504 c_class_id number,
1505 c_language in varchar2
1506 ) is
1507 select *
1508 from fnd_irep_classes_tl
1509 where class_id = c_class_id
1510 and language = c_language
1511 for update ;
1512
1513 c_class_language_rec c_class_language%ROWTYPE;
1514
1515 cursor c_class_name(c_class_id in number) is
1516 select class_name
1517 from fnd_irep_classes
1518 where class_id = c_class_id;
1519
1520 p_derived_class_name varchar2(430) := null;
1521
1522 begin
1523 if ( (p_class_id is null) or (p_language is null) ) then
1524 p_err_code := -1;
1525 p_err_message := 'Class ID or Language is null';
1529 open c_class_name(p_class_id);
1526 raise program_exit;
1527 end if;
1528
1530 fetch c_class_name into p_derived_class_name;
1531 close c_class_name;
1532
1533 open c_class_language(p_class_id,p_language);
1534 fetch c_class_language into c_class_language_rec;
1535
1536 if c_class_language%NOTFOUND then
1537
1538 insert into FND_IREP_CLASSES_TL
1539 (
1540 CLASS_ID,
1541 LANGUAGE,
1542 SOURCE_LANG,
1543 DISPLAY_NAME,
1544 SHORT_DESCRIPTION,
1545 CREATED_BY,
1546 CREATION_DATE,
1547 LAST_UPDATED_BY,
1548 LAST_UPDATE_DATE,
1549 LAST_UPDATE_LOGIN,
1550 SECURITY_GROUP_ID
1551 )
1552 values
1553 (
1554 p_class_id,
1555 p_language,
1556 p_source_lang,
1557 p_display_name,
1558 p_short_description,
1559 0,
1560 sysdate,
1561 0,
1562 sysdate,
1563 0,
1564 0
1565 );
1566
1567 elsif c_class_language%FOUND then
1568
1569 update fnd_irep_classes_tl
1570 set display_name = p_display_name,
1571 short_description = p_short_description,
1572 source_lang = p_source_lang,
1573 last_update_date = sysdate,
1574 last_updated_by = 0,
1575 last_update_login = 0,
1576 security_group_id = p_security_group_id
1577 where current of c_class_language;
1578
1579 end if;
1580
1581 close c_class_language;
1582
1583 p_err_message :=wf_core.translate('WF_WS_SUCCESS');
1584 p_err_code :=0;
1585 exception
1586 when program_exit then
1587 raise program_exit;
1588 when others then
1589 p_err_code := -1;
1590 wf_core.token('DerivedClassName', p_derived_class_name);
1591 wf_core.token('DerivedClassId',p_class_id);
1592 wf_core.token('Lang',p_language);
1593 wf_core.token('SqlErr',SQLERRM);
1594 p_err_message := wf_core.translate('WF_WS_CLASS_LANG');
1595 raise program_exit;
1596 end create_class_language;
1597
1598
1599 procedure create_class_lang_entries
1600 (
1601 p_base_class_id in number,
1602 p_class_id in number,
1603 p_err_code OUT NOCOPY pls_integer,
1604 p_err_message OUT NOCOPY varchar2
1605 )
1606
1607 is
1608 cursor c_base_class_tl(c_base_class_id in pls_integer) is
1609 select *
1610 from fnd_irep_classes_tl
1611 where class_id = c_base_class_id;
1612
1613 c_base_class_tl_rec c_base_class_tl%ROWTYPE;
1614
1615 cursor c_class_name(c_class_id in number) is
1616 select class_name
1617 from fnd_irep_classes
1618 where class_id = c_class_id;
1619
1620 p_derived_class_name varchar2(430) := null;
1621
1622 begin
1623 if ( (p_base_class_id is null) or (p_class_id is null) ) then
1624 p_err_code := -1;
1625 p_err_message := 'Base Class ID or Class ID is null';
1626 raise program_exit;
1627 end if;
1628
1629 open c_class_name(p_class_id);
1630 fetch c_class_name into p_derived_class_name;
1631 close c_class_name;
1632
1633 for c_base_class_tl_rec in c_base_class_tl(p_base_class_id)
1634 loop
1635 create_class_language
1636 (
1637 p_class_id,
1638 c_base_class_tl_rec.language,
1639 c_base_class_tl_rec.source_lang,
1640 c_base_class_tl_rec.display_name,
1641 c_base_class_tl_rec.short_description,
1642 c_base_class_tl_rec.security_group_id,
1643 p_err_code,
1644 p_err_message
1645 );
1646 end loop;
1647
1648 p_err_code := 0;
1649 p_err_message := wf_core.translate('WF_WS_SUCCESS');
1650
1651 exception
1652 when program_exit then
1653 raise program_exit;
1654 when others then
1655 p_err_code := -1;
1656 wf_core.token('DerivedClassName', p_derived_class_name);
1657 wf_core.token('DerivedClassId',p_class_id);
1658 wf_core.token('SqlErr',SQLERRM);
1659 p_err_message := wf_core.translate('WF_WS_CLASS_LANG_ENTRIES');
1660 raise program_exit;
1661 end create_class_lang_entries;
1662
1663 procedure create_xmlg_schema
1664 (
1665 p_clob OUT NOCOPY clob,
1666 p_root_element in varchar,
1667 p_product_code in varchar2,
1668 p_direction in varchar,
1669 p_port_type in varchar,
1670 p_operation in varchar,
1671 p_err_code OUT NOCOPY pls_integer,
1672 p_err_message OUT NOCOPY varchar2
1673 )
1674 is
1675
1676 i_tmp clob;
1677 i_buffer varchar2(32767) := null;
1678 i_lob_len pls_integer;
1679 i_root varchar2(200);
1680 begin
1681 dbms_lob.createtemporary(i_tmp,true,dbms_lob.session);
1682
1683 if ( p_direction = 'IN') then
1684
1685
1686 i_buffer := '<xsd:schema elementFormDefault="qualified"'||
1687 ' targetNamespace="http://xmlns.oracle.com/apps/'||lower(p_product_code)||'/'||p_port_type||'/'||p_operation||'">'||
1688 ' <xsd:element name="'||p_root_element||'" type="xsd:anyType"/>'||
1689 '</xsd:schema>';
1690 elsif (p_direction = 'OUT') then
1691 i_buffer :='<xsd:schema elementFormDefault="qualified"'||
1692 ' targetNamespace="http://xmlns.oracle.com/apps/fnd/XMLGateway">'||
1693 ' <xsd:element name="ReceiveDocument_Response">'||
1694 ' <xsd:complexType>'||
1695 ' <xsd:sequence>'||
1696 ' <xsd:element name="ResponseCode" type="xsd:string" />'||
1697 ' <xsd:element name="ResponseCode" type="xsd:string" />'||
1698 ' <xsd:element name="ResponseCode" type="xsd:string" />'||
1699 ' </xsd:sequence>'||
1700 ' </xsd:complexType>'||
1701 ' </xsd:element>'||
1702 '</xsd:schema>';
1703 end if;
1704
1705 i_lob_len := length(i_buffer);
1709
1706 dbms_lob.write(i_tmp,i_lob_len,1,i_buffer);
1707 p_clob := i_tmp;
1708 dbms_lob.freetemporary(i_tmp);
1710 p_err_code := 0;
1711 p_err_message := wf_core.translate('WF_WS_SUCCESS');
1712 exception
1713 when program_exit then
1714 raise program_exit;
1715 when others then
1716 p_err_code := -1;
1717 wf_core.token('InterfaceName',p_port_type);
1718 wf_core.token('SqlErr',SQLERRM);
1719 p_err_message := wf_core.translate('WF_WS_XMLG_SCHEMA');
1720 raise program_exit;
1721 end create_xmlg_schema;
1722
1723
1724 procedure to_upper
1725 (
1726 p_name in varchar2,
1727 p_new_name OUT NOCOPY varchar2,
1728 p_err_code OUT NOCOPY pls_integer,
1729 p_err_message OUT NOCOPY varchar2
1730 ) is
1731 l_var varchar2(100);
1732 begin
1733 if length(p_name) >0 then
1734 l_var := substr(p_name,1,1);
1735 l_var := upper(l_var);
1736 l_var := l_var||lower(substr(p_name,2,length(p_name)));
1737 p_new_name := l_var;
1738 end if;
1739
1740 p_err_code := 0;
1741 p_err_message := wf_core.translate('WF_WS_SUCCESS');
1742 exception
1743 when program_exit then
1744 raise program_exit;
1745 when others then
1746 p_err_code := -1;
1747 wf_core.token('Name',p_name);
1748 wf_core.token('SqlErr',SQLERRM);
1749 p_err_message := wf_core.translate('WF_WS_XMLG_NS');
1750 raise program_exit;
1751 end;
1752
1753
1754 /**Procedure to assign the Business Entities
1755 **Any Base Class Entry can have multiple business entities assigned to it.
1756 **For same IREP entry multiple assignment records to be created in fnd_lookup_assignments
1757 **with lookup_code equal to the business entity codes.
1758 **Relationship between lookup_assignments and the lookup_values is already existing.
1759 **/
1760 procedure assign_business_entities
1761 (
1762 p_base_class_id in number,
1763 p_derived_class_id in number,
1764 p_err_code OUT NOCOPY pls_integer,
1765 p_err_message OUT NOCOPY varchar2
1766 ) is
1767
1768 cursor c1(c_base_class_id in number) is
1769 select *
1770 from fnd_lookup_assignments
1771 where obj_name = 'FND_IREP_CLASSES'
1772 and lookup_type = 'BUSINESS_ENTITY'
1773 and instance_pk1_value = c_base_class_id;
1774
1775 c1_rec c1%ROWTYPE;
1776
1777 cursor c2
1778 (
1779 c_derived_class_id in number,
1780 c_lookup_code in varchar2
1781 ) is
1782 select *
1783 from fnd_lookup_assignments
1784 where obj_name = 'FND_IREP_CLASSES'
1785 and lookup_type = 'BUSINESS_ENTITY'
1786 and instance_pk1_value = c_derived_class_id
1787 and lookup_code = c_lookup_code
1788 for update ;
1789
1790 c2_rec c2%ROWTYPE;
1791
1792 cursor c3 is
1793 select fnd_lookup_assignments_s.nextval assign_id
1794 from dual;
1795
1796 c3_rec c3%ROWTYPE;
1797
1798 cursor c_class_name(c_class_id in number) is
1799 select class_name
1800 from fnd_irep_classes
1801 where class_id = c_class_id;
1802
1803 p_derived_class_name varchar2(430) := null;
1804
1805 begin
1806
1807 open c_class_name(p_derived_class_id);
1808 fetch c_class_name into p_derived_class_name;
1809 close c_class_name;
1810
1811 for c1_rec in c1(p_base_class_id)
1812 loop
1813 open c2(p_derived_class_id,c1_rec.lookup_code);
1814
1815 fetch c2 into c2_rec;
1816
1817 if c2%NOTFOUND then
1818
1819 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
1820 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.assign_business_entities', 'Assigning new Business Entity='||c1_rec.lookup_code);
1821 end if;
1822
1823 open c3;
1824 fetch c3 into c3_rec;
1825 close c3;
1826
1827 insert into fnd_lookup_assignments
1828 (
1829 LOOKUP_ASSIGNMENT_ID,
1830 LOOKUP_TYPE,
1831 LOOKUP_CODE,
1832 OBJ_NAME,
1833 INSTANCE_PK1_VALUE,
1834 INSTANCE_PK2_VALUE,
1835 INSTANCE_PK3_VALUE,
1836 INSTANCE_PK4_VALUE,
1837 INSTANCE_PK5_VALUE,
1838 DISPLAY_SEQUENCE,
1839 CREATED_BY,
1840 CREATION_DATE,
1841 LAST_UPDATED_BY,
1842 LAST_UPDATE_DATE,
1843 LAST_UPDATE_LOGIN
1844 )
1845 values
1846 (
1847 c3_rec.assign_id,
1848 c1_rec.lookup_type,
1849 c1_rec.lookup_code,
1850 c1_rec.obj_name,
1851 p_derived_class_id,
1852 null,
1853 null,
1854 null,
1855 null,
1856 null,
1857 1,
1858 sysdate,
1859 1,
1860 sysdate,
1861 0
1862 );
1863 elsif c2%FOUND then
1864
1865 if( FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
1866 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'oracle.apps.fnd.wf.ws.assign_business_entities', 'Updating Business Entity='||c1_rec.lookup_code);
1867 end if;
1868
1869 update fnd_lookup_assignments
1870 set LAST_UPDATED_BY = 1,
1871 last_update_date = sysdate,
1872 last_update_login = 0
1873 where current of c2;
1874 end if;
1875
1876 close c2;
1877 end loop;
1878
1879 p_err_code := 0;
1880 p_err_message := wf_core.translate('WF_WS_SUCCESS');
1881 exception
1882 when program_exit then
1883 raise program_exit;
1884 when others then
1885 p_err_code := -1;
1886 wf_core.token('DerivedClassName', p_derived_class_name);
1887 wf_core.token('DerivedClassId',p_derived_class_id);
1888 wf_core.token('SqlErr',SQLERRM);
1889 p_err_message := wf_core.translate('WF_WS_CREATE_BUS_ENTITIES');
1890 raise program_exit;
1891 end assign_business_entities;
1892
1896 p_description in varchar2,
1893 procedure ws_base_method_overload
1894 (
1895 p_function_id in number,
1897 p_scope_type in varchar2,
1898 p_irep_lifecycle in varchar2,
1899 p_irep_compatibility_flag in varchar2,
1900 p_err_code OUT NOCOPY pls_integer,
1901 p_err_message OUT NOCOPY varchar2
1902 ) is
1903
1904 cursor c1(c_function_id in number) is
1905 select *
1906 from fnd_irep_function_flavors
1907 where function_id = c_function_id
1908 for update;
1909
1910 cursor c_function_name(c_function_id in number) is
1911 select function_name
1912 from fnd_form_functions
1913 where function_id = c_function_id;
1914
1915 p_function_name varchar2(430) := null;
1916
1917 c1_rec c1%ROWTYPE;
1918 begin
1919 open c1(p_function_id);
1920 fetch c1 into c1_rec;
1921
1922 if c1%NOTFOUND then
1923
1924 insert into FND_IREP_FUNCTION_FLAVORS
1925 (
1926 FUNCTION_ID,OVERLOAD_SEQ,
1927 SCOPE_TYPE,LIFECYCLE_MODE,DESCRIPTION,COMPATIBILITY_FLAG
1928 )
1929 values
1930 (
1931 p_function_id,1,
1932 'PUBLIC','ACTIVE',p_description,'S'
1933 );
1934
1935
1936 elsif c1%FOUND then
1937
1938 update fnd_irep_function_FLAVORS
1939 set description = p_description,
1940 scope_type = p_scope_type
1941 where current of c1;
1942 end if;
1943
1944 close c1;
1945
1946 open c_function_name(p_function_id);
1947 fetch c_function_name into p_function_name;
1948 close c_function_name;
1949
1950 p_err_code := 0;
1951 p_err_message := wf_core.translate('WF_WS_SUCCESS');
1952 exception
1953 when others then
1954 p_err_code := -1;
1955 wf_core.token('DerivedFunctionName', p_function_name);
1956 wf_core.token('DerivedFunctionId',p_function_id);
1957 wf_core.token('SqlErr',SQLERRM);
1958 p_err_message := wf_core.translate('WF_WS_OVERLOAD_SEQ');
1959 raise program_exit;
1960 end ws_base_method_overload;
1961
1962
1963 procedure get_root_element
1964 (
1965 p_map_code in varchar2,
1966 p_root_element OUT NOCOPY varchar2,
1967 p_err_code OUT NOCOPY pls_integer,
1968 p_err_message OUT NOCOPY varchar2
1969 ) is
1970
1971 i_map_id number;
1972 invalid_input exception;
1973 begin
1974
1975 if (p_map_code = '') or (p_map_code is null)
1976 then
1977 raise invalid_input;
1978 end if;
1979
1980 select map_id
1981 into i_map_id
1982 from ecx_mappings
1983 where map_code = p_map_code;
1984
1985
1986 select root_element
1987 into p_root_element
1988 from ecx_objects
1989 where map_id = i_map_id and
1990 (object_type = 'XML' or
1991 object_type = 'DTD');
1992
1993
1994 exception
1995 when others then
1996 p_err_code := -1;
1997 wf_core.token('GetRootElement mapCode', p_map_code);
1998 wf_core.token('SqlErr',SQLERRM);
1999 p_err_message := wf_core.translate('WF_WS_MODULE_FAILED');
2000 raise program_exit;
2001 end get_root_element;
2002
2003 end WF_WS_GEN;