About :Oracle Apps(E-Business Suite), Oracle Application Framework (OAF), Application Development Framework (ADF) / ADF Mobile
Tuesday, March 10, 2015
Monday, March 09, 2015
OAF - Parameterized Popup
In this article, i will show you how to implement a parameterized popUp in OAF Page.
Region Style : PopUp is available only from R12.1.3 Ebiz.
Iam considering the below requirement to work on the functionality of popUp region.
BC4J Object List :
EmpVO
DeptVO --> parameterized with DeptID
Pages:
HelloPopUPPG.xml (Shows the employee details)
HelloPopUpCO
DeptRN.xml (Shows the Dept Details) -- Shared Region
Final Result
In this article, i will show you how to implement a parameterized popUp in OAF Page.
Region Style : PopUp is available only from R12.1.3 Ebiz.
Iam considering the below requirement to work on the functionality of popUp region.
BC4J Object List :
EmpVO
DeptVO --> parameterized with DeptID
Pages:
HelloPopUPPG.xml (Shows the employee details)
HelloPopUpCO
DeptRN.xml (Shows the Dept Details) -- Shared Region
Final Result
Sunday, March 01, 2015
OAF Integration with XML Report (Merge Multiple VO's)
In this sample, you will get to know how to merge multiple VO's into single XMLDocument and pass this input to RTF Template using : TemplateHelpder API to get the desired output.
RTF Template
Make sure you get the xdo files from $JAVA_TOP and move them in your myclasses of Jdeveloper
Below is the logic of the controller for the buttons in the page :
/*===========================================================================+
| Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA |
| All rights reserved. |
+===========================================================================+
| HISTORY |
+===========================================================================*/
package xxsri.oracle.apps.fnd.webui;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.server.OADBTransactionImpl;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.xdo.oa.schema.server.TemplateHelper;
import oracle.cabo.ui.data.DataObject;
import oracle.jbo.XMLInterface;
import oracle.xml.parser.v2.XMLDOMException;
import oracle.xml.parser.v2.XMLDocument;
import oracle.xml.parser.v2.XMLElement;
import oracle.xml.parser.v2.XMLNode;
import xxsri.oracle.apps.fnd.server.DeptVOImpl;
import xxsri.oracle.apps.fnd.server.EmpVOImpl;
import xxsri.oracle.apps.fnd.server.XXSriBizzServicesAMImpl;
/**
* Controller for ...
*/
public class XMLReportWithMultipleVOCO extends OAControllerImpl
{
public static final String RCS_ID="$Header$";
public static final boolean RCS_ID_RECORDED =
VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
/**
* Layout and page setup logic for a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
*/
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
}
/**
* Procedure to handle form submissions for form elements in
* a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
*/
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
if(pageContext.getParameter("generateXML")!=null)
{
getXMLDocument(pageContext,webBean);
}
//generateReport
else if (pageContext.getParameter("generateReport")!=null)
{
XMLDocument xmlDocObj = getXMLDocument(pageContext,webBean);
System.out.println("GEnerate Report Is Clicked");
// Get the HttpServletResponse object from the PageContext. The report output is written to HttpServletResponse.
DataObject sessionDictionary = (DataObject)pageContext.getNamedDataObject("_SessionParameters");
HttpServletResponse response = (HttpServletResponse)sessionDictionary.selectValue(null,"HttpServletResponse");
try {
ServletOutputStream os = response.getOutputStream();
// Set the Output Report File Name and Content Type
String contentDisposition = "attachment;filename=PerPopleData.html";
response.setHeader("Content-Disposition",contentDisposition);
response.setContentType("application/html");
// Get the Data XML File as the XMLNode
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
xmlDocObj.print(outputStream);
System.out.println("Output Stream-->");
System.out.println(outputStream.toString());
ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
ByteArrayOutputStream outputStreamFle = new ByteArrayOutputStream();
//Generate the PDF Report.
//Process Template
TemplateHelper.processTemplate(
((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getAppsContext(),
"FND",//APPLICATION SHORT NAME
"XXCUS_EMP_DEPT_REP", //TEMPLATE_SHORT_CODE
((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getLanguage(),
((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getCountry(),
inputStream,
TemplateHelper.OUTPUT_TYPE_HTML,
null,
outputStreamFle);
//TemplateHelper.
// Write the PDF Report to the HttpServletResponse object and flush.
byte[] b = outputStreamFle.toByteArray();
response.setContentLength(b.length);
os.write(b, 0, b.length);
os.flush();
os.close();
outputStreamFle.flush();
outputStreamFle.close();
}
catch(Exception e)
{
response.setContentType("text/html");
throw new OAException(e.getMessage(), OAException.ERROR);
}
pageContext.setDocumentRendered(true);
}
}
public XMLDocument getXMLDocument(OAPageContext pageContext, OAWebBean webBean)
{
XMLDocument exportDoc = new XMLDocument();
XMLElement root = (XMLElement)exportDoc.createElement("RootNode");
XXSriBizzServicesAMImpl am = (XXSriBizzServicesAMImpl)pageContext.getApplicationModule(webBean);
XMLNode adbpaXMLNode = getEmpVOXMLData(pageContext,webBean);
XMLNode sysDateXMLNode =getDeptVOXMLData(pageContext,webBean);
appendChild(exportDoc,root,adbpaXMLNode);
appendChild(exportDoc,root,sysDateXMLNode);
exportDoc.appendChild(root);
ByteArrayOutputStream bo = new ByteArrayOutputStream() ;
try
{
exportDoc.print(bo);
}
catch(Exception ex)
{
ex.printStackTrace();
}
System.out.println("Final XML Docu-->"+ bo.toString());
return exportDoc ;
}
public XMLNode getEmpVOXMLData(OAPageContext pageContext, OAWebBean webBean)
{
XXSriBizzServicesAMImpl am = (XXSriBizzServicesAMImpl)pageContext.getApplicationModule(webBean);
EmpVOImpl vo = am.getEmpVO1();
vo.executeQuery();
XMLNode xmlNode = (XMLNode) vo.writeXML(1, XMLInterface.XML_OPT_ALL_ROWS);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
System.out.println("getEmpVOXMLData"+ vo.getRowCount());
return xmlNode;
}
public XMLNode getDeptVOXMLData(OAPageContext pageContext, OAWebBean webBean)
{
XXSriBizzServicesAMImpl am = (XXSriBizzServicesAMImpl)pageContext.getApplicationModule(webBean);
DeptVOImpl vo = am.getDeptVO1();
vo.executeQuery();
XMLNode xmlNode = (XMLNode) vo.writeXML(1, XMLInterface.XML_OPT_ALL_ROWS);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
System.out.println("getDeptVOXMLData"+ vo.getRowCount());
return xmlNode;
}
public void appendChild(XMLDocument doc, XMLNode parent, XMLNode child)
{
try
{
if(parent!=null)
parent.appendChild(child);
else
doc.appendChild(child);
}
catch(XMLDOMException e)
{
try{
doc.adoptNode(child);
if(parent!=null)
parent.appendChild(doc.adoptNode(child));
else
doc.appendChild(child);
}
catch(Exception ex) {}
}
}
}
Subscribe to:
Posts (Atom)