Try to give parameters to a pageprovider in ecm:fulltext an others where clauses, extracting from widget template.xhtml


I try to do a page provider with parameters.

  • Parameter should be get in a WIDGET custom parameters.
  • This widget is using this page provider to display results.

I couldn't find a solution to have results in my request WHEN I had 2 fields “parameter” instead of using <pattern escapeParameters="true" quoteParameters="false">

Here is the extension point :

<extension target="org.nuxeo.ecm.platform.query.api.PageProviderService"  point="providers">

<coreQueryPageProvider name="document_suggestion_amoi">
  <property name="coreSession">#{documentManager}</property>
    SELECT * FROM Document WHERE (ecm:path STARTSWITH '?')
     AND ecm:primaryType IN ('Folder', 'Workspace') AND ecm:fulltext LIKE '?*' AND ecm:mixinType !=
    'HiddenInNavigation' AND ecm:isCheckedInVersion = 0 AND
    ecm:currentLifeCycleState != 'deleted'
  <parameter>/My Domain/workspaces/Bidule/</parameter>
  <sort ascending="true" column="dc:title"/>

moreover, parameter ONE should be #{mycustomparameter_fromwidgetcustom}

thank you

0 votes

2 answers




On version 5.6, the document suggestion widget accepts a provider that only takes one parameter: the suggestion input.

Additional parameters set on the page provider definition will be ignored. This limitation has recently been removed, see Note that the first '?' character in the query pattern will have to match the suggestion input.

You can define a custom widget template and associated custom suggestion method to replicate the logic on a 5.6.

0 votes


Thank you very much.

Now I can define extra-parameters without problem with the nuxeo patch 5.6_HF11 and a custom version of the last file single_document_suggestion_widget_template.xhtml

This is my exemple that work without variable parameters : <extension target="org.nuxeo.ecm.platform.query.api.PageProviderService" point="providers">

<coreQueryPageProvider name="document_suggestion_amoi">

<pattern quoteParameters="false"> SELECT * FROM Document WHERE

     ecm:primaryType IN (&apos;Folder&apos;, &apos;Workspace&apos;) 
     AND (ecm:fulltext LIKE &apos;?*&apos;) 
     AND (ecm:path STARTSWITH &apos;?&apos;)
     AND ecm:mixinType !=
    &apos;HiddenInNavigation&apos; AND ecm:isCheckedInVersion = 0 AND
    ecm:currentLifeCycleState != &apos;?&apos;

</pattern> <sort ascending="true" column="dc:title"/> <parameter>/default-domain/workspaces/toto/</parameter> <parameter>deleted</parameter> <pageSize>30</pageSize> </coreQueryPageProvider> </extension>

NEVERTHELESS I failed to replace the parameter "/default-domain/workspaces/toto" by <parameter>#{myPathStarts}</parameter> that is declared in xhtml like that <c:set var="myPathStarts" value="#{['myPathStarts']}"/> and myPathStarts is fielded in the widget custom properties in nuxeo studio.

Do you know how to GIVE A xhtml VARIABLE TO THE PAGE PROVIDER used for the rich:suggestionbox ?

thank you



c:set and the page provider parameters are not resolved in the same context.

Maybe you can try to use a seam component that would temporarily keep this value (similarly to what's done in SuggestionActionsBean#getSelectedValue). Keep it in scope EVENT if you'd like to use this widget type several time in the page. Just define a field, associated getters and setters.

Maybe you can reuse the one from SelectionActionsBean. The parameter on page provider would be #{selectionActions.selectedValue}. In the xhtml, you can set this value using a tag <f:setPropertyActionListener value="#{widgetProperty_myPathStarts}" target="#{selectionActions.selectedValue}" />.

The #{widgetProperty_myPathStarts} variable is exposed in the context of a widget of type "template" and is better than #{['myPathStarts']} as it will resolve EL expressions too (i mean: in case the widget property value is an EL expression too).

This tag will have to be place inside the rich:suggestionbox, twice: just inside the tag, and also inside the a4j:support tag (as suggestion method is called again on selection).



If you don't use quoteParameters=“false” you must remove quotes around your parameters no? Whereas, if you do that ecm:fulltext LIKE '?*' will not working anymore… (maybe with a concat?)

0 votes


thank you for your answer.

Sorry for my explaination, I used quoteParameters="false" with no parameters and with no "<parameter>" it works (with STARTWITH '/mystartpath/' so no parameter).

I try the same code bellow (from extension to extension) without the '' arround my parameters '?' but this doesn't work. I think the ensemble of my code has a problem, but couln't find where…


Try to replace your second parameter by that when you remove quote : <parameter>#{documentSearchActions.simpleSearchKeywords+"*"}</parameter>

Is This pattern using with a Document Suggestion Box?

Thanks Flav. Exactly, it's a document suggestion box. I try the new solution and test differents cases of giving parameters, but couldn't make it work with this 2 parameters :-(

I got

<rich:suggestionbox id="#{}_suggestionBox"

        for=&quot;#{idFieldPathSug}&quot; tokens=&quot;&quot;
        minChars=&quot;#{minChars}&quot; frequency=&quot;#{frequency}&quot; requestDelay=&quot;#{requestDelay}&quot;&gt;

for: the field id where the suggestion action is available.

Couldn't find what "parameter" is use when it's automatic with no parameter..