Class ChartRequestHandler


  • public abstract class ChartRequestHandler
    extends RequestHandler
    Message handler specifically for the chart views.
    • Constructor Detail

      • ChartRequestHandler

        public ChartRequestHandler​(String reqType,
                                   String respType,
                                   String nodeName)
        Constructs a chart model handler for a specific graph view. When chart requests come in, the handler will generate the appropriate chart data points and send back the response to the client.
        Parameters:
        reqType - type of the request event
        respType - type of the response event
        nodeName - name of JSON node holding data point
    • 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
        Parameters:
        payload - request message payload
      • createChartModel

        protected ChartModel createChartModel()
        Creates the chart model using getSeries() to initialize it, ready to be populated.

        This default implementation returns a chart model for all series.

        Returns:
        an empty chart model
      • getSeries

        protected abstract String[] getSeries()
        Subclasses should return the array of series with which to initialize their chart model.
        Returns:
        the series name
      • populateChart

        protected abstract void populateChart​(ChartModel cm,
                                              com.fasterxml.jackson.databind.node.ObjectNode payload)
        Subclasses should populate the chart model by adding datapoints.
             cm.addDataPoint()
                 .data(SERIES_ONE, ...)
                 .data(SERIES_TWO, ...)
                 ... ;
         
        The request payload is provided in case there are request filtering parameters.
        Parameters:
        cm - the chart model
        payload - request payload