Package org.dashbuilder.displayer.client
Class DataSetHandlerImpl
- java.lang.Object
-
- org.dashbuilder.displayer.client.DataSetHandlerImpl
-
- All Implemented Interfaces:
DataSetHandler
- Direct Known Subclasses:
DataSetEditHandler
public class DataSetHandlerImpl extends Object implements DataSetHandler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classDataSetHandlerImpl.GroupOpFilter
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,List<DataSetHandlerImpl.GroupOpFilter>>_groupOpsAddedprotected Map<String,List<DataSetHandlerImpl.GroupOpFilter>>_groupOpsSelectedprotected org.dashbuilder.dataset.client.DataSetClientServicesclientServicesprotected org.dashbuilder.dataset.DataSetlastLookedUpDataSetprotected org.dashbuilder.dataset.DataSetLookuplookupBaseprotected org.dashbuilder.dataset.DataSetLookuplookupCurrent
-
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)booleandrillDown(org.dashbuilder.dataset.group.DataSetGroup op)Applies the specified group interval selection operation over the existing group op.booleandrillUp(org.dashbuilder.dataset.group.DataSetGroup op)Reverts the changes applied by a previous drillDown operation.voidexportCurrentDataSetLookup(ExportFormat format, int maxRows, ExportCallback callback, Map<String,String> columnNameMap)Export the current data set to a file in the specified output format.booleanfilter(org.dashbuilder.dataset.filter.DataSetFilter op)Forces the underlying data set to be updated according the specified filter.booleanfilter(org.dashbuilder.dataset.group.DataSetGroup op)Forces the underlying data set to be updated according the group interval selection filter.org.dashbuilder.dataset.DataSetLookupgetCurrentDataSetLookup()Get the current data set lookup (if any)org.dashbuilder.dataset.group.DataSetGroupgetGroupOperation(String columnId)Retrieves any group operation present in the current data set lookup for the target column specified.org.dashbuilder.dataset.group.IntervalgetInterval(String columnId, int row)Get the interval at the given row for the column specified.org.dashbuilder.dataset.DataSetgetLastDataSet()Get the data set get on the last lookup call (if any)voidlimitDataSetRows(int offset, int rows)Forces the next data set lookup request to retrieve only the specified row sub set.voidlookupDataSet(org.dashbuilder.dataset.client.DataSetReadyCallback callback)Executes the current data set lookup request configured within this handler.voidresetAllOperations()Restore the current data set lookup instance to its base status.voidsort(String columnId, org.dashbuilder.dataset.sort.SortOrder sortOrder)Set the sort order operation to apply to the data set.booleanunfilter(org.dashbuilder.dataset.filter.DataSetFilter op)Reverts the changes applied by a previous filter operation.booleanunfilter(org.dashbuilder.dataset.group.DataSetGroup op)Reverts the changes applied by a previous filter operation.booleanunsort()
-
-
-
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
-
_groupOpsAdded
protected Map<String,List<DataSetHandlerImpl.GroupOpFilter>> _groupOpsAdded
-
_groupOpsSelected
protected Map<String,List<DataSetHandlerImpl.GroupOpFilter>> _groupOpsSelected
-
-
Method Detail
-
getLastDataSet
public org.dashbuilder.dataset.DataSet getLastDataSet()
Description copied from interface:DataSetHandlerGet the data set get on the last lookup call (if any)- Specified by:
getLastDataSetin interfaceDataSetHandler
-
getCurrentDataSetLookup
public org.dashbuilder.dataset.DataSetLookup getCurrentDataSetLookup()
Description copied from interface:DataSetHandlerGet the current data set lookup (if any)- Specified by:
getCurrentDataSetLookupin interfaceDataSetHandler
-
resetAllOperations
public void resetAllOperations()
Description copied from interface:DataSetHandlerRestore the current data set lookup instance to its base status.- Specified by:
resetAllOperationsin interfaceDataSetHandler
-
limitDataSetRows
public void limitDataSetRows(int offset, int rows)Description copied from interface:DataSetHandlerForces the next data set lookup request to retrieve only the specified row sub set.- Specified by:
limitDataSetRowsin interfaceDataSetHandler- 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:DataSetHandlerRetrieves any group operation present in the current data set lookup for the target column specified.- Specified by:
getGroupOperationin interfaceDataSetHandler- 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:DataSetHandlerForces the underlying data set to be updated according the group interval selection filter.- Specified by:
filterin interfaceDataSetHandler- 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:DataSetHandlerForces the underlying data set to be updated according the specified filter.- Specified by:
filterin interfaceDataSetHandler- 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:DataSetHandlerApplies the specified group interval selection operation over the existing group op.- Specified by:
drillDownin interfaceDataSetHandler- 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:DataSetHandlerReverts the changes applied by a previous filter operation.- Specified by:
unfilterin interfaceDataSetHandler- 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:DataSetHandlerReverts the changes applied by a previous filter operation.- Specified by:
unfilterin interfaceDataSetHandler- 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:DataSetHandlerReverts the changes applied by a previous drillDown operation.- Specified by:
drillUpin interfaceDataSetHandler- 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:DataSetHandlerSet the sort order operation to apply to the data set.- Specified by:
sortin interfaceDataSetHandler- 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 ExceptionDescription copied from interface:DataSetHandlerExecutes the current data set lookup request configured within this handler.- Specified by:
lookupDataSetin interfaceDataSetHandler- 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:DataSetHandlerGet 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:
getIntervalin interfaceDataSetHandler- 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:DataSetHandlerExport the current data set to a file in the specified output format.- Specified by:
exportCurrentDataSetLookupin interfaceDataSetHandler- Parameters:
format- The output formatmaxRows- Max rows to be exported.callback- The callback instance to be notifiedcolumnNameMap- 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)
-
-