BUG?: af:resource and page fragments

ADF No Comments »

I was working on a PoC to integrate Bing and Google maps with webcenter. The idea was to use the javascript apis for this. While doing this, I encountered this strange issue.

I had a taskflow with two page fragments and this was meant to be embedded as a region in another page. The bug is that javascript included using the af:resource doesn’t get loaded in any page fragment other than the default activity. Presumably looks like the af:resource contents are not (re)painted when the region gets repainted. This happens with inline javascripts and also source-linked javascripts. The workaround is to use trh:Script instead of af:resource or (less elegantly) to embed all the required javascript into the default activity page. I chose to go with option 1.

P.S: There are other gotchas with the maps integration. I had to turn off PPR navigation to make the maps work. It looks like neither the Google nor the Bing API is particularly fond of div’s that are dynamically inserted into the HTML DOM. That is what I think happens with PPR navigation i.e. ADF rewrites the DOM (via Javascript?) with the new page elements.

Upload files to database using ADF

ADF, Oracle No Comments »

While exploring options to develop an upload-to-database feature, I came across repeated suggestions that using Oracle MultiMedia (previously InterMedia) datatypes (OrdDoc, OrdImage, etc.) was the way to go. A few forums started me off in the right direction. This one for e.g. However, it wasn’t as straightforward to get it working especially given that there was no documentation whatsoever around OrdDomain types in the Fusion guides. So these are the steps that need to be done. Read the rest of this entry »

(BUG) ADF BC validation messages in WebCenter Spaces

ADF, WebCenter 2 Comments »

Another bug? Validation messages from the ADF BC layer don’t display correctly within Webcenter Spaces. Instead of the custom validation message that’s setup in the BC layer, Spaces always displays “Unexpected error(s) occurred. You may want to contact Administrator with the error reference.” The error-ed fields are flagged correctly though. I have raised an SR with Oracle for this. I am told that Webcenter Spaces considers any Exception outside of the oracle.webcenter package to be an unexpected error. I am waiting to see if Oracle gets back with a feasible workaround. Hmmm!

Given that ADF taskflows are a recommended way to extend webcenter spaces, I find this limitation, well, very limiting.

(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.

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.

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