-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 8.10
-
Component/s: Query & PageProvider
-
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
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) {