public class PredefinedQuery
extends java.lang.Object
Application.getQueryFile
.
The format of the XML file is forced by a DTD. In summary:
<?xml version="1.0" ?> <!DOCTYPE predefined-queries SYSTEM "predefined.dtd" > <predefined-queries> <query id="GET_GROUPS_FOR_USER" type="HQL"> <sql> SELECT ug.groupId FROM UserGroups ug WHERE ug.userId = :user_id </sql> <description> Loads the group ID for all groups where the user is a member </description> </query> </predefined-queries>
Modifier and Type | Field and Description |
---|---|
private static org.jdom.Document |
commonDom
Holds the XML document containing the common queries.
|
private static java.lang.String |
commonQueryFile
The path to the query file with common queries.
|
private static org.jdom.Document |
dialectDom
Holds the XML document containing the dialect-specific queries.
|
private static java.lang.String |
dialectQueryFile
The path to the query file with dialect-specific queries.
|
private static java.net.URL |
dtdFile
The DTD which is used to validate the XML file.
|
private static boolean |
isInitialised |
private static org.slf4j.Logger |
log
Log core events.
|
Constructor and Description |
---|
PredefinedQuery() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getQueryString(java.lang.String name,
java.lang.String... replacements)
Get the query string for the predefined query with
the specified name.
|
(package private) static void |
init()
Load and parse the file with predefined queries.
|
(package private) static void |
unload()
Unload all settings.
|
private static final org.slf4j.Logger log
private static org.jdom.Document commonDom
private static org.jdom.Document dialectDom
private static final java.lang.String commonQueryFile
private static java.lang.String dialectQueryFile
private static final java.net.URL dtdFile
private static boolean isInitialised
static void init() throws BaseException
BaseException
static void unload()
public static java.lang.String getQueryString(java.lang.String name, java.lang.String... replacements) throws BaseException
BaseException
- If the query is not found or there
is any other error