Fusion Developer

ADF – Display DepartmentName instead of DepartmentId

Create a new ADF project, with a a page on adfc-config. Create new business components based off the default HR schema.

Open the new Employee view object the you have just created and add a new List of Values to the DepartmentId attribute.

Add LOV to the DepartmentId attribute

Add LOV to the DepartmentId attribute

Add a new List Data Source:

Add a new List Data Source

Add a new List Data Source

Add DepartmentsVO to EmployeesVO:

Add DepartmentsVO to EmployeesVO

Add DepartmentsVO to EmployeesVO

Select the DepartmentId as the list attribute:

Select DepartmentId as the list attribute

Select DepartmentId as the list attribute

Choose the DepartmentName as the UI Display Attribute hint

 

Select DepartmentName as the display attribute

Select DepartmentName as the display attribute

Refresh the data controls, then drag employees table on to a page as an ADF Table

Drage Employee data control onto the page as an ADF table

Drage Employee data control onto the page as an ADF table

Make sure that the DepartmentId attribute component to use is an “ADF Select One Choice”

DepartmentId component should be ADF Select One Choice

DepartmentId component should be ADF Select One Choice

This example of an LOV is available for download as a zip.

SVN – Revert to a different version

Reverting to a different version using subversion is a relatively easy procedure. I had a problem with our project with regards to a colleague commiting to the SVN and creating a lot of errors. This was fixed by reverting the SVN repository to a previous version, checking out his code into a separate directory and merging the files using winmerge.

This is the state of the project before the revert:

Before the merge with a previous version

The first step is to identify the current revision number and make sure that we have the latest version on the server. To do this, we need to execute the following command:

svn update

In this example, it is revision 9.

The next step, is to  actually merge to the previous version. In this example, we want to revert to revision 8. To do this, we execute the following command from within the root working directory:

svn merge -r 9:8 ./

We then need to commit these changes, and we are ready to carry on developing! To commit, execute the following command:

svn commit ./ -m 'reverted'

And that’s it! Here is the result after the revert:

After the merge to a previous version

For those that would like to see the whole process, here it is:

SVN revert to previous version procedure

Until next time,
Kevin

ADF – Attribute <attribute_name> in <app_module>.<vo_name> is required.

Hi there,

After a change in our database today, one of the columns that we use was marked as not mandatory.

This is normally not a problem, as we just open up the EO and uncheck the mandatory flag. Once I ran the application and filled in the form though, I started getting the error: Attribute <attribute_name> in <app_module>.<vo_name> is required.

After checking the View Object, I saw that it was reflecting the changes I had made in the Entity Object. I checked the XML and I saw what the problem was:

Required Flag inside View Object XML

Required Flag inside View Object XML

After removing this line, I could insert blank items into that column. No more errors!

Kevin

ADF – Definition association of type Entity Association is not found

After re-syncing my entities with the database, I started running getting this error when I ran my application.

The problem was that after the sync, the package prefixes that I had given for the associations and entities had been lost within the Application Module and Entity Objects.

To solve this issue, open the files and view the xml. If there is a problem in that file, there will be an error warning within JDeveloper.

Valid XML will appear as follows:

Valid XML within an Entity Object

Valid XML within an Entity Object

Invalid XML will appear as follows:

Invalid XML within an Entity Object

Invalid XML within an Entity Object

If there is no indicator, wait for JDeveloper to parse the XML.

Prepend all references to associations and entity objects with the package prefix that describes their location.
For example:

model.entities.EntityNameEO
model.assoc.AssociationNameAssoc

This should fix the problem!

Kevin

ADF – Recursive Tree

This post will show you how to create a multi-level tree in ADF, using a single View Object.

Download the ADF Recursive Tree JDeveloper project here…

The first step is to create your business components. I will be basing this off of the HR schema, using the employees table.

1) Enter your database details:

ADF recursive Tree with Single View Object

2) Click OK.

ADF recursive Tree with Single View Object

3) Click OK and shuttle across EMPLOYEES and DEPARTMENTS.

ADF recursive Tree with Single View Object

4) Shuttle across the Entity-based View Objects.

ADF recursive Tree with Single View Object

5) Add it to your Application Module and click Finish.

ADF recursive Tree with Single View Object

6) Open up your Employees_VO, and click the “+” on View Criteria.

ADF recursive Tree with Single View Object

7) Click on Add Item, choose ManagerId as the Attribute and choose “Is Blank” for the Operator. Name the View Criteria to something useful (isManager).

ADF recursive Tree with Single View Object

8) Open up your AppModule, shuttle the View Objects already there out, and shuttle in Employees with a child object of the Employee View Object.
Tip: rename your Data Controls here to make it easier to identify later. I named the objects topManager and employee.

ADF recursive Tree with Single View Object

9) Choose the root Employee View Object (named topManager if you renamed), then click Edit… Shuttle across the isManager View Criteria.

ADF recursive Tree with Single View Object

10) Drag the topManager Data Control onto a page, and select Tree -> ADF Tree.. When asked for the binding details, shuttle across FirstName and Lastname. As the second level, which can be accessed by pressing the “+” button, select Employees.

ADF recursive Tree with Single View Object

11) The bindings should look as follows:

ADF recursive Tree with Single View Object

12) If you run the page now, and expand some of the nodes, you should see the following:

ADF recursive Tree with Single View Object

This is how to build a multi-leveled tree based off a single View Object.

 

ADF Recursive Tree: Master Detail-Type form

The remainder of this tutorial will detail how to push the selected node into another Data Control, and to show detail in another component, like a form. This emulates a “master detail” type component. 

13) Create a new View Link for the connection between the Employees_VO and the Departments_VO. By default, when ADF creates the link, it creates the relationship as 0..1 to * between Employees and Departments, when it should be * to 1. This is because many employees can belong to 1 department, but 1 employee cannot belong to many departments.

To create a new View Link, right click on your model package, and choose “New View Link…”, name it appropriately (I named it EmpDepCustomFK1). Change the cardinality to many-to-one, then select DepartmentId under Employees as the Source Attribute, and select DepartmentId under Departments as the Destination Attribute. Then click Add.

14 - custom_vl

14) Open your Application Model, and send across an instance of the Employees_VO and an instance of Departments_VO as a child, using the custom View Link that we just created.

16 - am_custom_link

15) Click on the “Bindings” tab of the page that the tree was placed on. Click the “+” in the Executables block, and select “iterator”.

13 - bindings_iter

16) Choose the newly added Employees Data Control.

15 - employees_iterator

17) Drag the Departments1 Data Control onto the page as a form.

17 - department_on_page

18) Go to the Bindings tab again, and edit the topManager binding to edit the tree bindings. Expand the Target Data Source section, and click EL Picker. In the window that pops up, expand “ADF Bindings” -> bindings and choose the newly created iterator. Click OK.

18 - link_departments_to_tree

19) Click on the form, and click the drop-down arrow for “PartialTriggers”, then click edit. Find your tree component, and shuttle it across. This will refresh the form whenever a new node is selected. Click OK.

19 - add_partial_trigger

20) Run your new app!

You now have a recursive Tree with a form that updates whenever you click, using only bindings!

Until next time,
Kevin

 Download the ADF Recursive Tree JDeveloper project here…

Converting .vdi to .img file

This is a quick guide to convert .vdi (VirtualBox) files to .img files and how you convert .img files to .vdi (VirtualBox) files.

To convert a .vdi file to a .img file, you can use these easy steps:

.vdi to .img

Windows

  1. Open up command prompt (click start, then type/click run)
  2. Issue the following command:
       VBoxManage clonehd <nameOfOriginalVDI>.vdi <nameOfNewImage>.img --format RAW
  3. Wait for the clone to finish, and presto! You have an image file.

Note:
When you do convert a .vdi to a .img, remember that the .img file will be the maximum size that you set your .vdi to grow to.
If VBoxManage is not recognized, navigate to the install directory of VirtualBox or add the install direction to your path.

Linux

The process for conversion is the same on Linux as on Windows.

.img to .vdi

Windows

  1. Open up command prompt (click start, then type/click run)
  2. Issue the following command:
       VBoxManage convertdd <nameOfOriginalImage>.img <nameOfNewVDI>.vdi
  3. Wait for the conversion process, and you once again have a lean, trim .vdi!

Note:
When converting a .img to a .vdi, the .vdi will shrink in size to accommodate the contents of the VM only.
If VBoxManage is not recognized, navigate to the install directory of VirtualBox or add the install direction to your path.

Linux

The process for conversion is the same on Linux as on Windows.

I hope this helps some of you out there in the deep, dark recesses of the blogosphere!

Kevin

Hello, World!

As the title says, hello everyone! This is to be my blog <applause>, sharing all of my experiences with Oracle Fusion Middleware.

I am an ADF/Java developer and a WebLogic admin. I work for iFactory Consulting, in South Africa.

I will be posting my first how-to this week. I hope you enjoy it!

Kevin