1 package body fnd_webfile as
2 /* $Header: AFCPFILB.pls 120.7.12010000.3 2010/03/19 11:20:54 mburra ship $ */
3
4
5 debug varchar2(1) := 'N';
6
7
8 /*--
9 *-- GENERIC_ERROR (Internal)
10 *--
11 *-- Set error message and raise exception for unexpected sql errors.
12 *--
13 */
14 procedure GENERIC_ERROR(routine in varchar2,
15 errcode in number,
16 errmsg in varchar2) is
17 begin
18 fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
19 fnd_message.set_token('ROUTINE', routine);
20 fnd_message.set_token('ERRNO', errcode);
21 fnd_message.set_token('REASON', errmsg);
22 end;
23
24 /*--
25 *-- UPDATE SVC (Internal)
26 *--
27 *-- Update registered node with full service denotation (for generic services)
28 *-- Created to be autonomous transaction so no commit would occur in get_url
29 *--
30 */
31 procedure UPDATE_SVC(id in number,
32 svc in varchar2) is
33 PRAGMA AUTONOMOUS_TRANSACTION;
34 begin
35 update fnd_file_temp
36 set node_name = svc
37 where file_id = id;
38
39 commit;
40 exception
41 when others then
42 rollback;
43 end update_svc;
44
45 /*
46 * Procedure: update_cfg_info
47 * Internal use only
48 *
49 * Purpose :
50 * Update registered node with full context file information
51 *
52 */
53 procedure update_cfg_info(id in number,
54 dest_file in varchar2,
55 dest_svc in varchar2,
56 tran_type in varchar2) is
57 PRAGMA AUTONOMOUS_TRANSACTION;
58 begin
59 update fnd_file_temp
60 set destination_node = dest_svc,
61 destination_file = dest_file,
62 transfer_type = tran_type
63 where file_id = id;
64
65 commit;
66 exception
67 when others then
68 rollback;
69 end update_cfg_info;
70
71 /*
72 *procedure: update_page_info
73 * is called from get_url function to update the page information(page_number and page_size column).
74 * It is an internal procedure.
75 *
76 *
77 *
78 */
79 procedure update_page_info(id in number,
80 p_page_no in number,
81 p_page_size in number,
82 p_tran_type in varchar2) is
83 PRAGMA AUTONOMOUS_TRANSACTION;
84 begin
85 update fnd_file_temp
86 set page_number = p_page_no,
87 page_size = p_page_size,
88 transfer_type = p_tran_type
89 where file_id =id;
90
91 commit;
92 exception
93 when others then
94 rollback;
95
96 end update_page_info;
97
98
99
100
101 /* Function: GET_URL
102 *
103 * Purpose: Constructs and returns the URL for a Concurrent Processing
104 * log or output file.
105 *
106 * Arguments:
107 * file_type - Specifies the type of file desired:
108 * fnd_webfile.process_log = The log of the concurrent process identified
109 * by the parameter ID.
110 * fnd_webfile.icm_log = The log of the ICM process identified by ID.
111 * Or, the log of the ICM process that spawned
112 * the concurrent process identified by ID.
113 * Or, the log of the most recent ICM process
114 * if ID is null.
115 * fnd_webfile.request_log = The log of the request identified by ID.
116 * fnd_webfile.request_out = The output of the request identified by ID.
117 * fnd_webfile.request_mgr = The log of the concurrent process that ran
118 * the request identified by ID.
119 * fnd_webfile.frd_log = The log of the forms process identified
120 * by ID.
121 * fnd_webfile.generic_log = The log file identified by ID.
122 * fnd_webfile.generic_trc = The trace file identified by ID.
123 * fnd_webfile.generic_ora = The ora file identified by ID.
124 * fnd_webfile.generic_cfg = The config file identified by ID.
125 * fnd_webfile.context_file= The context file identified by ID.
126 * fnd_webfile.generic_text= Generic file using text transfer mode.
127 * fnd_webfile.generic_binary = Generic file using binary transfer mode.
128 * fnd_webfile.request_xml_output = The XML output of Concurrent Request.
129 *
130 * id - A concurrent process ID, concurrent request ID, or file ID
131 * depending on the file type specified.
132 * For fnd_webfile.context_file,fnd_webfile.generic_text,
133 * fnd_webfile.generic_binary this value is null.
134 *
135 * gwyuid - The value of the environment variable GWYUID used in
136 * constructing the URL. No longer used.
137 *
138 * two_task - The database two_task, used in constructing the URL. No longer used.
139 *
140 * expire_time - The number of minutes for which this URL will remain
141 * valid.
142 * source_file - Source file name with full patch
143 *
144 * source_node - Source node name.
145 *
146 * dest_file - Destination file name
147 *
148 * dest_node - Destination node name
149 *
150 * page_no - Current page number
151 *
152 * page_size - Number of lines in a page
153 *
154 * Returns NULL on error. Check the FND message stack.
155 *
156 * Note that gwyuid and two_task are no longer used. They are retained for
157 * compatibility only.
158 *
159 */
160 function get_url( file_type IN number,
161 id IN number,
162 gwyuid IN varchar2,
163 two_task IN varchar2,
164 expire_time IN number,
165 source_file IN varchar2 default null,
166 source_node IN varchar2 default null,
167 dest_file IN varchar2 default null,
168 dest_node IN varchar2 default null,
169 page_no IN number default null,
170 page_size IN number default null) return varchar2
171 is
172 base varchar2(257);
173 base_type varchar2(3) := 'CGI';
174 url varchar2(512);
175 fname varchar2(255);
176 node varchar2(50);
177 mtype varchar2(80) := 'text/plain';
178 x_mode varchar2(30) := 'TEXT';
179 ffcode varchar2(30);
180 fs_enabled varchar2(2);
181 temp_id varchar2(32);
182 pos number;
183 svc varchar2(254);
184 dest_svc varchar2(254);
185 t_node varchar2(50);
186 req_id number;
187 controlling_mgr number;
188 cpid number;
189 fsize number;
190 save_out varchar2(2);
191 ext varchar2(32);
192 cmpext varchar2(32);
193 sqlstmt varchar2(200);
194 ncenc varchar2(1) := 'N';
195 prog_name varchar2(30) := null;
196 appl_name varchar2(30) := null;
197 action_publish_count number;
198 begin
199
200 /* Get URL base. */
201
202 --First check IF there is a url base defined FOR CGI - enh# 4477258
203 IF (fnd_profile.defined('APPS_CGI_AGENT')) THEN
204 fnd_profile.get('APPS_CGI_AGENT', base);
205 END IF;
206
207 --IF CGI agent is null then check the web agent
208 --Also set the base_type to WEB
209 IF (base IS NULL) THEN
210 fnd_profile.get('APPS_WEB_AGENT', base);
211 base_type := 'WEB';
212 END IF;
213
214 if (base is null) then
215 fnd_message.set_name('FND', 'FS-NO URL');
216 return null;
217 end if;
218
219
220 if (file_type = process_log) then
221 /* Concurrent process log */
222 begin
223 select logfile_name, node_name
224 into fname, node
225 from fnd_concurrent_processes
226 where concurrent_process_id = id;
227 exception
228 when no_data_found then
229 fnd_message.set_name('FND', 'CONC-PROCESS MISSING');
230 fnd_message.set_token('ROUTINE','FND_WEBFILE.GET_URL');
231 fnd_message.set_token('CPID', id);
232 return null;
233 end;
234 if (fname is null) then
235 fnd_message.set_name('FND', 'SYSTEM-MANAGER LOGFILE NULL');
236 fnd_message.set_token('PROCESS_ID', id);
237 return null;
238 end if;
239
240 elsif (file_type = icm_log) then
241 /* ICM log */
242 begin
243 select logfile_name, node_name
244 into fname, node
245 from fnd_concurrent_processes
246 where (((id is not null)
247 and concurrent_process_id =
248 ( select max(p.concurrent_process_id)
249 from fnd_concurrent_processes p,
250 fnd_concurrent_processes p2
251 where p.queue_application_id = 0
252 and p.concurrent_queue_id = 1
253 and p2.concurrent_process_id= id
254 and p.process_start_date <=
255 nvl(p2.process_start_date, sysdate) ) )
256 or
257 ((id is null) and concurrent_process_id =
258 ( select max(p.concurrent_process_id)
259 from fnd_concurrent_processes p
260 where p.queue_application_id = 0
261 and p.concurrent_queue_id = 1 ) ));
262 exception
263 when no_data_found then
264 fnd_message.set_name('FND', 'CONC-PROCESS MISSING');
265 fnd_message.set_token('ROUTINE','FND_WEBFILE.GET_URL');
266 fnd_message.set_token('CPID', id);
267 return null;
268 end;
269 if (fname is null) then
270 fnd_message.set_name('FND', 'SYSTEM-MANAGER LOGFILE NULL');
271 fnd_message.set_token('PROCESS_ID', id);
272 return null;
273 end if;
274
275 elsif (file_type = request_log) then
276 /* Request Log */
277
278 --Fix for bug 9244546
279 -- Enabling Native Client Encoding for Request Log
280 -- MBURRA
281 ncenc := 'Y';
282
283 begin
284 select logfile_name, logfile_node_name
285 into fname, node
286 from fnd_concurrent_requests
287 where request_id = id;
288 req_id := id;
289 exception
290 when no_data_found then
291 fnd_message.set_name('FND', 'CONC-REQUEST MISSING');
292 fnd_message.set_token('ROUTINE','FND_WEBFILE.GET_URL');
293 fnd_message.set_token('REQUEST', id);
294 return null;
295 end;
296 if (fname is null) then
297 fnd_message.set_name('FND', 'SYSTEM-REQUEST LOGFILE NULL');
298 fnd_message.set_token('REQUEST_ID', id);
299 return null;
300 end if;
301
302 elsif (file_type = request_out or file_type = request_xml_output) then
303 /* Request Output */
304 ncenc := 'Y';
305 begin
306 select fcr.outfile_name, fcr.outfile_node_name, fmt.mime_type,
307 fcr.save_output_flag, fcr.ofile_size, fmt.file_format_code,
308 fcp.concurrent_program_name, a.application_short_name
309 into fname, node, mtype, save_out, fsize, ffcode, prog_name,appl_name
310 from fnd_concurrent_requests fcr, fnd_mime_types_vl fmt,
311 fnd_concurrent_programs fcp, fnd_application a
312 where fcr.request_id = id
313 and upper(fcr.output_file_type) = upper(fmt.file_format_code)
314 and fcp.concurrent_program_id = fcr.concurrent_program_id
315 and fcp.application_id = fcr.program_application_id
316 and fcp.application_id = a.application_id
317 and rownum = 1;
318
319 /* Bug 6040814. Supporting output file display for FNDREPRINT (REPRINT and REPULISH) programs.
320 * First check whether the program is a FNDREPRINT program.
321 * 1) YES - case a. whether it is a REPRINT and REPUBLISH - check for output details in fnd_conc_req_outputs
322 * case b. Only REPRINT
323 * Check whether the parent program supports republish
324 * 1) YES - Check for output details in fnd_conc_req_outputs which request id as parent request id.
325 * 2) NO - Check for output details in fnd_concurrent_requests with REPRINT request id.
326 * 2) NO (NOT FNDREPRINT)
327 * case a. If the program is layout enabled - check for output details in fnd_conc_req_outputs
328 * case b. Check for the output details in fnd_concurrent_requests as already done in the above sql.
329 */
330
331 /* Check whether the program is a FNDREPRINT program */
332 if (prog_name = 'FNDREPRINT' and appl_name ='FND') then
333
334 select count(1) into action_publish_count from fnd_conc_pp_actions
335 where concurrent_request_id=id and action_type=6;
336
337 if(action_publish_count=1) then /* Check if it is a REPRINT and REPUBLISH request */
338 begin
339 select file_type,file_name,file_node_name,file_size, fmt.mime_type
340 into ffcode, fname, node, fsize, mtype
341 from fnd_conc_req_outputs RO, fnd_mime_types_vl fmt
342 where concurrent_request_id = id
343 and RO.file_type = fmt.file_format_code
344 and rownum = 1;
345 exception
346 when no_data_found then
347 fnd_message.set_name('FND', 'CONC-NO OUTPUT FILE');
348 fnd_message.set_token('REQUEST_ID', id);
349 return null;
350 end;
351 else /* Only a REPRINT request */
352 begin
353 /* Find the parent program for the REPRINT request */
354 select fcp.concurrent_program_name, a.application_short_name
355 into prog_name, appl_name
356 from fnd_concurrent_programs fcp, fnd_application a, fnd_concurrent_requests fcr
357 where fcp.concurrent_program_id = fcr.concurrent_program_id
358 and fcp.application_id = fcr.program_application_id
359 and fcp.application_id = a.application_id
360 and fcr.request_id = (select to_number(argument1) from fnd_concurrent_requests where request_id=id);
361 exception
362 when no_data_found then
363 fnd_message.set_name('FND', 'CONC-REQUEST MISSING');
364 fnd_message.set_token('ROUTINE','FND_WEBFILE.GET_URL');
365 fnd_message.set_token('REQUEST', id);
366 return null;
367 end;
368
369 /* Check if the parent program is layout enabled */
370 if (fnd_conc_sswa.layout_enabled(appl_name, prog_name)) then
371 begin
372 select file_type,file_name,file_node_name,file_size, fmt.mime_type
373 into ffcode, fname, node, fsize, mtype
374 from fnd_conc_req_outputs RO, fnd_mime_types_vl fmt
375 where concurrent_request_id = (select to_number(argument1) from fnd_concurrent_requests where request_id=id)
376 and RO.file_type = fmt.file_format_code
377 and rownum = 1;
378 exception
379 when no_data_found then
380 fnd_message.set_name('FND', 'CONC-NO OUTPUT FILE');
381 fnd_message.set_token('REQUEST_ID', id);
382 return null;
383 end;
384 else /* Parent program is not layout enabled*/
385 begin
386 select output_file_type, outfile_name, outfile_node_name, ofile_size, fmt.mime_type
387 into ffcode, fname, node, fsize, mtype
388 from fnd_concurrent_requests fcr, fnd_mime_types_vl fmt
389 where request_id = id
390 and fcr.output_file_type = fmt.file_format_code
391 and rownum = 1;
392 exception
393 when no_data_found then
394 fnd_message.set_name('FND', 'CONC-NO OUTPUT FILE');
395 fnd_message.set_token('REQUEST_ID', id);
396 return null;
397 end;
398 end if;
399 end if;
400 elsif(fnd_conc_sswa.layout_enabled(appl_name, prog_name) and file_type=request_out) then /* Not a FNDREPRINT request */
401 begin
402 select file_type,file_name,file_node_name,file_size, fmt.mime_type
403 into ffcode, fname, node, fsize, mtype
404 from fnd_conc_req_outputs RO, fnd_mime_types_vl fmt
405 where concurrent_request_id = id
406 and RO.file_type = fmt.file_format_code
407 and rownum = 1;
408 exception
409 when no_data_found then
410 fnd_message.set_name('FND', 'CONC-NO OUTPUT FILE');
411 fnd_message.set_token('REQUEST_ID', id);
412 return null;
413 end;
414 end if;
415
416 req_id := id;
417 exception
418 when no_data_found then
419 fnd_message.set_name('FND', 'CONC-REQUEST MISSING');
420 fnd_message.set_token('ROUTINE','FND_WEBFILE.GET_URL');
421 fnd_message.set_token('REQUEST', id);
422 return null;
423 end;
424 if (save_out = 'N') then
425 fnd_message.set_name('FND', 'CONC-Output file not saved');
426 return null;
427 end if;
428 if (fname is null) then
429 fnd_message.set_name('FND', 'SYSTEM-REQUEST OUTFILE NULL');
430 fnd_message.set_token('REQUEST_ID', id);
431 return null;
432 end if;
433
434 /* Decide the transfer mode, after getting the fnd_file_format datamodal
435 we have to replace these hardcoded values */
436 if ( upper(ffcode) in ('PDF','PS','PCL','EXCEL')) then
437 x_mode := 'BINARY';
438 end if;
439
440 elsif (file_type = request_mgr) then
441 begin
442 select p.logfile_name, p.node_name, r.controlling_manager,
443 p.concurrent_process_id
444 into fname, node, controlling_mgr, cpid
445 from fnd_concurrent_requests r, fnd_concurrent_processes p
446 where r.request_id = id
447 and r.controlling_manager = p.concurrent_process_id(+);
448 /* The outer join makes sure that we don't say that the request
449 row is missing, when the manager row is missing. We know that
450 the manager row was missing if cpid is null. */
451 exception
452 when no_data_found then
453 fnd_message.set_name('FND', 'CONC-REQUEST MISSING');
454 fnd_message.set_token('ROUTINE','FND_WEBFILE.GET_URL');
455 fnd_message.set_token('REQUEST', id);
456 return null;
457 end;
458 if (cpid is null) then
459 fnd_message.set_name('FND', 'CONC-PROCESS MISSING');
460 fnd_message.set_token('ROUTINE','FND_WEBFILE.GET_URL');
461 fnd_message.set_token('CPID', controlling_mgr);
462 return null;
463 end if;
464 if (fname is null) then
465 fnd_message.set_name('FND', 'SYSTEM-MANAGER LOGFILE NULL');
466 fnd_message.set_token('PROCESS_ID', cpid);
467 return null;
468 end if;
469
470 elsif (file_type = frd_log) then
471 begin
472 sqlstmt := 'select node from fnd_oam_forms_rti where rti_id = :id';
473 EXECUTE IMMEDIATE sqlstmt INTO node USING id;
474
475 sqlstmt := 'select filename from fnd_oam_frd_log where rti_id = :id';
476 EXECUTE IMMEDIATE sqlstmt INTO fname USING id;
477
478 exception
479 when no_data_found then
480 fnd_message.set_name('FND', 'CONC-ROW MISSING');
481 return null;
482
483 end;
484 if (fname is null) then
485 fnd_message.set_name('FND', 'SYSTEM-LOGFILE NULL');
486 return null;
487 end if;
488
489 elsif (file_type >= generic_log and file_type <= generic_cfg) then
490 begin
491 select filename, node_name
492 into fname, node
493 from fnd_file_temp
494 where file_id = id;
495
496 pos := instr(fname, '.', -1, 1);
497 ext := substr(fname, (pos + 1));
498
499 exception
500 when no_data_found then
501 fnd_message.set_name('FND', 'CONC-ROW MISSING');
502 return null;
503 end;
504 if (fname is null) then
505 fnd_message.set_name('FND', 'SYSTEM-LOGFILE NULL');
506 return null;
507 end if;
508
509 if(file_type = generic_log) then
510 cmpext := 'LOG';
511 elsif (file_type = generic_trc) then
512 cmpext := 'TRC';
513 elsif (file_type = generic_ora) then
514 cmpext := 'ORA';
515 elsif (file_type = generic_cfg) then
516 cmpext := 'CFG';
517 end if;
518
519 if (upper(ext) <> cmpext) then
520 fnd_message.set_name('FND', 'CONC-BAD EXTENSION');
521 return null;
522 end if;
523
524 elsif ( file_type in (context_file, generic_text, generic_binary) ) then
525 if ( file_type = context_file ) then
526 begin
527 select node_name into t_node
528 from fnd_oam_context_files
529 where path = dest_file
530 and node_name = dest_node
531 and rownum = 1;
532 exception
533 when no_data_found then
534 fnd_message.set_name('FND', 'CONC-ROW MISSING');
535 return null;
536 end;
537 end if;
538
539 node := source_node;
540 fname := source_file;
541
542 if (fnd_profile.defined('FS_SVC_PREFIX')) then
543 fnd_profile.get('FS_SVC_PREFIX', dest_svc);
544 if (dest_svc is not null) then
545 dest_svc := substr(dest_svc || dest_node, 1, 254);
546 else
547 dest_svc := 'FNDFS_' || dest_node;
548 end if;
549 else
550 dest_svc := 'FNDFS_' || dest_node;
551 end if;
552
553 end if;
554
555
556 if (fnd_profile.defined('FS_SVC_PREFIX')) then
557 fnd_profile.get('FS_SVC_PREFIX', svc);
558 if (svc is not null) then
559 svc := substr(svc || node, 1, 254);
560 else
561 svc := 'FNDFS_' || node;
562 end if;
563 else
564 svc := 'FNDFS_' || node;
565 end if;
566
567 if (file_type >= generic_log and file_type <= generic_cfg) then
568 temp_id := id;
569 update_svc(id, svc);
570 else
571 if ( file_type = generic_binary ) then
572 x_mode := 'BINARY';
573 end if;
574
575 temp_id := fnd_webfile.create_id(fname,
576 svc,
577 expire_time,
578 mtype,
579 req_id,
580 x_mode,
581 ncenc);
582 end if;
583
584 -- finally update destination file and node name, transfer_type
585 if ( file_type in ( context_file, generic_text, generic_binary) ) then
586 update_cfg_info(temp_id, dest_file, dest_svc, 'W');
587 end if;
588
589 --It updates the page information. That is page size and page number.It is required to enance a functionallity for
590 --viewing output/log file(only text file) page by page.
591 IF ((page_no IS NOT null) and (page_size IS NOT null)) THEN
592 if(x_mode = 'TEXT') THEN
593 update_page_info(temp_id, page_no, page_size, 'P');
594 end if;
595 end if;
596
597 base := Ltrim(Rtrim(base));
598
599 IF (base_type = 'WEB') THEN
600 -- Strip any file path from the base URL by truncating at the
601 -- third '/'.
602 -- This leaves us with something like 'http://ap363sun:8000'.
603 pos := instr(base, '/', 1, 3);
604 if (pos > 0) then
605 base := substr(base, 1, pos - 1);
606 end if;
607 -- 2638328 - security violation - removing login information from URL
608 url := base || '/OA_CGI/FNDWRR.exe?' || 'temp_id=' || temp_id;
609 ELSIF (base_type = 'CGI') THEN
610 IF (substr(base, length(base)) <> '/') THEN
611 base := base || '/';
612 END IF;
613 url := base || 'FNDWRR.exe?' || 'temp_id=' || temp_id;
614 END IF;
615
616 RETURN url;
617
618 exception
619 when others then
620 generic_error('fnd_webfile.get_url', SQLCODE, SQLERRM);
621 return null;
622 end get_url;
623
624
625
626
627
628
629
630
631 /* Function: get_req_log_urls
632 *
633 * Purpose: Constructs and returns the URLs for a concurrent request log
634 * and the log of the manager that ran the request..
635 *
636 * Arguments:
637 * request_id - Desired request_id.
638 *
639 * gwyuid - The value of the environment variable GWYUID used in
640 * constructing the URL.
641 *
642 * two_task - The database two_task, used in constructing the URL.
643 *
644 * expire_time - The number of minutes for which this URL will remain
645 * valid.
646 *
647 * req_log - Output URL for the request log.
648 *
649 * mgr_log - Output URL for the manager log.
650 *
651 * Returns FALSE on error. Check the FND message stack.
652 */
653
654 function get_req_log_urls( request_id IN number,
655 gwyuid IN varchar2,
656 two_task IN varchar2,
657 expire_time IN number,
658 req_log IN OUT NOCOPY varchar2,
659 mgr_log IN OUT NOCOPY varchar2) return boolean is
660 begin
661 req_log := get_url(request_log, request_id, gwyuid, two_task, expire_time);
662 mgr_log := get_url(request_mgr, request_id, gwyuid, two_task, expire_time);
663
664 if (req_log is not null and mgr_log is not null) then
665 return true;
666 else
667 return false;
668 end if;
669 end get_req_log_urls;
670
671
672
673 function create_id( name IN varchar2,
674 node IN varchar2,
675 lifetime IN number default 10,
676 type IN varchar2 default 'text/plain',
677 req_id IN number default 0,
678 x_mode IN varchar2 default 'TEXT',
679 ncenc IN varchar2 default 'N') return varchar2
680 is
681 PRAGMA AUTONOMOUS_TRANSACTION;
682 my_file_id varchar2(32);
683 fuid number;
684 frand number;
685 collision number;
686 nc_encoding varchar2(240) := NULL;
687 allow_enc varchar2(1);
688 fs_prefix varchar2(254) := NULL;
689 nmptr number;
690 svc varchar2(254) := NULL;
691 ftype fnd_concurrent_requests.output_file_type%TYPE := NULL;
692
693
694 begin
695
696 collision := 1;
697 while (collision > 0) loop
698 my_file_id := fnd_concurrent_file.get_file_id;
699
700 select count(*)
701 into collision
702 from fnd_file_temp T
703 where T.file_id = my_file_id;
704 end loop;
705
706
707 if (ncenc = 'Y') then
708
709 if (req_id <> 0) then
710 begin
711 select upper(output_file_type)
712 into ftype
713 from fnd_concurrent_requests
714 where request_id = req_id;
715 exception
716 when others then
717 null;
718 end;
719 end if;
720
721 begin
722 select allow_client_encoding
723 into allow_enc
724 from fnd_mime_types_vl
725 where mime_type = type
726 and ((ftype is not null and upper(file_format_code) = ftype)
727 or (ftype is null and rownum = 1));
728 exception
729 when others then
730 allow_enc := 'N';
731 end;
732
733 if allow_enc = 'Y' then
734 fnd_profile.get('FND_NATIVE_CLIENT_ENCODING', nc_encoding);
735 if (nc_encoding is null) then
736 fnd_message.set_name('CONC', 'CONC-Cannot get profile value');
737 fnd_message.set_token('ROUTINE', 'CREATE_ID');
738 fnd_message.set_token('PROFILE', 'FND_NATIVE_CLIENT_ENCODING');
739 fnd_message.set_token('REASON', 'Check if profile is set');
740 end if;
741 end if;
742 end if;
743
744 --- Begin Shared Appltop failover code
745 begin
746
747 if (fnd_profile.defined('FS_SVC_PREFIX')) then
748 fnd_profile.get('FS_SVC_PREFIX', fs_prefix);
749 end if;
750
751 if (fs_prefix is null) then
752 fs_prefix := 'FNDFS_';
753 end if;
754
755 -- If prefix already attached - switch node and reattach later
756 if (node LIKE (fs_prefix || '%')) then
757 nmptr := length(fs_prefix) + 1;
758 else -- No prefix, only switch node
759 nmptr := 1;
760 fs_prefix := NULL;
761 end if;
762
763 select substr(fs_prefix || 'APPLTOP_' || b.name, 1, 254)
764 into svc
765 from fnd_nodes n, fnd_appl_tops a, fnd_appl_tops b
766 where n.node_name = substr(node, nmptr, length(node))
767 and n.node_id = a.node_id
768 and a.name = b.name
769 and b.node_id <> a.node_id
770 and ROWNUM = 1;
771
772 exception when NO_DATA_FOUND then
773 svc := node;
774
775 end;
776 --- End Shared Appltop Failover code
777
778 insert into fnd_file_temp( file_id,
779 filename,
780 node_name,
781 mime_type,
782 request_id,
783 expires,
784 transfer_mode,
785 native_client_encoding,
786 enable_logging)
787 values (my_file_id, name, svc, type, req_id,
788 sysdate + (lifetime/1440), x_mode, nc_encoding,
789 debug);
790 commit;
791
792 return my_file_id;
793
794 exception
795 when OTHERS then
796 generic_error('fnd_webfile.create_id', SQLCODE, SQLERRM);
797 rollback;
798 return null;
799
800 end create_id;
801
802
803 procedure set_debug(dbg IN boolean) IS
804 begin
805 if dbg then
806 debug := 'Y';
807 else
808 debug := 'N';
809 end if;
810
811 end set_debug;
812
813
814
815 end;