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