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


                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

    public void service(HttpServletRequest request, HttpServletResponse response) throws FormatterException {
        renderFragment("outputStart");
        renderFragment("workspacesSelect");
        if (getNavigationManager().isAdminBarVisible()) try {
            Workspace currentWorkspace = getNavigationManager().getCurrentWorkspace();
            BackOfficePermission createPerm = BackOfficePermission.newInstance(null, BackOfficePermission.ACTION_CREATE_WORKSPACE);
            WorkspacePermission editPerm = WorkspacePermission.newInstance(currentWorkspace, WorkspacePermission.ACTION_EDIT);
            WorkspacePermission deletePerm = WorkspacePermission.newInstance(currentWorkspace, WorkspacePermission.ACTION_DELETE);
            boolean canAddWorkspace = getUserStatus().hasPermission(createPerm);
            if (canAddWorkspace) {
View Full Code Here

        List availableWorkspaces = new ArrayList();
        try {
            TreeSet workspaceIds = new TreeSet(UIServices.lookup().getWorkspacesManager().getAllWorkspacesIdentifiers());
            for (Iterator it = workspaceIds.iterator(); it.hasNext();) {
                String workspaceId = (String) it.next();
                Workspace workspace = UIServices.lookup().getWorkspacesManager().getWorkspace(workspaceId);

                boolean finish = false;
                int index = 0;
                while (!finish && index < WorkspacePermission.LIST_OF_ACTIONS.size()) {
                    Permission perm = WorkspacePermission.newInstance(workspace, WorkspacePermission.LIST_OF_ACTIONS.get(index++));
                    if (UserStatus.lookup().hasPermission(perm)) {
                        availableWorkspaces.add(workspace);
                        finish = true;
                    }
                }
            }
        } catch (Exception e) {
            renderFragment("error");
            throw new FormatterException("Error in formatter: ", e);
        }

        if (availableWorkspaces.isEmpty()) {
            renderFragment("empty");
        } else {
            renderFragment("outputStart");
            for (int i = 0; i < availableWorkspaces.size(); i++) {
                Workspace workspace = (Workspace) availableWorkspaces.get(i);
                setAttribute("index", i);
                setAttribute("count", i + 1);
                setAttribute("workspace", workspace);
                setAttribute("workspaceId", workspace.getId());
                setAttribute("workspaceName", StringEscapeUtils.escapeHtml((String) LocaleManager.lookup().localize(workspace.getName())));
                setAttribute("current", workspace.getId().equals(navigationManager.getCurrentWorkspaceId()));
                renderFragment("output");
            }
            renderFragment("outputEnd");
        }
    }
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", 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

     * Get the elements visible for a given context. These are the base elements plus the workspace, section and panel
     * elements. But hierarchy applies: Panel elements may hide section ones, workspace ones and global ones.
     * Assume current workspace, section and panel.
     */
    public GraphicElement[] getAvailableElements() {
        Workspace workspace = NavigationManager.lookup().getCurrentWorkspace();
        Section section = NavigationManager.lookup().getCurrentSection();
        RequestContext reqCtx = RequestContext.getCurrentContext();
        Long idPanel = null;
        Panel panel = (Panel) reqCtx.getRequest().getRequestObject().getAttribute(Parameters.RENDER_PANEL);
        if (panel != null && section != null) {
            idPanel = panel.getPanelId();
            if (getElementScopeDescriptor().isAllowedInstance()) {
                idPanel = panel.getInstanceId();
            }
        }
        return getAvailableElements(workspace == null ? null : workspace.getId(), section == null ? null : section.getId(), panel == null ? null : idPanel);
    }
View Full Code Here

    /**
     * Get the elements manageable for a given context. These are the base elements plus the workspace, section and panel
     * elements. Assume current workspace, section and panel.
     */
    public GraphicElement[] getManageableElements() {
        Workspace workspace = NavigationManager.lookup().getCurrentWorkspace();
        Section section = NavigationManager.lookup().getCurrentSection();
        Object panelObject = SessionManager.getCurrentPanel();//TODO : Current panel won't be set!
        Panel panel = null;
        if (panelObject != null && panelObject instanceof Panel)
            panel = (Panel) panelObject;
        return getManageableElements(workspace == null ? null : workspace.getId(), section == null ? null : section.getId(), panel == null ? null : panel.getPanelId());
    }
View Full Code Here

        List availableWorkspaces = new ArrayList();
        try {
            TreeSet workspaceIds = new TreeSet(UIServices.lookup().getWorkspacesManager().getAllWorkspacesIdentifiers());
            for (Iterator it = workspaceIds.iterator(); it.hasNext();) {
                String workspaceId = (String) it.next();
                Workspace workspace = UIServices.lookup().getWorkspacesManager().getWorkspace(workspaceId);
                Permission perm = WorkspacePermission.newInstance(workspace, actions);
                if (UserStatus.lookup().hasPermission(perm)) {
                    availableWorkspaces.add(workspace);
                }
            }
        } catch (Exception e) {
            log.error("Error:", e);
            renderFragment("error");
            throw new FormatterException("Error in formatter: ", e);
        }

        if (availableWorkspaces.isEmpty()) {
            renderFragment("empty");
        } else {
            renderFragment("outputStart");
            for (int i = 0; i < availableWorkspaces.size(); i++) {
                Workspace workspace = (Workspace) availableWorkspaces.get(i);
                setAttribute("index", i);
                setAttribute("count", i + 1);
                setAttribute("workspace", workspace);
                setAttribute("workspaceId", workspace.getId());
                setAttribute("workspaceName", StringEscapeUtils.escapeHtml((String) LocaleManager.lookup().localize(workspace.getName())));
                setAttribute("current", workspace.getId().equals(navigationManager.getCurrentWorkspaceId()));
                renderFragment("output");
            }
            renderFragment("outputEnd");
        }
    }
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

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.