In this post i will show you how to use ADF to create a simple CRUD application in just few minutes.
To know more about ADF "Application development framework" please go to this link.
1. Create an ADF web application.
2. Set application name "Sample Crud" and click finish.
3. Choose "Connect to a Database" and press "Create a Database Connection".
4. Put connection details, and connect to the Oracle Sample HR database, and make sure to test the connection.
Note: Make sure that the hr user is not locked, and if its locked you may need to unlock it.
5. Mark the "Connect to a database" step as Done.
6. Expand the "Build Business Services" step and click "Go to Substeps".
7. Expand "Create Entity Objects and Associations", Press "Create Entity Objects and Associations".
8. Choose the model project.
9. Choose the database connection created in step 3.
10. Press the Query button, and move the Jobs table to the right column.
11. For the updatable views, chose JobsView and move it to the right column, then press finish.
12. Mark the "Build Business Services" step as Done.
13. Open the "adf-config" unbounded task flow.
14. From the "Component Palette" panel drag the view icon to the task flow.
15. Rename it to "jobsView" and double click on it, and then click Ok.
16. Drag a button from "Component Palette" panel into the page, and rename it from the property panel.
17. Do the same for the Edit, Delete, View buttons.
18. From the "Data Control" panel, drag the JobsView1 into the page, and insert it as a read only table.
19. Choose "Single Row" for selection, and click Ok.
20. Back to the "adf-config" unbounded task flow, and drag a new view for the job form.
21. Double click the new page, and drag the JobsView1 into it from the "Data Control" panel as a form.
22. Check the "Include submit button" checkbox, and click Ok.
23. Back to the "adf-config" unbounded task flow, and drag a new view for the job details.
24. Double click the new view, and add the JobsView1 into it as a read only form, and click Ok.
25. Back to the "adf-config" unbounded task flow, In the "Data Control" panel, expand the JobsView1 -> Operations and drag the "CreateInsert" operation into the task flow.
26. Do the same for "Delete" operation.
27. From "Data Control" -> Operations, drag "Commit" and "Rollback" operations into the task flow page.
28. From the "Component Palette" panel click the "Control Flow Case" icon and drag from "jobsView" page to the "viewJobDetails" page, and name it "view".
29. Do the following to complete navigation flow for our business case:
A. "create" flow from "jobsView" to "createInsert" operation.
B. "edit" flow from "jobsView" to "jobForm" page.
C. "delete" flow from "jobsView" to "delete" operation.
D. "CreateInsert" flow from "CreateInsert" operation to "jobForm" page.
E. "Delete" flow from "Delete" operation to "Commit" operation.
F. "save" flow from "jobForm" page to "Commit" operation.
G. "cancel" flow from "jobForm" page to "Rollback" operation.
H. "Commit" flow from "Commit" operation to "jobsView" page.
I. "Rollback" flow from "Rollback" operation to "jobsView" page.
J. "back" flow from "viewJobDetails" page to "jobsView" page.
30. Go to the "jobsView" page, and double click it, and from the property panel, change the action for each button to be as follow:
A. "View" button action = "view"
B. "Create" button action = "create"
C. "Delete" button action = "delete"
D. "Edit" button action = "edit"
31. In the "jobForm" page, add a new button and name it cancel, and the action = cancel, imediate=true.
32. In the "viewJobDetails" page add a new button and name it back, and the action = back.
33. Right click the adf-config unbounded task flow and click run, if prompted to choose the run configuration choose "jobsView" page to be the start page.
34. Screen shots for the application:
Done.