use of org.ovirt.engine.core.searchbackend.SyntaxObject in project ovirt-engine by oVirt.
the class SearchableListModel method isSearchValidForServerSideSorting.
/**
* Returns {@code true} if this model's {@linkplain #getSearchString search string}
* allows the use of server-side sorting.
* <p>
* This method returns {@code false} if:
* <ul>
* <li>search string contains syntax error(s)
* <li>search string contains {@code SORTBY} syntax object
* </ul>
* Otherwise, this method returns {@code true}.
*/
public boolean isSearchValidForServerSideSorting() {
ISyntaxChecker syntaxChecker = getConfigurator().getSyntaxChecker();
if (syntaxChecker == null) {
return true;
}
String search = getSearchString();
SyntaxContainer syntaxResult = syntaxChecker.analyzeSyntaxState(search, true);
if (syntaxResult.getError() != SyntaxError.NO_ERROR) {
return false;
}
for (SyntaxObject syntaxObject : syntaxResult) {
if (syntaxObject.getType() == SyntaxObjectType.SORTBY) {
return false;
}
}
return true;
}
Aggregations