Class QueryEngine

java.lang.Object
com.groiss.reporting.QueryEngine

public class QueryEngine extends Object
initalize reporting and executes reports
  • Method Details

    • init

      public static void init(boolean forceInitalize)
      initalize the engine configuration
    • sheduleReinit

      public static void sheduleReinit()
      shedules reinitalization for Reporting engine
    • setThreadTzAndLocale

      public static void setThreadTzAndLocale(String tz, String locale)
      Parameters:
      tz -
      locale -
    • hasStatRight

      public static boolean hasStatRight(User u)
      check if a specified user has the statistic right
      Parameters:
      u - the user
      Returns:
      true if the user has the right statistic
    • hasStatRight

      public static boolean hasStatRight()
    • getQueryObject

      public static Query getQueryObject(HttpServletRequest req, boolean isStandardSearch)
    • getQueryObject

      public static Query getQueryObject(String id, String title, Document queryDoc, Report q, Map<String,String[]> paramMap, Date execution)
      Create Query Object
      Parameters:
      id - the query id
      title - the query title
      queryDoc - the xml structure of the report
      q - the base stored query - maybe null
      paramMap - the map with parameters
      execution - execution timestamp
      Returns:
    • executeQuery

      public static void executeQuery(HttpServletRequest req, HttpServletResponse res)
      the method executes report in a iframe context. it loads the result in the main-window, if executed in the 'right' frame, or fully standalone if loaded in any other frame
    • getTableModel

      public static ReportingTableModel getTableModel(List<List<Object>> values, Query q)
      Parameters:
      values - the result values
      the list of lists contains instances of com.groiss.reporting.data.ReportingExportable or java.lang.String
      q - the query object
      Returns:
      the result tablemodel
    • inCache

      public static boolean inCache(String query_id)
    • execute

      public static Pair<Query,List<List<Object>>> execute(Report sq, Map<String,String[]> params)
    • execute

      public static Pair<Query,List<List<Object>>> execute(Query q)
      Executes a query Object using cache
      Parameters:
      q - - the query object
      Returns:
      a Pair. first Entry is the query Object, the second the result values
      the list of lists contains instances of com.groiss.reporting.data.ReportingExportable or java.lang.String
      This matrix is the raw data of the ReportingTableModel
    • execute

      public static Pair<Query,List<List<Object>>> execute(Query q, String query_id, String requestId)
      Executes a query Object using cache
      Parameters:
      q - - the query object
      query_id - - the internal cache id of the query, use generateQueryId Method to generate an unique ID.
      Returns:
      a Pair. first Entry is the query Object, the second the result values
      the list of lists contains instances of com.groiss.reporting.data.ReportingExportable or java.lang.String
      This matrix is the raw data of the ReportingTableModel
    • encodeId

      public static String encodeId(String id)
    • isOracle

      public static boolean isOracle()
      Returns:
      true if Database is Oracle
    • generateQueryId

      public static String generateQueryId(Query q, User u)
      returns a unique query ID for caching purposes
    • abort

      public static void abort(String query_id)
      Aborts a query execution
      Parameters:
      query_id - the queryid to abort
    • openFormInEditMode

      public static boolean openFormInEditMode()
      Returns:
      true if forms should be opened in edit mode
    • getDocSearchMode

      public static int getDocSearchMode()
      Returns:
      the configured documet search mode
    • getSystemSchemaFile

      public static String getSystemSchemaFile()
      returns always "reporting.xml"
      Returns:
      the name of the configured system schema file path
    • getReportingDataInstance

      public static ReportingData getReportingDataInstance(String entity, String attribute)
      Parameters:
      entity - the referenced entity id of schema
      attribute - the referenced attribute id of schema
      Returns:
      the ReportingData Object for this attribute
    • getReportingDataInstance

      public static ReportingData getReportingDataInstance(Element e)
      Parameters:
      e - the xml element of the query xml
      Returns:
      the ReportingData Object for this attribute
      See Also:
    • getContextQuery

      public static Query getContextQuery()
      Returns:
      current executed queryobject
    • localize

      public static String localize(String text)
    • getLocalizeString

      public static String getLocalizeString(String key)
    • getMaxTable

      protected static int getMaxTable()
      Returns:
      the maxTable
    • sendReportRefreshToClient

      public static void sendReportRefreshToClient(String reportId)
      Send refresh notification to clients to refresh displayed reports with the given id. Maximum refresh delay is 30 seconds
      Parameters:
      reportId - the report to refresh - must not be null
    • sendReportRefreshToClient

      public static void sendReportRefreshToClient(String reportId, int maxSecondsDelayToRefresh)
      Send refresh notification to clients to refresh displayed reports with the given id.
      Parameters:
      reportId - the report to refresh - must not be null
      maxSecondsDelayToRefresh - - maximum delay (in seconds, default:30) to refresh report, the actual delay is random. If a negative number is used, the event is sent immediately, if not, the notification is done after commit of the user transaction
    • showStatus

      public static void showStatus(HttpServletRequest req, HttpServletResponse resp) throws Exception
      Throws:
      Exception
    • getMaxParallel

      public static int getMaxParallel()
      Returns:
      the maxParallel