Package org.dashbuilder.dataset

Examples of org.dashbuilder.dataset.DataSet


    @Inject
    protected SharedDataSetOpEngine dataSetOpEngine;

    public DataSet createDataSet(String uuid) {
        DataSet dataSet = DataSetFactory.newDataSet();
        dataSet.setUUID(uuid);
        return dataSet;
    }
View Full Code Here


        return index.getDataSet();
    }

    public DataSetMetadata getDataSetMetadata(String uuid) {
        DataSet dataSet = getDataSet(uuid);
        if (dataSet == null) return null;

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

        if (StringUtils.isEmpty(uuid)) return null;

        // Get the target data set
        DataSetIndex dataSetIndex = fetchDataSet(uuid);
        if (dataSetIndex == null) return null;
        DataSet dataSet = dataSetIndex.getDataSet();

        // Apply the list of operations specified (if any).
        if (!lookup.getOperationList().isEmpty()) {
            dataSet = dataSetOpEngine.execute(dataSetIndex.getDataSet(), lookup.getOperationList());
        }

        // Trim the data set as requested.
        dataSet = dataSet.trim(lookup.getRowOffset(), lookup.getNumberOfRows());
        return dataSet;
    }
View Full Code Here

        }
        return result;
    }

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

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

    @PostConstruct
    private void init() {
        // 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

    }

    @Inject SharedDataSetOpEngine dataSetOpEngine;

    public DataSet createDataSet(String uuid) {
        DataSet dataSet = DataSetFactory.newDataSet();
        dataSet.setUUID(uuid);
        return dataSet;
    }
View Full Code Here

            dataSetOpEngine.getIndexRegistry().put(dataSet);
        }
    }

    public DataSet removeDataSet(String uuid) {
        DataSet dataSet = getDataSet(uuid);
        dataSetOpEngine.getIndexRegistry().remove(uuid);
        return dataSet;
    }
View Full Code Here

        dataSetOpEngine.getIndexRegistry().remove(uuid);
        return dataSet;
    }

    public DataSetMetadata getDataSetMetadata(String uuid) {
        DataSet dataSet = getDataSet(uuid);
        if (dataSet == null) return null;

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

        if (StringUtils.isEmpty(uuid)) return null;

        // Get the target data set
        DataSetIndex dataSetIndex = dataSetOpEngine.getIndexRegistry().get(uuid);
        if (dataSetIndex == null) return null;
        DataSet dataSet = dataSetIndex.getDataSet();

        // Apply the list of operations specified (if any).
        if (!lookup.getOperationList().isEmpty()) {
            dataSet = dataSetOpEngine.execute(dataSetIndex.getDataSet(), lookup.getOperationList());
        }

        // Trim the data set as requested.
        dataSet = dataSet.trim(lookup.getRowOffset(), lookup.getNumberOfRows());
        return dataSet;
    }
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.