Hello, last video, we have connected developer with database and now the developer and database are ready to start creating ADF application from this video I will start working on it a business component some other layer I think you remember this short I wish I took before about it. Now are you focused for a couple of upcoming videos on model layer? So I will talk about entity object in detail. Then I will talk about view object in detail and application modules. There are two more components like cold Association and view link. I will talk about it as well in detail.
So, first thing now I will talk about it this way You is entity object. So Let's now move to developer and start working on ADF application. Let us now create a new application ADF application. Okay. It's your PDF application, I will call this application called HR ADF application. As I said before, Jennifer Barone automatically create to project first the project for the model.
This model which I will talk about it, we should talk about it business components, like entity object view object application modules Association and a few links. And the second project is view control controller, which is talking about the user interface GCF pages and interfaces components as a page editor. fiscal flows and so on. Next finish After you create the PDF application, the first step you have to do is to create some other. So, in EDF application once you created the application, you should create an EDF model but before you created a model you have various database should be ready. So, now let us now create a model pointed to the HR schema and start working on it.
So, here I will right click in the model and select business components from tables. I will look up to the HRT connection which we already created. I will copy the connection so, this is a connection which is a model we'll deal with okay. As I say before the first component of the if business component is a model is an entity objects. So I will put this in the package called eo two was the entity object on it. I press query to get all the tables in this connection, it's your connection.
This now create one entity called departments. Okay, next Nicolas, this is a view object we can create this view object as well for now. So I will create it is a package called model to and I will select the department's view Nick is this is another type of view object. I will talk about it later. Now. This is application modules.
Nick is Nick is Nick is Finish okay. So, let's discuss this view controller now we are working on their model layer okay as I said in the model layer, model layer has five components, first component is entity objects, second one is view object third one is application module and there are two more components I will talk about it later is associations and view link. Once you aware about these five components, you will be aware about the old if business component model. In this video, I will talk in detail about entity object. As I said before the entity object is you can consider it as a table So, each table database should map to the entity object. So this entity object is mapped to which table how we will know in the general what you find here in schema object, it does departments so it points to the department's table.
For each table, you will have this open the department's table here. You will have some column, we can go see the data if you want. department ID, department name manager ID Manager, location ID is the entity object in the attribute you will find the column here for column it will create attribute for each column. We call this attributes in the entity object and it will take the same data type of the column so if the department is numeric department department ID is a numeric what we name is our core measure number Location is a number you will find here gt will automatically create attribute with the same datatype which found here in the database. So, entity object is a table and attribute is a column of that table. Okay.
So what can we do in this entity object? What is the feature or what is the thing is in as an ADF application can do in this entity object. Let's talk about one by one first one. Here, you will find here something called alternative or alternate keys. Alternate keys it is if you want to mark a column one column is a database to be a key, but actually it is not a primary key. As you can see here is a database the department Or the column called department ID is a primary key okay of that table this is a primary key, but at the same time you want the department name should not be repeated you don't want this department name to be repeated as a key.
So, you can define here it as alternate key. So, you just press Add and I need to say this department name should not be repeated as well. In it a business component, you can define all business rule on all constraints and own all validation is that for the table, even this validation is not exist in the database level. So maybe the department table has no constraint at all. It is just like a table. There is no validation nothing at all, but you can put all validation you want is that entity level.
So, here I tells a framework that if the user try to insert a new row or update a current existing row with a department name already exist, you just give me a validation error. So this is the fairest Thank you can do is the entity object so the first thing is you can create alternate keys I will just go with a mean mean things okay for for tunings, we don't do anything and just Unix on the rest of the thing is just here. Just in general, you will know what's the table and you can find alternate key. But defined alternate key alone is not enough you have to define business rule for this alternate key. So I will talk about the business rules. business rules is the most important thing is the entity object.
From this tab, you can define A validation for this table there are two type of validation validation in the attribute level or a column level or validation in the old entity level. There are a breed defined business rule a it f has a predefined business rule and it will make easy to add a validation. So, now we create alternate key after you can use alternate key you have to go business rule and this is will be entity validation because this is not related to a specific column not related to a specific entity, this is general in the general entity. So, you just right click and you can add new validator and from the type you will find some alternative type I will talk about this later. So, what we have we have a unique key and you will find your alternate key. You just write a failure or error message If the user tried to add a department name, which is already exist, so you can say this deport mean name is already exists.
For example, this is Aramis. That's it. So, you add a validation in the entity whole entity level, this validation is a unique key validation boy into to you alternate key c user is a very simple there is no code at all. So, if in your ADF application want a specific table to be in one column was a specific table to be a unique you can come to the entity object which map to that table and you can create alternate key. Also they can be composite. You can see for example, the birth committee name and the location ID should be unique Both of them not only they're working with name so you can add any altona key as you want.
So, this is the first one second is attributes, its attributes there are a lot of things you can do in the attribute level or the column level in the case. For example, here let's talk about take select one of the attributes you will find here from some department he has this key sign it means this is a primary key and you will find here it is automatically mandatory. So no user has to SIDS the department ID before it insert. Here, what is the column which is this attribute is mapped to and the data type. As you can see here, updatable is always you can have here, never update, updatable at all or while new. Most of the times are primary should be while new while new it means once a user can create a new row for the departments, the department ID will be open as a field will be open to that the user can enter the department ID.
But once the user save and commit the changes to the database, he will not be able to update this value anymore. This is the thing is I will show you once we can eat a beach and I can show you all these kind of things. Here in UI you can give a label. So once a user use this view object or this entity object in the page, you will find the label behind or beside the field. For example, you can here say to bar meant ID you can see here Name Manager Location something like this you can give a label or a text on the for each attribute. This is for the attribute level.
You'll find here a validation rule for attributes even as I sit here as a business rule validations attribute you can do it from here or you can do it from here. So, for example, in the department name, you will find there are two rules already defined coming from the database, which is it is a mandatory and the value should be around 30. Characters what what else you can do here, you will find here some other validation rule. If you want to add a regular expression, it should match for example, if you have email Or something like this you can say it should emit has this says format to be validated or if you have a phone number you can use this better. So, you can define a regular expression for a specific column or a Pacific attribute you can be arranged if it is value it is integral value or double value you can say the minimum value should be 20 and the maximum should be for example 100 So, if the value out of this range you should write an error message okay.
So, you will define this range is defined the list it should be in this list only the user can add some lists only like for example, should be in between this list some signal exists and if the value is not in this list, you can add an error message here. There are a method if you need to make some customization we will call about programmatic and later, but this is if you want something programmatic It's another compare if you say the value should equal to exhibition or another attribute in some other view object or the query result you can write a select statement and if the value is not in say is selected statement result you will place error. So, as there are a lot of predefined validation in the attribute level you can you can defined and this is one of the most important feature and entity object.
So, in EDF application if if application if you want to add some validation in a specific field you should do it in the entity object. You just select it select the business rule and see sit your validation This is insane attribute third one is a business rule as I said there are two level of business rule one in the entity level and one in the attribute level is the entity level you can add something like unique as we say before or has the same attribute but this is will be in the whole entity living for example, if you have started date at the end date in the table and you want indeed it to be always greet or send start date. So, you should say here, select the attribute and compare results and other attribute and select a lot of it and so on here Here you will do all these kinds of things we will show it later, but I just want to know what is what you can do in entity object, what what exactly used for this object is used for.
So, in the entity object, so most of Important thing we will use is attribute level as a business rule. And Java will be used if you do want to do something programmatic. There are dedicated sections for all programmatics in RDF. And this is you need to add this view accessor and business event Forget it. So, this is the most three tabs you will use, and the entity object, attribute business rule and Java. For this video, I'll give you a quick explanation about entity object.
I will come back again to this entity object. Why did we create a beach so that you will be able to see the change and you manage to see the change so the next video, let us create a new page and we can make some change in that attribute and run and see how it will affect in the beach. So, see you next video