|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.PredefinedQuery
public class 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>
Field Summary | |
---|---|
private static Document |
commonDom
Holds the XML document containing the common queries. |
private static String |
commonQueryFile
The path to the query file with common queries. |
private static Document |
dialectDom
Holds the XML document containing the dialect-specific queries. |
private static String |
dialectQueryFile
The path to the query file with dialect-specific queries. |
private static URL |
dtdFile
The DTD which is used to validate the XML file. |
private static boolean |
isInitialised
|
private static Logger |
log
Log core events. |
Constructor Summary | |
---|---|
PredefinedQuery()
|
Method Summary | |
---|---|
static 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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logger log
private static Document commonDom
private static Document dialectDom
private static final String commonQueryFile
private static String dialectQueryFile
private static final URL dtdFile
private static boolean isInitialised
Constructor Detail |
---|
public PredefinedQuery()
Method Detail |
---|
static void init() throws BaseException
BaseException
static void unload()
public static String getQueryString(String name, String... replacements) throws BaseException
BaseException
- If the query is not found or there
is any other error
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |