Package org.jboss.dashboard.workspace

Examples of org.jboss.dashboard.workspace.Workspace


    public void service(HttpServletRequest request, HttpServletResponse response) throws FormatterException {
        if (navigationManager.isShowingConfig()) {
            renderFragment("config");
        } else {
            Workspace workspace = navigationManager.getCurrentWorkspace();
            if (workspace != null && !navigationManager.isUserRequiresLoginBackdoor()) {
                renderFragment("workspacePage");
            } else {
                renderFragment("loginPage");
            }
View Full Code Here


                }
            }
            // 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);
View Full Code Here

    public Workspace getWorkspace() throws Exception {
        return UIServices.lookup().getWorkspacesManager().getWorkspace(workspaceId);
    }

    public Section getDefaultSectionForRole(Role role) throws Exception {
        Workspace workspace = getWorkspace();
        Set<WorkspaceHome> homePages = workspace.getWorkspaceHomes();
        for (WorkspaceHome homePage : homePages) {
            if (homePage.getRoleId().equals(role.getName())) {
                if (homePage.getSectionId() == null) return null;
                return workspace.getSection(homePage.getSectionId());
            }
        }
        return null;
    }
View Full Code Here

                String param = request.getParameter("defaultPageFor_"+role.getName());
                if (!StringUtils.isBlank(param)) rolesPages.put(role.getName(), Long.decode(param));
                else rolesPages.put(role.getName(), null);
            }

            Workspace workspace = getWorkspace();
            Set<WorkspaceHome> homePages = workspace.getWorkspaceHomes();
            for (WorkspaceHome page : homePages) {
                Long sectionId = (Long) rolesPages.get(page.getRoleId());
                page.setSectionId(sectionId);
                rolesPages.remove(page.getRoleId());
            }

            Iterator it = rolesPages.keySet().iterator();
            while (it.hasNext()) {
                String roleName = (String) it.next();
                Long sectionId = (Long) rolesPages.get(roleName);
                WorkspaceHome newPage = new WorkspaceHome();
                newPage.setWorkspace(workspace);
                newPage.setRoleId(roleName);
                newPage.setSectionId(sectionId);
                workspace.getWorkspaceHomes().add(newPage);
            }

            // Save the changes made to the workspace.
            UIServices.lookup().getWorkspacesManager().store(workspace);
        }}.execute();
View Full Code Here

                    GraphicElement resource = resources[i];
                    resource.acceptVisit(exportVisitor);
                }
            if (workspaces != null)
                for (int i = 0; i < workspaces.length; i++) {
                    Workspace workspace = workspaces[i];
                    workspace.acceptVisit(exportVisitor);
                }
        }
        catch (Exception e) {
            log.error("Error: ", e);
            return new ExportResult(e, this);
View Full Code Here

                    GraphicElement resource = resources[i];
                    resource.acceptVisit(exportVisitor);
                }
            if (workspaces != null)
                for (int i = 0; i < workspaces.length; i++) {
                    Workspace workspace = workspaces[i];
                    workspace.acceptVisit(exportVisitor);
                }
        }
        catch (Exception e) {
            log.error("Error: ", e);
            return new ExportResult(e, this);
View Full Code Here

            StringBuffer urlprefix = new StringBuffer("http://" + request.getServerName());
            if (request.getServerPort() != 80)
                urlprefix.append(":").append(request.getServerPort());
            urlprefix.append(request.getContextPath());
            urlprefix.append("/workspace/&lt;lang&gt;/");
            Workspace currentWorkspace = getSectionPropertiesHandler().getWorkspace();
            String friendlyUrl = currentWorkspace.getFriendlyUrl();
            friendlyUrl = StringUtils.defaultIfEmpty(friendlyUrl, currentWorkspace.getId());
            urlprefix.append(friendlyUrl).append("/");

            setAttribute("urlPreffix", urlprefix.toString());
            setAttribute("value", getSectionPropertiesHandler().getUrl());
            setAttribute("error", getSectionPropertiesHandler().hasError("url"));
View Full Code Here

        //No file or directory exists in root with same name
        try {
            WorkspaceImpl currentWorkspace = (WorkspaceImpl) getWorkspace();

            Workspace p = UIServices.lookup().getWorkspacesManager().getWorkspaceByUrl(url);
            if (p != null && !currentWorkspace.getId().equals(p.getId()))
                return false;//Exists workspace with this friendly URL

            Section sections[] = currentWorkspace.getAllSections();

            if (sections != null) {
View Full Code Here

        try {
            Set<String> workspaceIds = UIServices.lookup().getWorkspacesManager().getAllWorkspacesIdentifiers();
            List<Workspace> workspaces = new ArrayList<Workspace>();
            for (String wsId : workspaceIds) {
                Workspace workspace = UIServices.lookup().getWorkspacesManager().getWorkspace(wsId);
                WorkspacePermission perm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_LOGIN);
                if (UserStatus.lookup().hasPermission(perm)) {
                    workspaces.add(workspace);
                }
            }
            if (!workspaces.isEmpty()) {
                renderFragment("outputStart");
                for (Workspace workspace : workspaces) {
                    setAttribute("workspace", workspace);
                    setAttribute("workspaceId", workspace.getId());
                    setAttribute("workspaceName", StringEscapeUtils.escapeHtml(getLocalizedValue(workspace.getTitle())));
                    Map params = new HashMap();
                    params.put(NavigationManager.WORKSPACE_ID, workspace.getId());
                    String workspaceURL = UIServices.lookup().getUrlMarkupGenerator().getPermanentLink("org.jboss.dashboard.ui.NavigationManager", "NavigateToWorkspace", params);
                    if (workspaceURL.startsWith(request.getContextPath())) {
                        workspaceURL = workspaceURL.substring((request.getContextPath()).length());
                    }
                    while (workspaceURL.startsWith("/")) workspaceURL = workspaceURL.substring(1);
View Full Code Here

        try {
            Set<String> workspaceIds = UIServices.lookup().getWorkspacesManager().getAllWorkspacesIdentifiers();
            TreeSet<String> sortedWorkspaceIds = new TreeSet<String>(workspaceIds);
            ArrayList list = new ArrayList();
            for (String wsId : sortedWorkspaceIds) {
                Workspace workspace = UIServices.lookup().getWorkspacesManager().getWorkspace(wsId);
                WorkspacePermission viewPerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_LOGIN);
                boolean canLogin = UserStatus.lookup().hasPermission(viewPerm);
                if (canLogin)
                    list.add(getNewWorkspaceNode(workspace));
            }
View Full Code Here

TOP

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

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.