Package org.jboss.dashboard.workspace

Examples of org.jboss.dashboard.workspace.WorkspaceImpl


        String rootSectionId = (String) getParameter("rootSectionId");

        boolean showHiddenPages = (!(getParameter("showHiddenPages") != null && !"".equals(getParameter("showHiddenPages")))) || Boolean.valueOf((String) getParameter("showHiddenPages")).booleanValue();
        Boolean checkPermissions = Boolean.valueOf((String) getParameter("checkPermissions"));
        try {
            WorkspaceImpl currentWorkspace = (WorkspaceImpl) (workspaceId != null && !"".equals(workspaceId) ? UIServices.lookup().getWorkspacesManager().getWorkspace(workspaceId) : NavigationManager.lookup().getCurrentWorkspace());
            Section[] rootSections;
            if (StringUtils.isEmpty(rootSectionId)) {
                rootSections = currentWorkspace.getAllRootSections();
            } else {
                Section parentSection  = currentWorkspace.getSection(Long.decode(rootSectionId));
                List<Section> children = parentSection.getChildren();
                rootSections = children.toArray(new Section[children.size()]);
            }
            renderFragment("outputStart");
            for (Section rootSection : rootSections) {
View Full Code Here


                renderFragment("outputHeaders");
                renderFragment("outputEndRow");
            }
            int n = 0;
            for (String workspaceId : getWorkspacesManager().getAllWorkspacesIdentifiers()) {
                WorkspaceImpl workspace = (WorkspaceImpl) getWorkspacesManager().getWorkspace(workspaceId);
                WorkspacePermission viewPerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_LOGIN);
                if (workspace == null) continue;
                if (!UserStatus.lookup().hasPermission(viewPerm)) continue;
                String estilo;
                if (n % 2 == 0) estilo = "skn-odd_row";
                else estilo = "skn-even_row";

                renderFragment("outputStartRow");
                setAttribute("value", workspaceId);
                setAttribute("estilo", estilo);

                WorkspacePermission deletePerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_DELETE);
                boolean canDelete = getUserStatus().hasPermission(deletePerm);
                if (getWorkspacesManager().getAvailableWorkspacesIds().size() < 2)
                    canDelete = false;

                renderFragment(canDelete ? "outputDelete" : "outputCantDelete");

                setAttribute("value", StringEscapeUtils.escapeHtml((String) LocaleManager.lookup().localize(workspace.getName())));
                setAttribute("workspaceId", workspaceId);
                setAttribute("estilo", estilo);

                WorkspacePermission editWorkspacePerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_EDIT);
                boolean canEdit = getUserStatus().hasPermission(editWorkspacePerm);

                renderFragment(canEdit ? "outputName" : "outputNameDisabled");

                setAttribute("value", StringEscapeUtils.escapeHtml((String) LocaleManager.lookup().localize(workspace.getTitle())));
                setAttribute("estilo", estilo);
                renderFragment("outputTitle");
                renderFragment("outputEndRow");
                n++;
            }
View Full Code Here

    public void service(HttpServletRequest request, HttpServletResponse response) throws FormatterException {


        try {
            WorkspaceImpl workspace = (WorkspaceImpl) getSectionsPropertiesHandler().getWorkspace();
            setAttribute("sectionTitle", getLocalizedValue(workspace.getSection(Long.decode(getSectionsPropertiesHandler().getSelectedSectionId())).getTitle()));
            renderFragment("outputStart");

            WorkspacePermission sectionPerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_CREATE_PAGE);
            if (UserStatus.lookup().hasPermission(sectionPerm)) {
                Panel[] panels = workspace.getSection(Long.decode(getSectionsPropertiesHandler().getSelectedSectionId())).getAllPanels();
                TreeSet panelInstances = new TreeSet();
                for (int i = 0; i < panels.length; i++) {
                    Panel panel = panels[i];
                    panelInstances.add(panel.getInstanceId());
                }
                if (!panelInstances.isEmpty()) {
                    setAttribute("sectionTitle", LocaleManager.lookup().localize(workspace.getSection(Long.decode(getSectionsPropertiesHandler().getSelectedSectionId())).getTitle()));
                    renderFragment("outputMode");

                    renderFragment("outputHeaders");
                    Iterator it = panelInstances.iterator();
                    int counter = 0;
                    while (it.hasNext()) {
                        String instanceId = it.next().toString();
                        PanelInstance instance = workspace.getPanelInstance(instanceId);
                        setAttribute("instanceId", instanceId);
                        setAttribute("group", instance.getResource(instance.getProvider().getGroup(), getLocale()));
                        setAttribute("description", instance.getResource(instance.getProvider().getDescription(), getLocale()));
                        setAttribute("title", getLocalizedValue(instance.getTitle()));
                        setAttribute("counter", counter);
View Full Code Here

        buildI18nValues(request);

        //For current Workspace, save new values.
        if (validateBeforeEdition()) {
            try {
                final WorkspaceImpl workspace = (WorkspaceImpl) getWorkspace();
                workspace.setName(name);
                workspace.setTitle(title);
                workspace.setSkinId(skin);
                workspace.setEnvelopeId(envelope);
                url = ("".equals(url)) ? null : url;
                workspace.setFriendlyUrl(url);
                workspace.setHomeSearchMode(homeSearchMode);

                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);
                    }
                };

                txFragment.execute();
View Full Code Here

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

    }

    private List getSections() {
        UserStatus userStatus = UserStatus.lookup();
        List sections = new ArrayList();
        WorkspaceImpl workspace = NavigationManager.lookup().getCurrentWorkspace();
        if (workspace != null) {
            Section[] workspaceSections = workspace.getAllSections();
            for (int i = 0; i < workspaceSections.length; i++) {
                SectionPermission viewPerm = SectionPermission.newInstance(workspaceSections[i], SectionPermission.ACTION_VIEW);
                if (userStatus.hasPermission(viewPerm))
                    sections.add(workspaceSections[i]);
            }
View Full Code Here

        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)) {
            deleteWorkspace();
        } else if ("duplicate".equals(operationName)) {
            duplicateWorkspace();
View Full Code Here

            duplicateWorkspace();
        }
    }

    public void duplicateWorkspace() throws Exception {
        WorkspaceImpl workspace = (WorkspaceImpl) UIServices.lookup().getWorkspacesManager().getWorkspace(workspaceId);
        BackOfficePermission workspacePerm = BackOfficePermission.newInstance(null, BackOfficePermission.ACTION_CREATE_WORKSPACE);
        if (!getUserStatus().hasPermission(workspacePerm)) return;
        WorkspaceImpl workspaceCopy = getCopyManager().copy(workspace);
        Map<String, String> name = workspace.getName();
        for (String lang : name.keySet()) {
            String desc = name.get(lang);
            String prefix = "Copia de ";
            prefix = lang.equals("en") ? "Copy of " : prefix;
            workspaceCopy.setName(prefix + desc, lang);
        }
        UIServices.lookup().getWorkspacesManager().store(workspaceCopy);
    }
View Full Code Here

        }
        UIServices.lookup().getWorkspacesManager().store(workspaceCopy);
    }

    public void deleteWorkspace() throws Exception {
        final WorkspaceImpl workspace = (WorkspaceImpl) UIServices.lookup().getWorkspacesManager().getWorkspace(workspaceId);
        WorkspacePermission workspacePerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_DELETE);
        if (!getUserStatus().hasPermission(workspacePerm)) return;
        UIServices.lookup().getWorkspacesManager().delete(workspace);
        getNavigationManager().setCurrentWorkspace(null);
    }
View Full Code Here

    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.WorkspaceImpl

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.