Skip to main content

Posts

Showing posts from May, 2010

EL to see whether a view activity is authorized for the current user

You can use the below EL to see whether a specific view activity is authorized for the current user

#{controllerContext.security.activity['your_view_activity_id'].viewAuthorized}

This is useful where you need to skip the rendering of links that refer to a page which is not authorized to view by the current user.

Please refer ControllerSecurityManager api to learn more.

You can download the sample workspace from here.
Run the login.html. Login to application as as guest/welcome123, application displays only 'Department' link. If you login as admin/welcome123, then application displays both 'Department' and 'Employee' links.
[Runs with Oracle JDeveloper 11g R1 PS2 + HR Schema]

Conditional rendering of editor components for a clickToEdit table

A very common use case related to table with 'click-to-edit' mode is to render some custom editor component for some cells, when user selects a row for edit. Newly added (as part of PS2 release) 'activeRowKey' attribute on table component will help us here.

The 'activeRowKey'is the row that is currently active on the client. In click-to-edit mode, the active row will be made editable and is brought into view (if not already visible). Upon initial display, the click-to-edit component defaults the active row to the first visible row.


A bit about the implementation. Please see the below given jsf tag snippet, which may help you to understand the concept better. Here, the EL 'backingBeanScope.TestBean.tbl.rowKey eq backingBeanScope.TestBean.tbl.activeRowKey' checks whether current row is the activeRowKey, and based on that display is flipped between components

<af:column sortProperty="DummyAttribute" sortable="true" headerText="…

What you may need to know about oracle.adf.view.rich.automation.ENABLED flag ?

You can use oracle.adf.view.rich.automation.ENABLED in web.xml file to enable automation testing.
<context-param> <param-name>oracle.adf.view.rich.automation.ENABLED</param-name> <param-value>true</param-value> </context-param>
But you may need to be measured while setting this parameter and it's advised to keep this parameter disabled in production environment.

Why?

Because enabling the test automation parameter generates a client component for every component on the page which can negatively impact performance.
1. Result in increased page size
2. Involves in 'n' number of checks(assertions) at run time.

Now, let me share a couple of interesting observations related to this parameter.

Few teams reported saying that after enabling this parameter, some web pages started misbehaving. Most of the issues were related to popup dialog, like popup (Custom popup, List Of Value, Datepicker etc) dialog no longer respond to user actio…

Displaying an empty table !

The title sounds silly, right? Whats the big deal in this? Yes you are right, this post discusses a very simple 'tip'. The use case requirement here is a pretty simple one where a table in a data capture page should be displayed empty on some conditions. Annoyingly, a table created by dragging and dropping a ViewObject on a page always display data. Hmm...this is very much expected, as and when the table renders, table model will try to get data though the binding by executing the ViewObject.
How to prevent this execution? Let me ask you a counter question, How does a search screen with result table displays empty result table initially?
A simple us case triggers lots of questions :) The answer for the above question end up in search binding's 'AutoQuery-or-ClearRowSet'. This is explained in one of my previous post.

Clearing RowSet

Lets us focus on 'ClearRowSet' behavior in this post. ClearRowSet in turn calls ViewObjectImpl::executeEmptyRowSet(). This…

CRUD operations on a tree table

<af:treeTable> is useful to present hierarchical data to the business users. ADF BC layer got a good support for use cases with tree table components. I'm sharing a simple application illustrating CRUD(Create,Read,Update,Delete) operations on a tree table with ADF Business Components.

You can download the sample workspace from here.
[Runs with Oracle JDeveloper 11g R1 PS2 + HR Schema]

The rest of the post is targeting mainly beginners who started using af:treetable with ADF Business Components. The sample is built using classic Department-Employee use case. Department information is displayed as parent rows and employees belonging to a department are displayed as child rows. The rendered page look like as shown below.



I'm not discussing creation of tree table here. If you want to know about the creation part, please refer chapter23.4 Using Trees to Display Master-Detail Objects from Fusion Developer's Guide.

Adding create functionality to a tree table

A very common(f…

Debugging "java.lang.IllegalStateException: Duplicate component id" error

I recently noticed an issue reported with below stack trace. Here the run time complaints about the presence of duplicate id in the jsf page. Interestingly, none of the components used in the page shares the same id. So what goes wrong here?

java.lang.IllegalStateException: Duplicate component id: 'pt1:USma:0:MAnt1:0:pt1:Perio1:0:ap1:r9:requestBtns:localeView:si1', first used in tag: 'com.sun.faces.taglib.jsf_core.SelectItemsTag' +id: j_id__ctru0 type: javax.faces.component.UIViewRoot@53eff13 +id: doc1 type: RichDocumentUIXFacesBeanImpl, id=doc1 +id: pt1 type: RichPageTemplateoracle.adf.view.rich.component.fragment.UIXInclude$ContextualFacesBeanWrapper@4bcc1b1, id=pt1 +id: r1 type: RichRegionUIXFacesBeanImpl, id=r1 +id: p1 type: RichPopupUIXFacesBeanImpl, id=p1 +id: dia1
Let me share a couple of points which may help you to narrow down this issue.

1. If you use multiple instances of same task f…