Package org.jboss.dashboard.dataset

Examples of org.jboss.dashboard.dataset.DataSet


        try {
            // Ensure data retrieved is refreshed.
            Chronometer crono = new Chronometer();
            crono.start();
            DataSet ds = dataProvider.refreshDataSet();
            crono.stop();
            elapsedTime = crono.elapsedTime();
            nrows = 0;
            if (ds != null && ds.getProperties().length > 0) nrows = ds.getRowCount();
            loadAttemptOk = true;
        } catch (Exception e) {
            throw new Exception(e.getMessage() != null ? e.getMessage() : getErrorMessage("error5") );
        }
        return null;
View Full Code Here


            }
            if (isTestConfigButtonPressed()) return;

            // Merge property configurations.
            DataProvider dpDO = getDataProvider();
            DataSet newDataSetConfigured = dpDO.getDataSet(); // Cached data set with properties configured (deserialized).
            DataSet newDataSetNotConfigured = dpDO.refreshDataSet(); // New data set. No configuration applied to it's properties.
            DataProperty[] properties = newDataSetConfigured.getProperties();
            for (int i = 0; i < properties.length; i++) {
                DataProperty configuredProperty = properties[i];
                DataProperty notConfiguredProperty = newDataSetNotConfigured.getPropertyById(configuredProperty.getPropertyId());

                Domain oldDomain = configuredProperty.getDomain();
                if (!(oldDomain instanceof LabelDomain && ((LabelDomain) oldDomain).isConvertedFromNumeric())) {
                    configuredProperty.setDomain(notConfiguredProperty.getDomain());
                }
View Full Code Here

        try {
            if (dataSource != null) sqlLoader.setDataSource(dataSource);
            sqlLoader.setSQLQuery(sqlQuery);

            Chronometer crono = new Chronometer(); crono.start();
            DataSet ds = dataProvider.refreshDataSet();
            crono.stop();
            elapsedTime = crono.elapsedTime();
            nrows = 0;
            if (ds != null && ds.getProperties().length > 0) nrows = ds.getRowCount();
            loadAttemptOk = true;
        } catch (Exception e) {
            Throwable cause = ErrorManager.lookup().getRootCause(e);
            throw new Exception(!StringUtils.isBlank(cause.getMessage()) ? cause.getMessage() : getErrorMessage("query.error") );
        }
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

     * 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

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.