Package org.jboss.dashboard.provider

Examples of org.jboss.dashboard.provider.DataProperty


    }

    public int getPropertyColumn(DataProperty p) {
        if (p == null) return -1;
        for (int column = 0; column < properties.length; column++) {
            DataProperty property = properties[column];
            if (property == p) return column;
        }
        for (int column = 0; column < properties.length; column++) {
            DataProperty property = properties[column];
            if (property.equals(p)) return column;
        }
        return -1;
    }
View Full Code Here


    }

    public DataProperty getPropertyById(String id) {
        if (id == null) return null;
        for (int i = 0; properties != null && i < properties.length; i++) {
            DataProperty property = properties[i];
            if (property.getPropertyId().equalsIgnoreCase(id)) return property;
        }
        return null;
    }
View Full Code Here

        // Create the result data set instance.
        DefaultDataSet _result = new DefaultDataSet(provider);
        _result.setPropertySize(propertyValues.length);
        for (int j=0; j<propertyValues.length; j++) {
            DataProperty dataProp = getPropertyByColumn(j);
            DataProperty _prop = dataProp.cloneProperty();
            _result.addProperty(_prop, j);
        }

        // Get only the subset of rows to be analyzed.
        Set<Integer> targetRows = preProcessFilter(targetFilter);
View Full Code Here

        // Populate the dataset with the calculations.
        int pivotColumn = -1;
        for (int j=0; j<columns.length; j++) {

            // Create a new data property for each target column.
            DataProperty dataProp = getPropertyByColumn(columns[j]);
            DataProperty _prop = dataProp.cloneProperty();
            _result.addProperty(_prop, j);

            if (pivotColumn == -1 && groupByProperty.equals(dataProp)) {
                _prop.setDomain(new LabelDomain());
                pivotColumn = j;

                // The row values for the pivot column are the own interval instances.
                for (Interval interval : intervals) {
                    _result.addRowValue(j, interval);
                }
            } else {
                // The values for other columns is a scalar function applied on the interval's values.
                ScalarFunctionManager scalarFunctionManager = DataProviderServices.lookup().getScalarFunctionManager();
                ScalarFunction function = scalarFunctionManager.getScalarFunctionByCode(functionCodes[j]);
                for (Interval interval : intervals) {
                    Double scalar = calculateScalar(interval, dataProp, function);
                    _result.addRowValue(j, scalar);
                }
                // After calculations, ensure the new property domain is numeric.
                _prop.setDomain(new NumericDomain());
            }
        }

        // Sort the resulting data set according to the sort order specified.
        if (sortOrder != 0) {
View Full Code Here

    public DataSet groupByLabel(DataProperty groupByProperty, int[] columns, String[] functionCodes, int sortIndex, int sortOrder) {
        // Create the result data set instance.
        DefaultDataSet _result = new DefaultDataSet(provider);
        _result.setPropertySize(columns.length);
        DataProperty _pivotProp = groupByProperty.cloneProperty();

        // Get the pivot column
        int pivotColumn = -1;
        for (int j=0; j<columns.length; j++) {
            DataProperty dataProp = getPropertyByColumn(columns[j]);
            if (pivotColumn == -1 && groupByProperty.equals(dataProp)) {
                pivotColumn = j;
                break;
            }
        }

        // Get the indexed labels
        int groupByColumn = getPropertyColumn(groupByProperty);
        List<DistinctValue> _distinctValues = index.getDistinctValues(groupByColumn);
        List<DistinctValue> _sortedValues = new ArrayList(_distinctValues);
        if (sortOrder != 0) {
            if (sortIndex < 0 || sortIndex == pivotColumn) index.sortByValue(_sortedValues, sortOrder);
            else index.sortByScalar(_sortedValues, functionCodes[sortIndex], columns[sortIndex], sortOrder);
        }

        // Build the label interval set from the sorted list of distinct values.
        LabelDomain _pivotDomain = (LabelDomain) _pivotProp.getDomain();
        List<Interval> intervals = _pivotDomain.getIntervals(_sortedValues);

        // Populate the dataset with the calculations.
        for (int j=0; j<columns.length; j++) {
            DataProperty dataProp = getPropertyByColumn(columns[j]);

            if (j == pivotColumn) {
                _result.addProperty(_pivotProp, j);

                // The row values for the pivot column are the own interval instances.
                for (Interval interval : intervals) {
                    _result.addRowValue(j, interval);
                }
            } else {
                DataProperty _prop = dataProp.cloneProperty();
                _result.addProperty(_prop, j);

                // The values for other columns is a scalar function applied on the interval's values.
                ScalarFunctionManager scalarFunctionManager = DataProviderServices.lookup().getScalarFunctionManager();
                ScalarFunction function = scalarFunctionManager.getScalarFunctionByCode(functionCodes[j]);
                for (Interval interval : intervals) {
                    Double scalar = calculateScalar(interval, dataProp, function);
                    _result.addRowValue(j, scalar);
                }
                // After calculations, ensure the new property domain is numeric.
                _prop.setDomain(new NumericDomain());
            }
        }
        return _result;
    }
View Full Code Here

        printIndent(out, indent++);
        out.println("<dataproperties>");

        DataProperty[] properties = getProperties();
        for (int i = 0; i < properties.length; i++) {
            DataProperty property = properties[i];
            printIndent(out, indent++);
            out.println("<dataproperty id=\"" + StringEscapeUtils.escapeXml(property.getPropertyId()) + "\">");
            printIndent(out, indent);
            Domain domain = property.getDomain();
            String convertedFromNumeric = "";
            if (domain instanceof LabelDomain && ((LabelDomain)domain).isConvertedFromNumeric()) convertedFromNumeric = " convertedFromNumeric=\"true\" ";
            out.println("<domain" + convertedFromNumeric + ">" + StringEscapeUtils.escapeXml(property.getDomain().getClass().getName()) + "</domain>");
            Map names = property.getNameI18nMap();
            if (names != null) {
                Iterator it = names.keySet().iterator();
                while (it.hasNext()) {
                    Locale locale = (Locale) it.next();
                    printIndent(out, indent);
View Full Code Here

    public void parseXMLProperties(NodeList nodes) throws Exception {
        for (int x = 0; x < nodes.getLength(); x++) {
            Node node = nodes.item(x);
            if (node.getNodeName().equals("dataproperty")) {
                String idDataProperty = StringEscapeUtils.unescapeXml(node.getAttributes().getNamedItem("id").getNodeValue());
                DataProperty property = getPropertyById(idDataProperty);
                if (property == null) continue; // Be aware of deleted properties.

                NodeList dataProperties = node.getChildNodes();
                for (int y = 0; y < dataProperties.getLength(); y++) {
                    Node dataProperty = dataProperties.item(y);
                    if (dataProperty.getNodeName().equals("domain")) {
                        Domain domain = (Domain) Class.forName(StringEscapeUtils.unescapeXml(dataProperty.getFirstChild().getNodeValue())).newInstance();
                        if (dataProperty.getAttributes().getNamedItem("convertedFromNumeric") != null) ((LabelDomain) domain).setConvertedFromNumeric(true);
                        property.setDomain(domain);
                    }
                    if (dataProperty.getNodeName().equals("name")) {
                        String lang = dataProperty.getAttributes().getNamedItem("language").getNodeValue();
                        String desc = StringEscapeUtils.unescapeXml(dataProperty.getFirstChild().getNodeValue());
                        property.setName(desc, new Locale(lang));
                    }
                }
            }
        }
    }
View Full Code Here

    public static final String PARAM_ACTION = "applyLink";
    public static final String PARAM_NSERIE = "serie";

    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

        while (dashboard != null) {
            Iterator it = dashboard.getDataProviders().iterator();
            while (it.hasNext()) {
                DataProvider provider = (DataProvider) it.next();
                try {
                    DataProperty p = provider.getDataSet().getPropertyById(propertyId);
                    if (p != null) return p;
                } catch (Exception e) {
                    log.error("Dashboard provider dataset load: " + provider.getCode(), e);
                    continue;
                }
View Full Code Here

        int rowIndex = Integer.parseInt(request.getRequestObject().getParameter("rowindex"));
        int columnIndex = Integer.parseInt(request.getRequestObject().getParameter("columnindex"));

        DataSetTable dataSetTable = (DataSetTable) getTable();
        DataProperty selectedProperty = dataSetTable.getDataProperty(columnIndex);
        Dashboard dashboard = DashboardHandler.lookup().getCurrentDashboard();
        Object selectedValue = dataSetTable.getValueAt(rowIndex, columnIndex);
        if (selectedValue instanceof Interval) {
            if (dashboard.filter(selectedProperty.getPropertyId(), (Interval) selectedValue, FilterByCriteria.ALLOW_ANY)) {
                // If drill-down then force the whole screen to be refreshed.
                return new ShowCurrentScreenResponse();
            }
        } else {
            Collection values = new ArrayList();
            values.add(selectedValue);
            if (dashboard.filter(selectedProperty.getPropertyId(), null, false, null, false, values, FilterByCriteria.ALLOW_ANY)) {
                // If drill-down then force the whole screen to be refreshed.
                return new ShowCurrentScreenResponse();
            }
        }
        return null;
View Full Code Here

TOP

Related Classes of org.jboss.dashboard.provider.DataProperty

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.