T
- either String (for searching handles) or DigitalObject (for searching object).public class AbstractQueryVisitorForSearch<T> extends java.lang.Object implements QueryVisitor<CloseableIterator<T>>
QueryVisitor
used by repository search implementations.
Subclasses should implement visitAttributeQuery(net.cnri.repository.search.AttributeQuery)
and/or visitElementAttributeQuery(net.cnri.repository.search.ElementAttributeQuery)
.
This class handles BooleanQuery
(by performing the boolean operations), RawQuery
(by interpreting it as an attribute query specification),
and MatchAllObjectsQuery
(by passing to the listHandles
or listObjects
methods of the repository).
The repository being searched, and the class of the results (either String.class
or DigitalObject.class
), are available as protected fields.Modifier and Type | Class and Description |
---|---|
static class |
AbstractQueryVisitorForSearch.SearchHandles
Use
new AbstractQueryVisitorForSearch.SearchHandles(repo) as shorthand for new AbstractQueryVisitorForSearch<String>(repo,String.class) . |
static class |
AbstractQueryVisitorForSearch.SearchObjects
Use
new AbstractQueryVisitorForSearch.SearchObjects(repo) as shorthand for new AbstractQueryVisitorForSearch<DigitalObject>(repo,DigitalObject.class) . |
Constructor and Description |
---|
AbstractQueryVisitorForSearch(Repository repo,
java.lang.Class<T> klass) |
Modifier and Type | Method and Description |
---|---|
CloseableIterator<T> |
visitAttributeQuery(AttributeQuery query) |
CloseableIterator<T> |
visitBooleanQuery(BooleanQuery booleanQuery) |
CloseableIterator<T> |
visitElementAttributeQuery(ElementAttributeQuery query) |
CloseableIterator<T> |
visitMatchAllObjectsQuery(MatchAllObjectsQuery query) |
CloseableIterator<T> |
visitRawQuery(RawQuery query) |
public AbstractQueryVisitorForSearch(Repository repo, java.lang.Class<T> klass)
public CloseableIterator<T> visitAttributeQuery(AttributeQuery query) throws RepositoryException
visitAttributeQuery
in interface QueryVisitor<CloseableIterator<T>>
RepositoryException
public CloseableIterator<T> visitElementAttributeQuery(ElementAttributeQuery query) throws RepositoryException
visitElementAttributeQuery
in interface QueryVisitor<CloseableIterator<T>>
RepositoryException
public CloseableIterator<T> visitRawQuery(RawQuery query) throws RepositoryException
visitRawQuery
in interface QueryVisitor<CloseableIterator<T>>
RepositoryException
public CloseableIterator<T> visitMatchAllObjectsQuery(MatchAllObjectsQuery query) throws RepositoryException
visitMatchAllObjectsQuery
in interface QueryVisitor<CloseableIterator<T>>
RepositoryException
public CloseableIterator<T> visitBooleanQuery(BooleanQuery booleanQuery) throws RepositoryException
visitBooleanQuery
in interface QueryVisitor<CloseableIterator<T>>
RepositoryException