Class TableRequestHandler

  • public abstract class TableRequestHandler
    extends RequestHandler
    Message handler specifically for table views.
    • Constructor Detail

      • TableRequestHandler

        public TableRequestHandler​(String reqType,
                                   String respType,
                                   String nodeName)
        Constructs a table request handler for a specific table view. When table requests come in, the handler will generate the appropriate table rows, sort them according the the request sort parameters, and send back the response to the client.
        reqType - type of the request event
        respType - type of the response event
        nodeName - name of JSON node holding row data
    • Method Detail

      • process

        public void process​(com.fasterxml.jackson.databind.node.ObjectNode payload)
        Description copied from class: RequestHandler
        Processes the incoming message payload from the client.
        Specified by:
        process in class RequestHandler
        payload - request message payload
      • createTableModel

        protected TableModel createTableModel()
        Creates the table model (devoid of data) using getColumnIds() to initialize it, ready to be populated.

        This default implementation returns a table model with default formatters and comparators for all columns.

        an empty table model
      • addTableConfigAnnotations

        protected void addTableConfigAnnotations​(TableModel tm,
                                                 com.fasterxml.jackson.databind.node.ObjectNode payload)
        Adds table configuration specific annotations to table model.
        tm - a table model
        payload - the event payload from the client
      • defaultColumnId

        protected String defaultColumnId()
        Returns the default column ID to be used when one is not supplied in the payload as the column on which to sort.

        This default implementation returns "id".

        default sort column identifier
      • getColumnIds

        protected abstract String[] getColumnIds()
        Subclasses should return the array of column IDs with which to initialize their table model.
        the column IDs
      • noRowsMessage

        protected abstract String noRowsMessage​(com.fasterxml.jackson.databind.node.ObjectNode payload)
        Subclasses should return the message to display in the table when there are no rows to display. For example, a host table might return "No hosts found".
        payload - request payload
        the message
      • populateTable

        protected abstract void populateTable​(TableModel tm,
                                              com.fasterxml.jackson.databind.node.ObjectNode payload)
        Subclasses should populate the table model by adding rows.
                 .cell(COL_ONE, ...)
                 .cell(COL_TWO, ...)
                 ... ;
        The request payload is provided in case there are request filtering parameters (other than sort column and sort direction) that are required to generate the appropriate data.
        tm - the table model
        payload - request payload