Package org.jboss.dashboard.workspace

Examples of org.jboss.dashboard.workspace.Workspace


        //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 workspaceIds = UIServices.lookup().getWorkspacesManager().getAllWorkspacesIdentifiers();
            List workspaces = new ArrayList();
            for (Iterator it = workspaceIds.iterator(); it.hasNext();) {
                String workspaceId = (String) it.next();
                Workspace workspace = UIServices.lookup().getWorkspacesManager().getWorkspace(workspaceId);
                WorkspacePermission perm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_LOGIN);
                if (UserStatus.lookup().hasPermission(perm)) {
                    workspaces.add(workspace);
                }
            }
            if (!workspaces.isEmpty()) {
                renderFragment("outputStart");
                for (int i = 0; i < workspaces.size(); i++) {
                    WorkspaceImpl workspace = (WorkspaceImpl) workspaces.get(i);
                    setAttribute("workspace", workspace);
                    setAttribute("workspaceId", workspace.getId());
                    setAttribute("workspaceName", 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

    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

    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

                }
            }
            // 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 (getUserStatus().hasPermission(workspacePerm)) {
                            navigationManager.setCurrentWorkspace(workspace);
View Full Code Here

                HibernateTxFragment txFragment = new HibernateTxFragment() {
                    protected void txFragment(Session session) throws Exception {
                        if (defaultWorkspace) {
                            log.debug("Setting default workspace");
                            Workspace currentDefaultWorkspace = getWorkspacesManager().getDefaultWorkspace();
                            log.debug("Current default workspace is " + (currentDefaultWorkspace == null ? "null" : currentDefaultWorkspace.getId()));
                            if (currentDefaultWorkspace != null && (!currentDefaultWorkspace.getId().equals(workspace.getId())))
                            {
                                log.debug("Deleting default workspace property in current default workspace");
                                currentDefaultWorkspace.setDefaultWorkspace(false);
                                getWorkspacesManager().store(currentDefaultWorkspace);
                            }
                        }
                        workspace.setDefaultWorkspace(defaultWorkspace);
                        getWorkspacesManager().store(workspace);
View Full Code Here

        if (new File(Application.lookup().getBaseAppDirectory() + "/" + url).exists())
            return false;

        //No file or directory exists in root with same name
        try {
            Workspace p = getWorkspacesManager().getWorkspaceByUrl(url);
            if (p == null) return true;//No workspace with same url exists.
            WorkspaceImpl workspace = (WorkspaceImpl) getWorkspace();
            if (workspace.getId().equals(p.getId())) return true;//It is my own workspace
        } catch (Exception e) {
            log.error("Error getting workspace", e);
        }
        return false;
    }
View Full Code Here

                HibernateTxFragment txFragment = new HibernateTxFragment() {
                    protected void txFragment(Session session) throws Exception {
                        if (defaultWorkspace) {
                            log.debug("Setting default workspace");
                            Workspace currentDefaultWorkspace = getWorkspacesManager().getDefaultWorkspace();
                            log.debug("Current default workspace is " + (currentDefaultWorkspace == null ? "null" : currentDefaultWorkspace.getId()));
                            if (currentDefaultWorkspace != null && (!currentDefaultWorkspace.getId().equals(workspace.getId())))
                            {
                                log.debug("Deleting default workspace property in current default workspace");
                                currentDefaultWorkspace.setDefaultWorkspace(false);
                                getWorkspacesManager().store(currentDefaultWorkspace);
                            }
                        }
                        workspace.setDefaultWorkspace(defaultWorkspace);
                        getWorkspacesManager().store(workspace);
View Full Code Here

        if (new File(Application.lookup().getBaseAppDirectory() + "/" + url).exists())
            return false;

        //No file or directory exists in root with same name
        try {
            Workspace p = getWorkspacesManager().getWorkspaceByUrl(url);
            if (p == null) return true;//No workspace with same url exists.
            WorkspaceImpl workspace = (WorkspaceImpl) getWorkspace();
            if (workspace.getId().equals(p.getId())) return true;//It is my own workspace
        } catch (Exception e) {
            log.error("Error getting workspace", e);
        }
        return false;
    }
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.