Package org.jboss.dashboard.workspace

Examples of org.jboss.dashboard.workspace.WorkspaceImpl


    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


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

        //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) {
                for (int i = 0; i < sections.length; i++) {
                    if (!sections[i].getId().equals(sectionId) && sections[i].getFriendlyUrl() != null && sections[i].getFriendlyUrl().equals(url))
                        return false;
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 name = workspace.getName();
        for (Iterator it = name.keySet().iterator(); it.hasNext();) {
            String lang = (String) it.next();
            String desc = (String) 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

    /**
     * @see javax.servlet.jsp.tagext.TagSupport
     */
    public int doEndTag() throws JspTagException {

        WorkspaceImpl workspace = NavigationManager.lookup().getCurrentWorkspace();

        if (workspace != null) {
            Section section = workspace.getSection(getSection());

            if (section != null) {
                String linkStr = getLink((HttpServletRequest) pageContext.getRequest(), (HttpServletResponse) pageContext.getResponse(), section);
                try {
                    pageContext.getOut().print(StringEscapeUtils.escapeHtml(linkStr));
View Full Code Here

        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 children = parentSection.getChildren();
                rootSections = (Section[]) children.toArray(new Section[children.size()]);
            }
            renderFragment("outputStart");
            for (int i = 0; i < rootSections.length; i++) {
View Full Code Here

        rqctx.getRequest().getRequestObject().removeAttribute(CURRENT_PAGE_ATTR);
    }

    protected WorkspaceImpl getCurrentWorkspaceFromCache() {
        RequestContext rqctx = RequestContext.getCurrentContext();
        WorkspaceImpl currentWorkspace = (WorkspaceImpl) rqctx.getRequest().getRequestObject().getAttribute(CURRENT_WORKSPACE_ATTR);
        return currentWorkspace;
    }
View Full Code Here

     * Get the current workspace, repositioning the navigation in case it is not correct.
     *
     * @return current workspace after checking ubication is correct
     */
    public synchronized WorkspaceImpl getCurrentWorkspace() {
        WorkspaceImpl currentWorkspace = getCurrentWorkspaceFromCache();
        if (currentWorkspace != null) return currentWorkspace;
        if (!isValidUbication()) reposition();
        currentWorkspace = doGetCurrentWorkspace();
        return currentWorkspace;
    }
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.