Query#
- public class Query implements QueryInterface, ToElementable, EntityTransactionInterface#
This class represents a single, complete Query execution from the parsing of the query string to the resulting list of entity ids.
This class handles caching of queries and checking retrieve permissions as well. It does not, however, retrieve the resulting entities; this is handled by the
Retrieveclass.- Author:
Timm Fitschen
Fields#
resultSet#
- List<IdVersionAclTriplet> resultSet#
Constructors#
Query#
Query#
Query#
- public Query(String query, Transaction<? extends TransactionContainer> transaction)#
Query#
- public Query(String query, Subject user, TransactionContainer container, EntityTransactionInterface transaction, Access access)#
Methods#
addBenchmark#
addToElement#
- public void addToElement(Element parent)#
applyQueryTemplates#
- public void applyQueryTemplates(QueryInterface query, String resultSet)#
Finds all QueryTemplates in the resultSet and applies them to the same resultSet. The IDs of the QueryTemplates themselves are then removed from the resultSet. If the current user doesn’t have the RETRIEVE:ENTITY permission for a particular QueryTemplate it will be ignored.
- Parameters:
resultSet
- Throws:
clearCache#
- public static void clearCache()#
Remove all cached queries from the cache.
execute#
- public void execute()#
Execute the query.
First try the cache and only then use the back-end.
- Throws:
ParsingException,– QueryException
executeQueryInBackend#
filterIntermediateResult#
getAccess#
getCacheKey#
getConnection#
- public Connection getConnection()#
getCount#
- public int getCount()#
getETag#
getEntity#
getQuery#
getRole#
getSelections#
getSourceSet#
getTargetSet#
getTargetSetCount#
- public int getTargetSetCount()#
- Returns:
the number of entities in the resultset. Might be updated by the filters.
getTimestamp#
- public UTCDateTime getTimestamp()#
getTransactionBenchmark#
- public TransactionBenchmark getTransactionBenchmark()#
getType#
getUser#
- public Subject getUser()#
isVersioned#
- public boolean isVersioned()#
matchIdPattern#
optimize#
- public void optimize()#
Optimize the query after parsing. The optimization is purely based on formal rules.
Implemented rules:
FIND * -> FIND ENTITY (which basically prevents to copy the complete entity table just to read out the IDs immediately).
parse#
- public void parse(boolean optimize)#
Parse the query and run optimize() if the parameter optimize is true.
- Parameters:
optimize – whether to run optimize() immediately.
- Throws:
parse#
- public void parse()#
Parse the query and run optimize() immediately.
- Throws: