Package org.jboss.dashboard.dataset

Examples of org.jboss.dashboard.dataset.DataSet


     * Get the property selected as the range.
     */
    public DataProperty getRangeProperty() {
        try {
            // Get the range property. Be aware of both property removal and data set refresh.
            DataSet dataSet = dataProvider.getDataSet();
            if (rangeProperty == null || hasDataSetChanged(rangeProperty)) {

                // If a range is currently configured then try to get the property from that.
                if (rangeConfig != null) rangeProperty = dataSet.getPropertyById(rangeConfig.getPropertyId());

                // If the property has been removed for any reason then reset the range.
                if (rangeProperty == null && rangeConfig != null) rangeConfig = null;
                if (rangeProperty == null) rangeProperty = getRangePropertiesAvailable()[0];

View Full Code Here


    public DataSet buildXYDataSet() {
        DataProperty domainProperty = getDomainProperty();
        DataProperty rangeProperty = getRangeProperty();
        ScalarFunction scalarFunction = getRangeScalarFunction();
        DataSet sourceDataSet = domainProperty.getDataSet();
        CodeBlockTrace trace = new BuildXYDataSetTrace(domainProperty, rangeProperty, scalarFunction).begin();
        try {
            if (domainProperty == null || domainProperty.getDomain() == null) return null;
            if (rangeProperty == null || scalarFunction == null) return null;

            // Group the original data set by the domain property.
            int pivot = sourceDataSet.getPropertyColumn(domainProperty);
            int range = sourceDataSet.getPropertyColumn(rangeProperty);
            int[] columns = new int[] {pivot, range};
            String[] functionCodes = new String[] {CountFunction.CODE, scalarFunction.getCode()};
            return sourceDataSet.groupBy(domainProperty, columns, functionCodes, intervalsSortCriteria, intervalsSortOrder);
        } finally {
            trace.end();
        }
    }
View Full Code Here

        return methodStr;
    }

    public static String generateKPIValuesArray(KPI kpi) {

        DataSet dataSet = KPIHelper.getDataSet(kpi);
        if  (dataSet == null) return null;

        DataFormatterRegistry dataFormatterRegistry = DataFormatterRegistry.lookup();
        StringBuffer buf = new StringBuffer();
        buf.append("new String[][] {");
        for (int i = 0; i < dataSet.getRowCount(); i++) {
            buf.append("\n{");

            for (int j = 0; j < dataSet.getProperties().length; j++) {
                Object dataSetValue = dataSet.getValueAt(i, j);
                DataProperty prop = dataSet.getPropertyByColumn(j);
                DataPropertyFormatter propFormatter = dataFormatterRegistry.getPropertyFormatter(prop.getPropertyId());
                String displayedValue = propFormatter.formatValue(prop, dataSetValue, Locale.ENGLISH);

                if (j > 0) buf.append(",");
                buf.append("\"" + displayedValue + "\"");
            }
            buf.append("}");
            if (i < dataSet.getRowCount()-1) buf.append(",");
        }
        buf.append("}");
        return buf.toString();
    }
View Full Code Here

        // Calculate the data set to display.
        // Set the scalar function to apply for the calculations of the chart values.
        ScalarFunction scalarFunction = scalarFunctionManager.getScalarFunctionByCode(SumFunction.CODE);
        barChartDisplayer.setRangeScalarFunction(scalarFunction);
        DataSet xyDataSet = barChartDisplayer.buildXYDataSet();

        // Check the expected results matrix
        assertDataSetValues(xyDataSet, new String[][] {
                new String[] {"Engineering", "7,650.162"},
                new String[] {"Services", "2,504.5"},
                new String[] {"Sales", "3,213.53"},
                new String[] {"Support", "3,345.6"},
                new String[] {"Management", "6,017.47"}}, 0);


        // Sort by department and check the expected results.
        DataSetComparator comp = new DataSetComparator();
        comp.addSortCriteria("0", DataSetComparator.ORDER_DESCENDING);
        xyDataSet = xyDataSet.sort(comp);
        assertDataSetValues(xyDataSet, new String[][] {
                new String[] {"Support", "3,345.6"}}, 0);

        // Sort by amount and check the expected results.
        comp = new DataSetComparator();
        comp.addSortCriteria("1", DataSetComparator.ORDER_ASCENDING);
        xyDataSet = xyDataSet.sort(comp);
        assertDataSetValues(xyDataSet, new String[][]{
                new String[]{"Services", "2,504.5"}}, 0);

    }
View Full Code Here

    public KPI getKPIByCode(String kpiCode) {
        return context.getKPIByCode(kpiCode);
    }

    public void assertKPIValues(KPI kpi, String[][] values) throws Exception {
        DataSet dataSet = KPIHelper.getDataSet(kpi);
        if  (dataSet != null) {
            assertDataSetValues(dataSet, values, 0);
        }
    }
View Full Code Here

    // methods again to avoid a test failure.

    @Test // Auto-generated by KPITestMethodGenerator
    public void test_kpi_64061223773274641() throws Exception {
        KPI kpi = getKPIByCode("kpi_64061223773274641");
        DataSet dataSet = KPIHelper.getDataSet(kpi);
        if  (dataSet != null) {
            assertDataSetValues(dataSet, new String[][] {
                    {"1","Barcelona","Engineering","Roxie Foraker","12/11/12 12:00 AM","120.35"},
                    {"2","Barcelona","Engineering","Roxie Foraker","12/1/12 12:00 AM","1,100.1"},
                    {"3","Barcelona","Engineering","Roxie Foraker","11/1/12 12:00 AM","900.1"},
View Full Code Here

    }

    @Test // Auto-generated by KPITestMethodGenerator
    public void test_kpi_64011223773089901() throws Exception {
        KPI kpi = getKPIByCode("kpi_64011223773089901");
        DataSet dataSet = KPIHelper.getDataSet(kpi);
        if  (dataSet != null) {
            assertDataSetValues(dataSet, new String[][] {
                    {"January 2009","921.9"},
                    {"February 2009","700.66"},
                    {"March 2009","345.45"},
View Full Code Here

    }

    @Test // Auto-generated by KPITestMethodGenerator
    public void test_kpi_30301353506280659() throws Exception {
        KPI kpi = getKPIByCode("kpi_30301353506280659");
        DataSet dataSet = KPIHelper.getDataSet(kpi);
        if  (dataSet != null) {
            assertDataSetValues(dataSet, new String[][] {
                    {"Apr 2010","42,485,847.012"},
                    {"Jul 2010","51,622,861.461"},
                    {"Oct 2010","59,985,255.528"},
View Full Code Here

    }

    @Test // Auto-generated by KPITestMethodGenerator
    public void test_kpi_30361353506582145() throws Exception {
        KPI kpi = getKPIByCode("kpi_30361353506582145");
        DataSet dataSet = KPIHelper.getDataSet(kpi);
        if  (dataSet != null) {
            assertDataSetValues(dataSet, new String[][] {
                    {"WIN","2,467,342.049"},
                    {"VERBAL COMMITMENT","2,704,337.45"},
                    {"STANDBY","2,692,343.835"},
View Full Code Here

    }

    @Test // Auto-generated by KPITestMethodGenerator
    public void test_kpi_30651353683614640() throws Exception {
        KPI kpi = getKPIByCode("kpi_30651353683614640");
        DataSet dataSet = KPIHelper.getDataSet(kpi);
        if  (dataSet != null) {
            assertDataSetValues(dataSet, new String[][] {
                    {"Darryl Innes","2,669,089.546"},
                    {"Nita Marling","2,342,011.583"},
                    {"Roxie Foraker","2,659,589.977"},
View Full Code Here

TOP

Related Classes of org.jboss.dashboard.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.