Class DataSetHandlerImpl

    • Constructor Summary

      Constructors 
      Constructor Description
      DataSetHandlerImpl​(org.dashbuilder.dataset.client.DataSetClientServices clientServices, org.dashbuilder.dataset.DataSetLookup lookup)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void _filter​(int index, org.dashbuilder.dataset.group.DataSetGroup op, boolean drillDown)  
      protected String _getSourceColumnId​(String columnId)  
      protected void _select​(org.dashbuilder.dataset.group.DataSetGroup op, List<org.dashbuilder.dataset.group.Interval> intervalList)  
      protected boolean _unfilter​(org.dashbuilder.dataset.group.DataSetGroup op, boolean drillDown)  
      boolean drillDown​(org.dashbuilder.dataset.group.DataSetGroup op)
      Applies the specified group interval selection operation over the existing group op.
      boolean drillUp​(org.dashbuilder.dataset.group.DataSetGroup op)
      Reverts the changes applied by a previous drillDown operation.
      void exportCurrentDataSetLookup​(ExportFormat format, int maxRows, ExportCallback callback, Map<String,​String> columnNameMap)
      Export the current data set to a file in the specified output format.
      boolean filter​(org.dashbuilder.dataset.filter.DataSetFilter op)
      Forces the underlying data set to be updated according the specified filter.
      boolean filter​(org.dashbuilder.dataset.group.DataSetGroup op)
      Forces the underlying data set to be updated according the group interval selection filter.
      org.dashbuilder.dataset.DataSetLookup getCurrentDataSetLookup()
      Get the current data set lookup (if any)
      org.dashbuilder.dataset.group.DataSetGroup getGroupOperation​(String columnId)
      Retrieves any group operation present in the current data set lookup for the target column specified.
      org.dashbuilder.dataset.group.Interval getInterval​(String columnId, int row)
      Get the interval at the given row for the column specified.
      org.dashbuilder.dataset.DataSet getLastDataSet()
      Get the data set get on the last lookup call (if any)
      void limitDataSetRows​(int offset, int rows)
      Forces the next data set lookup request to retrieve only the specified row sub set.
      void lookupDataSet​(org.dashbuilder.dataset.client.DataSetReadyCallback callback)
      Executes the current data set lookup request configured within this handler.
      void resetAllOperations()
      Restore the current data set lookup instance to its base status.
      void sort​(String columnId, org.dashbuilder.dataset.sort.SortOrder sortOrder)
      Set the sort order operation to apply to the data set.
      boolean unfilter​(org.dashbuilder.dataset.filter.DataSetFilter op)
      Reverts the changes applied by a previous filter operation.
      boolean unfilter​(org.dashbuilder.dataset.group.DataSetGroup op)
      Reverts the changes applied by a previous filter operation.
      boolean unsort()  
    • Field Detail

      • clientServices

        protected org.dashbuilder.dataset.client.DataSetClientServices clientServices
      • lookupBase

        protected org.dashbuilder.dataset.DataSetLookup lookupBase
      • lookupCurrent

        protected org.dashbuilder.dataset.DataSetLookup lookupCurrent
      • lastLookedUpDataSet

        protected org.dashbuilder.dataset.DataSet lastLookedUpDataSet
    • Constructor Detail

      • DataSetHandlerImpl

        public DataSetHandlerImpl​(org.dashbuilder.dataset.client.DataSetClientServices clientServices,
                                  org.dashbuilder.dataset.DataSetLookup lookup)
    • Method Detail

      • getLastDataSet

        public org.dashbuilder.dataset.DataSet getLastDataSet()
        Description copied from interface: DataSetHandler
        Get the data set get on the last lookup call (if any)
        Specified by:
        getLastDataSet in interface DataSetHandler
      • getCurrentDataSetLookup

        public org.dashbuilder.dataset.DataSetLookup getCurrentDataSetLookup()
        Description copied from interface: DataSetHandler
        Get the current data set lookup (if any)
        Specified by:
        getCurrentDataSetLookup in interface DataSetHandler
      • resetAllOperations

        public void resetAllOperations()
        Description copied from interface: DataSetHandler
        Restore the current data set lookup instance to its base status.
        Specified by:
        resetAllOperations in interface DataSetHandler
      • limitDataSetRows

        public void limitDataSetRows​(int offset,
                                     int rows)
        Description copied from interface: DataSetHandler
        Forces the next data set lookup request to retrieve only the specified row sub set.
        Specified by:
        limitDataSetRows in interface DataSetHandler
        Parameters:
        offset - The position where the row sub set starts.
        rows - The number of rows to get.
      • getGroupOperation

        public org.dashbuilder.dataset.group.DataSetGroup getGroupOperation​(String columnId)
        Description copied from interface: DataSetHandler
        Retrieves any group operation present in the current data set lookup for the target column specified.
        Specified by:
        getGroupOperation in interface DataSetHandler
        Parameters:
        columnId - The column id. to look for.
        Returns:
        The group operation that matches the given column id. Or null if no operation is found.
      • filter

        public boolean filter​(org.dashbuilder.dataset.group.DataSetGroup op)
        Description copied from interface: DataSetHandler
        Forces the underlying data set to be updated according the group interval selection filter.
        Specified by:
        filter in interface DataSetHandler
        Parameters:
        op - The group interval selection operation to apply op.getSelectedIntervalNames() MUST NOT BE EMPTY.
        Returns:
        false, if the target interval selection has already been applied - true, otherwise.
      • filter

        public boolean filter​(org.dashbuilder.dataset.filter.DataSetFilter op)
        Description copied from interface: DataSetHandler
        Forces the underlying data set to be updated according the specified filter.
        Specified by:
        filter in interface DataSetHandler
        Parameters:
        op - The filter operation to apply.
        Returns:
        false, if the filter requested has already been applied - true, otherwise.
      • drillDown

        public boolean drillDown​(org.dashbuilder.dataset.group.DataSetGroup op)
        Description copied from interface: DataSetHandler
        Applies the specified group interval selection operation over the existing group op.
        Specified by:
        drillDown in interface DataSetHandler
        Parameters:
        op - The group interval selection operation to apply op.getSelectedIntervalNames() MUST NOT BE EMPTY.
        Returns:
        false, if drillDown is not applicable for the target operation - true, otherwise.
      • unfilter

        public boolean unfilter​(org.dashbuilder.dataset.group.DataSetGroup op)
        Description copied from interface: DataSetHandler
        Reverts the changes applied by a previous filter operation.
        Specified by:
        unfilter in interface DataSetHandler
        Parameters:
        op - The operation to remove.
        Returns:
        false, if no filter has been applied for the target operation - true, otherwise.
      • unfilter

        public boolean unfilter​(org.dashbuilder.dataset.filter.DataSetFilter op)
        Description copied from interface: DataSetHandler
        Reverts the changes applied by a previous filter operation.
        Specified by:
        unfilter in interface DataSetHandler
        Parameters:
        op - The operation to remove.
        Returns:
        false, if no filter has been applied for the target operation - true, otherwise.
      • drillUp

        public boolean drillUp​(org.dashbuilder.dataset.group.DataSetGroup op)
        Description copied from interface: DataSetHandler
        Reverts the changes applied by a previous drillDown operation.
        Specified by:
        drillUp in interface DataSetHandler
        Parameters:
        op - The operation to remove.
        Returns:
        false, if no drillDown has been applied for the target operation - true, otherwise.
      • sort

        public void sort​(String columnId,
                         org.dashbuilder.dataset.sort.SortOrder sortOrder)
        Description copied from interface: DataSetHandler
        Set the sort order operation to apply to the data set.
        Specified by:
        sort in interface DataSetHandler
        Parameters:
        columnId - The name of the column to sort.
        sortOrder - The sort order.
      • unsort

        public boolean unsort()
      • lookupDataSet

        public void lookupDataSet​(org.dashbuilder.dataset.client.DataSetReadyCallback callback)
                           throws Exception
        Description copied from interface: DataSetHandler
        Executes the current data set lookup request configured within this handler.
        Specified by:
        lookupDataSet in interface DataSetHandler
        Parameters:
        callback - The callback interface that is invoked right after the data is available.
        Throws:
        Exception
      • getInterval

        public org.dashbuilder.dataset.group.Interval getInterval​(String columnId,
                                                                  int row)
        Description copied from interface: DataSetHandler
        Get the interval at the given row for the column specified.

        In case of grouped data sets, the interval may contain information related to the group operation. For instance, for a data set grouped by month, will return an interval containing the min/max dates of such month.

        For non-grouped or grouped by label data sets, will return only an interval with the value of the row/column selected.

        The interval information is useful for filtering purposes as the data provider needs all the information related to the selected interval.
        Specified by:
        getInterval in interface DataSetHandler
        Parameters:
        columnId - The column id.
        row - The row which interval we want to retrieve.
        Returns:
        An interval with information related to the target row/column. Or null, if
        • the column does not exist,
        • the row index is out of bounds,
        • or the value is null.
      • exportCurrentDataSetLookup

        public void exportCurrentDataSetLookup​(ExportFormat format,
                                               int maxRows,
                                               ExportCallback callback,
                                               Map<String,​String> columnNameMap)
        Description copied from interface: DataSetHandler
        Export the current data set to a file in the specified output format.
        Specified by:
        exportCurrentDataSetLookup in interface DataSetHandler
        Parameters:
        format - The output format
        maxRows - Max rows to be exported.
        callback - The callback instance to be notified
        columnNameMap - A map containing the column header names for every column in the data set lookup
      • _filter

        protected void _filter​(int index,
                               org.dashbuilder.dataset.group.DataSetGroup op,
                               boolean drillDown)
      • _select

        protected void _select​(org.dashbuilder.dataset.group.DataSetGroup op,
                               List<org.dashbuilder.dataset.group.Interval> intervalList)
      • _unfilter

        protected boolean _unfilter​(org.dashbuilder.dataset.group.DataSetGroup op,
                                    boolean drillDown)
      • _getSourceColumnId

        protected String _getSourceColumnId​(String columnId)