19: tv_sheet utl_http.html_pieces;
20: l_index number;
21: begin
22:
23: hr_utility.set_location('Entering: generateJPSinit',10);
24: l_query:= 'select per.*'
25: ||' ,per.full_name personname'
26: ||' ,per.last_name personlastname'
27: ||' ,decode(per.sex, ''M'',''1'',''F'',''2'',''9'') gender'
181: ||' and per.person_type_id=ppttl.person_type_id'
182: ||' and ppttl.language=userenv(''LANG'')'
183: ||' and rownum=1';
184:
185: hr_utility.set_location('Formed the query to retrieve data',11);
186:
187: if (p_stylesheet is null) then
188:
189: hr_utility.set_location('Stylesheet is null',12);
185: hr_utility.set_location('Formed the query to retrieve data',11);
186:
187: if (p_stylesheet is null) then
188:
189: hr_utility.set_location('Stylesheet is null',12);
190:
191: lv_stylesheet:=''||
192: '
193: '
330: '||'
331:
332:
333: ';
334: hr_utility.set_location('Created the stylesheet',13);
335:
336: else
337: hr_utility.set_location('Stylesheet is not null',14);
338:
333: ';
334: hr_utility.set_location('Created the stylesheet',13);
335:
336: else
337: hr_utility.set_location('Stylesheet is not null',14);
338:
339: begin
340: hr_utility.set_location('Getting stylesheet from URL',15);
341:
336: else
337: hr_utility.set_location('Stylesheet is not null',14);
338:
339: begin
340: hr_utility.set_location('Getting stylesheet from URL',15);
341:
342: l_stylesheet_url:=rtrim(fnd_profile.value('APPS_FRAMEWORK_AGENT'),'/')||'/OA_HTML/'||userenv('LANG')||'/'||p_stylesheet;
343: tv_sheet:= irc_xml_util.http_get_pieces(l_stylesheet_url,100);
344: if instr(lower(tv_sheet(1)),'1 then
344: if instr(lower(tv_sheet(1)),'1 then
345: l_stylesheet_url:=rtrim(fnd_profile.value('APPS_FRAMEWORK_AGENT'),'/')||'/OA_HTML/'||p_stylesheet;
346: tv_sheet:= irc_xml_util.http_get_pieces(l_stylesheet_url,100);
347: end if;
348: hr_utility.set_location('Got the stylesheet from the URL',16);
349:
350: exception when others then
351: hr_utility.set_location('Exception occured while getting stylesheet',17);
352: hr_utility.set_location('Exception: '||substrb(sqlerrm,1,160),18);
347: end if;
348: hr_utility.set_location('Got the stylesheet from the URL',16);
349:
350: exception when others then
351: hr_utility.set_location('Exception occured while getting stylesheet',17);
352: hr_utility.set_location('Exception: '||substrb(sqlerrm,1,160),18);
353: hr_utility.set_location('Exception: '||sqlcode,19);
354: l_stylesheet_url:=rtrim(fnd_profile.value('APPS_FRAMEWORK_AGENT'),'/')||'/OA_HTML/'||p_stylesheet;
355: tv_sheet:= irc_xml_util.http_get_pieces(l_stylesheet_url,100);
348: hr_utility.set_location('Got the stylesheet from the URL',16);
349:
350: exception when others then
351: hr_utility.set_location('Exception occured while getting stylesheet',17);
352: hr_utility.set_location('Exception: '||substrb(sqlerrm,1,160),18);
353: hr_utility.set_location('Exception: '||sqlcode,19);
354: l_stylesheet_url:=rtrim(fnd_profile.value('APPS_FRAMEWORK_AGENT'),'/')||'/OA_HTML/'||p_stylesheet;
355: tv_sheet:= irc_xml_util.http_get_pieces(l_stylesheet_url,100);
356: end;
349:
350: exception when others then
351: hr_utility.set_location('Exception occured while getting stylesheet',17);
352: hr_utility.set_location('Exception: '||substrb(sqlerrm,1,160),18);
353: hr_utility.set_location('Exception: '||sqlcode,19);
354: l_stylesheet_url:=rtrim(fnd_profile.value('APPS_FRAMEWORK_AGENT'),'/')||'/OA_HTML/'||p_stylesheet;
355: tv_sheet:= irc_xml_util.http_get_pieces(l_stylesheet_url,100);
356: end;
357: lv_stylesheet:='';
357: lv_stylesheet:='';
358: for l_index in 1..tv_sheet.count loop
359: lv_stylesheet:=lv_stylesheet||tv_sheet(l_index);
360: end loop;
361: hr_utility.set_location('Created the Stylesheet',20);
362: end if;
363: hr_utility.set_location('Executing the query',21);
364: ctx:= dbms_xmlquery.newContext(l_query);
365: dbms_xmlquery.setBindValue(ctx,'1',p_person_id);
359: lv_stylesheet:=lv_stylesheet||tv_sheet(l_index);
360: end loop;
361: hr_utility.set_location('Created the Stylesheet',20);
362: end if;
363: hr_utility.set_location('Executing the query',21);
364: ctx:= dbms_xmlquery.newContext(l_query);
365: dbms_xmlquery.setBindValue(ctx,'1',p_person_id);
366: dbms_xmlquery.setTagCase(ctx,dbms_xmlquery.LOWER_CASE);
367: dbms_xmlquery.setRowsetTag(ctx,'jobpositionseeker');
365: dbms_xmlquery.setBindValue(ctx,'1',p_person_id);
366: dbms_xmlquery.setTagCase(ctx,dbms_xmlquery.LOWER_CASE);
367: dbms_xmlquery.setRowsetTag(ctx,'jobpositionseeker');
368: clobdoc:=dbms_xmlquery.getXML(ctx);
369: hr_utility.set_location('Retrieved the XML data',22);
370: dbms_xmlquery.closeContext(ctx);
371: dbms_lob.createTemporary(l_formatted_doc,false,dbms_lob.call);
372: hr_utility.set_location('Entering Parsing section',23);
373: parser:=xmlparser.newparser;
368: clobdoc:=dbms_xmlquery.getXML(ctx);
369: hr_utility.set_location('Retrieved the XML data',22);
370: dbms_xmlquery.closeContext(ctx);
371: dbms_lob.createTemporary(l_formatted_doc,false,dbms_lob.call);
372: hr_utility.set_location('Entering Parsing section',23);
373: parser:=xmlparser.newparser;
374:
375: hr_utility.set_location('Setting encoding',231);
376: if(fnd_profile.value('ICX_CLIENT_IANA_ENCODING') <> '') then
371: dbms_lob.createTemporary(l_formatted_doc,false,dbms_lob.call);
372: hr_utility.set_location('Entering Parsing section',23);
373: parser:=xmlparser.newparser;
374:
375: hr_utility.set_location('Setting encoding',231);
376: if(fnd_profile.value('ICX_CLIENT_IANA_ENCODING') <> '') then
377: clobdoc := replace(clobdoc, '?>', ' encoding = '''||fnd_profile.value('ICX_CLIENT_IANA_ENCODING')||'''?>');
378: end if;
379: hr_utility.set_location('Exiting after setting encoding',233);
375: hr_utility.set_location('Setting encoding',231);
376: if(fnd_profile.value('ICX_CLIENT_IANA_ENCODING') <> '') then
377: clobdoc := replace(clobdoc, '?>', ' encoding = '''||fnd_profile.value('ICX_CLIENT_IANA_ENCODING')||'''?>');
378: end if;
379: hr_utility.set_location('Exiting after setting encoding',233);
380:
381: xmlparser.parseCLOB(parser,clobdoc);
382: xmldoc:=xmlparser.getDocument(parser);
383: engine:=xslprocessor.newProcessor;
383: engine:=xslprocessor.newProcessor;
384: xmlparser.parseBuffer(parser,lv_stylesheet);
385: stylesheetdoc:=xmlparser.getDocument(parser);
386: stylesheet:=xslprocessor.newStylesheet(stylesheetdoc,null);
387: hr_utility.set_location('Parsing the stylesheet',24);
388: xslprocessor.processXSL(engine,stylesheet,xmldoc,l_formatted_doc);
389: hr_utility.set_location('Parsing Sucess. Freeing parser',25);
390: xslprocessor.freeStylesheet(stylesheet);
391: xmldom.freeDocument(stylesheetdoc);
385: stylesheetdoc:=xmlparser.getDocument(parser);
386: stylesheet:=xslprocessor.newStylesheet(stylesheetdoc,null);
387: hr_utility.set_location('Parsing the stylesheet',24);
388: xslprocessor.processXSL(engine,stylesheet,xmldoc,l_formatted_doc);
389: hr_utility.set_location('Parsing Sucess. Freeing parser',25);
390: xslprocessor.freeStylesheet(stylesheet);
391: xmldom.freeDocument(stylesheetdoc);
392: xmlParser.freeParser(parser);
393: xslprocessor.freeProcessor(engine);
400: end if;
401:
402: p_formatted_doc:=l_formatted_doc;
403: -- p_formatted_doc:=clobdoc;
404: hr_utility.set_location('Generation successful',26);
405: exception when others then
406: hr_utility.set_location('Exception occured',27);
407: hr_utility.set_location('Exception: '||substrb(sqlerrm,1,160),28);
408: hr_utility.set_location('Exception: '||sqlcode,29);
402: p_formatted_doc:=l_formatted_doc;
403: -- p_formatted_doc:=clobdoc;
404: hr_utility.set_location('Generation successful',26);
405: exception when others then
406: hr_utility.set_location('Exception occured',27);
407: hr_utility.set_location('Exception: '||substrb(sqlerrm,1,160),28);
408: hr_utility.set_location('Exception: '||sqlcode,29);
409: xmlParser.freeParser(parser);
410: xslprocessor.freeProcessor(engine);
403: -- p_formatted_doc:=clobdoc;
404: hr_utility.set_location('Generation successful',26);
405: exception when others then
406: hr_utility.set_location('Exception occured',27);
407: hr_utility.set_location('Exception: '||substrb(sqlerrm,1,160),28);
408: hr_utility.set_location('Exception: '||sqlcode,29);
409: xmlParser.freeParser(parser);
410: xslprocessor.freeProcessor(engine);
411: xslprocessor.freeStylesheet(stylesheet);
404: hr_utility.set_location('Generation successful',26);
405: exception when others then
406: hr_utility.set_location('Exception occured',27);
407: hr_utility.set_location('Exception: '||substrb(sqlerrm,1,160),28);
408: hr_utility.set_location('Exception: '||sqlcode,29);
409: xmlParser.freeParser(parser);
410: xslprocessor.freeProcessor(engine);
411: xslprocessor.freeStylesheet(stylesheet);
412: xmldom.freeDocument(xmldoc);
419: l_dummy_doc CLOB;
420: l_formatted_doc CLOB;
421: l_stylesheet varchar2(240);
422: begin
423: hr_utility.set_location('Entering generateJPS',10);
424: if (p_stylesheet is not null) then
425: hr_utility.set_location('Stylesheet not null',11);
426: l_stylesheet:=p_stylesheet||'.xsl';
427: hr_utility.set_location('Calling generateJPSint with stylesheet',12);
421: l_stylesheet varchar2(240);
422: begin
423: hr_utility.set_location('Entering generateJPS',10);
424: if (p_stylesheet is not null) then
425: hr_utility.set_location('Stylesheet not null',11);
426: l_stylesheet:=p_stylesheet||'.xsl';
427: hr_utility.set_location('Calling generateJPSint with stylesheet',12);
428: generateJPSint(p_person_id=>p_person_id
429: ,p_stylesheet=>l_stylesheet
423: hr_utility.set_location('Entering generateJPS',10);
424: if (p_stylesheet is not null) then
425: hr_utility.set_location('Stylesheet not null',11);
426: l_stylesheet:=p_stylesheet||'.xsl';
427: hr_utility.set_location('Calling generateJPSint with stylesheet',12);
428: generateJPSint(p_person_id=>p_person_id
429: ,p_stylesheet=>l_stylesheet
430: ,p_raw_doc=>l_dummy_doc
431: ,p_formatted_doc=>l_formatted_doc);
429: ,p_stylesheet=>l_stylesheet
430: ,p_raw_doc=>l_dummy_doc
431: ,p_formatted_doc=>l_formatted_doc);
432: else
433: hr_utility.set_location('Calling generateJPSint without stylesheet',12);
434: generateJPSint(p_person_id=>p_person_id
435: ,p_raw_doc=>l_dummy_doc
436: ,p_formatted_doc=>l_formatted_doc);
437: end if;
441: procedure show_resume(p number,s varchar2) is
442: --
443: l_result CLOB;
444: begin
445: hr_utility.set_location('Entering show_resume',10);
446: l_result:=generateJPS(p,s);
447: htp.p(dbms_lob.substr(l_result));
448: exception
449: when others then
446: l_result:=generateJPS(p,s);
447: htp.p(dbms_lob.substr(l_result));
448: exception
449: when others then
450: hr_utility.set_location('Exception occured',20);
451: hr_utility.set_location('Exception: '||substrb(sqlerrm,1,160),30);
452: hr_utility.set_location('Exception: '||sqlcode,40);
453: htp.p(dbms_utility.format_error_stack);
454: end show_resume;
447: htp.p(dbms_lob.substr(l_result));
448: exception
449: when others then
450: hr_utility.set_location('Exception occured',20);
451: hr_utility.set_location('Exception: '||substrb(sqlerrm,1,160),30);
452: hr_utility.set_location('Exception: '||sqlcode,40);
453: htp.p(dbms_utility.format_error_stack);
454: end show_resume;
455: --
448: exception
449: when others then
450: hr_utility.set_location('Exception occured',20);
451: hr_utility.set_location('Exception: '||substrb(sqlerrm,1,160),30);
452: hr_utility.set_location('Exception: '||sqlcode,40);
453: htp.p(dbms_utility.format_error_stack);
454: end show_resume;
455: --
456: procedure save_candidate_resume(p_person_id in number
496: Begin
497: --
498: hr_multi_message.enable_message_list;
499: --
500: hr_utility.set_location('Entering save_candidate_resume',10);
501: open get_doc_name;
502: fetch get_doc_name into l_file_name;
503: close get_doc_name;
504: if l_file_name is null then
513: fnd_message.set_token('STYLE',l_meaning);
514: l_description:=substrb(fnd_message.get,1,240);
515: fnd_message.clear;
516: --
517: hr_utility.set_location('Getting stylesheet',11);
518: l_stylesheet:=p_stylesheet||'.xsl';
519: generateJPSint(p_person_id=>p_person_id
520: ,p_stylesheet=>l_stylesheet
521: ,p_raw_doc =>l_parsed_xml
569: where document_id=l_document_id;
570: end if;
571: irc_document_api.process_document(l_document_id);
572: --
573: hr_utility.set_location('Saved resume',12);
574: exception
575: when others then
576: hr_utility.set_location('Exception occured',20);
577: hr_utility.set_location('Exception: '||substrb(sqlerrm,1,160),30);
572: --
573: hr_utility.set_location('Saved resume',12);
574: exception
575: when others then
576: hr_utility.set_location('Exception occured',20);
577: hr_utility.set_location('Exception: '||substrb(sqlerrm,1,160),30);
578: hr_utility.set_location('Exception: '||sqlcode,40);
579: l_error_added := hr_multi_message.unexpected_error_add(l_proc);
580: raise;
573: hr_utility.set_location('Saved resume',12);
574: exception
575: when others then
576: hr_utility.set_location('Exception occured',20);
577: hr_utility.set_location('Exception: '||substrb(sqlerrm,1,160),30);
578: hr_utility.set_location('Exception: '||sqlcode,40);
579: l_error_added := hr_multi_message.unexpected_error_add(l_proc);
580: raise;
581: end save_candidate_resume;
574: exception
575: when others then
576: hr_utility.set_location('Exception occured',20);
577: hr_utility.set_location('Exception: '||substrb(sqlerrm,1,160),30);
578: hr_utility.set_location('Exception: '||sqlcode,40);
579: l_error_added := hr_multi_message.unexpected_error_add(l_proc);
580: raise;
581: end save_candidate_resume;
582: end;