Package org.fluxtream.core.domain

Examples of org.fluxtream.core.domain.Dashboard


    @Transactional(readOnly=false)
    public List<Dashboard> getDashboards(final long guestId) {
        List<Dashboard> dashboards = JPAUtils.find(em, Dashboard.class, "dashboards.all",
                                                   guestId);
        if (dashboards.size()==0) {
            Dashboard dashboard = createDashboard(guestId, "Untitled Dashboard");
            dashboard.active = true;
            addDefaultWidgets(guestId, dashboard);
            em.persist(dashboard);
        }
        return dashboards;
View Full Code Here


        em.persist(dashboard);
    }

    @Transactional(readOnly=false)
    private Dashboard createDashboard(final long guestId, final String dashboardName) {
        Dashboard dashboard = new Dashboard();
        dashboard.name = dashboardName;
        dashboard.guestId = guestId;
        dashboard.widgetNames = "";
        long maxOrder = JPAUtils.count(em, "dashboards.maxOrder", guestId);
        dashboard.ordering = (int)maxOrder+1;
View Full Code Here

    }

    @Override
    @Transactional(readOnly=false)
    public void removeDashboard(final long guestId, final long dashboardId) {
        Dashboard dashboard = getDashboardById(guestId, dashboardId);
        em.remove(dashboard);
        widgetsService.deleteWidgetSettings(guestId, dashboardId);
    }
View Full Code Here

    }

    @Override
    @Transactional(readOnly=false)
    public void renameDashboard(final long guestId, final long previousDashboardId, final String dashboardName) {
        Dashboard dashboard = getDashboardById(guestId, previousDashboardId);
        dashboard.name = dashboardName;
        em.persist(dashboard);
    }
View Full Code Here

        dashboard.name = dashboardName;
        em.persist(dashboard);
    }

    private Dashboard getDashboardById(long guestId, long dashboardId) {
        Dashboard dashboard = JPAUtils.findUnique(em, Dashboard.class, "dashboards.byId", guestId, dashboardId);
        return dashboard;
    }
View Full Code Here

    }

    @Override
    @Transactional(readOnly=false)
    public void addWidget(final long guestId, final long dashboardId, final String widgetName) {
        Dashboard dashboard = getDashboardById(guestId, dashboardId);
        final String[] namesArray = StringUtils.split(dashboard.widgetNames, ",");
        List<String> widgetNames = new ArrayList<String>();
        for (String s : namesArray) widgetNames.add(s);
        final List<DashboardWidget> availableWidgetsList = widgetsService.getAvailableWidgetsList(guestId);
        for (DashboardWidget dashboardWidget : availableWidgetsList) {
View Full Code Here

    }

    @Override
    @Transactional(readOnly=false)
    public void removeWidget(final long guestId, final long dashboardId, final String widgetName) {
        Dashboard dashboard = getDashboardById(guestId, dashboardId);
        final String[] namesArray = StringUtils.split(dashboard.widgetNames, ",");
        List<String> widgetNames = new ArrayList<String>();
        for (String s : namesArray) widgetNames.add(s);
        widgetNames.remove(widgetName);
        dashboard.widgetNames = StringUtils.join(widgetNames, ",");
View Full Code Here

    }

    @Override
    @Transactional(readOnly=false)
    public void setWidgetsOrder(final long guestId, final long dashboardId, final String[] widgetNames) {
        Dashboard dashboard = getDashboardById(guestId, dashboardId);
        dashboard.widgetNames = StringUtils.join(widgetNames, ",");
        em.persist(dashboard);
    }
View Full Code Here

    @Override
    @Transactional(readOnly=false)
    public void setDashboardsOrder(final long guestId, final long[] dashboardIds) {
        for(int i=0; i<dashboardIds.length; i++) {
            final Dashboard dashboard = getDashboardById(guestId, dashboardIds[i]);
            dashboard.ordering = i;
            em.persist(dashboard);
        }
    }
View Full Code Here

        try {
            List<Dashboard> dashboards = dashboardsService.getDashboards(guestId);
            Collections.sort(dashboards);
            List<DashboardModel> dashboardModels = new ArrayList<DashboardModel>();
            for (final ListIterator eachDashboard = dashboards.listIterator(); eachDashboard.hasNext(); ) {
                final Dashboard dashboard = (Dashboard)eachDashboard.next();
                DashboardModel dashboardModel = toDashboardModel(dashboard, guestId);
                dashboardModels.add(dashboardModel);
            }
            return Response.ok(dashboardModels).build();
        }
View Full Code Here

TOP

Related Classes of org.fluxtream.core.domain.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.