Uploaded image for project: 'Kuali Rice Development'
  1. Kuali Rice Development
  2. KULRICE-13110

lookup searches do not ignore case even though forceUppercase=true

    Details

    • Type: Task
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5
    • Component/s: Development
    • Security Level: Public (Public: Anyone can view)
    • Labels:
      None
    • Rice Module:
      KRAD
    • KRAD Feature Area:
      Lookup
    • Application Requirement:
      KC
    • Sprint:
      Core 2.5.0-m6 Sprint 2, Core 2.5.0-m7 Sprint 1, Core 2.5.0-rc Sprint 1, Middleware 2.5.1 Sprint 1, Middleware 2.5.1 Sprint 2, Middleware 2.5.1 Sprint 3, Middleware 2.5.2 Sprint 1, Middleware 2.5.2 Sprint 2, Middleware 2.5.2 Sprint 3
    • KAI Review Status:
      Not Required
    • KTI Review Status:
      Not Required
    • Code Review Status:
      Not Required
    • Include in Release Notes?:
      Yes
    • Story Points:
      5

      Description

      Lookups are not case insensitive in KRAD. When I dig deeper, I find that when I pass in a propery that has forceUppercase=true which is what KRAD seems to check to determine if the search should be case insensitive, the caseInsensitiveField is completely ignored. The code in question is here

      LookupCriteriaGeneratorImpl.java
       // XXX TODO: handle case insensitivity for native jpa queries! don't just UPPER(column)
      
                  //            // KULRICE-85 : made string searches case insensitive - used new DBPlatform function to force strings to upper case
                  //            if (caseInsensitive) {
                  //                propertyName = uppercasePropertyName(propertyName);
                  //                propertyValue = propertyValue.toUpperCase();
                  //            }
      

      as you can see, case insensitivity is not being handled at all. The property is searched for by constructing a LIKE query using the following code.

      protected void addLike(Predicates criteria, String propertyName, String propertyValue, boolean caseInsensitive) {
              // XXX: QBC does not support case sensitivity for like
              addLike(criteria, propertyName, propertyValue);
          }
      

      Since the LIKE criteria is not supported, the caseInsensitive boolean is ignored. To fix this, I think instead of using like, if there are no wildcards present, then we should use the addEqual method or find a way to support case insensitivity in LIKE (I do not know what QBC is)
      This used to work in the KNS even though that used to erroneously do case insensitive searches for fields marked forceUppercase=false.

        Attachments

          Issue Links

            Activity

            Hide
            jkeller Jonathan Keller added a comment -

            Ugh - just researched down to the code. There is no good way given the current API to link the lookup field configuration to the creation of the lookup criteria.

            Show
            jkeller Jonathan Keller added a comment - Ugh - just researched down to the code. There is no good way given the current API to link the lookup field configuration to the creation of the lookup criteria.
            Hide
            gathreya Gayathri Athreya added a comment -

            yeah just look at the code I pasted above in LookupCriteriaGeneratorImpl.java. That flag if it defaults to false would definitely help.

            Show
            gathreya Gayathri Athreya added a comment - yeah just look at the code I pasted above in LookupCriteriaGeneratorImpl.java. That flag if it defaults to false would definitely help.
            Hide
            jkeller Jonathan Keller added a comment - - edited

            I'm almost done fixing it. It looks like that, at the time org.kuali.rice.krad.service.impl.LookupCriteriaGeneratorImpl was implemented, there was no support for case insensitive LIKE operations. Then, it was added to the framework, but the above class was never adjusted.

            I'm making the change.

            This will have the effect of making all LIKE checks from lookups (and possibly some equals checks) case-insensitive by default, unless forceUppercase is true. (Since there is no separate flag and no place to really pull it from.)

            Show
            jkeller Jonathan Keller added a comment - - edited I'm almost done fixing it. It looks like that, at the time org.kuali.rice.krad.service.impl.LookupCriteriaGeneratorImpl was implemented, there was no support for case insensitive LIKE operations. Then, it was added to the framework, but the above class was never adjusted. I'm making the change. This will have the effect of making all LIKE checks from lookups (and possibly some equals checks) case-insensitive by default, unless forceUppercase is true. (Since there is no separate flag and no place to really pull it from.)
            Hide
            jkeller Jonathan Keller added a comment -

            OK. The code is in. This will result in lookup fields which are not forceUppercase being case insensitive by default.

            If we need to provide control over that, let's open a separate JIRA. That will likely require a change to the DD AttributeDefinition, since that's all we have available at that level.

            This problem was caused by a API limitation back in org.kuali.rice.krad.lookup.LookupableImpl.performSearch(LookupForm, Map<String, String>, boolean) where they only pulled a list of the wildcardAsLiteralSearchCriteria fields from the form instead of making the API able of passing back a general set of per-field lookup options.

            Show
            jkeller Jonathan Keller added a comment - OK. The code is in. This will result in lookup fields which are not forceUppercase being case insensitive by default. If we need to provide control over that, let's open a separate JIRA. That will likely require a change to the DD AttributeDefinition, since that's all we have available at that level. This problem was caused by a API limitation back in org.kuali.rice.krad.lookup.LookupableImpl.performSearch(LookupForm, Map<String, String>, boolean) where they only pulled a list of the wildcardAsLiteralSearchCriteria fields from the form instead of making the API able of passing back a general set of per-field lookup options.
            Hide
            gathreya Gayathri Athreya added a comment -

            Seems to be working now. WIll reopen if testers find something. Thanks!

            Show
            gathreya Gayathri Athreya added a comment - Seems to be working now. WIll reopen if testers find something. Thanks!

              People

              • Assignee:
                jkeller Jonathan Keller
                Reporter:
                gathreya Gayathri Athreya
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: