Package org.apache.jetspeed.om.folder

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


    private DefaultMutableTreeNode retrieveFolders(String folderPath, DefaultMutableTreeNode rootNode, boolean cleanBeforeRetrieve)
    {
        try
        {
            Link link;
            Folder folder;
            DefaultMutableTreeNode tmpNode;
            Page page;
            Folder rootfolder = getServiceLocator().getPageManager().getFolder(folderPath);
           
            if (rootNode == null)
            {
                rootNode = new DefaultMutableTreeNode(new SiteTreeNode(rootfolder, true));
            }
           
            if (cleanBeforeRetrieve)
            {
                rootNode.removeAllChildren();
            }
           
            Iterator folders = rootfolder.getFolders().iterator();
            while (folders.hasNext())
            {
                folder = (Folder) folders.next();
               
                if (rootfolder.getPath().equals("/_user"))
                {
                    if (folder.getName().startsWith("template"))
                    {
                        rootNode.add(new DefaultMutableTreeNode(new SiteTreeNode(folder)));
                    }
                }
                else
                {
                    rootNode.add(new DefaultMutableTreeNode(new SiteTreeNode(folder)));
                }
            }
           
            Iterator pages = rootfolder.getPages().iterator();
            while (pages.hasNext())
            {
                page = (Page) pages.next();
                tmpNode = new DefaultMutableTreeNode(new SiteTreeNode(page));
                tmpNode.setAllowsChildren(false);
                rootNode.add(tmpNode);
            }
           
            Iterator links = rootfolder.getLinks().iterator();
            while (links.hasNext())
            {
                link = (Link) links.next();
                tmpNode = new DefaultMutableTreeNode(new SiteTreeNode(link));
                tmpNode.setAllowsChildren(false);
View Full Code Here


    private DefaultMutableTreeNode retrieveCopyFolders(String folderPath,
            DefaultMutableTreeNode rootNode)
    {
        try
        {
            Folder folder;
            Folder rootfolder = getServiceLocator().getPageManager().getFolder(
                    folderPath);
            if (rootNode == null)
            {
                rootNode = new DefaultMutableTreeNode(new SiteTreeNode(
                        rootfolder, true));
            }
            Iterator folders = rootfolder.getFolders().iterator();
            while (folders.hasNext())
            {
                folder = (Folder) folders.next();
                if (rootfolder.getPath().equals("/_user"))
                {
                    if (folder.getName().startsWith("template"))
                    {
                        rootNode.add(new DefaultMutableTreeNode(
                                new SiteTreeNode(folder)));
View Full Code Here

            {
                documentOrder = Arrays.asList(choices.split(","));
            }
            if (node.getDocType() == SiteTreeNode.FileType.Folder)
            {
                Folder folder = getJetspeedFolder(node.getNodePath());
                folder.setDocumentOrder(documentOrder);
                folderAction(folder, SAVE_ACTION);
            }
        }
    }
View Full Code Here

        PageManager pageManger = getServiceLocator().getPageManager();
        if (node != null)
        {
            if (node.getDocType() == SiteTreeNode.FileType.Folder)
            {
                Folder folder = getJetspeedFolder(node.getNodePath());
                if (action.equals("save"))
                {
                    folder.setTitle(document.getTitle());
                    folder.setShortTitle(document.getShortTitle());
                    folder.setDefaultPage(document.getPage());
                    folder.setDefaultDecorator(document.getPageDecorator(),
                            Fragment.LAYOUT);
                    folder.setDefaultDecorator(document.getPortletDecorator(),
                            Fragment.PORTLET);
                    folder.setSkin(document.getDesktopTheme());
                    folder.setHidden(document.isHidden());
                    folderAction(folder, SAVE_ACTION);
                } else if (action.equals("remove"))
                {
                    folderAction(folder, REMOVE_ACTION);
                }
View Full Code Here

                    .getCastorPageManager();
            try
            {
                if (siteNode.getDocType() == SiteTreeNode.FileType.Folder)
                {
                    Folder folder = pageManager.getFolder(siteNode
                            .getNodePath());
                    if (recursive)
                    {
                        PortalSiteManagerUtil
                                .importFolder(castorPageManager, folder,
                                        userName, getRealPath(folder.getPath()), true);
                    } else
                    {
                        Folder destFolder = castorPageManager.copyFolder(
                                folder, PortalSiteManagerUtil.getUserFolder(
                                        userName, true)
                                        + siteNode.getNodeName());
                        castorPageManager.updateFolder(destFolder);
                    }
                } else if (siteNode.getDocType() == SiteTreeNode.FileType.Page)
                {
                    objectPath = PortalSiteManagerUtil
                            .getParentPath(objectPath);
                    Folder folder = pageManager.getFolder(objectPath);
                    Page page = folder.getPage(siteNode.getNodeName());
                    Page destPage = castorPageManager.copyPage(page,
                            PortalSiteManagerUtil.getUserFolder(userName, true)
                                    + siteNode.getNodeName(),
                                    true);
                    castorPageManager.updatePage(destPage);
                } else if (siteNode.getDocType() == SiteTreeNode.FileType.Link)
                {
                    objectPath = PortalSiteManagerUtil
                            .getParentPath(objectPath);
                    Folder folder = pageManager.getFolder(objectPath);
                    Link link = folder.getLink(siteNode.getNodeName());
                    Link destLink = castorPageManager.copyLink(link,
                            PortalSiteManagerUtil.getUserFolder(userName, true)
                                    + siteNode.getNodeName());
                    castorPageManager.updateLink(destLink);
                }
View Full Code Here

    private Folder importFolders(PageManager pageManager,
            PageManager castorPageManager, Folder srcFolder, String userName,
            String destination, boolean copyIds) throws JetspeedException
    {
        Folder dstFolder = lookupFolder(castorPageManager, srcFolder.getPath());
        dstFolder = pageManager.copyFolder(srcFolder, destination);
        pageManager.updateFolder(dstFolder);
        String newPath = "";
        Iterator pages = srcFolder.getPages().iterator();
        while (pages.hasNext())
        {
            Page srcPage = (Page) pages.next();
            Page dstPage = lookupPage(castorPageManager, srcPage.getPath());
            newPath = destination + getRealPath(srcPage.getPath());
            dstPage = pageManager.copyPage(srcPage, newPath, copyIds);
            pageManager.updatePage(dstPage);
        }
        Iterator links = srcFolder.getLinks().iterator();
        while (links.hasNext())
        {
            Link srcLink = (Link) links.next();
            Link dstLink = lookupLink(castorPageManager, srcLink.getPath());
            newPath = destination + getRealPath(srcLink.getPath());
            dstLink = pageManager.copyLink(srcLink, newPath);
            pageManager.updateLink(dstLink);
        }
        Iterator folders = srcFolder.getFolders().iterator();
        while (folders.hasNext())
        {
            Folder folder = (Folder) folders.next();
            newPath = destination + getRealPath(folder.getPath());
            importFolders(pageManager, castorPageManager, folder, userName,
                    newPath, copyIds);
        }
        return dstFolder;
    }
View Full Code Here

   
    private void getSubFoldersPage(JetspeedDocument document)
    {
        List<String> pageFolder = new ArrayList<String>();
        List<String> documentOrder = document.getDocumentOrder();
        Folder folder;
        try
        {
            folder = getJetspeedFolder(document.getPath());
            Iterator folders = folder.getFolders().iterator();
            while (folders.hasNext())
            {
                pageFolder.add(((Folder) folders.next()).getName());
            }
            Iterator pages = folder.getPages().iterator();
            while (pages.hasNext())
            {
                pageFolder.add(((Page) pages.next()).getName());
            }
            Iterator links = folder.getLinks().iterator();
            while (links.hasNext())
            {
                pageFolder.add(((Link) links.next()).getName());
            }
            for (String documentName : pageFolder)
View Full Code Here

        MenuDefinition definition = getMenuDefinition();
        MenuOptionsDefinition oldElement = getOptionsDefinition(options);
        MenuOptionsDefinition newElement = getOptionsDefinition(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

        {
            newElement.setMenuElements(oldElement.getMenuElements());
        }
        if (node.getDocType() == FileType.Folder)
        {
            Folder folder = getJetspeedFolder(node.getNodePath());
            List menuList = folder.getMenuDefinitions();
            if (action.equals(SAVE_ACTION))
            {
                menuList.remove(oldElement);
                menuList.add(newElement);
            }
            else if (action.equals(REMOVE_ACTION))
            {
                menuList.remove(oldElement);
            }
            else if (action.equals(ADD_ACTION))
            {
                menuList.add(newElement);
            }
            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();
        MenuSeparatorDefinition oldElement = getSeparatorDefinition(element.getText());
        MenuSeparatorDefinition newElement = getSeparatorDefinition(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

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.