@Name(value="smartNXQLQueryActions") @Scope(value=PAGE) public class SmartNXQLQueryActions extends Object implements Serializable
IncrementalSmartNXQLQuery
instance created for a given existing query string.
Also handles undo/redo actions and all ajax interactions for an incremental query build page.
Modifier and Type | Field and Description |
---|---|
protected IncrementalSmartNXQLQuery |
currentSmartQuery |
static int |
HISTORY_CAPACITY |
protected String |
queryPart
Deprecated.
since 8.1: query part held/set directly on the content view search document model
|
protected String |
queryPartComponentId
Request parameter making it possible to find the component holding the query part to update it.
|
protected HistoryList<String> |
queryPartHistory |
protected HistoryList<String> |
redoQueryPartHistory |
protected List<SortInfo> |
searchSortInfos
Deprecated.
since 8.1: search sort infos directly held/set on the content view search document model
|
protected List<String> |
selectedLayoutColumns
Deprecated.
since 8.1: selected columns directly held/set on the content view search document model
|
protected Boolean |
updateQueryPart
Deprecated.
since 8.1: query part is now held by the content view search document model, consider it does not
need to be updated until user clicks on "filter".
|
Constructor and Description |
---|
SmartNXQLQueryActions() |
Modifier and Type | Method and Description |
---|---|
protected void |
addToHistory(String queryPart,
HistoryList<String> queryPartHistory) |
protected void |
addToQueryPartHistory(String queryPart) |
void |
buildQueryPart(javax.faces.event.ActionEvent event)
Updates the query part, asking the
currentSmartQuery to build the new resulting query. |
void |
clearQueryPart(javax.faces.event.ActionEvent event)
Sets the query part to an empty value.
|
boolean |
getCanRedoQueryPartChanges() |
boolean |
getCanUndoQueryPartChanges() |
protected String |
getCurrentQueryPart() |
SmartQuery |
getCurrentSmartQuery() |
String |
getQueryPart()
Deprecated.
since 8.1: query part held/set directly on the content view search document model
|
List<SortInfo> |
getSearchSortInfos()
Deprecated.
since 8.1: search sort infos directly held/set on the content view search document model
|
List<String> |
getSelectedLayoutColumns()
Deprecated.
since 8.1: selected columns directly held/set on the content view search document model
|
String |
getWhereClause(String queryPart,
boolean followedByClause)
Returns a valid where clause from a query part.
|
protected boolean |
hasQueryPartHistory(HistoryList<String> history) |
void |
initCurrentSmartQuery(String existingQueryPart)
Creates a new
currentSmartQuery instance. |
void |
initCurrentSmartQuery(String existingQueryPart,
boolean resetHistory) |
boolean |
isAjaxRequest()
Returns true if current request is an ajax request.
|
boolean |
isInitialized() |
void |
queryPartChanged(javax.faces.event.AjaxBehaviorEvent event)
Updates the current
currentSmartQuery instance according to changes on the existing query part. |
void |
redoQueryPartChanges(javax.faces.event.ActionEvent event) |
void |
resetCurrentSmartQuery() |
void |
resetSelectedLayoutColumns()
Deprecated.
since 8.1: selected columns directly held/set on the content view search document model
|
protected void |
setQueryPart(javax.faces.event.ActionEvent event,
String newQuery,
boolean rebuildSmartQuery)
Updates the JSF component holding the query part.
|
void |
setQueryPart(String queryPart)
Deprecated.
since 8.1: query part held/set directly on the content view search document model
|
void |
setSearchSortInfos(List<SortInfo> searchSortInfos)
Deprecated.
since 8.1: search sort infos directly held/set on the content view search document model
|
void |
setSelectedLayoutColumns(List<String> selectedLayoutColumns)
Deprecated.
since 8.1: selected columns directly held/set on the content view search document model
|
void |
undoHistoryChanges(javax.faces.event.ActionEvent event,
HistoryList<String> history,
HistoryList<String> redoHistory) |
void |
undoQueryPartChanges(javax.faces.event.ActionEvent event) |
void |
validateQueryPart(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Object value)
Validates the query part: throws a
ValidatorException if query is not a String, or if
IncrementalSmartNXQLQuery.isValid(String) returns false. |
public static final int HISTORY_CAPACITY
protected String queryPart
protected HistoryList<String> queryPartHistory
protected HistoryList<String> redoQueryPartHistory
protected IncrementalSmartNXQLQuery currentSmartQuery
@Deprecated protected List<String> selectedLayoutColumns
@Deprecated protected List<SortInfo> searchSortInfos
@RequestParameter @Deprecated protected Boolean updateQueryPart
For instance, on the smart search form, any ajax action should update the backing property queryPart
.
When the query part is held by a document property, it should not be updated on ajax actions: only the global
submit of the form should impact it.
@RequestParameter protected String queryPartComponentId
public SmartNXQLQueryActions()
@Deprecated public String getQueryPart()
public void setQueryPart(String queryPart)
@Deprecated public List<String> getSelectedLayoutColumns()
@Deprecated public void setSelectedLayoutColumns(List<String> selectedLayoutColumns)
@Deprecated public void resetSelectedLayoutColumns()
@Deprecated public List<SortInfo> getSearchSortInfos()
@Deprecated public void setSearchSortInfos(List<SortInfo> searchSortInfos)
public void initCurrentSmartQuery(String existingQueryPart, boolean resetHistory)
public void initCurrentSmartQuery(String existingQueryPart)
currentSmartQuery
instance.
This method is supposed to be called once when loading a new page: it will initialize the smart query object according to the current existing qury part.
It should not be called when there are validation errors happening on the page, otherwise the new query part may be discarded.
public SmartQuery getCurrentSmartQuery()
public void queryPartChanged(javax.faces.event.AjaxBehaviorEvent event)
currentSmartQuery
instance according to changes on the existing query part.protected void setQueryPart(javax.faces.event.ActionEvent event, String newQuery, boolean rebuildSmartQuery)
event
- the JSF event that will give an anchor on the JSF tree to find the target component.newQuery
- the new query to set.rebuildSmartQuery
- if true, will rebuild the smart query completely, otherwise will just set the query part
on it.NuxeoException
- if target JSF component is not found in the JSF tree.public void buildQueryPart(javax.faces.event.ActionEvent event)
currentSmartQuery
to build the new resulting query.#setQueryPart(ActionEvent, String)
public void clearQueryPart(javax.faces.event.ActionEvent event)
#setQueryPart(ActionEvent, String)
protected String getCurrentQueryPart()
protected boolean hasQueryPartHistory(HistoryList<String> history)
public boolean getCanUndoQueryPartChanges()
public boolean getCanRedoQueryPartChanges()
public void undoHistoryChanges(javax.faces.event.ActionEvent event, HistoryList<String> history, HistoryList<String> redoHistory)
public void undoQueryPartChanges(javax.faces.event.ActionEvent event)
public void redoQueryPartChanges(javax.faces.event.ActionEvent event)
protected void addToHistory(String queryPart, HistoryList<String> queryPartHistory)
protected void addToQueryPartHistory(String queryPart)
public void validateQueryPart(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)
ValidatorException
if query is not a String, or if
IncrementalSmartNXQLQuery.isValid(String)
returns false.public boolean isAjaxRequest()
Useful when some component should be required only when the global form is submitted, and not when ajax calls are performed.
public String getWhereClause(String queryPart, boolean followedByClause)
Useful to avoid generating an invalid query if query part is empty (especially if content view is not marked as waiting for first execution).
public boolean isInitialized()
@Observer(value="searchSelected", create=false) @BypassInterceptors public void resetCurrentSmartQuery()
Copyright © 2017 Nuxeo. All rights reserved.