Class PredefinedQuery


  • public class PredefinedQuery
    extends Object
    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 Detail

      • log

        private static final org.slf4j.Logger log
        Log core events.
      • commonDom

        private static Document commonDom
        Holds the XML document containing the common queries.
      • dialectDom

        private static Document dialectDom
        Holds the XML document containing the dialect-specific queries.
      • commonQueryFile

        private static final String commonQueryFile
        The path to the query file with common queries.
        See Also:
        Constant Field Values
      • dialectQueryFile

        private static String dialectQueryFile
        The path to the query file with dialect-specific queries.
      • dtdFile

        private static final URL dtdFile
        The DTD which is used to validate the XML file.
      • isInitialised

        private static boolean isInitialised
    • Constructor Detail

      • PredefinedQuery

        public PredefinedQuery()
    • Method Detail

      • unload

        static void unload()
        Unload all settings.
      • getQueryString

        public static String getQueryString​(String name,
                                            String... replacements)
                                     throws BaseException
        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