SlideShare a Scribd company logo
1
Oracle EBS 12.1.3: Integrate OA Framework BC4J components within
Java Concurrent program.
Concurrent processing has been one of the rewarding aspect of Oracle EBS. This allows us to process
millions of transactions behind the scene without any user intervention. Oracle has provided multiple
avenues to design a concurrent program. One stands out of all “Java concurrent program” which uses
“Java — one language, endless possibilities”.
Most of background processes performs some kind of database operation. When comes to Java
concurrent program, JDBC API is in practice to execute SQL operation. Oracle Application Framework
(OAF) is available since many years now to help us to reduce some of the application development
complexities. OAF insulates JDBC connection pool complexity within AOL/J integration code.
OAF is built on MVC deign patterns where MVC stands for model-view and controller. Model-View
relationship separates business/back-end logic with graphical user interface logic. This represent how do
we control operation on server level object like “table inserts”. OAF provides all the bare minimal code
which developer needs to write additionally to fire SELECT/INSERT/UPDATE statement. This way
development team is more focus on actual task in hand which in this tutorial “Read a XML file”.
In this tutorial, I am going to demonstrate “How to use OA Framework BC4J components in Java
concurrent program” to perform complex background operations like loading a data file.
We are going to build a custom Java concurrent program which will read the XML file, parse it and load it
into the database table. Sample XML file being used for this tutorial is provided as below.
2
System Configuration used in this demonstration.
 JDeveloper 10g on Window7 4GB RAM.
 Oracle Database 11.2.0.4
 Oracle EBS 12.1.3 on Linux.
JDeveloper is being primarily tool used for OAF development. Before we proceed, we will have to find
out what JDeveloper version works with Oracle EBS release installed in the development environment.
Oracle has generously published this information in Metalink note#416708.1 to help us find exact
JDeveloper patch required.
I built this example on Release 12.1.3 with patch 15880118 applied which corresponds to JDeveloper
Patch# 9879989 as per below matrix available in note#416708.1.
OA Framework - How to Find the Correct Version of JDeveloper for OA Extensions to Use with
E-Business Suite 11i or Release 12.x (Doc ID 416708.1)
JDeveloper doesn’t comes with installer. Once you have downloaded the patch, you just need to
extract/unzip file at your preferred location.
As an example, I used C:AmitJdev_12_1_3 as a location to unzipextract the patch.
3
Setup Your Development Environment
It’s important we follow all the instructions provided under section “Setting Up Your Development
Environment” in Oracle Application Framework Developer's Guide. This can save us from nuisances.
Step1: Create an environment variable “JDEV_USER_HOME” in local machine.
Step2: Add below responsibilities to your EBS user account.
Step3: Define JDeveloper Database Connection
Step3.a: You can switch to Connection tab, right click on Databases and select “New Database
Connection”.
Responsibility:
 OA Framework ToolBox
 OA Framework ToolBox Tutorial Labs
4
Step3.b: Ignore the First/Splash screen.
Step3.c: Choose connection name.
Step3.d: Provide DB schema name as Username and corresponding password.
5
Step3.e: Provide Database hostname, DB Port and SID.
Step3.f: Test the connection.
6
Step3.g: Expand the connection to review an object / table.
Your DB connection is ready to use. JDeveloper will need DB connection to create Entity Object, View
object etc. for you.
Step4: Run the examples comes with JDeveloper patch
Running examples comes with patch is great way to find out if you are going to get into any trouble with
AOL/J integration. All the examples can be loaded by single WORKSPACE selection “toolbox.jws”. They
are normally available under <LOCAL_ DIR >JDevHomejdevmyprojects.
Step4.a: Choose workspace “toolbox.jws”
Go to File menu and select Open option and choose
<LOCAL_DIR>Jdevjdevhomejdevmyprojectstoolbox.jws
7
8
In Applications navigator, Right click on toolbox and select Rebuild/compile whole sample set.
Make sure fix any compilation error reported.
9
Step4.b: Change the “tutorial” project setting to include Database connection and discard whatever
comes in as default.
Step4.3 Update runtime connection. You can always check directory “$FND_TOP/secure” or
“$FND_SECURE” to find DBC file. If you don’t have access, you can request Oracle Applications DBA to
provide it to you.
10
Step4.c: You are all set to run JDeveloper examples. Right click on “test_fwktutorial.jsp” and select “Run”
to launch the main page. You shall see webpage showing main menu as below.
As long as you can run the example pages, your configuration settings are OKAY. We can proceed now
with topic in hand.
Step5: Create a New OA Workspace and add a New OA Project
Even though we can use “toolbox.jws” as workspace for development. I prefer we create new workspace
and project to separate the work being done.
Step5.a: Right click on Applications and Select “New OA Workspace...”
11
Step5.b: Define project name and Default Package.
Oracle naming convention to define package is as below.
<3rdPartyName>.oracle.apps.<applicationShortName>.<subcomponentName>.
In this example, I am using 3rdParty as “custom” and application name as “custmodule”
Step5.c: Predefined connection will be listed under Connection LOV. Select the appropriate one.
12
Step5.d: Select the DBC file and User name has to be an “EBS” account not Database account.
Click on finish button.
13
Define Model and View objects
Before we can add any component to newly created project, lets understand what object we will need…
OA Framework Stack
Step6: Create an entity object for table.
Step6.a: Right click on “Server” under “custom.oracle.apps.custmodule.conc” and select “New Entity
Object…”
We are building background job. As per OA
Framework stack, we need following
objects
1. Entity object
2. View Object
3. Application module.
We don’t need OA Controller object
because it is primarily responsible for user
action on HTML page.
14
Step6.b: Choose all the attributes. Please make sure custom table has WHO columns.
Step6.c: Select the primary key. If you don’t have, then select ROWID as primary key.
15
Step6.d: Select the Accessors as Generate Methods.
Step6.e: Don’t select the Generate Default View Objects.
16
Step6.f: Click the finish button to complete the EO creation.
Step7: Create a view object.
Step7.a: Right click on “Server” under “custom.oracle.apps.custmodule.conc” and select “New View
Object…”
17
Step7.b: Select the Entity object available in left side and move it to right.
Step7.c: Select all the available attributes in view.
18
Step7.d: Select the View Object class as well as View Row class as per below screen.
Step7.e: Finish the wizard.
19
Step8 Create an Application module.
Step8.a: Right click on “Server” under “custom.oracle.apps.custmodule.conc” and select “New
Application module. …”
Step8.b: Select the view object available on left side and move it right side.
20
Step8.c: There is only one Application Module in used. Please ignore this screen.
Step8.d: Select the Generate java files option for “contactinfoAMImpl” and finish the wizard.
21
JDeveloper will automatically generate java classes for you. As you can see now, you have class file for
Entity Object, View Object and Application Module.
As of now, we have all the required BC4J components which we will integrate with Java concurrent
program class.
Step9: Create class “LoadData.java” which implements Java
concurrent program methods.
Step9.a: Create a class.
Import all the required packages for Java concurrent program.
import oracle.apps.fnd.cp.request.CpContext;
import oracle.apps.fnd.cp.request.JavaConcurrentProgram;
22
Implements LoadData class to use JavaConcurrentProgram.
Red Underline on LoadData indicates below error.
Error: Method RunProgram not implemented
Step9.b: Add any missing method.
Now basic implementation of the class to implement Java Concurrent program looks as below.
Step9.c: Add basic functionality to class.
 Read any parameter pass to concurrent request.
 Display parameters in log file.
 Set Request completion status as 0 (successful).
import oracle.apps.fnd.cp.request.CpContext;
import oracle.apps.fnd.cp.request.JavaConcurrentProgram;
public class LoadData implements JavaConcurrentProgram{
public LoadData()
{}
public void runProgram(CpContext ctx)
{}
}
public void runProgram(CpContext ctx)
{
System.out.println(" Running Custom Job Parse and Load XML data into
Contact Info table.");
String attribute;
String line = null;
// Concurrent Request execution status
ReqCompletion rStatus = ctx.getReqCompletion();
rOutFile = ctx.getOutFile(); // get OutFile object from CpContext
rLogFile = ctx.getLogFile();// get LogFile object from CpContext
ParameterList pList = ctx.getParameterList();
Hashtable mAttributes = new Hashtable();
23
Code continue...
Object obj = null;
// Retrive the list of parameters provided to concurrent request.
if(pList.hasMoreElements())
{
rLogFile.writeln( "--------------------",
rLogFile.STATEMENT);
String attribute_name;
String attribute_value;
for(; pList.hasMoreElements(); )
{
NameValueType namevaluetype = pList.nextParameter();
attribute_name = namevaluetype.getName();
attribute_value = namevaluetype.getValue();
if(attribute_value != null)
{
if(attribute_name.equalsIgnoreCase("P_FILE_NAME"))
mFileName = attribute_value;
}
}
}
BufferedReader br;
try
{
br = new BufferedReader(new FileReader(mFileName));
while ((line = br.readLine()) != null)
{
rLogFile.writeln(line,rLogFile.STATEMENT);
}
} catch (FileNotFoundException e)
{rLogFile.writeln(e.getMessage(),rLogFile.STATEMENT);}
catch (java.io.IOException e1)
{rLogFile.writeln (e1.getMessage(),rLogFile.STATEMENT) ;}
rStatus.setCompletion(mXmlErrorCode, mXmlErrorMsg);
rLogFile.writeln ("Load XML Data using OA Business Component job
Completed",rLogFile.STATEMENT);
}
24
Step10: Test the basic functionality.
Step10.a: Create directories at middle tier which represent BC4J package
“custom.oracle.apps.custmodule.conc.server”.
Connect to APPS tier (I got Linux) as an instance owner, run below commands to create your directory
structure.
Step10.b: Upload all the class files from local machine to middle tier.
Step10.c: Define concurrent program and executable.
 cd $JAVA_TOP
 mkdir -p custom/oracle/apps/custmodule/conc/server
 $ pwd
Example: /{Instance_name}/apps/apps_st/comn/java/classes/custom/oracle/apps/custmodule/
conc/server
25
Define Concurrent Program.
Define Parameter for concurrent program.
26
Step10.d: Register the concurrent program to request group.
Step10.e: Run the concurrent program.
Concurrent request was completed normal. I printed XML content in log file to verify if process can read
file successfully.
Concurrent request log file:
Concurrent job was able to read xml file.
27
Step11: Add a parsing capability.
We can use DOM or SAX API to parse XML data. In this tutorial, I am going to use SAX parser. For more
information on SAX parser, please visit http://www.saxproject.org/.
SAX Parser is event oriented. Parsing event get fired on XML element. This make developer life easy
because we can just look for what is “Point of Interest” and discard rest of data.
With SAX Parser, we will need to implement 5 different methods to represent complete XML tag life cycle.
 startDocument()
 startElement()
 characters()
 endElement()
 endDocument()
Here is an example how API will be fired.
<?xml version="1.0"?>
<vendor>
<name>Jon Doe</name>
</vendor>
API firing sequence
Start Document
Start Element: vendor
Start Element: name
characters: Jon Doe
End Element: name
End Element: vendor
End document
Why did I select SAX instead of DOM?
Before I proceed to next step, I wanted to clear why SAX Parser was more appealing for me than DOM.
DOM loads whole XML document into memory as a tree. DOM API’s are fast but they need more
memory. In order to load XML data, I don’t need all the XML elements loaded in memory. I don’t even
need all of them. We will look for specific XML elements to decide what to load. For example, I don’t care
about <vendor> tag in file. This is just start and stop marker for me to decide when new record starts.
If you are in need to validate XML document first before you can use the XML data, DOM would be better
for you.
28
Step11.a: Add a new class “ReadXML” which implements SAX Parser API.
package custom.oracle.apps.custmodule.conc.server;
import java.io.IOException;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.FileInputStream;
public class ReadXML extends DefaultHandler
{
File lFile;
InputStream lFileStream;
SAXParser lSaxParser;
boolean recordData=false;
String lName = "";
String lAddress ="";
String lCity ="";
String lState ="";
String lZip = "";
StringBuffer textBuffer;
Attributes attrlist;
public ReadXML() {
}
public void readFile(String fileName)
{
jobAM=LoadData.getAM();
InitSaxXmlParser(fileName);
}
public void startDocument() throws SAXException
{
System.out.println("Start of document");
initAttribute();
}
29
public void initAttribute()
{
lName = "";
lAddress ="";
lCity ="";
lState ="";
lZip = "";
}
public void endDocument() throws SAXException
{
System.out.println("End of document. Does");
}
public void InitSaxXmlParser(String fileName)
{
DefaultHandler mhandler = new ReadXML();
try
{
System.out.println("File name length"+fileName.length());
lFile=new File(fileName);
lFileStream = new FileInputStream(lFile);
// Use the default (non-validating) SAX Parser
SAXParserFactory factory = SAXParserFactory.newInstance();
try
{
lSaxParser = factory.newSAXParser();
lSaxParser.parse(lFileStream, mhandler);
}
catch (ParserConfigurationException ex)
{
System.err.println ("Failed to create SAX parser:" + ex);}
catch (SAXException ex) {
System.err.println ("SAX parser exceeption:" + ex);}
catch (IOException ex) {
System.err.println ("IO exeception:" + ex);}
catch (IllegalArgumentException ex) {
System.err.println ("Invalid file argument" + ex);}
}
catch(FileNotFoundException e)
{
System.err.println ("Invalid file argument" + e.getMessage());}
}
30
public void startElement(String namespaceURI, String sName, // simple name
String qName, Attributes attrs) throws SAXException {
getElementText();
attrlist=attrs;
if (qName.equalsIgnoreCase("vendor")
recordData=true;
if (recordData)
{
if (qName.equalsIgnoreCase("name"))
Set_Attributes(attrlist, sName,qName,getElementText());
if (qName.equalsIgnoreCase("address"))
Set_Attributes(attrlist, sName,qName,getElementText());
if (qName.equalsIgnoreCase("city"))
Set_Attributes(attrlist, sName,qName,getElementText());
if (qName.equalsIgnoreCase("state"))
Set_Attributes(attrlist, sName,qName,getElementText());
if (qName.equalsIgnoreCase("zip"))
Set_Attributes(attrlist, sName,qName,getElementText());
}
}
public void Set_Attributes(Attributes mAttribute, String localName, String qualifiedName,
String tagValue ) {
if (recordData)
{
//System.out.println("Set_Attributes ->"+localName+" :"+qualifiedName+ ":"+ tagValue);
if (qualifiedName.equalsIgnoreCase("name"))
lName = tagValue;
if (qualifiedName.equalsIgnoreCase("Address"))
lAddress = tagValue;
if (qualifiedName.equalsIgnoreCase("city"))
lCity = tagValue;
if (qualifiedName.equalsIgnoreCase("state"))
lState = tagValue;
if (qualifiedName.equalsIgnoreCase("zip"))
lZip = tagValue;
}
}
31
public void characters(char[] buf, int offset, int len) throws SAXException
{
String s = new String(buf, offset, len);
if (textBuffer == null)
textBuffer = new StringBuffer(s);
else
textBuffer.append(s);
}
public String getElementText() throws SAXException
{
if (textBuffer == null) return null ;
String s = ""+textBuffer;
textBuffer = null;
return s;
}
public void endElement(String namespaceURI, String sName, String qName ) throws
SAXException
{
Set_Attributes(attrlist, sName,qName,getElementText());
if (qName.equalsIgnoreCase("vendor"))
{
recordData=false;
System.out.println(" name->"+lName);
System.out.println(" mAddress->"+lAddress);
System.out.println(" city->"+lCity);
System.out.println(" state->"+lState);
System.out.println(" zip->"+lZip);
}
}
public static void main(String[] args)
{
String fileName="C:AmitJdev_12_1_3JdevjdevhomejdevcontactInfo.xml";
ReadXML xmltobeRead = new ReadXML();
xmltobeRead.readFile(fileName);
}
}
32
Step12: Integrate BC4J functionality with Java concurrent program.
Step12.a: Define variable and create standalone Application module in LoadXML class.
Step12.b: Add a get method to access AM instance in ReadXML class.
Step12.c: Instantiate the xml parser in LoadXML.
Step12.d: Create a method which will insert row into View Object in ReadXML class.
This method will be called evert time we hit the </vendor> tag which represent end-of-record.
ReadXML xmlConsumer = new ReadXML();
xmlConsumer.readFile(mFileName);
private static OAApplicationModule lJobAM;
String mAmDefName = "custom.oracle.apps.custmodule.conc.server.contactinfoAM";
lJobAM = OAApplicationModuleFactory.createRootOAApplicationModule(ctx, mAmDefName);
public static OAApplicationModule getAM()
{
return ljobAM;
}
private void CreateContactInfoRow()
{
OAViewObject oaContactInfoVO=null;
if(jobAM!=null)
{
oaContactInfoVO=(OAViewObject)jobAM.findViewObject("contactInfoVO1");
OARow contactInfoRow = (OARow) oaContactInfoVO.createRow();
if(contactInfoRow!=null)
{
contactInfoRow.setAttribute("Name",lName);
contactInfoRow.setAttribute("Address",lAddress);
contactInfoRow.setAttribute("City", lCity);
contactInfoRow.setAttribute("State",lState);
contactInfoRow.setAttribute("Zip",lZip);
jobAM.invokeMethod("commitContactInfo");
}
else
System.out.println("AM job was NULL");
}
}
33
Step12.e: Add a method in Application module class to commit your changes.
Step12.f: Modify endElement method to call “CreateContactInfoRow()” as soon as we hit </vendor> tag.
We are all set to re-run the concurrent program again.
public void commitContactInfo()
{
Throwable athrowable[] = null;
OADBTransaction oadbtransaction = getOADBTransaction();
contactInfoVOImpl ccNewContact = getcontactInfoVO1();
oadbtransaction.postChanges();
oadbtransaction.commit();
ccNewContact.closeRowSet();
oadbtransaction.clearEntityCache("custom.oracle.apps.custmodule.conc.server.contactInfoEO"
);
if(athrowable != null && athrowable.length > 0)
throw OAException.getBundledOAException(athrowable);
else
return;
}
public void endElement(String namespaceURI,
String sName,
String qName ) throws SAXException
{
Set_Attributes(attrlist, sName,qName,getElementText());
if (qName.equalsIgnoreCase("vendor"))
{
recordData=false;
System.out.println(" name->"+lName);
System.out.println(" mAddress->"+lAddress);
System.out.println(" city->"+lCity);
System.out.println(" state->"+lState);
System.out.println(" zip->"+lZip);
CreateContactInfoRow();
}
}
34
Step12.g: Run the concurrent program
Finally query the table to confirm data was truly loaded.
35
As you can see, I was able to insert data into table without writing a single
INSERT statement. This is the simplification BC4J component offers to us.
This completes the demonstration “Integrate OA Framework BC4J components within Java concurrent
program”. All the class source code is available in Appendix section.
Summary
 Define entity object for table.
 Define view object for entity object.
 Define application module for view object.
 Define “LoadXML” class which implements Java concurrent program methods.
 Define “ReadXML” class which implement SAX Parser API’s.
 Create a root level Application Module in LoadXML class using Context passed as
parameter.
 Instantiate ReadXML within LoadXML class.
 Create an SAX Parser instance using SAXParserFactory and pass the XML file as
parameter to parse method.
 Parsing will generate event in below sequence for XML elements.
-> StartElement()
->Characters()
->EndElement()
 Inside method “EndElement()” , If xml element is “VENDOR” , call
CreateContactInfoRow()” which create a new row in view object.
 At the end of “CreateContactInfoRow()” method call commitContactInfo() which is defined
in application module to post the changes at database table.
 For all the XML element “VENDOR” , CreateContactInfoRow() will be called which will
create eventually all the rows in table.
 After XML parsing event complete, set the request set completion status as 0 in LoadData
class.
36
Appendix A: Application module java class.
package custom.oracle.apps.custmodule.conc.server;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.apps.fnd.framework.server.OADBTransaction;
// ---------------------------------------------------------------------
// --- File generated by Oracle ADF Business Components Design Time.
// --- Custom code may be added to this class.
// --- Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class contactinfoAMImpl extends OAApplicationModuleImpl {
/**This is the default constructor (do not remove)
*/
public contactinfoAMImpl() {
}
/**Container's getter for contactInfoVO1
*/
public contactInfoVOImpl getcontactInfoVO1() {
return (contactInfoVOImpl)findViewObject("contactInfoVO1");
}
public void commitContactInfo()
{
Throwable athrowable[] = null;
OADBTransaction oadbtransaction = getOADBTransaction();
contactInfoVOImpl ccNewContact = getcontactInfoVO1();
oadbtransaction.postChanges();
oadbtransaction.commit();
ccNewContact.closeRowSet();
oadbtransaction.clearEntityCache("custom.oracle.apps.custmodule.conc.server.contactInfoEO")
;
if(athrowable != null && athrowable.length > 0)
throw OAException.getBundledOAException(athrowable);
else
return;
}
/**Sample main for debugging Business Components code using the tester.
*/
public static void main(String[] args) {
launchTester("custom.oracle.apps.custmodule.conc.server", /* package name */
"contactinfoAMLocal" /* Configuration Name */);
}
}
37
Appendix B: Entity Object Java class file.
package custom.oracle.apps.custmodule.conc.server;
import oracle.apps.fnd.framework.server.OAEntityDefImpl;
import oracle.apps.fnd.framework.server.OAEntityImpl;
import oracle.jbo.domain.Date;
import oracle.jbo.domain.Number;
import oracle.jbo.domain.RowID;
import oracle.jbo.server.AttributeDefImpl;
import oracle.jbo.server.EntityDefImpl;
// ---------------------------------------------------------------------
// --- File generated by Oracle ADF Business Components Design Time.
// --- Custom code may be added to this class.
// --- Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class contactInfoEOImpl extends OAEntityImpl {
public static final int NAME = 0;
public static final int ADDRESS = 1;
public static final int CITY = 2;
public static final int STATE = 3;
public static final int ZIP = 4;
public static final int CREATIONDATE = 5;
public static final int CREATEDBY = 6;
public static final int LASTUPDATEDATE = 7;
public static final int LASTUPDATEDBY = 8;
public static final int ROWID = 9;
public static final int LASTUPDATELOGIN = 10;
private static OAEntityDefImpl mDefinitionObject;
/**This is the default constructor (do not remove)
*/
public contactInfoEOImpl() {
}
/**Retrieves the definition object for this instance class.
*/
public static synchronized EntityDefImpl getDefinitionObject() {
if (mDefinitionObject == null) {
mDefinitionObject =
(OAEntityDefImpl)EntityDefImpl.findDefObject("custom.oracle.apps.custmodule.conc.server.con
tactInfoEO");
}
return mDefinitionObject;
}
38
/**Gets the attribute value for Name, using the alias name Name
*/
public String getName() {
return (String)getAttributeInternal(NAME);
}
/**Sets <code>value</code> as the attribute value for Name
*/
public void setName(String value) {
setAttributeInternal(NAME, value);
}
/**Gets the attribute value for Address, using the alias name Address
*/
public String getAddress() {
return (String)getAttributeInternal(ADDRESS);
}
/**Sets <code>value</code> as the attribute value for Address
*/
public void setAddress(String value) {
setAttributeInternal(ADDRESS, value);
}
/**Gets the attribute value for City, using the alias name City
*/
public String getCity() {
return (String)getAttributeInternal(CITY);
}
/**Sets <code>value</code> as the attribute value for City
*/
public void setCity(String value) {
setAttributeInternal(CITY, value);
}
/**Gets the attribute value for State, using the alias name State
*/
public String getState() {
return (String)getAttributeInternal(STATE);
}
/**Sets <code>value</code> as the attribute value for State
*/
public void setState(String value) {
setAttributeInternal(STATE, value);
}
39
/**Gets the attribute value for Zip, using the alias name Zip
*/
public String getZip() {
return (String)getAttributeInternal(ZIP);
}
/**Sets <code>value</code> as the attribute value for Zip
*/
public void setZip(String value) {
setAttributeInternal(ZIP, value);
}
/**Gets the attribute value for CreationDate, using the alias name CreationDate
*/
public Date getCreationDate() {
return (Date)getAttributeInternal(CREATIONDATE);
}
/**Sets <code>value</code> as the attribute value for CreationDate
*/
public void setCreationDate(Date value) {
setAttributeInternal(CREATIONDATE, value);
}
/**Gets the attribute value for CreatedBy, using the alias name CreatedBy
*/
public Number getCreatedBy() {
return (Number)getAttributeInternal(CREATEDBY);
}
/**Sets <code>value</code> as the attribute value for CreatedBy
*/
public void setCreatedBy(Number value) {
setAttributeInternal(CREATEDBY, value);
}
/**Gets the attribute value for LastUpdateDate, using the alias name LastUpdateDate
*/
public Date getLastUpdateDate() {
return (Date)getAttributeInternal(LASTUPDATEDATE);
}
/**Sets <code>value</code> as the attribute value for LastUpdateDate
*/
public void setLastUpdateDate(Date value) {
setAttributeInternal(LASTUPDATEDATE, value);
}
/**Gets the attribute value for LastUpdatedBy, using the alias name LastUpdatedBy*/
40
public Number getLastUpdatedBy() {
return (Number)getAttributeInternal(LASTUPDATEDBY);
}
/**Sets <code>value</code> as the attribute value for LastUpdatedBy
*/
public void setLastUpdatedBy(Number value) {
setAttributeInternal(LASTUPDATEDBY, value);
}
/**Gets the attribute value for RowID, using the alias name RowID
*/
public RowID getRowID() {
return (RowID)getAttributeInternal(ROWID);
}
/**getAttrInvokeAccessor: generated method. Do not modify.
*/
protected Object getAttrInvokeAccessor(int index,
AttributeDefImpl attrDef) throws Exception {
switch (index) {
case NAME:
return getName();
case ADDRESS:
return getAddress();
case CITY:
return getCity();
case STATE:
return getState();
case ZIP:
return getZip();
case CREATIONDATE:
return getCreationDate();
case CREATEDBY:
return getCreatedBy();
case LASTUPDATEDATE:
return getLastUpdateDate();
case LASTUPDATEDBY:
return getLastUpdatedBy();
case ROWID:
return getRowID();
case LASTUPDATELOGIN:
return getLastUpdateLogin();
default:
return super.getAttrInvokeAccessor(index, attrDef);
}
}
41
protected void setAttrInvokeAccessor(int index, Object value,
AttributeDefImpl attrDef) throws Exception {
switch (index) {
case NAME:
setName((String)value);
return;
case ADDRESS:
setAddress((String)value);
return;
case CITY:
setCity((String)value);
return;
case STATE:
setState((String)value);
return;
case ZIP:
setZip((String)value);
return;
case CREATIONDATE:
setCreationDate((Date)value);
return;
case CREATEDBY:
setCreatedBy((Number)value);
return;
case LASTUPDATEDATE:
setLastUpdateDate((Date)value);
return;
case LASTUPDATEDBY:
setLastUpdatedBy((Number)value);
return;
case LASTUPDATELOGIN:
setLastUpdateLogin((Number)value);
return;
default:
super.setAttrInvokeAccessor(index, value, attrDef);
return;
}
}
public Number getLastUpdateLogin() {
return (Number)getAttributeInternal(LASTUPDATELOGIN);
}
public void setLastUpdateLogin(Number value) {
setAttributeInternal(LASTUPDATELOGIN, value);
}
}
42
Appendix C: View Object Java class file.
package custom.oracle.apps.custmodule.conc.server;
import oracle.apps.fnd.framework.server.OAViewRowImpl;
import oracle.jbo.domain.Date;
import oracle.jbo.domain.Number;
import oracle.jbo.domain.RowID;
import oracle.jbo.server.AttributeDefImpl;
// ---------------------------------------------------------------------
// --- File generated by Oracle ADF Business Components Design Time.
// --- Custom code may be added to this class.
// --- Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class contactInfoVORowImpl extends OAViewRowImpl {
public static final int NAME = 0;
public static final int ADDRESS = 1;
public static final int CITY = 2;
public static final int STATE = 3;
public static final int ZIP = 4;
public static final int CREATIONDATE = 5;
public static final int CREATEDBY = 6;
public static final int LASTUPDATEDATE = 7;
public static final int LASTUPDATEDBY = 8;
public static final int ROWID = 9;
public static final int LASTUPDATELOGIN = 10;
/**This is the default constructor (do not remove)
*/
public contactInfoVORowImpl() {
}
/**Gets contactInfoEO entity object.
*/
public contactInfoEOImpl getcontactInfoEO() {
return (contactInfoEOImpl)getEntity(0);
}
/**Gets the attribute value for NAME using the alias name Name
*/
public String getName() {
return (String) getAttributeInternal(NAME);
}
/**Sets <code>value</code> as attribute value for NAME using the alias name Name
*/
43
public void setName(String value) {
setAttributeInternal(NAME, value);
}
/**Gets the attribute value for ADDRESS using the alias name Address
*/
public String getAddress() {
return (String) getAttributeInternal(ADDRESS);
}
/**Sets <code>value</code> as attribute value for ADDRESS using the alias name Address
*/
public void setAddress(String value) {
setAttributeInternal(ADDRESS, value);
}
/**Gets the attribute value for CITY using the alias name City
*/
public String getCity() {
return (String) getAttributeInternal(CITY);
}
/**Sets <code>value</code> as attribute value for CITY using the alias name City
*/
public void setCity(String value) {
setAttributeInternal(CITY, value);
}
/**Gets the attribute value for STATE using the alias name State
*/
public String getState() {
return (String) getAttributeInternal(STATE);
}
/**Sets <code>value</code> as attribute value for STATE using the alias name State
*/
public void setState(String value) {
setAttributeInternal(STATE, value);
}
/**Gets the attribute value for ZIP using the alias name Zip
*/
public String getZip() {
return (String) getAttributeInternal(ZIP);
}
/**Sets <code>value</code> as attribute value for ZIP using the alias name Zip
44
*/
public void setZip(String value) {
setAttributeInternal(ZIP, value);
}
/**Gets the attribute value for CREATION_DATE using the alias name CreationDate
*/
public Date getCreationDate() {
return (Date) getAttributeInternal(CREATIONDATE);
}
/**Sets <code>value</code> as attribute value for CREATION_DATE using the alias name
CreationDate
*/
public void setCreationDate(Date value) {
setAttributeInternal(CREATIONDATE, value);
}
/**Gets the attribute value for CREATED_BY using the alias name CreatedBy
*/
public Number getCreatedBy() {
return (Number) getAttributeInternal(CREATEDBY);
}
/**Sets <code>value</code> as attribute value for CREATED_BY using the alias name
CreatedBy
*/
public void setCreatedBy(Number value) {
setAttributeInternal(CREATEDBY, value);
}
/**Gets the attribute value for LAST_UPDATE_DATE using the alias name LastUpdateDate
*/
public Date getLastUpdateDate() {
return (Date) getAttributeInternal(LASTUPDATEDATE);
}
/**Sets <code>value</code> as attribute value for LAST_UPDATE_DATE using the alias name
LastUpdateDate
*/
public void setLastUpdateDate(Date value) {
setAttributeInternal(LASTUPDATEDATE, value);
}
public Number getLastUpdatedBy() { return (Number)
getAttributeInternal(LASTUPDATEDBY);
}
45
/**Sets <code>value</code> as attribute value for LAST_UPDATED_BY using the alias name
LastUpdatedBy
*/
public void setLastUpdatedBy(Number value) {
setAttributeInternal(LASTUPDATEDBY, value);
}
/**Gets the attribute value for ROWID using the alias name RowID
*/
public RowID getRowID() {
return (RowID) getAttributeInternal(ROWID);
}
/**getAttrInvokeAccessor: generated method. Do not modify.
*/
protected Object getAttrInvokeAccessor(int index,
AttributeDefImpl attrDef) throws Exception {
switch (index) {
case NAME:
return getName();
case ADDRESS:
return getAddress();
case CITY:
return getCity();
case STATE:
return getState();
case ZIP:
return getZip();
case CREATIONDATE:
return getCreationDate();
case CREATEDBY:
return getCreatedBy();
case LASTUPDATEDATE:
return getLastUpdateDate();
case LASTUPDATEDBY:
return getLastUpdatedBy();
case ROWID:
return getRowID();
case LASTUPDATELOGIN:
return getLastUpdateLogin();
default:
return super.getAttrInvokeAccessor(index, attrDef);
}
}
/**setAttrInvokeAccessor: generated method. Do not modify.
*/
46
*/
protected void setAttrInvokeAccessor(int index, Object value,
AttributeDefImpl attrDef) throws Exception {
switch (index) {
case NAME:
setName((String)value);
return;
case ADDRESS:
setAddress((String)value);
return;
case CITY:
setCity((String)value);
return;
case STATE:
setState((String)value);
return;
case ZIP:
setZip((String)value);
return;
case CREATIONDATE:
setCreationDate((Date)value);
return;
case CREATEDBY:
setCreatedBy((Number)value);
return;
case LASTUPDATEDATE:
setLastUpdateDate((Date)value);
return;
case LASTUPDATEDBY:
setLastUpdatedBy((Number)value);
return;
case LASTUPDATELOGIN:
setLastUpdateLogin((Number)value);
return;
default:
super.setAttrInvokeAccessor(index, value, attrDef);
return;
}
}
/**Gets the attribute value for LAST_UPDATE_LOGIN using the alias name LastUpdateLogin
*/
public Number getLastUpdateLogin() {
return (Number) getAttributeInternal(LASTUPDATELOGIN);
}
/**Sets <code>value</code> as attribute value for LAST_UPDATE_LOGIN using the alias name
LastUpdateLogin
47
public void setLastUpdateLogin(Number value) {
setAttributeInternal(LASTUPDATELOGIN, value);
}
}
package custom.oracle.apps.custmodule.conc.server;
import oracle.apps.fnd.framework.server.OAViewObjectImpl;
// ---------------------------------------------------------------------
// --- File generated by Oracle ADF Business Components Design Time.
// --- Custom code may be added to this class.
// --- Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class contactInfoVOImpl extends OAViewObjectImpl {
/**This is the default constructor (do not remove)
*/
public contactInfoVOImpl() {
}
}
48
Appendix D: LoadData Java class
package custom.oracle.apps.custmodule.conc.server;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import oracle.apps.fnd.cp.request.ReqCompletion;
import oracle.apps.fnd.cp.request.LogFile;
import oracle.apps.fnd.cp.request.CpContext;
import oracle.apps.fnd.cp.request.JavaConcurrentProgram;
import oracle.apps.fnd.cp.request.OutFile;
import oracle.apps.fnd.util.ParameterList;
import java.util.Properties;
import java.util.Hashtable;
import oracle.apps.fnd.common.Message;
import oracle.apps.fnd.common.MessageToken;
import oracle.apps.fnd.util.NameValueType;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAApplicationModuleFactory;
import oracle.apps.fnd.framework.OAException;
import java.sql.CallableStatement;
import java.sql.SQLException;
import java.math.BigDecimal;
public class LoadData implements JavaConcurrentProgram {
private static OAApplicationModule ljobAM;
private static LogFile rLogFile;
private static OutFile rOutFile;
private static int mRequestId;
private static String mFileName;
private static int mXmlErrorCode=0;
private static String mXmlErrorMsg="";
public static void writeToLog(String data)
{
rLogFile.writeln( data, rLogFile.STATEMENT);
}
public static OAApplicationModule getAM()
{
return ljobAM;
}
49
public static String getFileName()
{
return mFileName;
}
public void runProgram(CpContext ctx)
{
System.out.println(" Running Custom Job Parse and Load XML data into Contact Info
table.");
String attribute;
String line = null;
// Concurrent Request execution status
ReqCompletion rStatus = ctx.getReqCompletion();
// properties will be used to store the all values in hash table with particular name
Properties rProperties = new Properties();
rProperties.put("APPS_CONTEXT", ctx);
String mAmDefName = "custom.oracle.apps.custmodule.conc.server.contactinfoAM";
ljobAM = OAApplicationModuleFactory.createRootOAApplicationModule(ctx,
mAmDefName);
rOutFile = ctx.getOutFile(); // get OutFile object from CpContext
rLogFile = ctx.getLogFile();// get LogFile object from CpContext
//LogFile mLog = cpcontext.getLogFile();
//cpcontext.getReqDetails()
ParameterList pList = ctx.getParameterList();
Hashtable mAttributes = new Hashtable();
Object obj = null;
// Retrive the list of parameters provided to concurrent request.
if(pList.hasMoreElements())
{
rLogFile.writeln( "--------------------", rLogFile.STATEMENT);
String attribute_name;
String attribute_value;
for(; pList.hasMoreElements(); )
{
NameValueType namevaluetype = pList.nextParameter();
attribute_name = namevaluetype.getName();
attribute_value = namevaluetype.getValue();
if(attribute_value != null)
{
if(attribute_name.equalsIgnoreCase("P_FILE_NAME"))
50
mFileName = attribute_value;
}
}
}
Message message = new Message("FND", "CONC-ARGUMENTS");
rLogFile.writeln(message, rLogFile.STATEMENT);
rLogFile.writeln( "--------------------", rLogFile.STATEMENT);
rLogFile.writeln("File Name: "+mFileName,rLogFile.STATEMENT );
BufferedReader br;
try
{
br = new BufferedReader(new FileReader(mFileName));
while ((line = br.readLine()) != null)
{
rLogFile.writeln(line,rLogFile.STATEMENT);
}
} catch (FileNotFoundException e)
{rLogFile.writeln(e.getMessage(),rLogFile.STATEMENT);}
catch (java.io.IOException e1)
{rLogFile.writeln(e1.getMessage(),rLogFile.STATEMENT);}
//Call the XML Parser
ReadXML xmlConsumer = new ReadXML();
xmlConsumer.readFile(mFileName);
rStatus.setCompletion(mXmlErrorCode, mXmlErrorMsg);
rLogFile.writeln("Load XML Data using OA Business Component job
Completed",rLogFile.STATEMENT);
}
}
51
Appendix E: ReadXML Java class
package custom.oracle.apps.custmodule.conc.server;
import java.io.IOException;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.FileInputStream;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.OARow;
import java.lang.Integer;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAApplicationModuleFactory;
public class ReadXML extends DefaultHandler
{
File lFile;
InputStream lFileStream;
SAXParser lSaxParser;
boolean recordData=false;
static OAApplicationModule jobAM;
String lName = "";
String lAddress ="";
String lCity ="";
String lState ="";
String lZip = "";
StringBuffer textBuffer;
Attributes attrlist;
public ReadXML() {
}
public void readFile(String fileName)
{
52
jobAM=LoadData.getAM();
InitSaxXmlParser(fileName);
}
private void CreateContactInfoRow()
{
OAViewObject oaContactInfoVO=null;
if(jobAM!=null)
{
oaContactInfoVO=(OAViewObject)jobAM.findViewObject("contactInfoVO1");
OARow contactInfoRow = (OARow) oaContactInfoVO.createRow();
if(contactInfoRow!=null)
{
contactInfoRow.setAttribute("Name",lName);
contactInfoRow.setAttribute("Address",lAddress);
contactInfoRow.setAttribute("City", lCity);
contactInfoRow.setAttribute("State",lState);
contactInfoRow.setAttribute("Zip",lZip);
jobAM.invokeMethod("commitContactInfo");
}
else
System.out.println("AM job was NULL");
}
}
public void initAttribute()
{
lName = "";
lAddress ="";
lCity ="";
lState ="";
lZip = "";
}
public void InitSaxXmlParser(String fileName)
{
DefaultHandler mhandler = new ReadXML();
try
{
System.out.println("File name length"+fileName.length());
lFile=new File(fileName);
lFileStream = new FileInputStream(lFile);
53
// Use the default (non-validating) SAX Parser
SAXParserFactory factory = SAXParserFactory.newInstance();
try
{
lSaxParser = factory.newSAXParser();
lSaxParser.parse(lFileStream, mhandler);
}
catch (ParserConfigurationException ex)
{
System.err.println ("Failed to create SAX parser:" + ex);}
catch (SAXException ex) {
System.err.println ("SAX parser exceeption:" + ex);}
catch (IOException ex) {
System.err.println ("IO exeception:" + ex);}
catch (IllegalArgumentException ex) {
System.err.println ("Invalid file argument" + ex);}
}
catch(FileNotFoundException e)
{
System.err.println ("Invalid file argument" + e.getMessage());}
}
public void startDocument() throws SAXException
{
System.out.println("Start of document");
initAttribute();
}
public void endDocument() throws SAXException
{
System.out.println("End of document. Does");
}
public void Set_Attributes(Attributes mAttribute, String localName, String qualifiedName,
String tagValue )
{
if (recordData)
{
//System.out.println("Set_Attributes ->"+localName+" :"+qualifiedName+ ":"+ tagValue);
if (qualifiedName.equalsIgnoreCase("name"))
lName = tagValue;
if (qualifiedName.equalsIgnoreCase("Address"))
lAddress = tagValue;
54
if (qualifiedName.equalsIgnoreCase("city"))
lCity = tagValue;
if (qualifiedName.equalsIgnoreCase("state"))
lState = tagValue;
if (qualifiedName.equalsIgnoreCase("zip"))
lZip = tagValue;
}
}
public void startElement(String namespaceURI,
String sName, // simple name
String qName, // qualified name
Attributes attrs) throws SAXException
{
getElementText();
attrlist=attrs;
if (qName.equalsIgnoreCase("vendor"))
{
recordData=true;
}
if (recordData)
{
if (qName.equalsIgnoreCase("name"))
Set_Attributes(attrlist, sName,qName,getElementText());
if (qName.equalsIgnoreCase("address"))
Set_Attributes(attrlist, sName,qName,getElementText());
if (qName.equalsIgnoreCase("city"))
Set_Attributes(attrlist, sName,qName,getElementText());
if (qName.equalsIgnoreCase("state"))
Set_Attributes(attrlist, sName,qName,getElementText());
if (qName.equalsIgnoreCase("zip"))
Set_Attributes(attrlist, sName,qName,getElementText());
}
}
public void endElement(String namespaceURI,
String sName,
String qName ) throws SAXException
{
55
Set_Attributes(attrlist, sName,qName,getElementText());
if (qName.equalsIgnoreCase("vendor"))
{
recordData=false;
CreateContactInfoRow();
}
}
public void characters(char[] buf, int offset, int len) throws SAXException
{
String s = new String(buf, offset, len);
if (textBuffer == null)
textBuffer = new StringBuffer(s);
else
textBuffer.append(s);
}
private String getElementText() throws SAXException
{
if (textBuffer == null) return null ;
String s = ""+textBuffer;
textBuffer = null;
return s;
}
public static void main(String[] args)
{
String
fileName="C:AmitJdev_12_1_3JdevjdevhomejdevcontactInfo.xml";//LoadData.getFile
Name();
ReadXML xmltobeRead = new ReadXML();
xmltobeRead.readFile(fileName);
}
}

More Related Content

What's hot (20)

DOC
Oracle EBS R12 Payroll user manual
Feras Ahmad
 
RTF
Calendar working days and holidays for Oracle EBS R12 Absence management
Feras Ahmad
 
PPTX
Oracle ebs r12 eam module-upk
jcvd12
 
PPT
Customizing Oracle EBS OA Framework
iWare Logic Technologies Pvt. Ltd.
 
DOCX
EBS-OPM Costing.docx
Mina Lotfy
 
PPTX
Oracle Ebiz R12.2 Features -- Ravi Sagaram
ravisagaram
 
PDF
Validation type 'special' in value sets
Feras Ahmad
 
DOCX
Discrete Job Closure Process
Baker Khader Abdallah, PMP
 
DOCX
Understanding and using life event checklists in oracle hrms r12
MuhammadAbubakar206124
 
DOC
Oracle HRMS Document R12.
Malaysia Employment Service / Business Idea.
 
PDF
Oracle R12 Order Management - Back to Back (B2B) Order Flow:
Boopathy CS
 
ODT
R12:Payment Process Request (PPR)
lingaswamy vallapu
 
PDF
Accounting Entires For Oracle Apps R12
Jessica Henderson
 
PDF
Purchase Order Approval Using Approval Management Engine
Ah_Ismail
 
DOC
How to create payslip through self service
Feras Ahmad
 
PDF
Uploading Data Using Oracle Web ADI
RapidValue
 
DOCX
Inventory aging report using oracle discoverer desktop
Ahmed Elshayeb
 
PPTX
Oracle R12.1.2 and R12.1.3 features
ravisagaram
 
DOCX
Inventory in Oracle apps
gbalagee
 
PPT
R12 inventory features
Suresh Mishra
 
Oracle EBS R12 Payroll user manual
Feras Ahmad
 
Calendar working days and holidays for Oracle EBS R12 Absence management
Feras Ahmad
 
Oracle ebs r12 eam module-upk
jcvd12
 
Customizing Oracle EBS OA Framework
iWare Logic Technologies Pvt. Ltd.
 
EBS-OPM Costing.docx
Mina Lotfy
 
Oracle Ebiz R12.2 Features -- Ravi Sagaram
ravisagaram
 
Validation type 'special' in value sets
Feras Ahmad
 
Discrete Job Closure Process
Baker Khader Abdallah, PMP
 
Understanding and using life event checklists in oracle hrms r12
MuhammadAbubakar206124
 
Oracle R12 Order Management - Back to Back (B2B) Order Flow:
Boopathy CS
 
R12:Payment Process Request (PPR)
lingaswamy vallapu
 
Accounting Entires For Oracle Apps R12
Jessica Henderson
 
Purchase Order Approval Using Approval Management Engine
Ah_Ismail
 
How to create payslip through self service
Feras Ahmad
 
Uploading Data Using Oracle Web ADI
RapidValue
 
Inventory aging report using oracle discoverer desktop
Ahmed Elshayeb
 
Oracle R12.1.2 and R12.1.3 features
ravisagaram
 
Inventory in Oracle apps
gbalagee
 
R12 inventory features
Suresh Mishra
 

Viewers also liked (20)

PDF
ORACLE FRAMEWORK ONLINE TRAINING
TRAINING ICON
 
PPTX
Forms11 presentation at ssuet 05 sep-2012
Zubair Ali
 
PDF
37727897 Oaf Basics
Hossam El-Faxe
 
PPT
ADF Value Proposition in 10 key points
Jaime Cid
 
PPTX
ADF Development Survival Kit
andrejusb
 
DOC
Oracle Application Technical - Hz architecture
Prasad V
 
PPTX
Tca presentation
prathapgali123
 
PPT
Oaf development-guide
俊 朱
 
PPT
Extensions in OAF
iWare Logic Technologies Pvt. Ltd.
 
PPTX
ADF Mythbusters UKOUG'14
andrejusb
 
PDF
Oracle TCA 101
Rhapsody Technologies, Inc.
 
PDF
Oaf personalization examples
Madhurima Chatterjee
 
PPTX
Building customer relationships without being a creep Chris Hayes R2i - Gil...
Chris Hayes
 
PPTX
ADF Anti-Patterns: Dangerous Tutorials
andrejusb
 
PDF
Oaf personaliztion examples
Kaushik Kumar Kuberanathan
 
PPTX
Oracle ADF Case Study
Jean-Marc Desvaux
 
PDF
Impact of Trading Community Architecture (TCA) on Oracle Receivables
Rhapsody Technologies, Inc.
 
PPTX
Oracle application framework (oaf) online training
Glory IT Technologies Pvt. Ltd.
 
PPS
Oracle Framework Personalization
Edi Yanto
 
ORACLE FRAMEWORK ONLINE TRAINING
TRAINING ICON
 
Forms11 presentation at ssuet 05 sep-2012
Zubair Ali
 
37727897 Oaf Basics
Hossam El-Faxe
 
ADF Value Proposition in 10 key points
Jaime Cid
 
ADF Development Survival Kit
andrejusb
 
Oracle Application Technical - Hz architecture
Prasad V
 
Tca presentation
prathapgali123
 
Oaf development-guide
俊 朱
 
ADF Mythbusters UKOUG'14
andrejusb
 
Oaf personalization examples
Madhurima Chatterjee
 
Building customer relationships without being a creep Chris Hayes R2i - Gil...
Chris Hayes
 
ADF Anti-Patterns: Dangerous Tutorials
andrejusb
 
Oaf personaliztion examples
Kaushik Kumar Kuberanathan
 
Oracle ADF Case Study
Jean-Marc Desvaux
 
Impact of Trading Community Architecture (TCA) on Oracle Receivables
Rhapsody Technologies, Inc.
 
Oracle application framework (oaf) online training
Glory IT Technologies Pvt. Ltd.
 
Oracle Framework Personalization
Edi Yanto
 
Ad

Similar to Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concurrent program. (20)

DOC
Apps1
Sultan Sharif
 
PDF
Oaf Course Content
ERP KEY
 
DOC
OAF Syllabus
Fusion Oracle
 
PPTX
OA Framwork Presentation.pptx
wadierefky1
 
PPT
1.OAF Custom Page Screen Shots.ppt
ShekarBKollu
 
DOC
Oracle Application Framework Cases
Feras Ahmad
 
PDF
Oracle Database Programming Using Java And Web Services 1st Edition Kuassi Me...
janionkocho
 
PDF
JDBC Next: A New Asynchronous API for Connecting to a Database
Yolande Poirier
 
PPTX
JDBC2 JDBCJDBCJDBCJDBCJDBCJDBCJDBCJDBCJDBC
yatakonakiran2
 
PPTX
jdbc concepts in java jdbc programming- programming
yatakonakiran2
 
PPT
JDBC Connectivity Model
kunj desai
 
DOCX
Gangadhar_Challa_Profile
Gangadhar Challa
 
PPTX
jdbc programs are useful jdbc programs are useful
yatakonakiran2
 
DOC
Ali_Resume_Oracle
Ali Asger
 
PPT
EBsSDKForJavaWithOracleADF_ppt.ppt
SudhirSinghShakyaVan
 
PPT
4. Database Connectivity using JDBC .ppt
HITENKHEMANI
 
PDF
Ahmed Abu_Eldahab Java Developer CV
Ahmed Abu Eldahab
 
PDF
Extending_EBS_12_1_3_with_APEX_5_0_COLLABORATE16
Alfredo Abate
 
DOCX
Noonan_resume
Dale Noonan
 
PDF
10 jdbc
snopteck
 
Oaf Course Content
ERP KEY
 
OAF Syllabus
Fusion Oracle
 
OA Framwork Presentation.pptx
wadierefky1
 
1.OAF Custom Page Screen Shots.ppt
ShekarBKollu
 
Oracle Application Framework Cases
Feras Ahmad
 
Oracle Database Programming Using Java And Web Services 1st Edition Kuassi Me...
janionkocho
 
JDBC Next: A New Asynchronous API for Connecting to a Database
Yolande Poirier
 
JDBC2 JDBCJDBCJDBCJDBCJDBCJDBCJDBCJDBCJDBC
yatakonakiran2
 
jdbc concepts in java jdbc programming- programming
yatakonakiran2
 
JDBC Connectivity Model
kunj desai
 
Gangadhar_Challa_Profile
Gangadhar Challa
 
jdbc programs are useful jdbc programs are useful
yatakonakiran2
 
Ali_Resume_Oracle
Ali Asger
 
EBsSDKForJavaWithOracleADF_ppt.ppt
SudhirSinghShakyaVan
 
4. Database Connectivity using JDBC .ppt
HITENKHEMANI
 
Ahmed Abu_Eldahab Java Developer CV
Ahmed Abu Eldahab
 
Extending_EBS_12_1_3_with_APEX_5_0_COLLABORATE16
Alfredo Abate
 
Noonan_resume
Dale Noonan
 
10 jdbc
snopteck
 
Ad

Recently uploaded (20)

PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 

Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concurrent program.

  • 1. 1 Oracle EBS 12.1.3: Integrate OA Framework BC4J components within Java Concurrent program. Concurrent processing has been one of the rewarding aspect of Oracle EBS. This allows us to process millions of transactions behind the scene without any user intervention. Oracle has provided multiple avenues to design a concurrent program. One stands out of all “Java concurrent program” which uses “Java — one language, endless possibilities”. Most of background processes performs some kind of database operation. When comes to Java concurrent program, JDBC API is in practice to execute SQL operation. Oracle Application Framework (OAF) is available since many years now to help us to reduce some of the application development complexities. OAF insulates JDBC connection pool complexity within AOL/J integration code. OAF is built on MVC deign patterns where MVC stands for model-view and controller. Model-View relationship separates business/back-end logic with graphical user interface logic. This represent how do we control operation on server level object like “table inserts”. OAF provides all the bare minimal code which developer needs to write additionally to fire SELECT/INSERT/UPDATE statement. This way development team is more focus on actual task in hand which in this tutorial “Read a XML file”. In this tutorial, I am going to demonstrate “How to use OA Framework BC4J components in Java concurrent program” to perform complex background operations like loading a data file. We are going to build a custom Java concurrent program which will read the XML file, parse it and load it into the database table. Sample XML file being used for this tutorial is provided as below.
  • 2. 2 System Configuration used in this demonstration.  JDeveloper 10g on Window7 4GB RAM.  Oracle Database 11.2.0.4  Oracle EBS 12.1.3 on Linux. JDeveloper is being primarily tool used for OAF development. Before we proceed, we will have to find out what JDeveloper version works with Oracle EBS release installed in the development environment. Oracle has generously published this information in Metalink note#416708.1 to help us find exact JDeveloper patch required. I built this example on Release 12.1.3 with patch 15880118 applied which corresponds to JDeveloper Patch# 9879989 as per below matrix available in note#416708.1. OA Framework - How to Find the Correct Version of JDeveloper for OA Extensions to Use with E-Business Suite 11i or Release 12.x (Doc ID 416708.1) JDeveloper doesn’t comes with installer. Once you have downloaded the patch, you just need to extract/unzip file at your preferred location. As an example, I used C:AmitJdev_12_1_3 as a location to unzipextract the patch.
  • 3. 3 Setup Your Development Environment It’s important we follow all the instructions provided under section “Setting Up Your Development Environment” in Oracle Application Framework Developer's Guide. This can save us from nuisances. Step1: Create an environment variable “JDEV_USER_HOME” in local machine. Step2: Add below responsibilities to your EBS user account. Step3: Define JDeveloper Database Connection Step3.a: You can switch to Connection tab, right click on Databases and select “New Database Connection”. Responsibility:  OA Framework ToolBox  OA Framework ToolBox Tutorial Labs
  • 4. 4 Step3.b: Ignore the First/Splash screen. Step3.c: Choose connection name. Step3.d: Provide DB schema name as Username and corresponding password.
  • 5. 5 Step3.e: Provide Database hostname, DB Port and SID. Step3.f: Test the connection.
  • 6. 6 Step3.g: Expand the connection to review an object / table. Your DB connection is ready to use. JDeveloper will need DB connection to create Entity Object, View object etc. for you. Step4: Run the examples comes with JDeveloper patch Running examples comes with patch is great way to find out if you are going to get into any trouble with AOL/J integration. All the examples can be loaded by single WORKSPACE selection “toolbox.jws”. They are normally available under <LOCAL_ DIR >JDevHomejdevmyprojects. Step4.a: Choose workspace “toolbox.jws” Go to File menu and select Open option and choose <LOCAL_DIR>Jdevjdevhomejdevmyprojectstoolbox.jws
  • 7. 7
  • 8. 8 In Applications navigator, Right click on toolbox and select Rebuild/compile whole sample set. Make sure fix any compilation error reported.
  • 9. 9 Step4.b: Change the “tutorial” project setting to include Database connection and discard whatever comes in as default. Step4.3 Update runtime connection. You can always check directory “$FND_TOP/secure” or “$FND_SECURE” to find DBC file. If you don’t have access, you can request Oracle Applications DBA to provide it to you.
  • 10. 10 Step4.c: You are all set to run JDeveloper examples. Right click on “test_fwktutorial.jsp” and select “Run” to launch the main page. You shall see webpage showing main menu as below. As long as you can run the example pages, your configuration settings are OKAY. We can proceed now with topic in hand. Step5: Create a New OA Workspace and add a New OA Project Even though we can use “toolbox.jws” as workspace for development. I prefer we create new workspace and project to separate the work being done. Step5.a: Right click on Applications and Select “New OA Workspace...”
  • 11. 11 Step5.b: Define project name and Default Package. Oracle naming convention to define package is as below. <3rdPartyName>.oracle.apps.<applicationShortName>.<subcomponentName>. In this example, I am using 3rdParty as “custom” and application name as “custmodule” Step5.c: Predefined connection will be listed under Connection LOV. Select the appropriate one.
  • 12. 12 Step5.d: Select the DBC file and User name has to be an “EBS” account not Database account. Click on finish button.
  • 13. 13 Define Model and View objects Before we can add any component to newly created project, lets understand what object we will need… OA Framework Stack Step6: Create an entity object for table. Step6.a: Right click on “Server” under “custom.oracle.apps.custmodule.conc” and select “New Entity Object…” We are building background job. As per OA Framework stack, we need following objects 1. Entity object 2. View Object 3. Application module. We don’t need OA Controller object because it is primarily responsible for user action on HTML page.
  • 14. 14 Step6.b: Choose all the attributes. Please make sure custom table has WHO columns. Step6.c: Select the primary key. If you don’t have, then select ROWID as primary key.
  • 15. 15 Step6.d: Select the Accessors as Generate Methods. Step6.e: Don’t select the Generate Default View Objects.
  • 16. 16 Step6.f: Click the finish button to complete the EO creation. Step7: Create a view object. Step7.a: Right click on “Server” under “custom.oracle.apps.custmodule.conc” and select “New View Object…”
  • 17. 17 Step7.b: Select the Entity object available in left side and move it to right. Step7.c: Select all the available attributes in view.
  • 18. 18 Step7.d: Select the View Object class as well as View Row class as per below screen. Step7.e: Finish the wizard.
  • 19. 19 Step8 Create an Application module. Step8.a: Right click on “Server” under “custom.oracle.apps.custmodule.conc” and select “New Application module. …” Step8.b: Select the view object available on left side and move it right side.
  • 20. 20 Step8.c: There is only one Application Module in used. Please ignore this screen. Step8.d: Select the Generate java files option for “contactinfoAMImpl” and finish the wizard.
  • 21. 21 JDeveloper will automatically generate java classes for you. As you can see now, you have class file for Entity Object, View Object and Application Module. As of now, we have all the required BC4J components which we will integrate with Java concurrent program class. Step9: Create class “LoadData.java” which implements Java concurrent program methods. Step9.a: Create a class. Import all the required packages for Java concurrent program. import oracle.apps.fnd.cp.request.CpContext; import oracle.apps.fnd.cp.request.JavaConcurrentProgram;
  • 22. 22 Implements LoadData class to use JavaConcurrentProgram. Red Underline on LoadData indicates below error. Error: Method RunProgram not implemented Step9.b: Add any missing method. Now basic implementation of the class to implement Java Concurrent program looks as below. Step9.c: Add basic functionality to class.  Read any parameter pass to concurrent request.  Display parameters in log file.  Set Request completion status as 0 (successful). import oracle.apps.fnd.cp.request.CpContext; import oracle.apps.fnd.cp.request.JavaConcurrentProgram; public class LoadData implements JavaConcurrentProgram{ public LoadData() {} public void runProgram(CpContext ctx) {} } public void runProgram(CpContext ctx) { System.out.println(" Running Custom Job Parse and Load XML data into Contact Info table."); String attribute; String line = null; // Concurrent Request execution status ReqCompletion rStatus = ctx.getReqCompletion(); rOutFile = ctx.getOutFile(); // get OutFile object from CpContext rLogFile = ctx.getLogFile();// get LogFile object from CpContext ParameterList pList = ctx.getParameterList(); Hashtable mAttributes = new Hashtable();
  • 23. 23 Code continue... Object obj = null; // Retrive the list of parameters provided to concurrent request. if(pList.hasMoreElements()) { rLogFile.writeln( "--------------------", rLogFile.STATEMENT); String attribute_name; String attribute_value; for(; pList.hasMoreElements(); ) { NameValueType namevaluetype = pList.nextParameter(); attribute_name = namevaluetype.getName(); attribute_value = namevaluetype.getValue(); if(attribute_value != null) { if(attribute_name.equalsIgnoreCase("P_FILE_NAME")) mFileName = attribute_value; } } } BufferedReader br; try { br = new BufferedReader(new FileReader(mFileName)); while ((line = br.readLine()) != null) { rLogFile.writeln(line,rLogFile.STATEMENT); } } catch (FileNotFoundException e) {rLogFile.writeln(e.getMessage(),rLogFile.STATEMENT);} catch (java.io.IOException e1) {rLogFile.writeln (e1.getMessage(),rLogFile.STATEMENT) ;} rStatus.setCompletion(mXmlErrorCode, mXmlErrorMsg); rLogFile.writeln ("Load XML Data using OA Business Component job Completed",rLogFile.STATEMENT); }
  • 24. 24 Step10: Test the basic functionality. Step10.a: Create directories at middle tier which represent BC4J package “custom.oracle.apps.custmodule.conc.server”. Connect to APPS tier (I got Linux) as an instance owner, run below commands to create your directory structure. Step10.b: Upload all the class files from local machine to middle tier. Step10.c: Define concurrent program and executable.  cd $JAVA_TOP  mkdir -p custom/oracle/apps/custmodule/conc/server  $ pwd Example: /{Instance_name}/apps/apps_st/comn/java/classes/custom/oracle/apps/custmodule/ conc/server
  • 25. 25 Define Concurrent Program. Define Parameter for concurrent program.
  • 26. 26 Step10.d: Register the concurrent program to request group. Step10.e: Run the concurrent program. Concurrent request was completed normal. I printed XML content in log file to verify if process can read file successfully. Concurrent request log file: Concurrent job was able to read xml file.
  • 27. 27 Step11: Add a parsing capability. We can use DOM or SAX API to parse XML data. In this tutorial, I am going to use SAX parser. For more information on SAX parser, please visit http://www.saxproject.org/. SAX Parser is event oriented. Parsing event get fired on XML element. This make developer life easy because we can just look for what is “Point of Interest” and discard rest of data. With SAX Parser, we will need to implement 5 different methods to represent complete XML tag life cycle.  startDocument()  startElement()  characters()  endElement()  endDocument() Here is an example how API will be fired. <?xml version="1.0"?> <vendor> <name>Jon Doe</name> </vendor> API firing sequence Start Document Start Element: vendor Start Element: name characters: Jon Doe End Element: name End Element: vendor End document Why did I select SAX instead of DOM? Before I proceed to next step, I wanted to clear why SAX Parser was more appealing for me than DOM. DOM loads whole XML document into memory as a tree. DOM API’s are fast but they need more memory. In order to load XML data, I don’t need all the XML elements loaded in memory. I don’t even need all of them. We will look for specific XML elements to decide what to load. For example, I don’t care about <vendor> tag in file. This is just start and stop marker for me to decide when new record starts. If you are in need to validate XML document first before you can use the XML data, DOM would be better for you.
  • 28. 28 Step11.a: Add a new class “ReadXML” which implements SAX Parser API. package custom.oracle.apps.custmodule.conc.server; import java.io.IOException; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.ParserConfigurationException; import java.io.File; import java.io.FileNotFoundException; import java.io.InputStream; import java.io.FileInputStream; public class ReadXML extends DefaultHandler { File lFile; InputStream lFileStream; SAXParser lSaxParser; boolean recordData=false; String lName = ""; String lAddress =""; String lCity =""; String lState =""; String lZip = ""; StringBuffer textBuffer; Attributes attrlist; public ReadXML() { } public void readFile(String fileName) { jobAM=LoadData.getAM(); InitSaxXmlParser(fileName); } public void startDocument() throws SAXException { System.out.println("Start of document"); initAttribute(); }
  • 29. 29 public void initAttribute() { lName = ""; lAddress =""; lCity =""; lState =""; lZip = ""; } public void endDocument() throws SAXException { System.out.println("End of document. Does"); } public void InitSaxXmlParser(String fileName) { DefaultHandler mhandler = new ReadXML(); try { System.out.println("File name length"+fileName.length()); lFile=new File(fileName); lFileStream = new FileInputStream(lFile); // Use the default (non-validating) SAX Parser SAXParserFactory factory = SAXParserFactory.newInstance(); try { lSaxParser = factory.newSAXParser(); lSaxParser.parse(lFileStream, mhandler); } catch (ParserConfigurationException ex) { System.err.println ("Failed to create SAX parser:" + ex);} catch (SAXException ex) { System.err.println ("SAX parser exceeption:" + ex);} catch (IOException ex) { System.err.println ("IO exeception:" + ex);} catch (IllegalArgumentException ex) { System.err.println ("Invalid file argument" + ex);} } catch(FileNotFoundException e) { System.err.println ("Invalid file argument" + e.getMessage());} }
  • 30. 30 public void startElement(String namespaceURI, String sName, // simple name String qName, Attributes attrs) throws SAXException { getElementText(); attrlist=attrs; if (qName.equalsIgnoreCase("vendor") recordData=true; if (recordData) { if (qName.equalsIgnoreCase("name")) Set_Attributes(attrlist, sName,qName,getElementText()); if (qName.equalsIgnoreCase("address")) Set_Attributes(attrlist, sName,qName,getElementText()); if (qName.equalsIgnoreCase("city")) Set_Attributes(attrlist, sName,qName,getElementText()); if (qName.equalsIgnoreCase("state")) Set_Attributes(attrlist, sName,qName,getElementText()); if (qName.equalsIgnoreCase("zip")) Set_Attributes(attrlist, sName,qName,getElementText()); } } public void Set_Attributes(Attributes mAttribute, String localName, String qualifiedName, String tagValue ) { if (recordData) { //System.out.println("Set_Attributes ->"+localName+" :"+qualifiedName+ ":"+ tagValue); if (qualifiedName.equalsIgnoreCase("name")) lName = tagValue; if (qualifiedName.equalsIgnoreCase("Address")) lAddress = tagValue; if (qualifiedName.equalsIgnoreCase("city")) lCity = tagValue; if (qualifiedName.equalsIgnoreCase("state")) lState = tagValue; if (qualifiedName.equalsIgnoreCase("zip")) lZip = tagValue; } }
  • 31. 31 public void characters(char[] buf, int offset, int len) throws SAXException { String s = new String(buf, offset, len); if (textBuffer == null) textBuffer = new StringBuffer(s); else textBuffer.append(s); } public String getElementText() throws SAXException { if (textBuffer == null) return null ; String s = ""+textBuffer; textBuffer = null; return s; } public void endElement(String namespaceURI, String sName, String qName ) throws SAXException { Set_Attributes(attrlist, sName,qName,getElementText()); if (qName.equalsIgnoreCase("vendor")) { recordData=false; System.out.println(" name->"+lName); System.out.println(" mAddress->"+lAddress); System.out.println(" city->"+lCity); System.out.println(" state->"+lState); System.out.println(" zip->"+lZip); } } public static void main(String[] args) { String fileName="C:AmitJdev_12_1_3JdevjdevhomejdevcontactInfo.xml"; ReadXML xmltobeRead = new ReadXML(); xmltobeRead.readFile(fileName); } }
  • 32. 32 Step12: Integrate BC4J functionality with Java concurrent program. Step12.a: Define variable and create standalone Application module in LoadXML class. Step12.b: Add a get method to access AM instance in ReadXML class. Step12.c: Instantiate the xml parser in LoadXML. Step12.d: Create a method which will insert row into View Object in ReadXML class. This method will be called evert time we hit the </vendor> tag which represent end-of-record. ReadXML xmlConsumer = new ReadXML(); xmlConsumer.readFile(mFileName); private static OAApplicationModule lJobAM; String mAmDefName = "custom.oracle.apps.custmodule.conc.server.contactinfoAM"; lJobAM = OAApplicationModuleFactory.createRootOAApplicationModule(ctx, mAmDefName); public static OAApplicationModule getAM() { return ljobAM; } private void CreateContactInfoRow() { OAViewObject oaContactInfoVO=null; if(jobAM!=null) { oaContactInfoVO=(OAViewObject)jobAM.findViewObject("contactInfoVO1"); OARow contactInfoRow = (OARow) oaContactInfoVO.createRow(); if(contactInfoRow!=null) { contactInfoRow.setAttribute("Name",lName); contactInfoRow.setAttribute("Address",lAddress); contactInfoRow.setAttribute("City", lCity); contactInfoRow.setAttribute("State",lState); contactInfoRow.setAttribute("Zip",lZip); jobAM.invokeMethod("commitContactInfo"); } else System.out.println("AM job was NULL"); } }
  • 33. 33 Step12.e: Add a method in Application module class to commit your changes. Step12.f: Modify endElement method to call “CreateContactInfoRow()” as soon as we hit </vendor> tag. We are all set to re-run the concurrent program again. public void commitContactInfo() { Throwable athrowable[] = null; OADBTransaction oadbtransaction = getOADBTransaction(); contactInfoVOImpl ccNewContact = getcontactInfoVO1(); oadbtransaction.postChanges(); oadbtransaction.commit(); ccNewContact.closeRowSet(); oadbtransaction.clearEntityCache("custom.oracle.apps.custmodule.conc.server.contactInfoEO" ); if(athrowable != null && athrowable.length > 0) throw OAException.getBundledOAException(athrowable); else return; } public void endElement(String namespaceURI, String sName, String qName ) throws SAXException { Set_Attributes(attrlist, sName,qName,getElementText()); if (qName.equalsIgnoreCase("vendor")) { recordData=false; System.out.println(" name->"+lName); System.out.println(" mAddress->"+lAddress); System.out.println(" city->"+lCity); System.out.println(" state->"+lState); System.out.println(" zip->"+lZip); CreateContactInfoRow(); } }
  • 34. 34 Step12.g: Run the concurrent program Finally query the table to confirm data was truly loaded.
  • 35. 35 As you can see, I was able to insert data into table without writing a single INSERT statement. This is the simplification BC4J component offers to us. This completes the demonstration “Integrate OA Framework BC4J components within Java concurrent program”. All the class source code is available in Appendix section. Summary  Define entity object for table.  Define view object for entity object.  Define application module for view object.  Define “LoadXML” class which implements Java concurrent program methods.  Define “ReadXML” class which implement SAX Parser API’s.  Create a root level Application Module in LoadXML class using Context passed as parameter.  Instantiate ReadXML within LoadXML class.  Create an SAX Parser instance using SAXParserFactory and pass the XML file as parameter to parse method.  Parsing will generate event in below sequence for XML elements. -> StartElement() ->Characters() ->EndElement()  Inside method “EndElement()” , If xml element is “VENDOR” , call CreateContactInfoRow()” which create a new row in view object.  At the end of “CreateContactInfoRow()” method call commitContactInfo() which is defined in application module to post the changes at database table.  For all the XML element “VENDOR” , CreateContactInfoRow() will be called which will create eventually all the rows in table.  After XML parsing event complete, set the request set completion status as 0 in LoadData class.
  • 36. 36 Appendix A: Application module java class. package custom.oracle.apps.custmodule.conc.server; import oracle.apps.fnd.framework.OAException; import oracle.apps.fnd.framework.server.OAApplicationModuleImpl; import oracle.apps.fnd.framework.server.OADBTransaction; // --------------------------------------------------------------------- // --- File generated by Oracle ADF Business Components Design Time. // --- Custom code may be added to this class. // --- Warning: Do not modify method signatures of generated methods. // --------------------------------------------------------------------- public class contactinfoAMImpl extends OAApplicationModuleImpl { /**This is the default constructor (do not remove) */ public contactinfoAMImpl() { } /**Container's getter for contactInfoVO1 */ public contactInfoVOImpl getcontactInfoVO1() { return (contactInfoVOImpl)findViewObject("contactInfoVO1"); } public void commitContactInfo() { Throwable athrowable[] = null; OADBTransaction oadbtransaction = getOADBTransaction(); contactInfoVOImpl ccNewContact = getcontactInfoVO1(); oadbtransaction.postChanges(); oadbtransaction.commit(); ccNewContact.closeRowSet(); oadbtransaction.clearEntityCache("custom.oracle.apps.custmodule.conc.server.contactInfoEO") ; if(athrowable != null && athrowable.length > 0) throw OAException.getBundledOAException(athrowable); else return; } /**Sample main for debugging Business Components code using the tester. */ public static void main(String[] args) { launchTester("custom.oracle.apps.custmodule.conc.server", /* package name */ "contactinfoAMLocal" /* Configuration Name */); } }
  • 37. 37 Appendix B: Entity Object Java class file. package custom.oracle.apps.custmodule.conc.server; import oracle.apps.fnd.framework.server.OAEntityDefImpl; import oracle.apps.fnd.framework.server.OAEntityImpl; import oracle.jbo.domain.Date; import oracle.jbo.domain.Number; import oracle.jbo.domain.RowID; import oracle.jbo.server.AttributeDefImpl; import oracle.jbo.server.EntityDefImpl; // --------------------------------------------------------------------- // --- File generated by Oracle ADF Business Components Design Time. // --- Custom code may be added to this class. // --- Warning: Do not modify method signatures of generated methods. // --------------------------------------------------------------------- public class contactInfoEOImpl extends OAEntityImpl { public static final int NAME = 0; public static final int ADDRESS = 1; public static final int CITY = 2; public static final int STATE = 3; public static final int ZIP = 4; public static final int CREATIONDATE = 5; public static final int CREATEDBY = 6; public static final int LASTUPDATEDATE = 7; public static final int LASTUPDATEDBY = 8; public static final int ROWID = 9; public static final int LASTUPDATELOGIN = 10; private static OAEntityDefImpl mDefinitionObject; /**This is the default constructor (do not remove) */ public contactInfoEOImpl() { } /**Retrieves the definition object for this instance class. */ public static synchronized EntityDefImpl getDefinitionObject() { if (mDefinitionObject == null) { mDefinitionObject = (OAEntityDefImpl)EntityDefImpl.findDefObject("custom.oracle.apps.custmodule.conc.server.con tactInfoEO"); } return mDefinitionObject; }
  • 38. 38 /**Gets the attribute value for Name, using the alias name Name */ public String getName() { return (String)getAttributeInternal(NAME); } /**Sets <code>value</code> as the attribute value for Name */ public void setName(String value) { setAttributeInternal(NAME, value); } /**Gets the attribute value for Address, using the alias name Address */ public String getAddress() { return (String)getAttributeInternal(ADDRESS); } /**Sets <code>value</code> as the attribute value for Address */ public void setAddress(String value) { setAttributeInternal(ADDRESS, value); } /**Gets the attribute value for City, using the alias name City */ public String getCity() { return (String)getAttributeInternal(CITY); } /**Sets <code>value</code> as the attribute value for City */ public void setCity(String value) { setAttributeInternal(CITY, value); } /**Gets the attribute value for State, using the alias name State */ public String getState() { return (String)getAttributeInternal(STATE); } /**Sets <code>value</code> as the attribute value for State */ public void setState(String value) { setAttributeInternal(STATE, value); }
  • 39. 39 /**Gets the attribute value for Zip, using the alias name Zip */ public String getZip() { return (String)getAttributeInternal(ZIP); } /**Sets <code>value</code> as the attribute value for Zip */ public void setZip(String value) { setAttributeInternal(ZIP, value); } /**Gets the attribute value for CreationDate, using the alias name CreationDate */ public Date getCreationDate() { return (Date)getAttributeInternal(CREATIONDATE); } /**Sets <code>value</code> as the attribute value for CreationDate */ public void setCreationDate(Date value) { setAttributeInternal(CREATIONDATE, value); } /**Gets the attribute value for CreatedBy, using the alias name CreatedBy */ public Number getCreatedBy() { return (Number)getAttributeInternal(CREATEDBY); } /**Sets <code>value</code> as the attribute value for CreatedBy */ public void setCreatedBy(Number value) { setAttributeInternal(CREATEDBY, value); } /**Gets the attribute value for LastUpdateDate, using the alias name LastUpdateDate */ public Date getLastUpdateDate() { return (Date)getAttributeInternal(LASTUPDATEDATE); } /**Sets <code>value</code> as the attribute value for LastUpdateDate */ public void setLastUpdateDate(Date value) { setAttributeInternal(LASTUPDATEDATE, value); } /**Gets the attribute value for LastUpdatedBy, using the alias name LastUpdatedBy*/
  • 40. 40 public Number getLastUpdatedBy() { return (Number)getAttributeInternal(LASTUPDATEDBY); } /**Sets <code>value</code> as the attribute value for LastUpdatedBy */ public void setLastUpdatedBy(Number value) { setAttributeInternal(LASTUPDATEDBY, value); } /**Gets the attribute value for RowID, using the alias name RowID */ public RowID getRowID() { return (RowID)getAttributeInternal(ROWID); } /**getAttrInvokeAccessor: generated method. Do not modify. */ protected Object getAttrInvokeAccessor(int index, AttributeDefImpl attrDef) throws Exception { switch (index) { case NAME: return getName(); case ADDRESS: return getAddress(); case CITY: return getCity(); case STATE: return getState(); case ZIP: return getZip(); case CREATIONDATE: return getCreationDate(); case CREATEDBY: return getCreatedBy(); case LASTUPDATEDATE: return getLastUpdateDate(); case LASTUPDATEDBY: return getLastUpdatedBy(); case ROWID: return getRowID(); case LASTUPDATELOGIN: return getLastUpdateLogin(); default: return super.getAttrInvokeAccessor(index, attrDef); } }
  • 41. 41 protected void setAttrInvokeAccessor(int index, Object value, AttributeDefImpl attrDef) throws Exception { switch (index) { case NAME: setName((String)value); return; case ADDRESS: setAddress((String)value); return; case CITY: setCity((String)value); return; case STATE: setState((String)value); return; case ZIP: setZip((String)value); return; case CREATIONDATE: setCreationDate((Date)value); return; case CREATEDBY: setCreatedBy((Number)value); return; case LASTUPDATEDATE: setLastUpdateDate((Date)value); return; case LASTUPDATEDBY: setLastUpdatedBy((Number)value); return; case LASTUPDATELOGIN: setLastUpdateLogin((Number)value); return; default: super.setAttrInvokeAccessor(index, value, attrDef); return; } } public Number getLastUpdateLogin() { return (Number)getAttributeInternal(LASTUPDATELOGIN); } public void setLastUpdateLogin(Number value) { setAttributeInternal(LASTUPDATELOGIN, value); } }
  • 42. 42 Appendix C: View Object Java class file. package custom.oracle.apps.custmodule.conc.server; import oracle.apps.fnd.framework.server.OAViewRowImpl; import oracle.jbo.domain.Date; import oracle.jbo.domain.Number; import oracle.jbo.domain.RowID; import oracle.jbo.server.AttributeDefImpl; // --------------------------------------------------------------------- // --- File generated by Oracle ADF Business Components Design Time. // --- Custom code may be added to this class. // --- Warning: Do not modify method signatures of generated methods. // --------------------------------------------------------------------- public class contactInfoVORowImpl extends OAViewRowImpl { public static final int NAME = 0; public static final int ADDRESS = 1; public static final int CITY = 2; public static final int STATE = 3; public static final int ZIP = 4; public static final int CREATIONDATE = 5; public static final int CREATEDBY = 6; public static final int LASTUPDATEDATE = 7; public static final int LASTUPDATEDBY = 8; public static final int ROWID = 9; public static final int LASTUPDATELOGIN = 10; /**This is the default constructor (do not remove) */ public contactInfoVORowImpl() { } /**Gets contactInfoEO entity object. */ public contactInfoEOImpl getcontactInfoEO() { return (contactInfoEOImpl)getEntity(0); } /**Gets the attribute value for NAME using the alias name Name */ public String getName() { return (String) getAttributeInternal(NAME); } /**Sets <code>value</code> as attribute value for NAME using the alias name Name */
  • 43. 43 public void setName(String value) { setAttributeInternal(NAME, value); } /**Gets the attribute value for ADDRESS using the alias name Address */ public String getAddress() { return (String) getAttributeInternal(ADDRESS); } /**Sets <code>value</code> as attribute value for ADDRESS using the alias name Address */ public void setAddress(String value) { setAttributeInternal(ADDRESS, value); } /**Gets the attribute value for CITY using the alias name City */ public String getCity() { return (String) getAttributeInternal(CITY); } /**Sets <code>value</code> as attribute value for CITY using the alias name City */ public void setCity(String value) { setAttributeInternal(CITY, value); } /**Gets the attribute value for STATE using the alias name State */ public String getState() { return (String) getAttributeInternal(STATE); } /**Sets <code>value</code> as attribute value for STATE using the alias name State */ public void setState(String value) { setAttributeInternal(STATE, value); } /**Gets the attribute value for ZIP using the alias name Zip */ public String getZip() { return (String) getAttributeInternal(ZIP); } /**Sets <code>value</code> as attribute value for ZIP using the alias name Zip
  • 44. 44 */ public void setZip(String value) { setAttributeInternal(ZIP, value); } /**Gets the attribute value for CREATION_DATE using the alias name CreationDate */ public Date getCreationDate() { return (Date) getAttributeInternal(CREATIONDATE); } /**Sets <code>value</code> as attribute value for CREATION_DATE using the alias name CreationDate */ public void setCreationDate(Date value) { setAttributeInternal(CREATIONDATE, value); } /**Gets the attribute value for CREATED_BY using the alias name CreatedBy */ public Number getCreatedBy() { return (Number) getAttributeInternal(CREATEDBY); } /**Sets <code>value</code> as attribute value for CREATED_BY using the alias name CreatedBy */ public void setCreatedBy(Number value) { setAttributeInternal(CREATEDBY, value); } /**Gets the attribute value for LAST_UPDATE_DATE using the alias name LastUpdateDate */ public Date getLastUpdateDate() { return (Date) getAttributeInternal(LASTUPDATEDATE); } /**Sets <code>value</code> as attribute value for LAST_UPDATE_DATE using the alias name LastUpdateDate */ public void setLastUpdateDate(Date value) { setAttributeInternal(LASTUPDATEDATE, value); } public Number getLastUpdatedBy() { return (Number) getAttributeInternal(LASTUPDATEDBY); }
  • 45. 45 /**Sets <code>value</code> as attribute value for LAST_UPDATED_BY using the alias name LastUpdatedBy */ public void setLastUpdatedBy(Number value) { setAttributeInternal(LASTUPDATEDBY, value); } /**Gets the attribute value for ROWID using the alias name RowID */ public RowID getRowID() { return (RowID) getAttributeInternal(ROWID); } /**getAttrInvokeAccessor: generated method. Do not modify. */ protected Object getAttrInvokeAccessor(int index, AttributeDefImpl attrDef) throws Exception { switch (index) { case NAME: return getName(); case ADDRESS: return getAddress(); case CITY: return getCity(); case STATE: return getState(); case ZIP: return getZip(); case CREATIONDATE: return getCreationDate(); case CREATEDBY: return getCreatedBy(); case LASTUPDATEDATE: return getLastUpdateDate(); case LASTUPDATEDBY: return getLastUpdatedBy(); case ROWID: return getRowID(); case LASTUPDATELOGIN: return getLastUpdateLogin(); default: return super.getAttrInvokeAccessor(index, attrDef); } } /**setAttrInvokeAccessor: generated method. Do not modify. */
  • 46. 46 */ protected void setAttrInvokeAccessor(int index, Object value, AttributeDefImpl attrDef) throws Exception { switch (index) { case NAME: setName((String)value); return; case ADDRESS: setAddress((String)value); return; case CITY: setCity((String)value); return; case STATE: setState((String)value); return; case ZIP: setZip((String)value); return; case CREATIONDATE: setCreationDate((Date)value); return; case CREATEDBY: setCreatedBy((Number)value); return; case LASTUPDATEDATE: setLastUpdateDate((Date)value); return; case LASTUPDATEDBY: setLastUpdatedBy((Number)value); return; case LASTUPDATELOGIN: setLastUpdateLogin((Number)value); return; default: super.setAttrInvokeAccessor(index, value, attrDef); return; } } /**Gets the attribute value for LAST_UPDATE_LOGIN using the alias name LastUpdateLogin */ public Number getLastUpdateLogin() { return (Number) getAttributeInternal(LASTUPDATELOGIN); } /**Sets <code>value</code> as attribute value for LAST_UPDATE_LOGIN using the alias name LastUpdateLogin
  • 47. 47 public void setLastUpdateLogin(Number value) { setAttributeInternal(LASTUPDATELOGIN, value); } } package custom.oracle.apps.custmodule.conc.server; import oracle.apps.fnd.framework.server.OAViewObjectImpl; // --------------------------------------------------------------------- // --- File generated by Oracle ADF Business Components Design Time. // --- Custom code may be added to this class. // --- Warning: Do not modify method signatures of generated methods. // --------------------------------------------------------------------- public class contactInfoVOImpl extends OAViewObjectImpl { /**This is the default constructor (do not remove) */ public contactInfoVOImpl() { } }
  • 48. 48 Appendix D: LoadData Java class package custom.oracle.apps.custmodule.conc.server; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import oracle.apps.fnd.cp.request.ReqCompletion; import oracle.apps.fnd.cp.request.LogFile; import oracle.apps.fnd.cp.request.CpContext; import oracle.apps.fnd.cp.request.JavaConcurrentProgram; import oracle.apps.fnd.cp.request.OutFile; import oracle.apps.fnd.util.ParameterList; import java.util.Properties; import java.util.Hashtable; import oracle.apps.fnd.common.Message; import oracle.apps.fnd.common.MessageToken; import oracle.apps.fnd.util.NameValueType; import oracle.apps.fnd.framework.OAApplicationModule; import oracle.apps.fnd.framework.OAApplicationModuleFactory; import oracle.apps.fnd.framework.OAException; import java.sql.CallableStatement; import java.sql.SQLException; import java.math.BigDecimal; public class LoadData implements JavaConcurrentProgram { private static OAApplicationModule ljobAM; private static LogFile rLogFile; private static OutFile rOutFile; private static int mRequestId; private static String mFileName; private static int mXmlErrorCode=0; private static String mXmlErrorMsg=""; public static void writeToLog(String data) { rLogFile.writeln( data, rLogFile.STATEMENT); } public static OAApplicationModule getAM() { return ljobAM; }
  • 49. 49 public static String getFileName() { return mFileName; } public void runProgram(CpContext ctx) { System.out.println(" Running Custom Job Parse and Load XML data into Contact Info table."); String attribute; String line = null; // Concurrent Request execution status ReqCompletion rStatus = ctx.getReqCompletion(); // properties will be used to store the all values in hash table with particular name Properties rProperties = new Properties(); rProperties.put("APPS_CONTEXT", ctx); String mAmDefName = "custom.oracle.apps.custmodule.conc.server.contactinfoAM"; ljobAM = OAApplicationModuleFactory.createRootOAApplicationModule(ctx, mAmDefName); rOutFile = ctx.getOutFile(); // get OutFile object from CpContext rLogFile = ctx.getLogFile();// get LogFile object from CpContext //LogFile mLog = cpcontext.getLogFile(); //cpcontext.getReqDetails() ParameterList pList = ctx.getParameterList(); Hashtable mAttributes = new Hashtable(); Object obj = null; // Retrive the list of parameters provided to concurrent request. if(pList.hasMoreElements()) { rLogFile.writeln( "--------------------", rLogFile.STATEMENT); String attribute_name; String attribute_value; for(; pList.hasMoreElements(); ) { NameValueType namevaluetype = pList.nextParameter(); attribute_name = namevaluetype.getName(); attribute_value = namevaluetype.getValue(); if(attribute_value != null) { if(attribute_name.equalsIgnoreCase("P_FILE_NAME"))
  • 50. 50 mFileName = attribute_value; } } } Message message = new Message("FND", "CONC-ARGUMENTS"); rLogFile.writeln(message, rLogFile.STATEMENT); rLogFile.writeln( "--------------------", rLogFile.STATEMENT); rLogFile.writeln("File Name: "+mFileName,rLogFile.STATEMENT ); BufferedReader br; try { br = new BufferedReader(new FileReader(mFileName)); while ((line = br.readLine()) != null) { rLogFile.writeln(line,rLogFile.STATEMENT); } } catch (FileNotFoundException e) {rLogFile.writeln(e.getMessage(),rLogFile.STATEMENT);} catch (java.io.IOException e1) {rLogFile.writeln(e1.getMessage(),rLogFile.STATEMENT);} //Call the XML Parser ReadXML xmlConsumer = new ReadXML(); xmlConsumer.readFile(mFileName); rStatus.setCompletion(mXmlErrorCode, mXmlErrorMsg); rLogFile.writeln("Load XML Data using OA Business Component job Completed",rLogFile.STATEMENT); } }
  • 51. 51 Appendix E: ReadXML Java class package custom.oracle.apps.custmodule.conc.server; import java.io.IOException; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.ParserConfigurationException; import java.io.File; import java.io.FileNotFoundException; import java.io.InputStream; import java.io.FileInputStream; import oracle.apps.fnd.framework.OAViewObject; import oracle.apps.fnd.framework.OARow; import java.lang.Integer; import oracle.apps.fnd.framework.OAApplicationModule; import oracle.apps.fnd.framework.OAApplicationModuleFactory; public class ReadXML extends DefaultHandler { File lFile; InputStream lFileStream; SAXParser lSaxParser; boolean recordData=false; static OAApplicationModule jobAM; String lName = ""; String lAddress =""; String lCity =""; String lState =""; String lZip = ""; StringBuffer textBuffer; Attributes attrlist; public ReadXML() { } public void readFile(String fileName) {
  • 52. 52 jobAM=LoadData.getAM(); InitSaxXmlParser(fileName); } private void CreateContactInfoRow() { OAViewObject oaContactInfoVO=null; if(jobAM!=null) { oaContactInfoVO=(OAViewObject)jobAM.findViewObject("contactInfoVO1"); OARow contactInfoRow = (OARow) oaContactInfoVO.createRow(); if(contactInfoRow!=null) { contactInfoRow.setAttribute("Name",lName); contactInfoRow.setAttribute("Address",lAddress); contactInfoRow.setAttribute("City", lCity); contactInfoRow.setAttribute("State",lState); contactInfoRow.setAttribute("Zip",lZip); jobAM.invokeMethod("commitContactInfo"); } else System.out.println("AM job was NULL"); } } public void initAttribute() { lName = ""; lAddress =""; lCity =""; lState =""; lZip = ""; } public void InitSaxXmlParser(String fileName) { DefaultHandler mhandler = new ReadXML(); try { System.out.println("File name length"+fileName.length()); lFile=new File(fileName); lFileStream = new FileInputStream(lFile);
  • 53. 53 // Use the default (non-validating) SAX Parser SAXParserFactory factory = SAXParserFactory.newInstance(); try { lSaxParser = factory.newSAXParser(); lSaxParser.parse(lFileStream, mhandler); } catch (ParserConfigurationException ex) { System.err.println ("Failed to create SAX parser:" + ex);} catch (SAXException ex) { System.err.println ("SAX parser exceeption:" + ex);} catch (IOException ex) { System.err.println ("IO exeception:" + ex);} catch (IllegalArgumentException ex) { System.err.println ("Invalid file argument" + ex);} } catch(FileNotFoundException e) { System.err.println ("Invalid file argument" + e.getMessage());} } public void startDocument() throws SAXException { System.out.println("Start of document"); initAttribute(); } public void endDocument() throws SAXException { System.out.println("End of document. Does"); } public void Set_Attributes(Attributes mAttribute, String localName, String qualifiedName, String tagValue ) { if (recordData) { //System.out.println("Set_Attributes ->"+localName+" :"+qualifiedName+ ":"+ tagValue); if (qualifiedName.equalsIgnoreCase("name")) lName = tagValue; if (qualifiedName.equalsIgnoreCase("Address")) lAddress = tagValue;
  • 54. 54 if (qualifiedName.equalsIgnoreCase("city")) lCity = tagValue; if (qualifiedName.equalsIgnoreCase("state")) lState = tagValue; if (qualifiedName.equalsIgnoreCase("zip")) lZip = tagValue; } } public void startElement(String namespaceURI, String sName, // simple name String qName, // qualified name Attributes attrs) throws SAXException { getElementText(); attrlist=attrs; if (qName.equalsIgnoreCase("vendor")) { recordData=true; } if (recordData) { if (qName.equalsIgnoreCase("name")) Set_Attributes(attrlist, sName,qName,getElementText()); if (qName.equalsIgnoreCase("address")) Set_Attributes(attrlist, sName,qName,getElementText()); if (qName.equalsIgnoreCase("city")) Set_Attributes(attrlist, sName,qName,getElementText()); if (qName.equalsIgnoreCase("state")) Set_Attributes(attrlist, sName,qName,getElementText()); if (qName.equalsIgnoreCase("zip")) Set_Attributes(attrlist, sName,qName,getElementText()); } } public void endElement(String namespaceURI, String sName, String qName ) throws SAXException {
  • 55. 55 Set_Attributes(attrlist, sName,qName,getElementText()); if (qName.equalsIgnoreCase("vendor")) { recordData=false; CreateContactInfoRow(); } } public void characters(char[] buf, int offset, int len) throws SAXException { String s = new String(buf, offset, len); if (textBuffer == null) textBuffer = new StringBuffer(s); else textBuffer.append(s); } private String getElementText() throws SAXException { if (textBuffer == null) return null ; String s = ""+textBuffer; textBuffer = null; return s; } public static void main(String[] args) { String fileName="C:AmitJdev_12_1_3JdevjdevhomejdevcontactInfo.xml";//LoadData.getFile Name(); ReadXML xmltobeRead = new ReadXML(); xmltobeRead.readFile(fileName); } }