(BUG) Attributes with same name – ADF BC Validation Messages

ADF 1 Comment »

I have two entities and associated views. Each of them have attributes with the same name. In my particular case, they are two dates – StartDate and EndDate. EndDate on both entities have validations (Script Expression). The validations check that the End Date is later than Start Date – “return newValue > StartDate”

I have a single create page that contains both these entities. What happens now is that if even one of the entities fail the validation, fields of both the entities are flagged. Renaming the attribute on one of the entity (and corresponding view object) seems to work. I am using this workaround for now. Have logged an SR with Oracle. Let’s wait and see if a bug gets filed.

I have a simplified repro case (contains Jdev project and SQL script) here - http://dox.bijesh.info/reproValidationMsg.zip

ADF Quirks, Bugs & Hints

ADF No Comments »

ADF Table shows duplicate rows on CreateInsert

My particular page had a master-detail-detail editable table on it with a “CreateInsert” operation. The first time I hit the createInsert button the page came back with a clean empty row. Every consecutive createInsert operation resulted in a duplicate of the first created row. What was weird was that in debug mode, I could trace the create operation on the view object and the entity object so I knew that a new row was getting created. Even weirder was the fact on dropping a read only column for the primary key attribute, this particular column alone showed freshly created data.

After spending some time breaking my head over this, I came across this post on the forum – http://forums.oracle.com/forums/thread.jspa?messageID=4579932&#4579932. So, it appears that ADF treeTable binding requires that the source attribute of a ViewLink is a key attribute on the master data source. My View Links were based on multiple attributes and not all of them were a primary key in the database (although they should’ve been). I went ahead and made the source attributes at each ViewLink level part of the primary key on the corresponding entities. And voila! It worked. Lesson Learnt – Set up primary keys on the entities even if the database design does not specify them.

UserPrincipal missing in ADF context

This is apparently a bug in ADF 11.1.3. The UserPrincipal does not propagate to the ADF session. My application had a no. of queries that used the logged in user’s id as the bind variable’s value. I had used the Groovy expression  - “viewObject.DBTransaction.session.userPrincipalName”. Unfortunately, none of my queries worked as expected. After furious Googling, I found out that this was a bug in ADF 11.1.3. Luckily enough, there is another way to fetch the UserPrinicpal – through ADFContext. The code for this – “ADFContext.getCurrent().getSecurityContext().getUserName();”.

To further simply this, I overrode the prepareSession method in my Application Module. In the overridden method, I fetched the user name from ADFContext and set the value into the session.
“session.getEnvironment().put(PropertyMetadata.USER_PRINCIPAL.getName(), currentUserName);”

protected void prepareSession(Session session) {
        super.prepareSession(session);
        String currentUser =
            ADFContext.getCurrent().getSecurityContext().getUserName();
        session.getEnvironment().put(PropertyMetadata.USER_PRINCIPAL.getName(),
                                         currentUser);
    }

Thanks to Andrejus for his post on the bug.

ADF Bug(?): Multiple entities with same attribute names cause ADF BC Validation errors to display incorrectly

This requires a post for itself. Coming up soon.

WebCenter Spaces: The people connections tab

WebCenter No Comments »

SOLVED – here.
You may have seen the default tab that Webcenter Spaces displays – the one titled with the logged in username. This tab originates from the People Connections service and contains sub-tabs like “Gallery”, “Activity Stream”, “Message Board”, etc.

People Connections Tab

People Connections Tab

In my current project, there is a requirement to not display this tab. There does not seem to be any admin option to turn off this tab. Nor does the people connections tab (and also the Personal Space tab) allow the “Close this tab” option. If you use the “Maximised” site template, of course, the primary tab is displayed at one level below and so the PC tab does not show but neither do other group space tabs. That isn’t a workable solution either.

As a last option, I decided to dig into the webcenter application to see what was going on under the wraps. Turns out the tab is hard-wired into the menu model used by WC Spaces. What’s more, the application explicitly leaves out the “Close this tab” option. The only way I see to disable this tab (unless Oracle decides it’s useful and release a patch to enable this feature) is to create a custom site template, create a dummy menu model accessor in a custom bean and use this as the model for the tabs. In the menu model accessor, retrieve the built-in menu model “#{o_w_w_i_v_s_tabManager.menuModel}” and manipulate it at run-time. It isn’t as easy as it sounds. The roadblocks -

  1. Getting all the required class libraries containing the webcenter spaces classes. The key classes needed are WebCenterShellMenuModel, WebCenterShellTabModel
  2. Finding a way to actually manipulate the menu model
  3. Making the whole thing upgrade/patch proof.
  4. Most importantly, figuring out the copyright/legal implications of using the Webcenter application classes and manipulating an internal object.

I seem to have sorted 1 out. I am working on 2 during my off hours. First step of 2 is to actually identify the entry for this tab, retrieve it at run time and examine its properties.

Custom ADF Task Flows and the Spaces resource catalog

ADF, WebCenter 8 Comments »

Note: This is a very roughly put-together guide. I will spend some time in cleaning this up later.

I had someone ask for help on deploying a task flow to WebCenter Spaces and exposing it through a resource catalog. Here’s a quick run-through of how I do it. I will explain the essential building blocks and you should be able to implement it any way you like.

What you’ll need

1) Read the “Extending WebCenter Spaces” whitepaper on OTN.

2) Download the sample project that supplements the whitepaper.

Both these can be downloaded from OTN here. The easiest way to expose custom ADF task flows is to use the sample project and the ANT build file it contains. You can always customize the project to fit your requirements.

Building Blocks

1. Shared ADF Library

  1. Develop your ADF Taskflow and create an ADF Library out of it.
  2. Create a new WAR file (let’s call it custom-taskflow.war) including the ADF library jar(s) from step 1 in the WEB-INF/lib of the WAR. Optionally include a manifest to name your extension and setup version info.
  3. Deploy the WAR to the weblogic server to the WLS_Spaces and AdminServer managed server as a shared library. Note the deployed library’s name from the WLS Admin Console.

2. WebCenter Spaces Customisation

To expose the custom task flow in the Spaces catalog, you have to create and deploy a customisation shared library – “custom.webcenter.spaces”. The Webcenter Spaces installation should already contain a base version of this library.

Here we create and deploy a WS customisation that makes the task flow available on the Spaces catalog. You may choose to add the task flow to either the default personal catalog or the group spaces catalog.

  1. From the whitepaper sample project, copy the resource catalog required. You’ll find them in the path SourceFiles\catalog\oracle\adf\rc\metadata\scopedMD\defaultScope
  2. Edit the xml file and add your custom task flow to the resource catalog. To obtain the correct entry for your task flow
    1. Create a file system connection to the folder containing your ADF Library Jar (from Step 1a)
    2. Navigate to the task flow entry in the file system connection
    3. Right clock on the task flow and choose the option “Show Catalog Reference”
    4. You can copy the entire XML tag that shows up in the dialog.
    5. Optionally you can add attributes to this – title, description, etc for your task flow. See the entries already present in the source catalog for reference.
  3. Create a jar that contains the resource catalog. The path to the catalog in the JAR should be custom\oracle\adf\rc\metadata\scopedMD\defaultScope
  4. Create a WAR file to deploy this as a shared library. A few important points to note on this
    1. The WAR should contain the JAR from 2c in WEB-INF/lib
    2. The WAR should contain a weblogic.xml with a library reference entry pointing to the deployment name from 1C.
    3. The WAR should contain a manifest file that specifies the following mandatorily (See the sample project for reference)
      Extension-Name: custom.webcenter.spaces
      Specification-Version: <the specification version of the default custom.webcenter.spaces library>
      Implementation-Version: <an implementation version higher than the current deployment>
  5. Deploy the WAR file as a shared library to the WLS_Spaces and AdminServer managed servers.
  6. Redeploy the webcenter application on WLS_Spaces for the changes to take effect.

ojdeploy ant task pitfalls

JDeveloper No Comments »

This is on JDeveloper 11.1.1.3. YMMV

  1. ojdeploy does not understand “nocompile=false”

    If you have the nocompile property set, then ojdeploy does not compile your project no matter what the value of the property.

  2. ojdeploy does not like relative paths in the properties

    For e.g., my workspace path was getting constructed as “C:\folder\build\..\MyApp\MyApp.jws”. That didn’t work – ojdeploy did not create the task-flow-registry file. I had to make sure that the workspace path was “C:\folder\MyApp\MyApp.jws”

  3. Chris Muir reports on OTN that there is a bug cos of which ojdeploy is case-sensitive to Windows paths as well. http://forums.oracle.com/forums/thread.jspa?messageID=9119712#9119712. Come to think of it, this could’ve been the root cause for my point 2 failure.

Oracle WebCenter Spaces

WebCenter 9 Comments »

I am building an enterprise portal on Oracle WebCenter for a client. The client requires quite a few custom portlets that enable their business functions. The plan is to build these custom applications using Oracle ADF as individual task flows that may later be consumed either by WebCenter Spaces or by a custom WebCenter application.

Extending WebCenter Spaces is no fun at all. The only resource to help integrate customizations into spaces is the Oracle Whitepaper – Extending WebCenter Spaces. To be honest, integrating into Spaces could end up being the most frustrating part of the whole process.

I have spent a few days now trying the custom project that accompanies the WebCenter Spaces. The default settings for deployment work extremely well. My first point of trouble was when I tried to undeploy the customizations. Once I did that, the Spaces app began to throw exceptions all over the place. It was looking for metadata related to a template that existed in the sample war – the custom war that I “undeployed”. Figured out that WebLogic wasn’t cleaning up correctly after an “undeploy”. I had to manually delete the caches to get Spaces back to its default. Details here.

The second point of trouble was when I wanted to deploy only the custom resource catalog from the sample project. I didn’t have the need for any of the other customizations, so I followed the whitepaper instructions on removing whatever I did not need. The project builds fine and deploys fine. Unfortunately, Spaces began to throw up a different set of exceptions. The user error simply says “Error occurred in getting the complete list of pages you can access. Please contact the administrator.” without saying anything useful. The actual exceptions in the log are ClassCastExceptions and NPEs.

After a lot of unnecessary detours, I have now managed to integrate a custom ADF task flow into the Personal Catalog on Spaces. The taskflow is deployed on the server as a shared library.

I shouldn’t have to create a custom version of a WAR to simply consume an application in the portal. I’m told that the next release of WebCenter (PS3) will make customizations and skinning easier. Keeping fingers crossed!

Self Note: Useful Links

- Managing Portlet Producers
- Adding Portlets to pages

Back on the ADF bandwagon

ADF No Comments »

I am back to working with ADF. I am doing this in personal time out of a wish to keep in touch. I haven’t worked on JDeveloper after the 11g Tech Preview. The production version is quite fast (comparatively) but there are a lot of random error notifications popping up now and then – just a minor irritant considering the awesomeness of the LAF ADF RC provides. I am yet to fully explore the Oracle UI Shell functional UI pattern (or Oracle Dynamic Tabs) but from what I have read and tried, it looks like an excellent way to maintain a uniform LAF across the application.

ADF RC: 3 column template

ADF No Comments »

Looking for the three column page template that ships with ADF RC? It’s inside JDEV_INSTALL_DIR/jlib/oracle-page-templates.jar. It’s the file called threeColumnTemplate.jspx

ADF RC: Date and Time

ADF No Comments »

How do you enable the user to enter both date and time in an inputDate component? How do you allow the user to choose the date and the time in the calendar pop-up? Read the rest of this entry »

ADF Library Jar does not work

ADF No Comments »

In Jdeveloper 11, have you noticed the option “ADF Library JAR File” in the Gallery under Deployment Profiles? The description makes it sound like an interesting option. You would be able to distribute Task Flows as a reusable library. Such a thing would prove useful where you have many different applications being built and these have some common functionality required like a Login page. Read the rest of this entry »

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in