Beruflich Dokumente
Kultur Dokumente
We will perform the below listed task in order to complete our assignment
6. Create Controller
7. Test Page
--------------------------------------------------
Create table.
-------------------------------------------
Navigation:
Right Click on Project -->New -->Business Tier -->ADF Business Components --
>Application Module --> Press OK button.
Step 1:
Specify Package called path where you want to save your application Module
E.g : Package: oracle.apps.fnd.server
Specify package name
E.g: Name:ImportcsvAM
Press Next Button
Step 2: Make sure in Data Model your Application Module is appearing and Press
Button Next
Step 3:Press Button Next
Step 4: Check the Generate Java File(s) checkbox in Application
Module Class: ImportcsvAMImplto generate the ImportcsvAMImpl java class. (It is
already checked by default.)
Step 5: In Finish window, Press Finish Button
-------------------------------------------
Navigation:
Right Click on Project -->New -->Business Tier -->ADF Business Components -->Entity
Object --> Press OK button.
Page 2 of 7
Step 4: Check Create Method, Remove Method and Validate Method
Press Button Next.
Step 5: Here you have a option to VO belongs to EO but we will not create and we will
Press Button Next.
Step 6: In Finish window, Press Finish Button.
-------------------------------------------
Navigation:
Right Click on Project -->New -->Business Tier -->ADF Business Components -->View
Object --> Press OK button.
To link the view object to the application module, perform the following steps:
1. In the Application Navigator tab, double-click the ImportcsvAM
4. Shift the ImportcsvVO from Available View Objects: to Data Model: by clicking on
the > button
-------------------------------------------
Create Page
Page 3 of 7
Right Click on Project -->New -->Web Tier -->OA Components -->Page --> Press OK
button.
New Window will appear, here you need to Name your page and specify package.
Name: ImportcsvPG
Package: oracle.apps.fnd.webui
Press Buttons OK
Page 4 of 7
2. In the Structure pane, right-click PageLayoutRN and select New | Region from
the pop-up menu.
3. In the Property Inspector, set the following properties:
ID: ImportcsvRN
Region Style: defaultSingleColumn
4. Click on the Save All button from the toolbar.
Adding item to hold path
Navigation:
Right Click on PagePayoutRN -->New -->Item
In the Structure pane, click on the Item attribute and set the following properties:
ID: MessageFileUpload
Item Style: MessageFileUpload
Navigation:
Right Click on PagePayoutRN -->New -->Item
In the Structure pane, click on the Item attribute and set the following properties:
ID: Go
Item Style: SubmitButton
Attribute Set :/oracle/apps/fnd/attributesets/Buttons/Go
Create Controller
Navigation:
Right Click on PagePayoutRN -->Set New Controller
New Window will appear to you, you need to specify Package and Name
Package: oracle.apps.fnd.webui
Name: ImportcsvCO
OAApplicationModule am = (OAApplicationModule)
pageContext.getApplicationModule(webBean);
OAViewObjectImpl vo =
(OAViewObjectImpl)am.findViewObject("ImportcsvVO1");
Page 5 of 7
OAViewObjectImpl csvVO =
(OAViewObjectImpl)am.findViewObject("ImportcsvVO1");
if (pageContext.getParameter("Go") != null) {
//Get Data of uploaded CSV file
DataObject csvUploadData =
pageContext.getNamedDataObject("MessageFileUpload");
//Declare Variable that will be used in reading uploaded file
String fileName = null;
String contentType = null;
Long fileCapacity = null;
BlobDomain uploadStream = null;
BufferedReader inReader = null;
try {
fileName =
(String)csvUploadData.selectValue(null, "UPLOAD_FILE_NAME");
contentType =
(String)csvUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
uploadStream =
(BlobDomain)csvUploadData.selectValue(null, fileName);
inReader =
new BufferedReader(new
InputStreamReader(uploadStream.getBinaryStream()));
fileCapacity = new Long(uploadStream.getLength());
} catch (NullPointerException ex) {
throw new OAException("Please Select an CSV File to Upload it to Database!!!",
OAException.ERROR);
}
try {
String wholeLine = "";
long counter = 0;
String[] seperatedCells;
while (((wholeLine = inReader.readLine()) != null))
{
//Split the deliminated data and
if (wholeLine.trim().length() > 0) {
//split whole line to cells
seperatedCells = wholeLine.split(",");
row.setAttribute("Column1",seperatedCells[0]);
row.setAttribute("Column2", seperatedCells[1]);
row.setAttribute("Column3",seperatedCells[2]);
row.setAttribute("Column4", seperatedCells[3]);
Page 6 of 7
row.setAttribute("Column5", seperatedCells[4]);
}
}
} catch (IOException e) {
throw new OAException(e.getMessage(), OAException.ERROR);
}
am.getTransaction().commit();
pageContext.forwardImmediately(
"OA.jsp?page=/oracle/apps/fnd/webui/ImportcsvPG",
null, OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
-------------------------------------------
Test Page
Navigation:
Page 7 of 7