Package org.jboss.dashboard.dataset

Examples of org.jboss.dashboard.dataset.DataSet


        return resultsDataProperty;
    }

    public boolean hasDataSetChanged(DataProperty property) {
        try {
            DataSet ds1 = dataProvider.getDataSet();
            DataSet ds2 = property.getDataSet();
            return (ds1 != ds2 || ds1.getRowCount() != ds2.getRowCount());
        } catch (Exception e) {
            log.error("Error getting data set.", e);
        }
        return false;
    }
View Full Code Here


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

                // If a domain is currently configured the try to get the property form that.
                if (domainConfig != null) domainProperty = dataSet.getPropertyById(domainConfig.getPropertyId());

                // If the property has been removed for any reason then reset the domain.
                if (domainProperty == null && domainConfig != null) domainConfig = null;
                if (domainProperty == null) domainProperty = getDomainPropertiesAvailable()[0];

View Full Code Here

     * 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 void setShowLabelsXAxis(boolean showLabelsXAxis) {
        this.showLabelsXAxis = showLabelsXAxis;
    }

    public DataSet buildXYDataSet() {
        DataSet targetDataSet = null;
        DataProperty domainProperty = getDomainProperty();
        DataProperty rangeProperty = getRangeProperty();
        ScalarFunction scalarFunction = getRangeScalarFunction();
        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. Thus the scalar function is applied to the range values.
            DataSet sourceDataSet = domainProperty.getDataSet();
            List<DataProperty> targetDataProps = Arrays.asList(new DataProperty[]{domainProperty, rangeProperty});
            List<String> targetFunctionCodes = Arrays.asList(new String[]{CountFunction.CODE, scalarFunction.getCode()});
            targetDataSet = sourceDataSet.groupBy(domainProperty, targetDataProps, targetFunctionCodes);

            // Sort the resulting data set according to the sort policy specified.
            if (intervalsSortOrder != INTERVALS_SORT_ORDER_NONE) {
                DataSetComparator comp = new DataSetComparator();
                comp.addSortCriteria(Integer.toString(intervalsSortCriteria), intervalsSortOrder);
View Full Code Here

        }
        return null;
    }

    public DataProperty getGroupByProperty() {
        DataSet originalDataSet = getOriginalDataSet();
        if (originalDataSet == null) return null;
       
        // If the group by property is null or it disappears from the data set then reload it from persistence.
        if (groupByProperty == null || originalDataSet.getPropertyById(groupByProperty.getPropertyId()) == null)  {
            if (groupByConfig != null) {
                groupByProperty = originalDataSet.getPropertyById(groupByConfig.getPropertyId());
                if (groupByProperty != null) {
                    groupByProperty = groupByProperty.cloneProperty();
                    groupByConfig.apply(groupByProperty);
                }
            }
View Full Code Here

    public boolean isNonGroupByColumn(int columnIndex) {
        if (groupByProperty == null) return true;
         if (columnIndex > getColumnCount()) return true;

        DataSetTableModel model = (DataSetTableModel) super.getModel();
        DataSet groupByDataSet = model.getDataSet();
        DataProperty prop = groupByDataSet.getProperties()[columnIndex];
        return !groupByProperty.equals(prop);
    }
View Full Code Here

    public int[] getNonGroupByColumnIndexes() {
        if (groupByProperty == null) return new int[] {};

        List temp = new ArrayList();
        DataSetTableModel model = (DataSetTableModel) super.getModel();
        DataSet groupByDataSet = model.getDataSet();
        DataProperty[] tableProps = groupByDataSet.getProperties();
        for (int i=0; i<getColumnCount(); i++) {
            if (!groupByProperty.equals(tableProps[i])) temp.add(new Integer(i));
        }
        int [] results = new int[temp.size()];
        for (int i = 0; i < results.length; i++) results[i] = ((Integer) temp.get(i)).intValue();
View Full Code Here

    protected void catchDataSetChanges() {
        if (dataProvider == null) return;
        try {
            // Be aware of the dataset changes.
            DataSet uptodateDataSet = dataProvider.getDataSet();
            boolean dataSetChanged = (dataSet != null && (dataSet != uptodateDataSet || dataSetRowCount != uptodateDataSet.getRowCount()));
            dataSet = uptodateDataSet;

            // If the data set is updated then refresh the current group by (if any).
            if (dataSetChanged) {
                currentPage = 1;
View Full Code Here

    protected DataSet groupByDataSet(DataProperty groupByProperty) {
        // Performance log.
        log.debug("Creating the group by data set.");

        DataSet originalDataSet = getOriginalDataSet();
        int[] columns = new int [getColumnCount()];
        String[] functions = new String[getColumnCount()];
        for (int i=0; i<getColumnCount(); i++) {
            columns[i] = originalDataSet.getPropertyColumn(getOriginalDataProperty(i));
            functions[i] = getGroupByFunctionCode(i);
        }
        return originalDataSet.groupBy(groupByProperty, columns, functions);
    }
View Full Code Here

        return resultsDataProperty;
    }

    public boolean hasDataSetChanged(DataProperty property) {
        try {
            DataSet ds1 = dataProvider.getDataSet();
            DataSet ds2 = property.getDataSet();
            return (ds1 != ds2 || ds1.getRowCount() != ds2.getRowCount());
        } catch (Exception e) {
            log.error("Error getting data set.", e);
        }
        return false;
    }
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.