Package org.jboss.dashboard.workspace

Examples of org.jboss.dashboard.workspace.Workspace


            StringBuffer urlprefix = new StringBuffer("http://" + request.getServerName());
            if (request.getServerPort() != 80)
                urlprefix.append(":").append(request.getServerPort());
            urlprefix.append(request.getContextPath());
            urlprefix.append("/workspace/<lang>/");
            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


        return true;
    }

    public boolean isEditable() {
        WorkspaceNode parent = (WorkspaceNode) getParent();
        Workspace workspace;
        try {
            workspace = parent.getWorkspace();
            WorkspacePermission editPerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_ADMIN_PROVIDERS);
            return super.isEditable() && UserStatus.lookup().hasPermission( editPerm);
        } catch (Exception e) {
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

        //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

        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

    public void service(HttpServletRequest request, HttpServletResponse response) throws FormatterException {
        renderFragment("outputStart");
        renderFragment("workspacesSelect");
        if (getNavigationManager().userIsAdminInCurrentWorkspace()) 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

        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

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.