Package org.jboss.dashboard.workspace

Examples of org.jboss.dashboard.workspace.Workspace


    }


    private String getTitle(String workspaceId) {
        try {
            Workspace workspace = UIServices.lookup().getWorkspacesManager().getWorkspace(workspaceId);
            return (String) (LocaleManager.lookup()).localize(workspace.getTitle());
        } catch (Exception e) {
            return workspaceId;
        }
    }
View Full Code Here


    public void service(HttpServletRequest request, HttpServletResponse response) throws FormatterException {
        List<Workspace> availableWorkspaces = new ArrayList<Workspace>();
        try {
            Set<String> workspaceIds = new TreeSet<String>(UIServices.lookup().getWorkspacesManager().getAllWorkspacesIdentifiers());
            for (String workspaceId : workspaceIds) {
                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 = 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

                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

        setWorkspaceId(request.getParameter(Parameters.DISPATCH_IDWORKSPACE));
        navigateToPath(getParsedValue(workspaceConfigPath));
    }

    public void actionNewPage(CommandRequest request) throws Exception {
        Workspace workspace = getNavigationManager().getCurrentWorkspace();
        WorkspacePermission sectionPerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_CREATE_PAGE);
        getUserStatus().checkPermission(sectionPerm);
        setWorkspaceValues(request);
        sectionsPropertiesHandler.setCreateSection(Boolean.TRUE);
        sectionsPropertiesHandler.setDuplicateSection(Boolean.FALSE);
View Full Code Here

        sectionsPropertiesHandler.setDuplicateSection(Boolean.FALSE);
        navigateToConfigPath(getParsedValue(newPagePath));
    }

    public void actionDuplicatePage(CommandRequest request) throws Exception {
        Workspace workspace = getNavigationManager().getCurrentWorkspace();
        WorkspacePermission sectionPerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_CREATE_PAGE);
        getUserStatus().checkPermission(sectionPerm);
        setWorkspaceValues(request);
        sectionsPropertiesHandler.setCreateSection(Boolean.FALSE);
        sectionsPropertiesHandler.setDuplicateSection(Boolean.TRUE);
View Full Code Here

        setWorkspaceValuesFromTree(workspace, section, null);
        navigateToConfigPath(getParsedValue(pageConfigPath));
    }

    public void actionNewPanel(CommandRequest request) throws Exception {
        Workspace workspace = getNavigationManager().getCurrentWorkspace();
        WorkspacePermission panelPerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_ADMIN);
        getUserStatus().checkPermission(panelPerm);
        setWorkspaceValues(request);
        String region = request.getRequestObject().getParameter("region");
        panelsPropertiesHandler.setRegion(region);
View Full Code Here

        this.workspaceId = workspaceId;
    }

    public synchronized void actionOnWorkspace(CommandRequest request) throws Exception {
        if ("navigate".equals(operationName)) {
            Workspace currentWorkspace = getNavigationManager().getCurrentWorkspace();
            if (currentWorkspace != null && currentWorkspace.getId().equals(workspaceId)) {
                return; //Nothing to do, workspace is the same !!
            }
            WorkspaceImpl workspaceToNavigateTo = (WorkspaceImpl) UIServices.lookup().getWorkspacesManager().getWorkspace(workspaceId);
            getNavigationManager().setCurrentWorkspace(workspaceToNavigateTo);
        } else if ("delete".equals(operationName)) {
View Full Code Here

        UIServices.lookup().getWorkspacesManager().delete(workspace);
        getNavigationManager().setCurrentWorkspace(null);
    }

    public synchronized void actionNavigateToWorkspace(CommandRequest request) throws Exception {
        Workspace currentWorkspace = getNavigationManager().getCurrentWorkspace();
        if (currentWorkspace != null && currentWorkspace.getId().equals(workspaceId)) {
            return; //Nothing to do, workspace is the same !!
        }
        WorkspaceImpl workspaceToNavigateTo = (WorkspaceImpl) UIServices.lookup().getWorkspacesManager().getWorkspace(workspaceId);
        getNavigationManager().setCurrentWorkspace(workspaceToNavigateTo);
    }
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.