Package org.alfresco.rest.api.impl
Class QueriesImpl.AbstractQuery<T>
- java.lang.Object
-
- org.alfresco.rest.api.impl.QueriesImpl.AbstractQuery<T>
-
- Enclosing class:
- QueriesImpl
public abstract static class QueriesImpl.AbstractQuery<T> extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classQueriesImpl.AbstractQuery.Sort
-
Constructor Summary
Constructors Constructor Description AbstractQuery(NodeService nodeService, SearchService searchService)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddSortOrder(Parameters parameters, Map<String,org.alfresco.service.namespace.QName> sortParamsToQNames, List<SortColumn> defaultSortCols, SearchParameters sp)Adds sort order to the SearchParameters.protected abstract voidbuildQuery(StringBuilder query, String term, SearchParameters sp, String queryTemplateName)Builds up the query and is expected to callSearchParameters.setDefaultFieldName(String)andSearchParameters.addQueryTemplate(String, String)protected abstract Tconvert(NodeRef nodeRef, List<String> includeParam)Converts a nodeRef into the an object of the required type.protected StringescapeTerm(String term)Trim and escape the term - override if neededCollectionWithPagingInfo<T>find(Parameters parameters, String termName, int minTermLength, String queryTemplateName, QueriesImpl.AbstractQuery.Sort sort, Map<String,org.alfresco.service.namespace.QName> sortParamsToQNames, SortColumn... defaultSort)protected StringgetTerm(Parameters parameters, String termName, int minTermLength)protected static <T> CollectionWithPagingInfo<T>listPage(List<T> result, Paging paging)protected abstract List<T>newList(int capacity)Returns a list of the correct type.protected List<NodeRef>postQuerySort(Parameters parameters, Map<String,org.alfresco.service.namespace.QName> sortParamsToQNames, List<SortColumn> defaultSortCols, List<NodeRef> nodeRefs)
-
-
-
Constructor Detail
-
AbstractQuery
public AbstractQuery(NodeService nodeService, SearchService searchService)
-
-
Method Detail
-
find
public CollectionWithPagingInfo<T> find(Parameters parameters, String termName, int minTermLength, String queryTemplateName, QueriesImpl.AbstractQuery.Sort sort, Map<String,org.alfresco.service.namespace.QName> sortParamsToQNames, SortColumn... defaultSort)
-
buildQuery
protected abstract void buildQuery(StringBuilder query, String term, SearchParameters sp, String queryTemplateName)
Builds up the query and is expected to callSearchParameters.setDefaultFieldName(String)andSearchParameters.addQueryTemplate(String, String)- Parameters:
query- StringBuilder into which the query should be built.term- to be searched forsp- SearchParametersqueryTemplateName-
-
newList
protected abstract List<T> newList(int capacity)
Returns a list of the correct type.- Parameters:
capacity- of the list- Returns:
- a new list.
-
convert
protected abstract T convert(NodeRef nodeRef, List<String> includeParam)
Converts a nodeRef into the an object of the required type.- Parameters:
nodeRef- to be convertedincludeParam- additional fields to be included- Returns:
- the object
-
getTerm
protected String getTerm(Parameters parameters, String termName, int minTermLength)
-
escapeTerm
protected String escapeTerm(String term)
Trim and escape the term - override if needed- Parameters:
term-- Returns:
-
addSortOrder
protected void addSortOrder(Parameters parameters, Map<String,org.alfresco.service.namespace.QName> sortParamsToQNames, List<SortColumn> defaultSortCols, SearchParameters sp)
Adds sort order to the SearchParameters.
-
postQuerySort
protected List<NodeRef> postQuerySort(Parameters parameters, Map<String,org.alfresco.service.namespace.QName> sortParamsToQNames, List<SortColumn> defaultSortCols, List<NodeRef> nodeRefs)
-
listPage
protected static <T> CollectionWithPagingInfo<T> listPage(List<T> result, Paging paging)
-
-