Package org.dashbuilder.dataset

Examples of org.dashbuilder.dataset.DataSet


        }
        return result;
    }

    public DataSetMetadata lookupDataSetMetadata(DataSetLookup lookup) {
        DataSet dataSet = lookupDataSet(lookup);
        if (dataSet == null) return null;

        return dataSet.getMetadata();
    }
View Full Code Here


     */
    public void lookupDataSet(final DataSetLookup request, final DataSetReadyCallback listener) throws Exception {

        // Look always into the client data set manager.
        if (clientDataSetManager.getDataSet(request.getDataSetUUID()) != null) {
            DataSet dataSet = clientDataSetManager.lookupDataSet(request);
            listener.callback(dataSet);
        }
        // If the data set is not in client, then look up remotely (only if the remote access is available).
        else if (dataSetLookupService != null) {

View Full Code Here

    private void onDataSetRegistered(@Observes DataSetBackendRegisteredEvent event) {

        // Remove stale data. This will force next lookup requests to push a refreshed data set.
        checkNotNull("event", event);
        String uuid = event.getDataSetMetadata().getUUID();
        DataSet clientDataSet = clientDataSetManager.removeDataSet(uuid);

        // If the data set existed on client then an out of date event is fired.
        if (clientDataSet != null) {
            dataSetModifiedEvent.fire(new DataSetModifiedEvent(clientDataSet.getMetadata()));
        }
    }
View Full Code Here

            clientDataSetManager.registerDataSet(dataSet);
            notification.fire(new NotificationEvent( DataSetConstants.INSTANCE.dsLookupClient_successfullyLoaded(), SUCCESS));

            for (DataSetLookupListenerPair pair : listenerList) {
                DataSet result = clientDataSetManager.lookupDataSet(pair.lookup);
                pair.listener.callback(result);
            }
        }
View Full Code Here

@ApplicationScoped
public class CollectionsDataSetSort implements DataSetSortAlgorithm {


    public List<Integer> sort(DataSetHandler ctx, List<ColumnSort> columnSortList) {
        DataSet dataSet = ctx.getDataSet();

        // Create the comparator.
        DataSetRowComparator comparator = new DataSetRowComparator();
        for (ColumnSort columnSort : columnSortList) {
            DataColumn column = dataSet.getColumnById(columnSort.getColumnId());
            if (column == null) throw new IllegalArgumentException("Column not found in data set: " + columnSort.getColumnId());

            comparator.criteria(column, columnSort.getOrder());
        }
        // Create the row number list to sort.
        List<Integer> rows = new ArrayList<Integer>();
        if (ctx != null && ctx.getRows() != null) {
            rows.addAll(ctx.getRows());
        } else {
            for (int i=0; i<dataSet.getRowCount(); i++) {
                rows.add(i);
            }
        }
        // Sort the row numbers.
        Collections.sort(rows, comparator);
View Full Code Here

        rendererLibLocator.setDefaultRenderer( DisplayerType.TABLE, GoogleRenderer.UUID);
        rendererLibLocator.setDefaultRenderer( DisplayerType.SELECTOR, SelectorRenderer.UUID);

        // Generate the data set to be used by the Showcase Gallery and by the Sales sample dashboards.
        Date currentDate = new Date();
        DataSet salesDataSet = salesDataSetGenerator.generateDataSet(SalesConstants.SALES_OPPS, 30, currentDate.getYear()-1, currentDate.getYear()+3);
        dataSetManager.registerDataSet(salesDataSet);
    }
View Full Code Here

        return opportunities;
    }

    public DataSet generateDataSet(String uuid, int opportunitiesPerMonth, int startYear, int endYear) {
        List<Opportunity> opportunities = randomOpportunities(opportunitiesPerMonth, startYear, endYear);
        DataSet dataSet = dataSetManager.createDataSet(uuid);

        dataSet.addColumn(AMOUNT, ColumnType.NUMBER);
        dataSet.addColumn(CREATION_DATE, ColumnType.DATE);
        dataSet.addColumn(CLOSING_DATE, ColumnType.DATE);
        dataSet.addColumn(PIPELINE, ColumnType.LABEL);
        dataSet.addColumn(STATUS, ColumnType.LABEL);
        dataSet.addColumn(CUSTOMER, ColumnType.LABEL);
        dataSet.addColumn(COUNTRY, ColumnType.LABEL);
        dataSet.addColumn(PRODUCT, ColumnType.LABEL);
        dataSet.addColumn(SALES_PERSON, ColumnType.LABEL);
        dataSet.addColumn(PROBABILITY, ColumnType.LABEL);
        dataSet.addColumn(SOURCE, ColumnType.LABEL);
        dataSet.addColumn(EXPECTED_AMOUNT, ColumnType.NUMBER);
        dataSet.addColumn(COLOR, ColumnType.LABEL);

        for (int i = 0; i < opportunities.size(); i++) {
            Opportunity opp = opportunities.get(i);
            dataSet.setValueAt(i, 0, opp.amount);
            dataSet.setValueAt(i, 1, opp.creationDate);
            dataSet.setValueAt(i, 2, opp.closingDate);
            dataSet.setValueAt(i, 3, opp.pipeline);
            dataSet.setValueAt(i, 4, opp.status);
            dataSet.setValueAt(i, 5, opp.customer);
            dataSet.setValueAt(i, 6, opp.country);
            dataSet.setValueAt(i, 7, opp.product);
            dataSet.setValueAt(i, 8, opp.salesPerson);
            dataSet.setValueAt(i, 9, opp.probability);
            dataSet.setValueAt(i, 10, opp.source);
            dataSet.setValueAt(i, 11, opp.expectedAmount);
            dataSet.setValueAt(i, 12, opp.color);
        }
        return dataSet;
    }
View Full Code Here

        displayer.setDisplayerSettings( target );

        // Check if a DataSet has been set instead of a DataSetLookup.
        DataSetLookup dataSetLookup = target.getDataSetLookup();
        if (target.getDataSet() != null) {
            DataSet dataSet = target.getDataSet();
            clientDataSetManager.registerDataSet(dataSet);
            dataSetLookup = new DataSetLookup(dataSet.getUUID());
        }

        DataSetHandler handler = new DataSetHandlerImpl(dataSetLookup);
        displayer.setDataSetHandler(handler);
        return displayer;
View Full Code Here

        public DataSet buildDataSet(InternalContext context) {
            if (context.index == null) {
                // If no index exists then just return the data set from context
                return context.dataSet;
            }
            DataSet result = _buildDataSet(context);
            context.dataSet = result;
            context.index = null;
            return result;
        }
View Full Code Here

        }

        private DataSet _buildDataSet(InternalContext context) {
            DataSetOp lastOp = context.lastOperation;
            DataSetIndexNode index = context.index;
            DataSet dataSet = context.dataSet;

            if (lastOp instanceof DataSetGroup) {
                DataSetGroup gOp = (DataSetGroup) lastOp;
                ColumnGroup columnGroup = gOp.getColumnGroup();
                if (columnGroup == null) {
                    return _buildDataSet(context, gOp.getGroupFunctions());
                } else {
                    if (!gOp.getSelectedIntervalNames().isEmpty() && gOp.getGroupFunctions().isEmpty()) {
                        return dataSet.trim(index.getRows());
                    } else {
                        return _buildDataSet(context, gOp);
                    }
                }
            }
            if (lastOp instanceof DataSetFilter) {
                return dataSet.trim(index.getRows());
            }
            if (lastOp instanceof DataSetSort) {
                DataSetImpl sortedDataSet = new DataSetImpl();
                for (DataColumn column : dataSet.getColumns()) {
                    SortedList sortedValues = new SortedList(column.getValues(), index.getRows());
                    sortedDataSet.addColumn(column.getId(), column.getColumnType(), sortedValues);
                }
                return sortedDataSet;
            }
View Full Code Here

TOP

Related Classes of org.dashbuilder.dataset.DataSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.