Try to give parameters to a pageprovider in ecm:fulltext an others where clauses, extracting from widget template.xhtml
Hello,
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>
<pattern>
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'
</pattern>
<parameter>/My Domain/workspaces/Bidule/</parameter>
<parameter>#{documentSearchActions.simpleSearchKeywords}</parameter>
<sort ascending="true" column="dc:title"/>
<pageSize>5</pageSize>
</coreQueryPageProvider>
</extension>
moreover, parameter ONE should be #{mycustomparameter_fromwidgetcustom}
thank you
Hi,
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 https://jira.nuxeo.com/browse/NXP-11014. 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.
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 ('Folder', 'Workspace')
AND (ecm:fulltext LIKE '?*')
AND (ecm:path STARTSWITH '?')
AND ecm:mixinType !=
'HiddenInNavigation' AND ecm:isCheckedInVersion = 0 AND
ecm:currentLifeCycleState != '?'
</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="#{widget.properties['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 #{widget.properties['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).
HTH
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?)
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…
<rich:suggestionbox id="#{widget.id}_suggestionBox"
for="#{idFieldPathSug}" tokens=""
suggestionAction="#{docSuggestionActions.getDocSuggestions}"
var="result"
fetchValue=""
nothingLabel="#{messages['label.suggestion.noSearchResults']}"
minChars="#{minChars}" frequency="#{frequency}" requestDelay="#{requestDelay}">
for: the field id where the suggestion action is available.
Couldn't find what "parameter" is use when it's automatic with no parameter..