Package org.rhq.enterprise.server.measurement.MeasurementPreferences

Examples of org.rhq.enterprise.server.measurement.MeasurementPreferences.MetricViewData


    public List<String> getCharts(Subject user, EntityContext context, String viewName) throws MeasurementViewException {
        try {
            String key = context.getLegacyKey();
            MeasurementPreferences measurementPreferences = new MeasurementPreferences(user);
            MetricViewData viewData = measurementPreferences.getMetricViewData(key, viewName);
            return viewData.charts;
        } catch (IllegalArgumentException iae) {
            // view with 'viewName' was not found, this is OK as the caller will handle creating it by default
            throw new MeasurementViewException("Could not find view " + viewName + " in context " + context);
        }
View Full Code Here


    }

    public void saveCharts(Subject user, EntityContext context, String viewName, List<String> charts) {
        String key = context.getLegacyKey();
        MeasurementPreferences measurementPreferences = new MeasurementPreferences(user);
        MetricViewData viewData = new MetricViewData();
        // don't even bother reading the current value out of the preferences, it's being overridden
        viewData.charts = charts;
        measurementPreferences.setMetricViewData(key, viewName, viewData);
    }
View Full Code Here

    }

    public void moveChartUp(Subject user, EntityContext context, String viewName, String viewKey) {
        String key = context.getLegacyKey();
        MeasurementPreferences measurementPreferences = new MeasurementPreferences(user);
        MetricViewData viewData = measurementPreferences.getMetricViewData(key, viewName);
        List<String> charts = viewData.charts;
        int index = charts.indexOf(viewKey);
        if (index < 1) {
            return; // either non-existent or viewKey is already at beginning of the list
        }
View Full Code Here

    }

    public void moveChartDown(Subject user, EntityContext context, String viewName, String viewKey) {
        String key = context.getLegacyKey();
        MeasurementPreferences measurementPreferences = new MeasurementPreferences(user);
        MetricViewData viewData = measurementPreferences.getMetricViewData(key, viewName);
        List<String> charts = viewData.charts;
        int index = charts.indexOf(viewKey);
        if (index == -1 && index >= charts.size() - 1) {
            return; // either non-existent or viewKey is already at the end of the list
        }
View Full Code Here

    }

    public void addChart(Subject user, EntityContext context, String viewName, String viewKey) {
        String key = context.getLegacyKey();
        MeasurementPreferences measurementPreferences = new MeasurementPreferences(user);
        MetricViewData viewData = measurementPreferences.getMetricViewData(key, viewName);
        // only add chart if it's not already in the list
        if (!viewData.charts.contains(viewKey)) {
            viewData.charts.add(viewKey); // new charts always go at the end
            measurementPreferences.setMetricViewData(key, viewName, viewData);
        }
View Full Code Here

    }

    public void removeChart(Subject user, EntityContext context, String viewName, String viewKey) {
        String key = context.getLegacyKey();
        MeasurementPreferences measurementPreferences = new MeasurementPreferences(user);
        MetricViewData viewData = measurementPreferences.getMetricViewData(key, viewName);
        viewData.charts.remove(viewKey); // graceful no-op if viewKey did not exist in context
        measurementPreferences.setMetricViewData(key, viewName, viewData);
    }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.measurement.MeasurementPreferences.MetricViewData

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.