Package org.rhq.core.domain.dashboard

Examples of org.rhq.core.domain.dashboard.Dashboard


            entityManager);
        return queryRunner.execute();
    }

    public Dashboard storeDashboard(Subject subject, Dashboard dashboard) {
        Dashboard d = null;
        if ((d = entityManager.find(Dashboard.class, dashboard.getId())) == null) {
            dashboard.setOwner(subject);
            entityManager.persist(dashboard);
            return dashboard;
        } else {
            if (!authorizationManager.hasGlobalPermission(subject, Permission.MANAGE_SETTINGS)
                && d.getOwner().getId() != subject.getId()) {
                throw new PermissionException("You may only alter dashboards you own.");
            }
            return entityManager.merge(dashboard);
        }
    }
View Full Code Here


        }
    }

    public void removeDashboard(Subject subject, int dashboardId) {

        Dashboard toDelete = entityManager.find(Dashboard.class, dashboardId);

        if (!authorizationManager.hasGlobalPermission(subject, Permission.MANAGE_SETTINGS)
            && toDelete.getOwner().getId() != subject.getId()) {
            throw new PermissionException("You may only delete dashboards you own.");
        }

        entityManager.remove(toDelete);
    }
View Full Code Here

                        public void onFailure(Throwable caught) {
                            CoreGUI.getErrorHandler().handleError(MSG.view_dashboardsManager_error1(), caught);
                        }

                        public void onSuccess(final PageList<Dashboard> result) {
                            Dashboard dashboard = result.isEmpty() ? getDefaultDashboard() : result.get(0);
                            setDashboard(dashboard);

                            isInitialized = true;

                            // draw() may be done since onInit finishes asynchronously, if so redraw
View Full Code Here

    protected Dashboard getDefaultDashboard() {
        Subject sessionSubject = UserSessionManager.getSessionSubject();
        Resource resource = resourceComposite.getResource();

        Dashboard dashboard = new Dashboard();

        dashboard.setName(DASHBOARD_NAME_PREFIX + sessionSubject.getId() + "_" + resource.getId());
        dashboard.setCategory(DashboardCategory.RESOURCE);
        dashboard.setResource(resource);
        dashboard.setColumns(2);

        // TODO, add real portlets
        // set leftmost column and let the rest be equally divided
        dashboard.setColumnWidths("40%");
        dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "transparent"));

        //figure out which portlets to display and how
        HashMap<String, String> resKeyNameMap = DashboardView.processPortletNameMapForResource(resourceComposite);
        int colLeft = 0;
        int colRight = 1;
        int rowLeft = 0;
        int rowRight = 0;
        //Left Column
        if (resKeyNameMap.containsKey(ResourceMetricsPortlet.KEY)) {//measurments top left if available
            DashboardPortlet measurements = new DashboardPortlet(ResourceMetricsPortlet.NAME,
                ResourceMetricsPortlet.KEY, 220);
            dashboard.addPortlet(measurements, colLeft, rowLeft++);
            resKeyNameMap.remove(ResourceMetricsPortlet.KEY);
        }

        // right Column(approx 60%. As larger more room to display table and N rows.)
        if (resKeyNameMap.containsKey(ResourceAlertsPortlet.KEY)) {//alerts top right if available
            DashboardPortlet alerts = new DashboardPortlet(ResourceAlertsPortlet.NAME, ResourceAlertsPortlet.KEY, 210);
            dashboard.addPortlet(alerts, colRight, rowRight++);
            resKeyNameMap.remove(ResourceAlertsPortlet.KEY);
        }
        if (resKeyNameMap.containsKey(ResourceEventsPortlet.KEY)) {//events if available
            DashboardPortlet events = new DashboardPortlet(ResourceEventsPortlet.NAME, ResourceEventsPortlet.KEY, 210);
            dashboard.addPortlet(events, colRight, rowRight++);
            resKeyNameMap.remove(ResourceEventsPortlet.KEY);
        }
        if (resKeyNameMap.containsKey(ResourceOperationsPortlet.KEY)) {//operations if available
            DashboardPortlet ops = new DashboardPortlet(ResourceOperationsPortlet.NAME, ResourceOperationsPortlet.KEY,
                210);
            dashboard.addPortlet(ops, colRight, rowRight++);
            resKeyNameMap.remove(ResourceOperationsPortlet.KEY);
        }
        if (resKeyNameMap.containsKey(ResourceConfigurationUpdatesPortlet.KEY)) {//configuration if available
            DashboardPortlet ops = new DashboardPortlet(ResourceConfigurationUpdatesPortlet.NAME,
                ResourceConfigurationUpdatesPortlet.KEY, 210);
            dashboard.addPortlet(ops, colRight, rowRight++);
            resKeyNameMap.remove(ResourceConfigurationUpdatesPortlet.KEY);
        }

        //Fill out left column(typically smaller portlets) then alternate cols with remaining
        boolean displayLeft = false;
        for (String key : resKeyNameMap.keySet()) {
            DashboardPortlet portlet = new DashboardPortlet(resKeyNameMap.get(key), key, 105);
            if (rowLeft < 4) {
                dashboard.addPortlet(portlet, colLeft, rowLeft++);
            } else {//alternate
                if (!displayLeft) {
                    dashboard.addPortlet(portlet, colRight, rowRight++);
                } else {
                    dashboard.addPortlet(portlet, colLeft, rowLeft++);
                }
                //toggle
                displayLeft = !displayLeft;
            }
        }
View Full Code Here

                        public void onFailure(Throwable caught) {
                            CoreGUI.getErrorHandler().handleError(MSG.view_dashboardsManager_error1(), caught);
                        }

                        public void onSuccess(final PageList<Dashboard> result) {
                            Dashboard dashboard = result.isEmpty() ? getDefaultDashboard() : result.get(0);
                            setDashboard(dashboard);

                            isInitialized = true;

                            // draw() may be done since onInit finishes asynchronously, if so redraw
View Full Code Here

    protected Dashboard getDefaultDashboard() {
        Subject sessionSubject = UserSessionManager.getSessionSubject();
        final ResourceGroup group = groupComposite.getResourceGroup();

        final Dashboard dashboard = new Dashboard();

        dashboard.setName(DASHBOARD_NAME_PREFIX + sessionSubject.getId() + "_" + group.getId());
        dashboard.setCategory(DashboardCategory.GROUP);
        dashboard.setGroup(group);
        dashboard.setColumns(2);

        // set leftmost column and let the rest be equally divided
        dashboard.setColumnWidths("40%");
        dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "transparent"));

        //figure out which portlets to display and how
        Map<String, String> groupKeyNameMap = DashboardView.processPortletNameMapForGroup(groupComposite);

        //reset positioning parameters
        colLeft = 0;
        colRight = 1;
        rowLeft = 0;
        rowRight = 0;
        //Left Column
        if (groupKeyNameMap.containsKey(GroupMetricsPortlet.KEY)) {//measurments top left if available
            DashboardPortlet measurements = new DashboardPortlet(GroupMetricsPortlet.NAME, GroupMetricsPortlet.KEY, 220);
            dashboard.addPortlet(measurements, colLeft, rowLeft++);
            groupKeyNameMap.remove(GroupMetricsPortlet.KEY);
        }

        // right Column(approx 60%. As larger more room to display table and N rows.)
        if (groupKeyNameMap.containsKey(GroupAlertsPortlet.KEY)) {//alerts top right if available
            DashboardPortlet alerts = new DashboardPortlet(GroupAlertsPortlet.NAME, GroupAlertsPortlet.KEY, 210);
            dashboard.addPortlet(alerts, colRight, rowRight++);
            groupKeyNameMap.remove(GroupAlertsPortlet.KEY);
        }
        if (groupKeyNameMap.containsKey(GroupEventsPortlet.KEY)) {//events if available
            DashboardPortlet events = new DashboardPortlet(GroupEventsPortlet.NAME, GroupEventsPortlet.KEY, 210);
            dashboard.addPortlet(events, colRight, rowRight++);
            groupKeyNameMap.remove(GroupEventsPortlet.KEY);
        }
        if (groupKeyNameMap.containsKey(GroupOperationsPortlet.KEY)) {//operations if available
            DashboardPortlet ops = new DashboardPortlet(GroupOperationsPortlet.NAME, GroupOperationsPortlet.KEY, 210);
            dashboard.addPortlet(ops, colRight, rowRight++);
            groupKeyNameMap.remove(GroupOperationsPortlet.KEY);
        }
        if (groupKeyNameMap.containsKey(GroupConfigurationUpdatesPortlet.KEY)) {//operations if available
            DashboardPortlet ops = new DashboardPortlet(GroupConfigurationUpdatesPortlet.NAME,
                GroupConfigurationUpdatesPortlet.KEY, 210);
            dashboard.addPortlet(ops, colRight, rowRight++);
            groupKeyNameMap.remove(GroupConfigurationUpdatesPortlet.KEY);
        }

        //Fill out left column(typically smaller portlets) then alternate cols with remaining
        displayLeft = false;
View Full Code Here

        addMember(tabSet);
    }

    protected Dashboard getDefaultDashboard() {

        Dashboard dashboard = new Dashboard();
        dashboard.setName(MSG.common_title_default());
        dashboard.setCategory(DashboardCategory.INVENTORY);
        dashboard.setColumns(2);
        // only leftmost column width is currently settable, the rest are equally divided
        dashboard.setColumnWidths("32%");

        ProductInfo productInfo = CoreGUI.get().getProductInfo();
        boolean isRHQ = (productInfo != null) && "RHQ".equals(productInfo.getShortName());

        // Left Column
        int columnIndex = 0;
        int rowIndex = 0;

        if (isRHQ) {
            DashboardPortlet welcome = new DashboardPortlet(MessagePortlet.NAME, MessagePortlet.KEY, 250);
            dashboard.addPortlet(welcome, columnIndex, rowIndex++);
        }

        DashboardPortlet summary = new DashboardPortlet(InventorySummaryPortlet.NAME, InventorySummaryPortlet.KEY, 250);
        dashboard.addPortlet(summary, columnIndex, rowIndex++);

        DashboardPortlet news = new DashboardPortlet(MashupPortlet.NAME, MashupPortlet.KEY, 300);
        news.getConfiguration().put(new PropertySimple("address", "mashup.html"));

        dashboard.addPortlet(news, columnIndex, rowIndex++);

        // Right Column
        columnIndex = 1;
        rowIndex = 0;

        DashboardPortlet recentAlerts = new DashboardPortlet(RecentAlertsPortlet.NAME, RecentAlertsPortlet.KEY, 250);
        dashboard.addPortlet(recentAlerts, columnIndex, rowIndex++);

        DashboardPortlet problemResources = new DashboardPortlet(ProblemResourcesPortlet.NAME,
            ProblemResourcesPortlet.KEY, 250);
        //initialize config for the problemResources portlet.
        problemResources.getConfiguration().put(
            new PropertySimple(ProblemResourcesPortlet.PROBLEM_RESOURCE_SHOW_MAX,
                ProblemResourcesPortlet.defaultShowMax));
        problemResources.getConfiguration().put(
            new PropertySimple(ProblemResourcesPortlet.PROBLEM_RESOURCE_SHOW_HRS,
                ProblemResourcesPortlet.defaultShowHours));
        dashboard.addPortlet(problemResources, columnIndex, rowIndex++);

        DashboardPortlet operations = new DashboardPortlet(OperationHistoryPortlet.NAME, OperationHistoryPortlet.KEY,
            200);
        dashboard.addPortlet(operations, columnIndex, rowIndex++);

        return dashboard;
    }
View Full Code Here

            if (!this.dashboardsByName.containsKey(candidateDashboardName)) {
                availableDashboardName = candidateDashboardName;
            }
        }

        Dashboard dashboard = new Dashboard();
        dashboard.setCategory(DashboardCategory.INVENTORY);
        dashboard.setName(availableDashboardName);
        dashboard.setColumns(2);
        // only leftmost column width is currently settable, the rest are equally divided
        dashboard.setColumnWidths("32%");

        dashboardService.storeDashboard(dashboard, new AsyncCallback<Dashboard>() {
            public void onFailure(Throwable caught) {
                CoreGUI.getErrorHandler().handleError(MSG.view_dashboardsManager_error1(), caught);
                newDashboardButton.enable();
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.dashboard.Dashboard

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.