Hello in this video, I will show you how you can create a shared library. This library will have two things first thing will have your template, your CSS, your icons, your imaging, which you can use in multiple PDF application. And I think I've talked about this before in this course, second point will be the whole code which you usually use at any ADF application. During this course, I talk about how you can get that attribute from specific a trait or how you can execute a operation from the budget definition how you can use a cookie how you can show Baba from the back been, so you have a lot of shared code will be used in all the different location. So for the best practice, you should create your own shared library, as this library should be deployed in one place in WebLogic, and makes ETF or ETF application point to this library.
In this course I will show you how you can do all of this. In this video, let us create a shared code which we usually use it in our if application we need to create this shared code in one place and you can use this library at any diff application you will develop. So, it does not create a simple application or custom application because some application and this application will be my EDF sure who occasion okay because and we can use this we can call this my shear good okay and finish this is just simple brushing application. Let us go to the feature and let us sorry to go to the library And library which we need to use we need to use ADF common long time we can use it it faces from time we can use ADF model is the wrong time if controller okay I think we need some clarity to model and very efficient is because we will use the code in our boy into the model and if you so let us now create a class, we can call this class, my PDF So, this utility clause will have all All function which you will need while developing any diff application or your roads, most of us the common good we usually use at any default application here.
Let's see what is here. Okay, so one library is missing let's add it let's add meds runtime dependency, okay. So, this is a library which I added in this project, so that it will have all these functions can be run it let's quickly go through this function. This is as I told you, this is a common library, you will have to use you can use it if application so we should use this code as a shared library at Unity publication. It started with a private methods. So, you can skip this private method I will go quickly to the public method which you will use here get a default EDF application module.
So, if you want to get your application module actually this is will be used in some function to refresh view object to clear view object just to be sure that your data control is module data control. If you have a different data control you can change it here from here. This is a your data control. So, if you have here AB module data control in your EDF application, you should write it here a module that if you rename this you should rename it here. So, is that your library should be should be good. So, if you if your PDF library will have all By default emulator controls so be sure that your data controller native application should have the same name.
Okay, so this is continue here This function will get is a traitor you just send as a traitor name from your widget definition and it will return the result. If you want to execute enumeration like commit rollback Nick Scruton search just to call this function and since operation name like commit, of course you be sure this operation is existence average definition. Otherwise you will get no pointer exception. If you want to commit the change at any time in your code in the back pain you want to see cute is a commit you can execute called the commit. If you want to call rollback you can call a function rollback. If you execute rollback it actually it will set the current row of the three to two the first row but in case if you want to keep after the book is a roll back, keep control as as it is without changing you can call rollback and DB in the same current row or in the current row.
This is for database transaction clinical good the default database transaction, if you find component if he ever in a publication, I told you if you want to access component in your code, you will go to the binding isn't it? If you select For example, this is our if application before So, if you open any page and select any component and you want to use this component in the back being so that you can manually manually work was it we use a binding barbarity here in the fonts it we use the binding and we bind this component is affected. But in case if you want to get a component wizard we want to get you want to get it from the three hierarchy rule exists, you can call this function and send the component ID, the component ID will be for example, if you want to get the hundred books, you should, you should get it from the ID which has been in books.
Id, but because officers are big templates, so be sure that page template is PT one, Xin should be like quantum, then it should be a pendant books one this is will be the like this. So this is should be the full ID which is a component so that it will be able to get this should be a better book, so I don't remember it, so, I just read any name, so, it should be this. So, what you should send here, you should send PT one column, then when that box ID and synthesis ID to the final component and this We'll return use your component. This is another way you can get a component from being without using bind property. If you want to show up as I showed you before, you can just call this function since the mobile ID and the mobile will be open.
This is show Bob but if you want to make this more aligned to specific ID in that case, you can send the mobile app name and the component which you want this book to be aligned to it. If you want to see attribute in the traitor you can quote it repeatedly to just send that return name and what is attribute name and the value of the attribute and it will set the value here is a get if you have a current a traitor and you want to get value from the attribute so you can call it since the return name and attribute name and this function will return a value. If you want to open any any URL in a new window, you can send a URL to this function and this function will open it in a new window. This is If you want to get a connection, if you want to write a Java or SQL statement and you'd like bean and you need to get a connection, you can call this function.
If your talk was a session scope if you want to put values in session scope or get value from session or bit both value in that equal scope and get value from request scope, this is if you want to get a string from bundle if you want to get value from the source bundle you just send a base name and the key is a business name will be your boss to that you want to for example, here in our example, it should be view dot view controller bundle, if you right view dot view control bundle and send it here and is a key for example, the key will be first it will be in English secure will be finished so it returns a value first. This is in case if you want in your Java code to get value from our source. But if you want to know the current location, Just to call this function get a big name is a big name it will return user user current page name.
If you already have application has 5060 pages, and you want the code to be executed only in a specific page, you can call this function, this function will return the current page name. And you can write your own or your own code. If you want to refresh the whole page, you can call this function in your native code or your in your back in native code. If you want to navigate to a specific page, you can call this function and just since outcome, if you make some changes in the current throw, and you want to cancel this change without invoking rollback, because I told you drop back will retake the current rule as a first rule. So if you want to be as the same rule and you just want to cancel this change, you can just call cancel change and since a traitor not a traitor name, if you want to show error message nubuck been you call this function and since a mission message if you want to show successful message or if you want to show a warning message you can call this function.
If you want to refresh the whole view object, you can call refresh view we can send the view object name What is the view option in the view object which exists in under your control in that case, you can send department if you want and to this function and it will refresh the view object. If you want to refresh by a traitor name, instead of view name, you can send a traitor name to this function and it will refresh the address. If you want to refresh the traitor itself, you can call this function get the sum of attributes. So if you have for example, salary in the if you have a table called employee and this table has a salary and you will get the sum of this salary, you can call this function and this function should send later name and its return name And attribute name, for example salary and it will loop over it and the return the sum, okay.
But if you get any null pointer exception because of the number of rows and a traitor is greater than 25 go to the big definition and select say three to hear and set a range size to be minus one minus one it will fetch the old row is it 25 fro if you use this function and return null pointer exception, you just be sure that a traitor which you sent it here has a range size minus one. Get some more for three better as long as this will return as a double, double if you want as long as you can, you can add to call this function. If you want to refresh a component. Sometimes you need to refresh a component component in the back being so you want to mix some code and after that you want to refresh some component, you can go refresh component and since component for localization if you want to sit as a browser localization if you want to get the current localization, if you want to upload file, you can send the file location paths and the file name and this function will upload the file to this location.
Okay, if you want to the route file as well, you can send the file name as it will notify name. It is sequence to this value in Oracle Database if you will have a database sequence and you need to get sequence because venue you can call this function. If you have a view object and you want to clear all rows in the view object you can call this function to clear all rows. This is closed statement if you write a SQL statement in Java, you need to close the prepared statement and the result set you can call this function. If you have Add decimal value you and you want to get around to the decimal value. For example, if you have a result like this, and you just want to get a 3d small value, so you can call this function and set the street so it would be like this, someone arithmetic operation you can do in your application and you'll find the result will be number like, like even more than this something like this too big.
And it's a bit you just want me to splay 15.2. So in that case, you can call this function sends a double and the cost should be one. Here a usually use a lot. If you have a select statement and you want just to get a description or a name this says select the statement or return only one row and one description. For example, if you want to get to the department name, and you have department ID and you want to get department name. So you will just let the bottom name from the bottom where the document ID equals ID and since this is secured statement in this function and this function will return the department the same if you want to get a double value.
For example if we were to get select a salary or sum of salary from employees sit this since this is equal here and it will return the double value. here if you want to do things along value, for example if you want to sit to get the count of all in between for department so your your right select account from departments were for employee you were a department equal since this is secure here and it will return along which is a result of this SELECT statement. If you want to execute the mail, like insert or update or delete SQL statement, if you have update department where department equal just sent this SQL statement here and it will execute the SQL statement. If you want To get a view object by name, you just call this get field by name. And you can work with a few objects like if you send department if you want here, it will return an object to the view department and you can do whatever you want you can change the where clause, you can get the control you can override whatever you want you can do once you get the view object here if you want to get the object from a traitor so just write sends a traitor name and it returns a view object.
This make table selection row as a control, I talked about this in the listener of the table selection listener. So I wrote here a function you can call this function signal value to all rows in a tree attribute. For example, if you have a table and you want to set value to old row, you just send the traitor name and attribute name and the value and this value will be set to all rows in this attribute or is it a tribute sometimes it a face it while I'm using Just hurry. What if you need to get a real boss for a file folder just since a file or folder it need to return the real parts of this folder. Because after you deploy your application to the server, it will deploy it to some boss and you want to get a real boss for the file, you just send it here and returns area.
Clear table filtering over the columns, the tables are filtering if you all you want programmatically to clear this filter, you can just call this function and insensitive table component. So you should bind the table component in the beam since this table to this function, and this function will clear the old filter over the column. Reset query filters. This is a Bennett query if you have search screen, and you want to programmatically to clear the field you can call this function. Citizen focus if you want to use JavaScript in your back pain and you want to Focus offs attribute or as a course or in some specific verticals you just sent, or the focus to the any component, you just sent a component ID, and it will focus to this component ID. If you want to create a new file programmatically, you can call this function.
If you have a property file and you want to edit the file, you can use this function or read value from blogger to file because sometimes you need to store some value in a boggart file and you want it if system to get the value from birth divide, you can use this function of course they go quickly because there are a lot of function I just want to go quickly over it. After that you can if you want to get the current route from a traitor you call this function. If you want to consider changing the view objects just since the view object name and it will consider the changes for all rows in this view object. Or you can constituents in iterate or reconsider a traitor name and you We'll consider all these changes for roles for just a trade. Okay this is a private message should be sent up.
This is if you want to get the status of the role if you if you are in the programmatically have a role and you want to status if it is new or no it will not if you want to know is this is a distro is just user created it all this is all the rule exists in the database before so if you want to know is this row is a new one sorrel user is inserted but still not committed. You can call this is a row instead new and since a row and it will return true or false. And the same is if you want to zero is updated or not just the center is a row here and it will send you true or false if it is updated or not. Or if you want to get the states over specific row just sends a row here and it will return the status of the row.
This is justified Want to get a client component computer name, this is a cookie function which we use. So, all this almost common function which we use, you can use at any ADF application generic function, if you have your own function you can add it here. So now we are prepared let us go to the application so now we are prepare our shared code here in one place. Next video I will show you how you can deploy this as a shared library in in our project So, see you next video