Interface ReportAPIResourceListener


public interface ReportAPIResourceListener
An interface which defines event handlers that will be called at different stages of the construction of ReportAPIResource metadata. Subclasses are free to override only the methods they need. In general:
  • Each method will be called as the very last step in the construction of that piece of the report. For example, the onFilterField method will be called after the ReportResource has added all of the standard metadata but before the filter field is added to the form.
  • Events for higher level components are fired after lower level components. IE: after all of the filter fields are constructed, the onFormConfig will be fired
  • Each event will not necessarily fire on each request to the report resource. For example, if the client already has the form, then the form-related events will not fire. The only event that will fire every time is onReport and the ReportJSONObject it is passed will not have all of the pieces of the report: only the pieces that were constructed during this report request
  • The FieldDef passed the listener could be an instance of UiFieldDef or ReportFieldDef
  • Method Summary

    Modifier and Type Method Description
    default void onFilterField​(org.json.JSONObject filter, Field field)
    Called when building the metadata for each filter field.
    default void onReport​(org.json.JSONObject report)
    Called when the entire report is complete
    default void onReportExecuted​(Table table, javax.servlet.http.HttpServletRequest request)
    Called after report is executed
  • Method Details

    • onFilterField

      default void onFilterField​(org.json.JSONObject filter, Field field)
      Called when building the metadata for each filter field. This allows you to make changes such as making fields required or optional, making fields hidden or visible, changing the autocomplete/picker options for model link fields, etc.

      Please note that this does not give you access to filter field values. To change or prepopulate filter values for reports with autoExecute set to true, see #beforeParseFilters(JSONObject). If autoExecute is false, however, you should use this method to prepopulate default filter values.

      For example, the following code will make the OwningOrg filter hidden:

       if (field.getId().getName().equals("OwningOrg")) {
         filter.setXtype("hidden");
       }
       
      Parameters:
      filter - the json object representing the filter field definition
      field - the FieldDef this filter is based on
    • onReport

      default void onReport​(org.json.JSONObject report)
      Called when the entire report is complete
      Parameters:
      report -
    • onReportExecuted

      default void onReportExecuted​(Table table, javax.servlet.http.HttpServletRequest request)
      Called after report is executed
      Parameters:
      report -