Package org.jboss.dashboard.workspace

Examples of org.jboss.dashboard.workspace.WorkspaceImpl


            if (tokens.size() > 1) sectionCandidate = (String) tokens.get(1);
            if (log.isDebugEnabled()) {
                log.debug("workspaceCandidate=" + workspaceCandidate);
                log.debug("sectionCandidate=" + sectionCandidate);
            }
            WorkspaceImpl workspace = null;
            Section section = null;
            if (workspaceCandidate != null) {
                boolean canbeWorkspaceId = canBeWorkspaceId(workspaceCandidate);
                if (canbeWorkspaceId) workspace = (WorkspaceImpl) UIServices.lookup().getWorkspacesManager().getWorkspace(workspaceCandidate);
                if (workspace == null) workspace = (WorkspaceImpl) UIServices.lookup().getWorkspacesManager().getWorkspaceByUrl(workspaceCandidate);
            }
            if (workspace != null && sectionCandidate != null) {
                try {
                    section = workspace.getSection(Long.decode(sectionCandidate));
                } catch (NumberFormatException nfe) {
                    section = workspace.getSectionByUrl(sectionCandidate);
                }
            }
            // Check the user has access permissions to the target workspace.
            if (workspace != null && section == null) {
                try {
                    Workspace currentWorkspace = navigationManager.getCurrentWorkspace();
                    log.debug("currentWorkspace = " + (currentWorkspace == null ? "null" : currentWorkspace.getId()) + " workspaceCandidate = " + workspaceCandidate);
                    if (!workspace.equals(currentWorkspace)) {

                        WorkspacePermission workspacePerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_LOGIN);
                        if (userStatus.hasPermission(workspacePerm)) {
                            navigationManager.setCurrentWorkspace(workspace);
                            log.debug("SessionManager.setWorkspace(" + workspace.getId() + ")");
                        } else {
                            if (log.isDebugEnabled()) log.debug("User has no " + WorkspacePermission.ACTION_LOGIN + " permission in workspace " + workspaceCandidate);
                            if (isShowLoginBackDoorOnPermissionDenied()) {
                                navigationManager.setUserRequiresLoginBackdoor(true);
                                navigationManager.setCurrentWorkspace(workspace);
View Full Code Here


        }
        if (getSectionsPropertiesHandler().getDuplicateSection().booleanValue()) {
            renderFragment("outputDuplicateSection");
            return;
        }
        WorkspaceImpl workspace;
        renderFragment("outputStart");
        try {
            workspace = (WorkspaceImpl) getSectionsPropertiesHandler().getWorkspace();
            renderFragment("outputCommandsBarStart");

            String preffix = (String) getParameter("preffix");
            List pages = initSections(preffix == null ? "--" : preffix, workspace);

            if (!pages.isEmpty()) {
                renderFragment("outputStartSelect");
                renderFragment("outputNoneSelected");

                for (int i = 0; i < pages.size(); i++) {
                    Section section = (Section) pages.get(i);
                    String title = (String) pageTitles.get(i);
                    setAttribute("id", section.getId());
                    setAttribute("title", StringEscapeUtils.escapeHtml(title));
                    renderFragment("outputSelect");
                }
                renderFragment("outputEndSelect");
            }

            WorkspacePermission workspacePerm = WorkspacePermission.newInstance(getSectionsPropertiesHandler().getWorkspace(), WorkspacePermission.ACTION_ADMIN_PROVIDERS);
            setAttribute("editPanels", UserStatus.lookup().hasPermission(workspacePerm));

            setAttribute("workspace", workspace);
            renderFragment("outputCommandsBarEnd");
            renderFragment("commandsBarSeparation");

            if (!getSectionsPropertiesHandler().getErrorPermission().isEmpty()) {

                for (int i = 0; i < getSectionsPropertiesHandler().getErrorPermission().size(); i++) {
                    setAttribute("errorCommand", getSectionsPropertiesHandler().getErrorPermission().get(i));
                    renderFragment("outputErrorCommands");
                }
                getSectionsPropertiesHandler().setErrorPermission(new ArrayList());
            }

            renderFragment("outputTreeStart");
            if (workspace.getSectionsCount() == 0)
                renderFragment("outputEmptySections");
            else {
                setAttribute("workspaceId", workspace.getId());
                renderFragment("outputTreeBody");
            }
            renderFragment("outputTreeEnd");
            setAttribute("moveLoop", getSectionsPropertiesHandler().getMoveLoop());
            renderFragment("outputEnd");
View Full Code Here

        return m;
    }


    public void initSections(Section rootSection, String indent, String preffix) throws Exception {
        WorkspaceImpl workspace;

        workspace = (WorkspaceImpl) getSectionsPropertiesHandler().getWorkspace();
        if (workspace != null) {
            Section[] sections = rootSection != null ?
                    workspace.getAllChildSections(rootSection.getId()) :
                    workspace.getAllRootSections();
            for (int i = 0; i < sections.length; i++) {
                SectionPermission viewPerm = SectionPermission.newInstance(sections[i], SectionPermission.ACTION_VIEW);
                if (UserStatus.lookup().hasPermission(viewPerm)) {
                    pageIds.add(sections[i].getId());
                    pageTitles.add(indent + getTitle(sections[i]));
View Full Code Here

    public void actionChangeProviders(final CommandRequest request) {
        try {
            HibernateTxFragment txFragment = new HibernateTxFragment() {
                protected void txFragment(Session session) throws Exception {
                    WorkspaceImpl workspace = (WorkspaceImpl) getWorkspace();
                    workspace.setPanelProvidersAllowed(Collections.EMPTY_SET);
                    for (Enumeration paramNames = request.getRequestObject().getParameterNames(); paramNames.hasMoreElements();) {
                        String paramName = (String) paramNames.nextElement();
                        if (!paramName.startsWith("CHKBOX_")) continue;

                        String providerId = paramName.substring("CHKBOX_".length());
                        workspace.addPanelProviderAllowed(providerId);
                    }
                    UIServices.lookup().getWorkspacesManager().store(workspace);
                }
            };
View Full Code Here

    public void service(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws FormatterException {
        try {
            renderFragment("outputStart");
            renderFragment("outputProvidersGroupsStart");
            WorkspaceImpl workspace = (WorkspaceImpl) getWorkspacesManager().getWorkspace(getPanelsTypesPropertiesHandler().getWorkspaceId());
            String[] groups = getPanelsProvidersManager().enumerateProvidersGroups();
            for (int i = 0; i < groups.length; i++) {
                String group = groups[i];
                String groupName = getPanelsProvidersManager().getGroupDisplayName(group, SessionManager.getCurrentLocale());
                PanelProvider[] providers = getPanelsProvidersManager().getProvidersInGroup(group);
                int nProviders = providers.length;
                setAttribute("groupName", groupName);
                setAttribute("nProviders", nProviders);
                setAttribute("providerGroup", group);
                renderFragment("outputGroupName");
                setAttribute("providerGroup", group);
                renderFragment("outputDescriptionStart");
                for (int j = 0; j < providers.length; j++) {
                    PanelProvider provider = providers[j];
                    String providerDescription = provider.getResource(provider.getDescription(), SessionManager.getCurrentLocale());
                    setAttribute("providerAllowed", workspace.isProviderAllowed(provider.getId()));
                    setAttribute("providerDescription", providerDescription);
                    setAttribute("providerId", provider.getId());
                    setAttribute("providerGroup", provider.getGroup());
                    renderFragment("outputDescription");
                }
                renderFragment("outputDescriptionEnd");
            }
            setAttribute("providerAllowed", workspace.isProviderAllowed("*"));
            renderFragment("outputProvidersGroupsEnd");
            renderFragment("outputEnd");
        } catch (Exception e) {
            log.error("Error:", e);
        }
View Full Code Here

        setAttribute("value", "ui.region");
        renderFragment("outputHeaders");
        renderFragment("outputEndRow");

        int n = 0;
        WorkspaceImpl workspace;
        Section section;
        try {
            workspace = (WorkspaceImpl) UIServices.lookup().getWorkspacesManager().getWorkspace(getPanelsPropertiesHandler().getWorkspaceId());
            Panel[] panels;
            if (getPanelsPropertiesHandler().getSectionId() == null) {
                panels = ((WorkspaceImpl) UIServices.lookup().getWorkspacesManager().getWorkspace(workspace.getId())).getPanelInstance(getPanelsPropertiesHandler().getInstanceId()).getAllPanels();
                section = null;
            } else {
                section = workspace.getSection(getPanelsPropertiesHandler().getSectionId());
                panels = section.getAllPanels();
            }

            if (panels != null && panels.length == 0) {
                renderFragment("empty");
View Full Code Here

        this.homePagesHandler = homePagesHandler;
    }

    public void service(HttpServletRequest request, HttpServletResponse response) throws FormatterException {
        try {
            WorkspaceImpl workspace = (WorkspaceImpl) getHomePagesHandler().getWorkspace();
            renderFragment("outputStart");

            Set<Role> allRoles = SecurityServices.lookup().getRolesManager().getAllRoles();
            if (allRoles.size() > 0) {
                int i = 0;
View Full Code Here

    public List<WorkspaceImpl> getWorkspacesWithKPIs() throws Exception {
        List<WorkspaceImpl> results = new ArrayList<WorkspaceImpl>();
        WorkspaceImpl[] workspaces = UIServices.lookup().getWorkspacesManager().getWorkspaces();
        for (int i = 0; i < workspaces.length; i++) {
            WorkspaceImpl workspace = workspaces[i];
            List<Section> dashs = getSectionsWithKPIs(workspace);
            if (!dashs.isEmpty()) results.add(workspace);
        }
        return results;
    }
View Full Code Here

    }

    public List<KPI> getSelectedKPIs() throws Exception {
        List<KPI> results = new ArrayList<KPI>();
        for (String workspaceId : selectedSectionIds.keySet()) {
            WorkspaceImpl workspace = (WorkspaceImpl) UIServices.lookup().getWorkspacesManager().getWorkspace(workspaceId);
            Set<Section> sections = getSelectedSections(workspace);
            for (Section section : sections) {
                for (Panel panel : section.getPanels()) {
                    KPI kpi = DashboardHandler.lookup().getKPI(panel);
                    if (kpi != null && !results.contains(kpi)) results.add(kpi);
View Full Code Here

            sectionIds.add(Long.valueOf(sectionId));
        }
    }

    public void actionSelectAllSections(CommandRequest request) throws Exception {
        WorkspaceImpl workspace = getSelectedWorkspace();
        if (workspace != null) {
            List<Section> dashs = getSectionsWithKPIs(workspace);
            Set<Long> sectionIds = new HashSet<Long>();
            selectedSectionIds.put(selectedWorkspaceId, sectionIds);
            for (Section dash : dashs) {
View Full Code Here

TOP

Related Classes of org.jboss.dashboard.workspace.WorkspaceImpl

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.