Package org.apache.jetspeed.om.folder

Examples of org.apache.jetspeed.om.folder.Folder


        MenuDefinition definition = getMenuDefinition();
        MenuIncludeDefinition oldElement = getIncludesDefinition(name);
        MenuIncludeDefinition newElement = getIncludesDefinition(element);
        if (node.getDocType() == FileType.Folder)
        {
            Folder folder = getJetspeedFolder(node.getNodePath());
            List menuList = folder.getMenuDefinitions();
            if (action.equals(SAVE_ACTION))
            {
                menuList.remove(definition);
                if(definition.getMenuElements()!=null)
                {
                    definition.getMenuElements().remove(oldElement);
                    definition.getMenuElements().add(newElement);
                }else{
                    List elements =  new ArrayList();
                    elements.add(newElement);
                    definition.setMenuElements(elements);
                }
                menuList.add(definition);
            }
            else if (action.equals(REMOVE_ACTION))
            {
                menuList.remove(definition);
                definition.getMenuElements().remove(oldElement);
                menuList.add(definition);
            }
            folder.setMenuDefinitions(menuList);
            folderAction(folder, SAVE_ACTION);
        }
        else if (node.getDocType() == FileType.Page)
        {
            Page page = getJetspeedPage(node.getNodePath());
View Full Code Here


        MenuDefinition definition = getMenuDefinition();
        MenuExcludeDefinition oldElement = getExcludeDefinition(name);
        MenuExcludeDefinition newElement = getExcludesDefinition(element);
        if (node.getDocType() == FileType.Folder)
        {
            Folder folder = getJetspeedFolder(node.getNodePath());
            List menuList = folder.getMenuDefinitions();
            if (action.equals(SAVE_ACTION))
            {
                menuList.remove(definition);
                if(definition.getMenuElements()!=null)
                {
                    definition.getMenuElements().remove(oldElement);
                    definition.getMenuElements().add(newElement);
                }else{
                    List elements =  new ArrayList();
                    elements.add(newElement);
                    definition.setMenuElements(elements);
                }
                menuList.add(definition);
            }
            else if (action.equals(REMOVE_ACTION))
            {
                menuList.remove(definition);
                definition.getMenuElements().remove(oldElement);
                menuList.add(definition);
            }
            folder.setMenuDefinitions(menuList);
            folderAction(folder, SAVE_ACTION);
        }
        else if (node.getDocType() == FileType.Page)
        {
            Page page = getJetspeedPage(node.getNodePath());
View Full Code Here

        return link;
    }

    protected Folder getJetspeedFolder(String folderPath)
    {
        Folder folder = null;
        try
        {
            folder = getServiceLocator().getPageManager().getFolder(folderPath);
        }
        catch (FolderNotFoundException e)
View Full Code Here

                    siteTreeNode = new SiteTreeNode(page.getName(), page.getPath(), SiteTreeNode.FileType.Page, true);
                    treeRootNode = new DefaultMutableTreeNode(new SiteTreeNode(page));
                }
                else if (FOLDER_NODE_TYPE.equals(type))
                {
                    Folder folder = pageManager.getFolder(pathParam);
                    siteTreeNode = new SiteTreeNode(folder.getName(), folder.getPath(), SiteTreeNode.FileType.Folder, true);
                    treeRootNode = new DefaultMutableTreeNode(new SiteTreeNode(folder, true));
                }
                else if (LINK_NODE_TYPE.equals(type))
                {
                    Link link = pageManager.getLink(pathParam);
View Full Code Here

                actionResponse.sendRedirect(redirect);
            }
            else if (Folder.FOLDER_TYPE.equals(type))
            {
                String path = nodePath;
                Folder folder = pageManager.newFolder(path);
                folder.setTitle(name);
                pageManager.updateFolder(folder);
               
                String defaultPagePath = folder.getPath() + "/" + Folder.FALLBACK_DEFAULT_PAGE;
                Page source = pageManager.getPage(templatePage);
                Page newPage = pageManager.copyPage(source, defaultPagePath, false);
                pageManager.updatePage(newPage);
               
                requestContext.setSessionAttribute(PORTAL_SITE_SESSION_CONTEXT_ATTR_KEY, null);
View Full Code Here

                                        && !destPath.equals(""))
                                {
                                    // if "/" is path, then file separator will
                                    // work, as root.
                                    if (destPath.equals("/")) destPath = "";
                                    Folder folder = getServiceLocator()
                                            .getCastorPageManager().getFolder(
                                                    userName);
                                    if (fileType.equalsIgnoreCase("psml"))
                                    {
                                        Page source = folder.getPage(fileName);
                                        Page page = null;
                                        if (pageManager.pageExists(destPath
                                                + pathSeparator + fileName))
                                        {
                                            pageManager.removePage(pageManager
                                                    .getPage(destPath
                                                            + pathSeparator
                                                            + fileName));
                                        }
                                        page = pageManager.copyPage(source,
                                                destPath + pathSeparator
                                                        + fileName,
                                                        copyIds);
                                        pageManager.updatePage(page);
                                        success = true;
                                    } else if (fileType.equalsIgnoreCase("tpsml"))
                                    {
                                        PageTemplate source = folder.getPageTemplate(fileName);
                                        PageTemplate pageTemplate = null;
                                        if (pageManager.pageTemplateExists(destPath
                                                + pathSeparator + fileName))
                                        {
                                            pageManager.removePageTemplate(pageManager
                                                    .getPageTemplate(destPath
                                                            + pathSeparator
                                                            + fileName));
                                        }
                                        pageTemplate = pageManager.copyPageTemplate(source,
                                                destPath + pathSeparator
                                                + fileName,
                                                copyIds);
                                        pageManager.updatePageTemplate(pageTemplate);
                                        success = true;
                                    } else if (fileType.equalsIgnoreCase("dpsml"))
                                    {
                                        DynamicPage source = folder.getDynamicPage(fileName);
                                        DynamicPage dynamicPage = null;
                                        if (pageManager.dynamicPageExists(destPath
                                                + pathSeparator + fileName))
                                        {
                                            pageManager.removeDynamicPage(pageManager
                                                    .getDynamicPage(destPath
                                                            + pathSeparator
                                                            + fileName));
                                        }
                                        dynamicPage = pageManager.copyDynamicPage(source,
                                                destPath + pathSeparator
                                                + fileName,
                                                copyIds);
                                        pageManager.updateDynamicPage(dynamicPage);
                                        success = true;
                                    } else if (fileType.equalsIgnoreCase("fpsml"))
                                    {
                                        FragmentDefinition source = folder.getFragmentDefinition(fileName);
                                        FragmentDefinition fragmentDefinition = null;
                                        if (pageManager.fragmentDefinitionExists(destPath
                                                + pathSeparator + fileName))
                                        {
                                            pageManager.removeFragmentDefinition(pageManager
                                                    .getFragmentDefinition(destPath
                                                            + pathSeparator
                                                            + fileName));
                                        }
                                        fragmentDefinition = pageManager.copyFragmentDefinition(source,
                                                destPath + pathSeparator
                                                + fileName,
                                                copyIds);
                                        pageManager.updateFragmentDefinition(fragmentDefinition);
                                        success = true;
                                    } else if (fileType
                                            .equalsIgnoreCase("link"))
                                    {
                                        Link source = folder.getLink(fileName);
                                        Link link;
                                        if (pageManager.linkExists(destPath
                                                + pathSeparator + fileName))
                                        {
                                            pageManager.removeLink(pageManager
View Full Code Here

        {
            FileType docType = getUserSelectedNode().getDocType();
           
            if (getUserSelectedNode().getDocType() == FileType.Folder)
            {
                Folder sourceFolder = getJetspeedFolder(oldPath);
                Node sourceParentNode = sourceFolder.getParent();
               
                try
                {
                    String destFolderPath = newPath + JETSPEED_PATH_SEPRATOR + newName;
                    getServiceLocator().getPageManager().deepCopyFolder(sourceFolder, destFolderPath, getFolderOwner(sourceFolder));
                   
                    Folder destFolder = getServiceLocator().getPageManager().getFolder(destFolderPath);
                    if (destFolder.getParent() != null)
                    {
                        setFolderTreeNodeLoadedByPath(destFolder.getParent(), false);
                    }
                   
                    if (!copy)
                    {
                        folderAction(sourceFolder, REMOVE_ACTION);
View Full Code Here

                    } else
                    {
                        documentPath = treeNode.getNodePath()
                                + JETSPEED_PATH_SEPRATOR;
                    }
                    Folder folder = getServiceLocator().getPageManager()
                            .newFolder(documentPath + document.getName());
                    folder.setTitle(document.getTitle());
                    folder.setShortTitle(document.getShortTitle());
                    folderAction(folder, SAVE_ACTION);
                    node.insert(new DefaultMutableTreeNode(new SiteTreeNode(
                            folder)), 0);
                    LinkTree tree = (PortalTree) getPage().get("siteTree");
                    tree.getTreeState().expandNode(node);
View Full Code Here

    }
   
    public static Folder importFolder(PageManager castorPageManager, Folder srcFolder, String userName, String destination, boolean copyIds) throws JetspeedException
    {
        String newPath = "";
        Folder dstFolder = lookupFolder(castorPageManager,srcFolder.getPath());
        dstFolder = castorPageManager.copyFolder(srcFolder, getUserFolder(userName, true) + destination);
        castorPageManager.updateFolder(dstFolder);
        Iterator pages = srcFolder.getPages().iterator();
        while (pages.hasNext())
        {
            Page srcPage = (Page) pages.next();
            Page dstPage = lookupPage(castorPageManager,srcPage.getPath());
            newPath = getUserFolder(userName, true) + destination + getRealPath(srcPage.getPath());
            dstPage = castorPageManager.copyPage(srcPage, newPath, copyIds);
            castorPageManager.updatePage(dstPage);
        }
        Iterator pageTemplates = srcFolder.getPageTemplates().iterator();
        while (pageTemplates.hasNext())
        {
            PageTemplate srcPageTemplate = (PageTemplate) pageTemplates.next();
            PageTemplate dstPageTemplate = lookupPageTemplate(castorPageManager,srcPageTemplate.getPath());
            newPath = getUserFolder(userName, true) + destination + getRealPath(srcPageTemplate.getPath());
            dstPageTemplate = castorPageManager.copyPageTemplate(srcPageTemplate, newPath, copyIds);
            castorPageManager.updatePageTemplate(dstPageTemplate);
        }       
        Iterator dynamicPages = srcFolder.getDynamicPages().iterator();
        while (dynamicPages.hasNext())
        {
            DynamicPage srcDynamicPage = (DynamicPage) dynamicPages.next();
            DynamicPage dstDynamicPage = lookupDynamicPage(castorPageManager,srcDynamicPage.getPath());
            newPath = getUserFolder(userName, true) + destination + getRealPath(srcDynamicPage.getPath());
            dstDynamicPage = castorPageManager.copyDynamicPage(srcDynamicPage, newPath, copyIds);
            castorPageManager.updateDynamicPage(dstDynamicPage);
        }
        Iterator fragmentDefinitions = srcFolder.getFragmentDefinitions().iterator();
        while (fragmentDefinitions.hasNext())
        {
            FragmentDefinition srcFragmentDefinition = (FragmentDefinition) fragmentDefinitions.next();
            FragmentDefinition dstFragmentDefinition = lookupFragmentDefinition(castorPageManager,srcFragmentDefinition.getPath());
            newPath = getUserFolder(userName, true) + destination + getRealPath(srcFragmentDefinition.getPath());
            dstFragmentDefinition = castorPageManager.copyFragmentDefinition(srcFragmentDefinition, newPath, copyIds);
            castorPageManager.updateFragmentDefinition(dstFragmentDefinition);
        }
        Iterator links = srcFolder.getLinks().iterator();
        while (links.hasNext())
        {
            Link srcLink = (Link) links.next();
            Link dstLink = lookupLink(castorPageManager,srcLink.getPath());
            newPath = getUserFolder(userName, true) + destination + getRealPath(srcLink.getPath());
            dstLink = castorPageManager.copyLink(srcLink, newPath);
            castorPageManager.updateLink(dstLink);
        }
        Iterator folders = srcFolder.getFolders().iterator();
        while (folders.hasNext())
        {
            Folder folder = (Folder) folders.next();
            newPath = destination + getRealPath(folder.getPath());
            importFolder(castorPageManager,folder, userName, newPath, copyIds);
        }
        return dstFolder;
    }
View Full Code Here

                if (!pageManager.folderExists(templateFolderPath))
                {
                    throw new PortletException("Space template folder does not exist: " + templateFolderPath);
                }
               
                Folder templateFolder = pageManager.getFolder(templateFolderPath);
                String owner = actionRequest.getUserPrincipal().getName();
                try
                {
                    userManager.getUser(owner);
                }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.folder.Folder

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.