SlideShare a Scribd company logo
1 of 55
Download to read offline
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

Oracle EBS Self service from A to Z
Oracle EBS Self service from A to ZOracle EBS Self service from A to Z
Oracle EBS Self service from A to ZFeras Ahmad
 
Oracle Applications R12 architecture
Oracle Applications R12 architectureOracle Applications R12 architecture
Oracle Applications R12 architectureSekhar Byna
 
Oracle EBS Apps HRMS Presentation
Oracle EBS Apps HRMS PresentationOracle EBS Apps HRMS Presentation
Oracle EBS Apps HRMS PresentationFeras Ahmad
 
Absence management in oracle HRMS
Absence management in oracle HRMSAbsence management in oracle HRMS
Absence management in oracle HRMSRajiv reddy
 
R12:Payment Process Request (PPR)
R12:Payment Process Request (PPR)R12:Payment Process Request (PPR)
R12:Payment Process Request (PPR)lingaswamy vallapu
 
Creating business group in oracle apps
Creating business group in oracle appsCreating business group in oracle apps
Creating business group in oracle appsGurpreet singh
 
Calendar working days and holidays for Oracle EBS R12 Absence management
Calendar working days and holidays for Oracle EBS R12 Absence managementCalendar working days and holidays for Oracle EBS R12 Absence management
Calendar working days and holidays for Oracle EBS R12 Absence managementFeras Ahmad
 
Webadi -a_sample_implementation
Webadi  -a_sample_implementationWebadi  -a_sample_implementation
Webadi -a_sample_implementationAshish Harbhajanka
 
Steps on how to restrict sit s
Steps on how to restrict sit sSteps on how to restrict sit s
Steps on how to restrict sit sFeras Ahmad
 
Query to get the geography information using bi report
Query to get the geography information using bi reportQuery to get the geography information using bi report
Query to get the geography information using bi reportFeras Ahmad
 
Oracle XML Publisher / BI Publisher
Oracle XML Publisher / BI PublisherOracle XML Publisher / BI Publisher
Oracle XML Publisher / BI PublisherEdi Yanto
 
Oracle Fusion Web Clock Setup(Oracle Time and Labor)
Oracle Fusion Web Clock Setup(Oracle Time and Labor)Oracle Fusion Web Clock Setup(Oracle Time and Labor)
Oracle Fusion Web Clock Setup(Oracle Time and Labor)Nitin Maheshwari
 
Pick pack and ship confirm process in oracle apps
Pick pack and ship confirm process in oracle appsPick pack and ship confirm process in oracle apps
Pick pack and ship confirm process in oracle appsshravan kumar chelika
 
Understanding Flex Fields with Accounting Flexfields(Chart of Accounts) in O...
Understanding Flex Fields with  Accounting Flexfields(Chart of Accounts) in O...Understanding Flex Fields with  Accounting Flexfields(Chart of Accounts) in O...
Understanding Flex Fields with Accounting Flexfields(Chart of Accounts) in O...Gurpreet singh
 
Oracle Applications - R12 Approvals Management Engine - AME Training
Oracle Applications - R12 Approvals Management Engine - AME TrainingOracle Applications - R12 Approvals Management Engine - AME Training
Oracle Applications - R12 Approvals Management Engine - AME TrainingDharmalingam Kandampalayam Shanmugam
 

What's hot (20)

Oracle EBS Self service from A to Z
Oracle EBS Self service from A to ZOracle EBS Self service from A to Z
Oracle EBS Self service from A to Z
 
Oracle Applications R12 architecture
Oracle Applications R12 architectureOracle Applications R12 architecture
Oracle Applications R12 architecture
 
Oracle EBS Apps HRMS Presentation
Oracle EBS Apps HRMS PresentationOracle EBS Apps HRMS Presentation
Oracle EBS Apps HRMS Presentation
 
Oracle application framework (oaf) online training
Oracle application framework (oaf) online trainingOracle application framework (oaf) online training
Oracle application framework (oaf) online training
 
Absence management in oracle HRMS
Absence management in oracle HRMSAbsence management in oracle HRMS
Absence management in oracle HRMS
 
R12:Payment Process Request (PPR)
R12:Payment Process Request (PPR)R12:Payment Process Request (PPR)
R12:Payment Process Request (PPR)
 
Creating business group in oracle apps
Creating business group in oracle appsCreating business group in oracle apps
Creating business group in oracle apps
 
Calendar working days and holidays for Oracle EBS R12 Absence management
Calendar working days and holidays for Oracle EBS R12 Absence managementCalendar working days and holidays for Oracle EBS R12 Absence management
Calendar working days and holidays for Oracle EBS R12 Absence management
 
Webadi -a_sample_implementation
Webadi  -a_sample_implementationWebadi  -a_sample_implementation
Webadi -a_sample_implementation
 
Steps on how to restrict sit s
Steps on how to restrict sit sSteps on how to restrict sit s
Steps on how to restrict sit s
 
Oracle Assets
Oracle AssetsOracle Assets
Oracle Assets
 
Query to get the geography information using bi report
Query to get the geography information using bi reportQuery to get the geography information using bi report
Query to get the geography information using bi report
 
Oracle XML Publisher / BI Publisher
Oracle XML Publisher / BI PublisherOracle XML Publisher / BI Publisher
Oracle XML Publisher / BI Publisher
 
Oracle Fusion Web Clock Setup(Oracle Time and Labor)
Oracle Fusion Web Clock Setup(Oracle Time and Labor)Oracle Fusion Web Clock Setup(Oracle Time and Labor)
Oracle Fusion Web Clock Setup(Oracle Time and Labor)
 
Pick pack and ship confirm process in oracle apps
Pick pack and ship confirm process in oracle appsPick pack and ship confirm process in oracle apps
Pick pack and ship confirm process in oracle apps
 
Understanding Flex Fields with Accounting Flexfields(Chart of Accounts) in O...
Understanding Flex Fields with  Accounting Flexfields(Chart of Accounts) in O...Understanding Flex Fields with  Accounting Flexfields(Chart of Accounts) in O...
Understanding Flex Fields with Accounting Flexfields(Chart of Accounts) in O...
 
Oaf personalization examples
Oaf personalization examplesOaf personalization examples
Oaf personalization examples
 
Report Manager in Oracle EBS R12
Report Manager in Oracle EBS R12Report Manager in Oracle EBS R12
Report Manager in Oracle EBS R12
 
Oracle Applications - R12 Approvals Management Engine - AME Training
Oracle Applications - R12 Approvals Management Engine - AME TrainingOracle Applications - R12 Approvals Management Engine - AME Training
Oracle Applications - R12 Approvals Management Engine - AME Training
 
Oracle General Ledger GL FSG
Oracle General Ledger GL FSG Oracle General Ledger GL FSG
Oracle General Ledger GL FSG
 

Viewers also liked

ORACLE FRAMEWORK ONLINE TRAINING
ORACLE FRAMEWORK ONLINE TRAININGORACLE FRAMEWORK ONLINE TRAINING
ORACLE FRAMEWORK ONLINE TRAININGTRAINING ICON
 
Forms11 presentation at ssuet 05 sep-2012
Forms11 presentation at ssuet 05 sep-2012Forms11 presentation at ssuet 05 sep-2012
Forms11 presentation at ssuet 05 sep-2012Zubair Ali
 
ADF Value Proposition in 10 key points
ADF Value Proposition in 10 key pointsADF Value Proposition in 10 key points
ADF Value Proposition in 10 key pointsJaime Cid
 
ADF Development Survival Kit
ADF Development Survival KitADF Development Survival Kit
ADF Development Survival Kitandrejusb
 
Oracle Application Technical - Hz architecture
Oracle Application Technical - Hz architectureOracle Application Technical - Hz architecture
Oracle Application Technical - Hz architecturePrasad V
 
Oaf development-guide
Oaf development-guideOaf development-guide
Oaf development-guide俊 朱
 
ADF Mythbusters UKOUG'14
ADF Mythbusters UKOUG'14ADF Mythbusters UKOUG'14
ADF Mythbusters UKOUG'14andrejusb
 
Building customer relationships without being a creep Chris Hayes R2i - Gil...
Building customer relationships without being a creep   Chris Hayes R2i - Gil...Building customer relationships without being a creep   Chris Hayes R2i - Gil...
Building customer relationships without being a creep Chris Hayes R2i - Gil...Chris Hayes
 
ADF Anti-Patterns: Dangerous Tutorials
ADF Anti-Patterns: Dangerous TutorialsADF Anti-Patterns: Dangerous Tutorials
ADF Anti-Patterns: Dangerous Tutorialsandrejusb
 
Impact of Trading Community Architecture (TCA) on Oracle Receivables
Impact of Trading Community Architecture (TCA) on Oracle ReceivablesImpact of Trading Community Architecture (TCA) on Oracle Receivables
Impact of Trading Community Architecture (TCA) on Oracle ReceivablesRhapsody Technologies, Inc.
 
Oracle Framework Personalization
Oracle Framework PersonalizationOracle Framework Personalization
Oracle Framework PersonalizationEdi Yanto
 
Oracle JET CRUD and ADF BC REST
Oracle JET CRUD and ADF BC RESTOracle JET CRUD and ADF BC REST
Oracle JET CRUD and ADF BC RESTandrejusb
 

Viewers also liked (18)

ORACLE FRAMEWORK ONLINE TRAINING
ORACLE FRAMEWORK ONLINE TRAININGORACLE FRAMEWORK ONLINE TRAINING
ORACLE FRAMEWORK ONLINE TRAINING
 
Forms11 presentation at ssuet 05 sep-2012
Forms11 presentation at ssuet 05 sep-2012Forms11 presentation at ssuet 05 sep-2012
Forms11 presentation at ssuet 05 sep-2012
 
37727897 Oaf Basics
37727897 Oaf Basics37727897 Oaf Basics
37727897 Oaf Basics
 
ADF Value Proposition in 10 key points
ADF Value Proposition in 10 key pointsADF Value Proposition in 10 key points
ADF Value Proposition in 10 key points
 
ADF Development Survival Kit
ADF Development Survival KitADF Development Survival Kit
ADF Development Survival Kit
 
Real life forms to adf
Real life forms to adfReal life forms to adf
Real life forms to adf
 
Oracle Application Technical - Hz architecture
Oracle Application Technical - Hz architectureOracle Application Technical - Hz architecture
Oracle Application Technical - Hz architecture
 
Tca presentation
Tca presentationTca presentation
Tca presentation
 
Oaf development-guide
Oaf development-guideOaf development-guide
Oaf development-guide
 
ADF Mythbusters UKOUG'14
ADF Mythbusters UKOUG'14ADF Mythbusters UKOUG'14
ADF Mythbusters UKOUG'14
 
Oracle TCA 101
Oracle TCA 101Oracle TCA 101
Oracle TCA 101
 
Building customer relationships without being a creep Chris Hayes R2i - Gil...
Building customer relationships without being a creep   Chris Hayes R2i - Gil...Building customer relationships without being a creep   Chris Hayes R2i - Gil...
Building customer relationships without being a creep Chris Hayes R2i - Gil...
 
ADF Anti-Patterns: Dangerous Tutorials
ADF Anti-Patterns: Dangerous TutorialsADF Anti-Patterns: Dangerous Tutorials
ADF Anti-Patterns: Dangerous Tutorials
 
Oaf personaliztion examples
Oaf personaliztion examplesOaf personaliztion examples
Oaf personaliztion examples
 
Oracle ADF Case Study
Oracle ADF Case StudyOracle ADF Case Study
Oracle ADF Case Study
 
Impact of Trading Community Architecture (TCA) on Oracle Receivables
Impact of Trading Community Architecture (TCA) on Oracle ReceivablesImpact of Trading Community Architecture (TCA) on Oracle Receivables
Impact of Trading Community Architecture (TCA) on Oracle Receivables
 
Oracle Framework Personalization
Oracle Framework PersonalizationOracle Framework Personalization
Oracle Framework Personalization
 
Oracle JET CRUD and ADF BC REST
Oracle JET CRUD and ADF BC RESTOracle JET CRUD and ADF BC REST
Oracle JET CRUD and ADF BC REST
 

Similar to Integrate OA Framework BC4J in Java concurrent program

Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
OAF installation for 12c database
OAF installation for 12c databaseOAF installation for 12c database
OAF installation for 12c databaseAnand Mallarapu
 
Developing RIA Web Applications with Oracle ADF.pdf
Developing RIA Web Applications with Oracle ADF.pdfDeveloping RIA Web Applications with Oracle ADF.pdf
Developing RIA Web Applications with Oracle ADF.pdfsheriframadan18
 
Learning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFrameworkLearning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFrameworkAkhil Mittal
 
patchVantage Cloud Starter Pack
patchVantage Cloud Starter Pack patchVantage Cloud Starter Pack
patchVantage Cloud Starter Pack David McNish
 
Free EJB Tutorial | VirtualNuggets
Free EJB Tutorial | VirtualNuggetsFree EJB Tutorial | VirtualNuggets
Free EJB Tutorial | VirtualNuggetsVirtual Nuggets
 
How to deploy a j2ee application
How to deploy a j2ee applicationHow to deploy a j2ee application
How to deploy a j2ee applicationKumar
 
EJB 3.0 Java Persistence with Oracle TopLink
EJB 3.0 Java Persistence with Oracle TopLinkEJB 3.0 Java Persistence with Oracle TopLink
EJB 3.0 Java Persistence with Oracle TopLinkBill Lyons
 
Metamorphosis from Forms to Java: A technical lead's perspective, part II
Metamorphosis from Forms to Java:  A technical lead's perspective, part IIMetamorphosis from Forms to Java:  A technical lead's perspective, part II
Metamorphosis from Forms to Java: A technical lead's perspective, part IIMichael Fons
 
Dao pattern
Dao patternDao pattern
Dao patternciriako
 
Jdbc Complete Notes by Java Training Center (Som Sir)
Jdbc Complete Notes by Java Training Center (Som Sir)Jdbc Complete Notes by Java Training Center (Som Sir)
Jdbc Complete Notes by Java Training Center (Som Sir)Som Prakash Rai
 
Iphone programming: Core Data Tutorial for iOS
Iphone programming: Core Data Tutorial for iOSIphone programming: Core Data Tutorial for iOS
Iphone programming: Core Data Tutorial for iOSKenny Nguyen
 
12c weblogic installation steps for Windows
12c weblogic installation steps for Windows12c weblogic installation steps for Windows
12c weblogic installation steps for WindowsCognizant
 
Weblogic 12c Graphical Mode installation steps in Windows
Weblogic 12c Graphical Mode installation steps in Windows Weblogic 12c Graphical Mode installation steps in Windows
Weblogic 12c Graphical Mode installation steps in Windows webservicesm
 

Similar to Integrate OA Framework BC4J in Java concurrent program (20)

Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
Tomcat + other things
Tomcat + other thingsTomcat + other things
Tomcat + other things
 
OAF installation for 12c database
OAF installation for 12c databaseOAF installation for 12c database
OAF installation for 12c database
 
Developing RIA Web Applications with Oracle ADF.pdf
Developing RIA Web Applications with Oracle ADF.pdfDeveloping RIA Web Applications with Oracle ADF.pdf
Developing RIA Web Applications with Oracle ADF.pdf
 
Learning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFrameworkLearning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFramework
 
Hibernate notes
Hibernate notesHibernate notes
Hibernate notes
 
patchVantage Cloud Starter Pack
patchVantage Cloud Starter Pack patchVantage Cloud Starter Pack
patchVantage Cloud Starter Pack
 
Notepad tutorial
Notepad tutorialNotepad tutorial
Notepad tutorial
 
Free EJB Tutorial | VirtualNuggets
Free EJB Tutorial | VirtualNuggetsFree EJB Tutorial | VirtualNuggets
Free EJB Tutorial | VirtualNuggets
 
How to deploy a j2ee application
How to deploy a j2ee applicationHow to deploy a j2ee application
How to deploy a j2ee application
 
EJB 3.0 Java Persistence with Oracle TopLink
EJB 3.0 Java Persistence with Oracle TopLinkEJB 3.0 Java Persistence with Oracle TopLink
EJB 3.0 Java Persistence with Oracle TopLink
 
Metamorphosis from Forms to Java: A technical lead's perspective, part II
Metamorphosis from Forms to Java:  A technical lead's perspective, part IIMetamorphosis from Forms to Java:  A technical lead's perspective, part II
Metamorphosis from Forms to Java: A technical lead's perspective, part II
 
Jdbc
JdbcJdbc
Jdbc
 
Eclipse Vs Netbeans
Eclipse Vs NetbeansEclipse Vs Netbeans
Eclipse Vs Netbeans
 
Dao pattern
Dao patternDao pattern
Dao pattern
 
Jdbc Complete Notes by Java Training Center (Som Sir)
Jdbc Complete Notes by Java Training Center (Som Sir)Jdbc Complete Notes by Java Training Center (Som Sir)
Jdbc Complete Notes by Java Training Center (Som Sir)
 
Iphone programming: Core Data Tutorial for iOS
Iphone programming: Core Data Tutorial for iOSIphone programming: Core Data Tutorial for iOS
Iphone programming: Core Data Tutorial for iOS
 
12c weblogic installation steps for Windows
12c weblogic installation steps for Windows12c weblogic installation steps for Windows
12c weblogic installation steps for Windows
 
Weblogic 12c Graphical Mode installation steps in Windows
Weblogic 12c Graphical Mode installation steps in Windows Weblogic 12c Graphical Mode installation steps in Windows
Weblogic 12c Graphical Mode installation steps in Windows
 
154090896 installation-of-oracle-database-12c
154090896 installation-of-oracle-database-12c154090896 installation-of-oracle-database-12c
154090896 installation-of-oracle-database-12c
 

Recently uploaded

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 

Recently uploaded (20)

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 

Integrate OA Framework BC4J in 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); } }