Interface NamedQueryManager
- All Known Implementing Classes:
ClientNamedQueryManager
,DesignerNamedQueryManager
,SecuredNamedQueryManager
public interface NamedQueryManager
This allows NamedQueries to use unsaved queries in the Designer (so other resources can use them without forcing
a save), but not the Client.
-
Method Summary
Modifier and TypeMethodDescriptionbeginTransaction
(String project, String datasource, int isolationLevel, long timeout) Registers a transaction, but does not actually begin it until a query is invoked in that transaction.void
clearAllCaches
(String project) Clears all Named Query caches for this project.void
clearCache
(String project, Set<String> queryPaths) Clears the named query caches of the passed paths to the named queries.execute
(String project, NamedQuery query, Map<String, Object> parameters, boolean canCache, boolean canLimit, String tx, boolean getKey) Executes a named query that exists on the providedqueryPath
.execute
(String project, String queryPath, Map<String, Object> parameters, boolean canCache, boolean canLimit, String tx, boolean getKey) Executes a named query that exists on the providedqueryPath
.boolean
Executes an update query that exists on the providedqueryPath
through the Store & Forward system.getQueryFromPath
(String project, String queryPath) Returns the CachedNamedQuery
based on the providedqueryPath
.
-
Method Details
-
beginTransaction
@Nullable String beginTransaction(String project, String datasource, int isolationLevel, long timeout) throws Exception Registers a transaction, but does not actually begin it until a query is invoked in that transaction. This lets us have a beginTransaction without client protection that doesn't risk getting our connection pool clobbered. Returns null if project does not exist or has not started up.- Throws:
Exception
-
execute
@Nullable Object execute(String project, String queryPath, Map<String, Object> parameters, boolean canCache, boolean canLimit, String tx, boolean getKey) throws ExceptionExecutes a named query that exists on the providedqueryPath
. If the Named Query has parameters, values for each parameter should be supplied in theparameters
map that conform to their data type. If the Named Query cannot be found at the supplied path, the required parameters aren't present, or their types are incorrect an Exception is thrown.- Parameters:
queryPath
- The path to the Named Query. Must not be nullparameters
- A parameter map for the named query. Keys being the parameter name and values their corresponding value. Must not be nullcanCache
- If true, will cache if the query config is set to cachecanLimit
- If true, will limit the results if the query config is set to limittx
- If this field is not blank, will make this query part of a transactiongetKey
- If update query, will return new PK if true otherwise returns number of rows affected.- Returns:
- Object of query results. May be null
- Throws:
Exception
- If query not found or query generates an exception
-
execute
@Nullable Object execute(String project, NamedQuery query, Map<String, Object> parameters, boolean canCache, boolean canLimit, String tx, boolean getKey) throws ExceptionExecutes a named query that exists on the providedqueryPath
. If the Named Query has parameters, values for each parameter should be supplied in theparameters
map that conform to their data type. If the Named Query cannot be found at the supplied path, the required parameters aren't present, or their types are incorrect an Exception is thrown.- Parameters:
project
- The name of the effective project the named queries whose cache you wish to clear reside in.query
- The NamedQuery to execute. Must not be nullparameters
- A parameter map for the named query. Keys being the parameter name and values their corresponding value. Must not be nullcanCache
- If true, will cache if the query config is set to cachecanLimit
- If true, will limit the results if the query config is set to limit- Returns:
- Object of query results. May be null
- Throws:
Exception
- If query not found or query generates an exception
-
getQueryFromPath
Returns the CachedNamedQuery
based on the providedqueryPath
. Useful for checking permissions.- Parameters:
queryPath
- Path to Named Query resource- Returns:
- NamedQuery resource or null if not found.
- Throws:
Exception
- If query or the project are not found
-
clearCache
Clears the named query caches of the passed paths to the named queries.- Parameters:
project
- the name of the effective project the named queries whose cache you wish to clear reside in.queryPaths
- a set of paths to the named queries that we want to clear. Must not be null.- Throws:
Exception
- If query or the project are not found
-
clearAllCaches
Clears all Named Query caches for this project.- Parameters:
project
- The name of the effective project whose named queries' cache you wish to clear.- Throws:
Exception
- If the project is not found
-
executeSFquery
Executes an update query that exists on the providedqueryPath
through the Store & Forward system. If the Named Query cannot be found at the supplied path, the required parameters aren't present, or their types are incorrect an Exception is thrown.- Parameters:
project
- Project the query resides in. Not empty or null.path
- Path to the query resource. Not empty or null.parameters
- A parameter map for the named query. Keys being the parameter name and values their corresponding value. Must not be null- Returns:
- True if successfully sent to store and forward system.
- Throws:
Exception
- If required values are empty or don't exist, or if query is not an Update query.
-