Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-22829

Fix replacement of page provider's named parameter of type list or array

    XMLWordPrintable

    Details

    • Release Notes Summary:
      List of array type is now supported as page provider named parameter
    • Backlog priority:
      800
    • Sprint:
      nxcore 9.3.3
    • Story Points:
      2

      Description

      How to reproduce:

      • define a new page provider:
        <extension target="org.nuxeo.ecm.platform.query.api.PageProviderService" point="providers">
        
            <coreQueryPageProvider name="ContentSearch">
                <pattern>
                    SELECT * FROM Document
                    WHERE ecm:primaryType IN :types
                    AND ecm:mixinType != 'HiddenInNavigation'
                    AND ecm:isProxy = 0
                    AND ecm:isCheckedInVersion = 0
                    AND ecm:currentLifeCycleState != :state
                </pattern>
                <sort column="dc:title" ascending="true" />
                <pageSize>50</pageSize>
            </coreQueryPageProvider>
        
        </extension>
        
      • set named parameters with proper values (a string for state and a list of strings for types) and execute the page provider

      :state is properly replaced in the NXQL query but :types is not.
      I could fix the problem with the following change:

      diff --git a/nuxeo-services/nuxeo-platform-query-api/src/main/java/org/nuxeo/ecm/platform/query/nxql/NXQLQueryBuilder.java b/nuxeo-services/nuxeo-platform-query-api/src/main/java/org/nuxeo/ecm/platform/query/nxql/NXQLQueryBuilder.java
      index 294623f..0b35bb7 100644
      --- a/nuxeo-services/nuxeo-platform-query-api/src/main/java/org/nuxeo/ecm/platform/query/nxql/NXQLQueryBuilder.java
      +++ b/nuxeo-services/nuxeo-platform-query-api/src/main/java/org/nuxeo/ecm/platform/query/nxql/NXQLQueryBuilder.java
      @@ -225,9 +225,9 @@ public class NXQLQueryBuilder {
                       }
                       key = ":" + key;
                       if (parameter instanceof String[]) {
      -                    replaceStringList(pattern, Arrays.asList((String[]) parameter), quoteParameters, escape, key);
      +                    pattern = replaceStringList(pattern, Arrays.asList((String[]) parameter), quoteParameters, escape, key);
                       } else if (parameter instanceof List) {
      -                    replaceStringList(pattern, (List<?>) parameter, quoteParameters, escape, key);
      +                    pattern = replaceStringList(pattern, (List<?>) parameter, quoteParameters, escape, key);
                       } else if (parameter instanceof Boolean) {
                           pattern = buildPattern(pattern, key, ((Boolean) parameter) ? "1" : "0");
                       } else if (parameter instanceof Number) {
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 30 minutes
                2h 30m