As said in the introduction, this tutorial is to provide back-end functionality for our VIE portal that we are building in the WebCenter Tutorial.
Our online education agency requires some back-end system to manage subscriptions, students, teachers and so on. Some of these features require WebCenter but this tutorial will only focus on ADF which means that we are going to build a separate application and integrate this in WebCenter later on in the other tutorial. So don't expect to see much WebCenter in this tutorial. Business Components, Security, taskflows, managed beans and so on, this is what this tutorial is all about.
Let's start by giving a global overview of the requirements
As with a normal development cycle, requirements change. For the beginning of the tutorial, our requirements are quite simple. We need a management tool for subscriptions of courses. This means we need to have forms for several entities. In ADF we will divide the functionalities in following modules:
The base idea is to manage subscriptions but because we also need courses, teachers and students, we need to include these modules as well.
It speaks for itself that we need to include security to our application so only the appropriate people are able to manage the subscriptions. We will have different roles so a secretary can manage students and teachers and teachers can manage their courses.
The management application is not exactly rocket science but it gives an overview of a real world problem that you might encounter in some other projects. This applications will contain basic concepts that are very common in most projects.
When developing a transactional application, you almost always have to use data model of some sort. Whether you are using your own database or getting the information from services, you have to define a data model so it fits your needs. This is what we will do now.
Well, to be honest, I already made the data model for this tutorial. I have kept it very simple for the simple reason that we will change it later on. When I first started with ADF and Business Components I always found it very difficult to change the data model. There are so many steps to take into account and I always had lots of problems when I needed to change the data model.
Exactly for that reason we are going to start with a very basic model. In a later chapter we are going to change it and going over each step to add or move columns from one table to another.
Below is an overview of the model that I have created for this tutorial:
The model is self explanatory. If there are questions about it, just ask in the comments.
As you can see we have a table for the most important entities:
Student, teacher, course and subscriptions. Country and category are lookup tables to store reference data for the category of the course and country for an address.
Now that I have explained the model we can start creating our application and importing the model into our database.
An ADF Web Application is actually called a Fusion Web Application in JDeveloper. In order to create one we have to open the Create New gallery popup. Just press CTRL+N in JDeveloper.
Select Application in the General section and Fusion Web Application (ADF) in the right hand side. Press Ok to create the application.
In the next screen we have to specify a name for the application. Because this will be our back-end system for the VIE portal we are calling this VieApp. We are also going to specify the package prefix so everywhere in the application we this prefix will be used.
A Fusion Web Application contains out of two projects. The model project will contain the model assets like our business components. The ViewController project contains the actual web application.
In the next step of the wizard we need to specify the properties of these projects. The first project we need to specify is the model project.
We are going to change the name into viewModel:
In the next step we specify the java settings for the project like package. These settings are fine so just press next.
In the next step we have to specify the ViewController project. Again we are going to rename this to VieView.
In the next step we have to specify the java settings of the project. These settings are also fine so we can press Finish.
This will create the application as shown in the Application Navigator:
Now we can create a connection to the database.
Connections in JDeveloper are created and managed in the Application Resources section. By default this is just below the Application Navigator. Right click on the Connections folder and select New Connection. This opens a popup that allows you to select the type of new connection. We have to select Database from this menu because... Well... We are going to create a database connection. This opens a popup to specify the database connection.
In order for you to complete this tutorial, you either have to have a user in a database so we can add our tables there or you can either create a new user for this. In my case, I am working with a new user called DEV_VIE. Because this is an ADF tutorial and not DB Admin tutorial, I assume you know how to create such a user or at least have a proper user in the database.
In the popup specify the settings to connect to your database:
These are my settings:
When the database connection has been created you can right click on it and select Open in Database Navigator. This will connect to the DB and open a worksheet. I also created a script to create all of the tables and foreign keys. You can view it here.
Just copy paste the contents of that file into the worksheet and execute it. This will create all the tables as shown in the following image.
That's basically it for the first chapter. You have learned how to create a fusion web application and how to import the data model into a database.
In the next chapter we will start by creating some business components out of that model.
Hope you like it so far and in case of question, you know where to find me.