Package org.jboss.dashboard.dataset

Examples of org.jboss.dashboard.dataset.DataSet


     * 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 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

            // Apply the in-memory filter in order to cover all the filter properties non specified as SQL conditions.
            DataFilter _remainingFilter = (DataFilter) filter.cloneFilter();
            List<String> propIds = currentStatement.getFilterPropertyIds();
            for (String propId : propIds) _remainingFilter.removeProperty(propId);
            DataSet result = sqlDataSet._filterInMemory(_remainingFilter);

            // If the in-memory filter applies then return it.
            if (result != null) return result;
            return sqlDataSet;
        }
View Full Code Here

    public CommandResponse actionApplyLink(CommandRequest request) throws Exception {
        AbstractChartDisplayer abstractChartDisplayer = (AbstractChartDisplayer) getDataDisplayer();
        DataProperty property = abstractChartDisplayer.getDomainProperty();
        Integer series = Integer.decode(request.getRequestObject().getParameter(PARAM_NSERIE));
        DataSet dataSet = abstractChartDisplayer.buildXYDataSet();
        Interval interval = (Interval) dataSet.getValueAt(series, 0);
        Dashboard dashboard = DashboardHandler.lookup().getCurrentDashboard();
        if (dashboard.filter(property.getPropertyId(), interval, FilterByCriteria.ALLOW_ANY)) {
            return new ShowCurrentScreenResponse();
        }
        return null;
View Full Code Here

    public CommandResponse actionApplyLink(CommandRequest request) throws Exception {
        AbstractChartDisplayer abstractChartDisplayer = (AbstractChartDisplayer) getDataDisplayer();
        DataProperty property = abstractChartDisplayer.getDomainProperty();
        Integer series = Integer.decode(request.getRequestObject().getParameter(PARAM_NSERIE));
        DataSet dataSet = abstractChartDisplayer.buildXYDataSet();
        Interval interval = (Interval) dataSet.getValueAt(series, 0);
        Dashboard dashboard = DashboardHandler.lookup().getCurrentDashboard();
        if (dashboard.filter(property.getPropertyId(), interval, FilterByCriteria.ALLOW_ANY)) {
            return new ShowCurrentScreenResponse();
        }
        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

                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

    public static final String RANGE_SAVE_BUTTON_PRESSED = "updateRangeDetails";

    public CommandResponse actionSubmit(CommandRequest request) throws Exception {
        AbstractChartDisplayer displayer = (AbstractChartDisplayer) getDataDisplayer();
        if (!displayer.getDataProvider().isReady()) return null;
        DataSet ds = displayer.getDataProvider().getDataSet();

        // Renderer
        String rendererUid = request.getRequestObject().getParameter("rendererUid");
        DataDisplayerRenderer renderer = DataDisplayerServices.lookup().getDataDisplayerManager().getDisplayerRendererByUid(rendererUid);
        if (renderer == null) return null;
        displayer.setDataDisplayerRenderer(renderer);

        // New domain and range properties.
        String idDomainDetails = request.getRequestObject().getParameter("idDomainDetails");
        if (idDomainDetails != null) {

            // If the domain property has been changed, load it.
            DataProperty domainProperty = displayer.getDomainProperty();
            if (!idDomainDetails.equals(domainProperty.getPropertyId())) displayer.setDomainProperty(ds.getPropertyById(idDomainDetails));

            // If domain save button has been pressed, update its configuration parameters
            // TODO: Also save if the enter key has been pressed.
            String domainSaveButtonPressed = request.getRequestObject().getParameter(DOMAIN_SAVE_BUTTON_PRESSED);
            boolean updateDomainDetails =  (domainSaveButtonPressed != null) && Boolean.valueOf(domainSaveButtonPressed).booleanValue();
            if (updateDomainDetails) {
                DomainConfiguration domainConfig = new DomainConfiguration();
                DomainConfigurationParser parser = new DomainConfigurationParser(domainConfig);
                parser.parse(request);
                domainConfig.setPropertyId(idDomainDetails);
                domainConfig.apply(displayer.getDomainProperty());
            }
        }

        String idRangeDetails = request.getRequestObject().getParameter("idRangeDetails");
        if (idRangeDetails != null) {

            // If the range property has been changed, load it.
            DataProperty rangeProperty = displayer.getRangeProperty();
            if (!idRangeDetails.equals(rangeProperty.getPropertyId())) displayer.setRangeProperty(ds.getPropertyById(idRangeDetails));

            // If range save button has been pressed, update its configuration parameters.
            String rangeSaveButtonPressed = request.getRequestObject().getParameter(RANGE_SAVE_BUTTON_PRESSED);
            boolean updateRangeDetails =  (rangeSaveButtonPressed != null) && Boolean.valueOf(rangeSaveButtonPressed).booleanValue();
            // TODO: Also save if the enter key has been pressed.
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

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.