Wednesday, November 24, 2010

LOVs does not reset criteria values. (Fixed in 11.1.1.4)

In a default input list of values you can set criteria to query for specific records and select a record with no problem
The problem is that if you open LOV again, even though the criteria values are cleared the results are still the same (filtered).This happens even if you change the record.
This has other side effects like, if LOV is autosubmit and if user types a valid value that does not exist in the previous filtered LOV data the value is not accepted and LOV opens displayed the previous filtered data.
Finally if you put criteria in LOV and select a value and then navigate away from the task flow, when you come back and open LOV the criteria values are shown and Reset button of LOV is not functional.
This functionality of LOVs cause much frustration to users.
Test Case :
http://adfbugs.googlecode.com/files/TestLOVsCriteria.zip

Steps to reproduce in the test case:
1. Not accepting valid values.
1 run Main.jspx
2 go to Test task flow.
3 open managerId LOV and type criteria (i.e. ‘A’ for firstName) and press search
4. Select a row and press ok
5. In LOV field, type a valid value of an employee that first name does not start with ‘A’ and press tab
Result: LOV opens showing rows of employees starting with A. User has to press Reset and search for the value again

* in 11.1.1.4 the valid value is accepted without opening the LOV. Yet if you open LOV second time the results rows are limited but not for employees starting with A.

2. Reset button does not work:
1 run Main.jspx
2 go to Test task flow.
3 open LOV and type criteria (i.e. ‘A’ for firstName) and press search
4. Select a row and press ok
5 Press button to Main (return from task flow)
6 go to Test task flow again
7 Open managerId LOV (Criteria values and results are visible from previous search
8. Press Reset Button on LOV (Nothing happens)
Result: LOV opens showing rows of employees starting with A and criteria value for firstName. User cannot press Reset to clear values and search again.

Monday, November 15, 2010

Activation creates duplicate row when primary key is populated through DB trigger ((Fixed in 11.1.1.4)

The same issue as previus post is also reproduced if Primary key is populated through database trigger and Pk attribute is defined as DB Sequence and refresh after insert.
Fusion Developer's Guide for Oracle ADF
4.10.10 How to Get Trigger-Assigned Primary Key Values from a Database Sequence

To run the test case you need to create database trigger :

CREATE OR REPLACE TRIGGER LOCATIONS_PK
BEFORE INSERT
ON "LOCATIONS"
FOR EACH ROW
BEGIN
IF INSERTING
THEN
IF :NEW."LOCATION_ID" IS NULL
THEN
SELECT LOCATIONS_SEQ.NEXTVAL INTO :NEW."LOCATION_ID" FROM DUAL;
END IF;
END IF;
END;

When you try to insert second line, first line is dublicated, when testing activation safe.


Test case

Friday, November 12, 2010

Activation creates duplicate row when primary key is populated through DB sequence (Fixed in 11.1.1.4)

We are testing if our Application Module is Activation-Safe according to:
Fusion Developer's Guide for Oracle ADF
40.10 Testing to Ensure Your Application Module is Activation-Safe
And we have many problems.
1 of them is that when we press createInsert instead of creating a new row we get the same row 2 times.

I reproduce it in a simple test case from HR schema with Countries and Locations Entities.
In Locations Entity create method I populate primary key from sequence

@Override
protected void create(AttributeList attributeList) {
super.create(attributeList);
SequenceImpl s = new SequenceImpl("LOCATIONS_SEQ",getDBTransaction());
setLocationId(s.getSequenceNumber());
}

As in
Fusion Developer's Guide for Oracle ADF
4.12.5 Assigning the Primary Key Value Using an Oracle Sequence

I check Activation-Safe by un-checking Enable Application Module Pooling in configuration.


I have a simple master Countries form and detail Locations table with CreateInsert button.
When I press CreateInsert for first time a new row is created with new sequence as locationId and I fill also other fields with values.



When I press CreateInsert again instead of getting a new rows I get 2 same rows as the first and both of them has the same new sequence as primary key.!!??


After that whatever I do on the page I get null pointer exception. (NullPointerException)
Is this a bug?

Test case:
http://adfbugs.googlecode.com/files/TestActivateSequence.zip

Friday, October 15, 2010

Number precision and conversion in query criteria

There is a strange behavior of number type fields in af:query.
I created a simple Query page from HR schema for Employees (Entity and View) with some typical criteria.
When a user type a value in a String criterion field then he is not allowed to type more characters than the precision of the field.(i.e. 25 for LastName, email)
The same apply for the LOV field (Department 4 digits)
Yet Number fields have strange behavior.No mater the precision of the Number field you can type as many digits you want.
Yet if you type up to 21 then the last 4 digits are converted to 0!!?
If you type more than 21 digits it is converted to the first digits with other 3 as decimals!?
If you type number with more than 3 decimals it is rounded to 3 decimals.

These restrictions make large numbers not usable for query criteria.
Is this a bug to be fixed?
Test case:

Sunday, October 10, 2010

ADF/SOA custom worklist viewFilter

I have managed to create a ADF application with a custom worklist region following instructions of :
Developer's Guide for Oracle SOA Suite &30.13 Creating Reusable Worklist Regions

It was not easy since
• WSRP Container is missing in latest jdeveloper 11.1.1.3
• when I deployed nothing was shown and no error in the logs.

I found out that WSRP Container seems not to be needed and that it was authorization issue.
Since the application must have security enabled, you need to give access also to task flows that comes from libraries:


Then the task list is visible and task details shows as dialog.


Yet we need to show to the user a custom view that contains Flex Fields with business logic values.
I see that there is a parameter you can pass to the worklist task flow the viewFilter:
Developer's Guide for Oracle SOA Suite &34.4 Passing Worklist Portlet Parameters
'viewFilter Specifies the selected view for which the tasks are displayed.'

Yet when I use it with values like:
value="Due Soon"
value="My Work Queues/Standard Views/Due Soon"
I get the following error:



Is this a bug or i need diferent format of value in order to filter specific task view?

I also noticed that from view menu all views shows 2 times apart from Inbox:


Is this also a bug?

Test case:
http://adfbugs.googlecode.com/files/TestCustomWorklist.zip

Friday, September 24, 2010

Making View Criteria Case Insensitive and MDS

In a previous post i had posted a workaround about making view criteria case insensitive:
http://adfbugs.blogspot.com/2010/07/making-view-criteria-case-insensitive.html
Yet this has 2 side effects.
  1. It makes values of criteria upercase.
  2. It brakes MDS save criteria functionality.


I found a simpler solution (workaround).
/**
* Set the view criteria rows to use case-insensitive querying and
* uppercase any of the non-null query-by-example criteria provided.
*/
private void doCaseInsensitiveOnStringsInViewCriteria() {
ViewCriteria[] vclist = getApplyViewCriterias(ViewCriteria.CRITERIA_MODE_QUERY);
if (vclist.length>0) {
for (ViewCriteria vc : vclist){
if (!vc.isUpperColumns())
vc.setUpperColumns(true);
}
}
}

@Override
protected void executeQueryForCollection(Object object, Object[] object2 int i) {
doCaseInsensitiveOnStringsInViewCriteria();
super.executeQueryForCollection(object, object2, i);
}
This code makes query criteria Case insensitive and also does not make values of criteria upercase.Yet it still brake MDS .
Sice we need this in LOV criteria that does not have Save search, we can prevent this code to execute in LOVs using :
if (this.getName().contains("LOCAL_VIEW_USAGE"))
doCaseInsensitiveOnStringsInViewCriteria();

Test case:
http://adfbugs.googlecode.com/files/MDSTestUpper.zip

Saturday, September 11, 2010

Validating Train Flow

A very nice option of Task Flows is the Train Task flow.

You can easily create a train task flow and add pages as Train stops and add in page train navigation and train buttons (Next/Previous) and create a wizard like navigation.

Yet many times you need to validate the input of a train stop before you go to the next one. When this validation is more complex than a required field you probably need to do it when the user tries to navigate to the next train stop.

I found a solution close to what I needed in Duncan Mills post: Executing Activities between Train Stops
http://groundside.com/blog/DuncanMills.php?blog=6&cat=18&page=1&disp=posts&paged=2
The strange thing is that you need to define an outcome on the target Train Stop activity.
Then you add a wildcard to go to a router to check your condition in order to decide to go to the target Train Stop or the source.




In my example the condition is if the Department has employees or not. If it has it go to employees page, if not it returns to department task flow.



The remaining issue is to show the appropriate message. In the example I have added it as a simple text that is visible when Department does not have Employees


Test Case:
http://adfbugs.googlecode.com/files/TestTrainValidation.zip