Implementing Case-Insensitive Searching
By default, searches for custom task fields are case-sensitive. For example, a search for the term Order will return different results than a search for order. If you have a task application that requires case-insensitive searches, a public API method (caseInsensitive) is available to enable individual custom search fields to provide case-insensitive behavior.
You must carry out this procedure for each field that requires case-insensitive behavior.
To define a field as case-insensitive
1. In the Project Explorer view, expand the task application project you want to work with.
2. Open the task inbox results default view Java file in the editor. For example:
com.webmethods.caf.<taskName>_inboxresults >
<taskName>_InboxResultsDefaultviewView.java
3. Locate:
private static final String[][] TASKSEARCHPROVIDER_PROPERTY_BINDINGS =
new String[][]
and add the following binding:
{"#{taskSearchProvider.searchQuery.<fieldName>.caseInsensitive}", "true"},
4. Save the file.
Alternative Approach
As an alternative to the method above, you can modify the task search provider Java file, as follows:
1. Open the task search provider Java file in the editor. For example:
com.webmethods.caf.<taskName>_inboxresults >
<taskName>_SearchProvider.java
2. Add <fieldName>.setCaseInsensitive(true); to the get action for the field you want to apply case-insensitive behavior to. For example, if you are working with the field FirstName:
public com.webmethods.caf.faces.data.task.impl.TaskSearchQueryTerm
getFirstName() {
if (FirstName == null) {
FirstName = new
com.webmethods.caf.faces.data.task.impl.TaskSearchQueryTerm();
FirstName.setCaseInsensitive(true);
}
return errorMessage;
}
3. Save the file.
Related Topics