Package net.sf.basedb.core
Class PredefinedQuery
java.lang.Object
net.sf.basedb.core.PredefinedQuery
This class is used for reading XML files with information
about predefined queries. The file should be located at the path
returned by
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>
- Version:
- 2.0, 2.13 (made public)
- Author:
- Nicklas
-
Field Summary
Modifier and TypeFieldDescriptionprivate static Document
Holds the XML document containing the common queries.private static final String
The path to the query file with common queries.private static Document
Holds the XML document containing the dialect-specific queries.private static String
The path to the query file with dialect-specific queries.private static final URL
The DTD which is used to validate the XML file.private static boolean
private static final Logger
Log core events. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getQueryString
(String name, 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.
-
Field Details
-
log
Log core events. -
commonDom
Holds the XML document containing the common queries. -
dialectDom
Holds the XML document containing the dialect-specific queries. -
commonQueryFile
The path to the query file with common queries.- See Also:
-
dialectQueryFile
The path to the query file with dialect-specific queries. -
dtdFile
The DTD which is used to validate the XML file. -
isInitialised
private static boolean isInitialised
-
-
Constructor Details
-
PredefinedQuery
public PredefinedQuery()
-
-
Method Details
-
init
Load and parse the file with predefined queries.- Throws:
BaseException
-
unload
static void unload()Unload all settings. -
getQueryString
Get the query string for the predefined query with the specified name. This method was made public in BASE 2.13.- Throws:
BaseException
- If the query is not found or there is any other error- Since:
- 2.13
-