I write solutions to the problems I can't find much about elsewhere on the Web, also some code/script snippets that are absolutely awesome and make my life easier. Will be glad if someone finds these posts interesting and helpful!

Showing posts with label ADF 10. Show all posts
Showing posts with label ADF 10. Show all posts

Monday, May 3, 2010

How to make the Oracle Application Server 10g run as a Windows service

A problem that recently has been bugging the project I’m currently working on, was to make the Oracle Application Server 10g run as a service, so that it would be available without a user logging in and starting it up manually. We solved it with the use of an open source middleware project called JavaService, a pretty neat tool. Find below how.

Requirements:
Windows machine (the guide was tested with a vanilla Windows 2003 server installation)
Oracle Application Server 10g
The latest version (today 2.0.10) of JavaService

Actions:

Let’s say JavaService is unzipped to C:\JavaService-2.0.10
Then from the JavaService-2.0.10 directory execute:

Now the service OAS can be found among other services.

Should be also mentioned, that the Application Server better be stopped by the time you attempt to start the service.

Hope this helps.

Global validation for a Date input field in ADF 10

Say you have a table with a date column and you have created a view accessing it. Now try to insert an abnormal date into the dateInput field on the page (something like 1/1/111111111), commit the changes, check the value in the DB and you’ll get what I’m talking about here. I had queried a question on the OTN forum regarding this and the only answer I got was from Frank Nimphius to
configure a value change listener on the date field and verify that the provided value is valid, If not call FacesContext.renderResponse to ignore the request
this is a solution, but well, it requires more or less to apply it to each dateInput field on every single page. The other way around that I finally used, was to override the EntityImpl setAttributeInternal method like the following:

which actually just checks that the Date attribute provided is of a logical range.


This method has to be part of a class extending oracle.jbo.server.EntityImpl and obviously the entity implementation for that table with a date column must extend the new EntityImpl class.


That's it. Hope this helps!

Clear an iterator in ADF 10g

The mission is to empty out an iterator without setting its Refresh attribute to “never” and consequentially executing it manually. What I ended up doing, when I needed this once, was adding a parameter to the query WHERE clause (something like “and 1 = nvl(:param, 1)”) and invoking it with a zero when I needed it empty. Apparently there is an easier way.
Say the iterator to clear is defined in the pageDef as:

Then the code in the backing bean would look like:

That’s it. Hope this helps!