Package org.apache.jetspeed.om.page

Examples of org.apache.jetspeed.om.page.DynamicPage


     * @throws NodeException
     */
    public DynamicPage getDynamicPage(String name, boolean checkAccess) throws PageNotFoundException, NodeException
    {
        // get dynamic page
        DynamicPage dynamicPage = (DynamicPage) getAllNodes().subset(DynamicPage.DOCUMENT_TYPE).get(name);
        if (dynamicPage == null)
        {
            throw new PageNotFoundException("Jetspeed PSML dynamic page not found: " + name);
        }

        // check access
        if (checkAccess)
        {
            dynamicPage.checkAccess(JetspeedActions.VIEW);
        }
        return dynamicPage;
    }
View Full Code Here


     */
    public ContentPage newContentPage(BaseFragmentsElement pageOrTemplate, PageTemplate pageTemplate, Map fragmentDefinitions)
    {
        // generate content page
        BaseConcretePageElement concretePage = ((pageOrTemplate instanceof BaseConcretePageElement) ? (BaseConcretePageElement)pageOrTemplate : null);
        DynamicPage dynamicPage = ((pageOrTemplate instanceof DynamicPage) ? (DynamicPage)pageOrTemplate : null);
        FragmentDefinition fragmentDefinition = (((concretePage == null) && (pageOrTemplate instanceof FragmentDefinition)) ? (FragmentDefinition)pageOrTemplate : null);
        String contentPageId = pageOrTemplate.getId();
        ContentPageImpl contentPageImpl = new ContentPageImpl(this, contentPageId, pageOrTemplate, pageTemplate, fragmentDefinitions);
        // set/merge page attributes
        mergeContentPageAttributes(contentPageImpl, pageOrTemplate);
        contentPageImpl.setName(pageOrTemplate.getName());
        contentPageImpl.setPath(pageOrTemplate.getPath());
        contentPageImpl.setUrl(pageOrTemplate.getUrl());
        contentPageImpl.setHidden(pageOrTemplate.isHidden());       
        // merge template attributes
        mergeContentPageAttributes(contentPageImpl, pageTemplate);           
        // set effective default detectors from merged default
        // decorators or inherit page effective default decorators
        Map effectiveDefaultDecorators = null;
        String effectiveLayoutDefaultDecorator = contentPageImpl.getDefaultDecorator(Fragment.LAYOUT);
        if (effectiveLayoutDefaultDecorator == null)
        {
            if (concretePage != null)
            {
                effectiveLayoutDefaultDecorator = concretePage.getEffectiveDefaultDecorator(Fragment.LAYOUT);
            }
            else if (pageOrTemplate.getParent() != null)
            {
                effectiveLayoutDefaultDecorator = ((Folder)pageOrTemplate.getParent()).getEffectiveDefaultDecorator(Fragment.LAYOUT);
            }
        }
        if (effectiveLayoutDefaultDecorator != null)
        {
            if (effectiveDefaultDecorators == null)
            {
                effectiveDefaultDecorators = new HashMap();
            }
            effectiveDefaultDecorators.put(Fragment.LAYOUT, effectiveLayoutDefaultDecorator);
        }
        String effectivePortletDefaultDecorator = contentPageImpl.getDefaultDecorator(Fragment.PORTLET);
        if (effectivePortletDefaultDecorator == null)
        {
            if (concretePage != null)
            {
                effectivePortletDefaultDecorator = concretePage.getEffectiveDefaultDecorator(Fragment.PORTLET);
            }
            else if (pageOrTemplate.getParent() != null)
            {
                effectiveLayoutDefaultDecorator = ((Folder)pageOrTemplate.getParent()).getEffectiveDefaultDecorator(Fragment.PORTLET);
            }
        }
        if (effectivePortletDefaultDecorator != null)
        {
            if (effectiveDefaultDecorators == null)
            {
                effectiveDefaultDecorators = new HashMap();
            }
            effectiveDefaultDecorators.put(Fragment.PORTLET, effectivePortletDefaultDecorator);
        }
        contentPageImpl.setEffectiveDefaultDecorators(effectiveDefaultDecorators);
        if (dynamicPage != null)
        {
            contentPageImpl.setContentType(dynamicPage.getContentType());
            contentPageImpl.setInheritable(dynamicPage.isInheritable());
        }
        if (fragmentDefinition != null)
        {
            contentPageImpl.setDefId(fragmentDefinition.getDefId());
        }
View Full Code Here

            String newDynamicPagePath = folder.getPath()+(folder.getPath().endsWith(Folder.PATH_SEPARATOR) ? "" : Folder.PATH_SEPARATOR)+pageName+DynamicPage.DOCUMENT_TYPE;
            if (pageManager.dynamicPageExists(newDynamicPagePath))
            {
                throw new IllegalArgumentException("Dynamic page "+newDynamicPagePath+" exists");
            }
            DynamicPage newDynamicPage = pageManager.newDynamicPage(newDynamicPagePath);
            newDynamicPage.setContentType(!Utils.isNull(contentType) ? contentType : "*");
            if (!Utils.isNull(layoutName) && (newDynamicPage.getRootFragment() instanceof Fragment))
            {
                ((Fragment)newDynamicPage.getRootFragment()).setName(layoutName);
            }
            if (!Utils.isNull(pageTitle))
            {
                newDynamicPage.setTitle(pageTitle);
            }
            if (!Utils.isNull(pageShortTitle))
            {
                newDynamicPage.setShortTitle(pageShortTitle);
            }
            String defaultLayoutDecorator = null;
            String defaultPortletDecorator = null;
            if (page != null)
            {
                defaultLayoutDecorator = page.getDefaultDecorator(Fragment.LAYOUT);
                if (defaultLayoutDecorator != null)
                {
                    newDynamicPage.setDefaultDecorator(defaultLayoutDecorator, Fragment.LAYOUT);
                }
                defaultPortletDecorator = page.getDefaultDecorator(Fragment.PORTLET);
                if (defaultPortletDecorator != null)
                {
                    newDynamicPage.setDefaultDecorator(defaultPortletDecorator, Fragment.PORTLET);
                }
            }

            // update new dynamic page in page manager
            pageManager.updateDynamicPage(newDynamicPage);
View Full Code Here

            BaseFragmentsElement pageOrTemplate = getPageOrTemplate(contentPageImpl.getPageOrTemplate().getPath());
            if (!(pageOrTemplate instanceof DynamicPage))
            {
                throw new IllegalArgumentException("Content only supported on dynamic pages.");
            }
            DynamicPage dynamicPage = (DynamicPage)pageOrTemplate;
           
            // check for edit permission
            dynamicPage.checkAccess(JetspeedActions.EDIT);           

            // update default decorator and page in page manager
            boolean update = false;
            if (!Utils.isNull(contentType) && !contentType.equals(dynamicPage.getContentType()))
            {
                dynamicPage.setContentType(contentType);
                update = true;
            }
            if ((inheritable != null) && (inheritable.booleanValue() != dynamicPage.isInheritable()))
            {
                dynamicPage.setInheritable(inheritable.booleanValue());
                update = true;
            }
            if (update)
            {
                updatePage(dynamicPage);
View Full Code Here

        assertNotNull(rootPage0);
        assertEquals(rootFolder.getPage("page0.psml"), rootPage0);       
        Link rootLink0 = pageManager.getLink("/link0.link");       
        assertNotNull(rootLink0);
        assertEquals(rootFolder.getLink("link0.link"), rootLink0);       
        DynamicPage docPage = pageManager.getDynamicPage("/docpage.dpsml");       
        assertNotNull(docPage);
        assertEquals(rootFolder.getDynamicPage("docpage.dpsml"), docPage);       
    }
View Full Code Here

        Link rootLink0View = rootFolderView.getLink("link0.link");
        assertNotNull(rootLink0View);
        assertEquals(rootFolderView, rootLink0View.getParent());
        assertEquals("link0.link", rootLink0View.getName());
        assertEquals("/link0.link", extractFileSystemPathFromId(rootLink0View.getId()));
        DynamicPage docPageView = rootFolderView.getDynamicPage("docpage.dpsml");       
        assertNotNull(docPageView);
        assertEquals(rootFolderView, docPageView.getParent());
        assertEquals("docpage.dpsml", docPageView.getName());
        assertEquals("/docpage.dpsml", extractFileSystemPathFromId(docPageView.getId()));
        Folder rootFolder0View = rootFolderView.getFolder("folder0");
        assertNotNull(rootFolder0View);
        assertEquals(rootFolderView, rootFolder0View.getParent());
        assertEquals(1, rootFolder0View.getPages().size());
        assertNull(rootFolder0View.getLinks());
        assertEquals("folder0", rootFolder0View.getName());
        assertEquals("/folder0", extractFileSystemPathFromId(rootFolder0View.getId()));
        Page folder0Page0View = rootFolder0View.getPage("page0.psml");
        assertNotNull(folder0Page0View);
        assertEquals(rootFolder0View, folder0Page0View.getParent());
        assertEquals("page0.psml", folder0Page0View.getName());
        assertEquals("/folder0/page0.psml", extractFileSystemPathFromId(folder0Page0View.getId()));

        // test SiteView access by path
        Folder rootFolderViewByPath = (Folder)baseView.getNodeView("/", null, null, true, false, false);
        assertNotNull(rootFolderViewByPath);
        assertEquals(rootFolderView, rootFolderViewByPath);
        Folder rootFolder0ViewByPath = (Folder)baseView.getNodeView("/folder0/", null, null, true, false, false);
        assertNotNull(rootFolder0ViewByPath);
        assertEquals(rootFolder0View, rootFolder0ViewByPath);
        Page folder0Page0ViewByPath = (Page)baseView.getNodeView("/folder0/page0.psml", null, null, true, false, false);
        assertNotNull(folder0Page0ViewByPath);
        assertEquals(folder0Page0View, folder0Page0ViewByPath);
        folder0Page0ViewByPath = (Page)baseView.getNodeView("page0.psml", rootFolder0View, null, true, false, false);
        assertNotNull(folder0Page0ViewByPath);
        assertEquals(folder0Page0View, folder0Page0ViewByPath);
        try
        {
            baseView.getNodeView("/folderX/page0.psml", null, null, true, false, false);
            fail("/folderX/page0.psml should not be found");
        }
        catch (NodeNotFoundException nnfe)
        {
        }
        try
        {
            baseView.getNodeView("/folder0/pageX.psml", null, null, true, false, false);
            fail("/folder0/pageX.psml should not be found");
        }
        catch (NodeNotFoundException nnfe)
        {
        }
        List rootPageViewsByPath = baseView.getNodeViews("/page?.psml", null, null, true, false, false);
        assertNotNull(rootPageViewsByPath);
        assertEquals(3,rootPageViewsByPath.size());
        assertTrue(rootPageViewsByPath.contains(rootPage0View));
        List rootFolderViewsByPath = baseView.getNodeViews("/*/", null, null, true, false, false);
        assertNotNull(rootFolderViewsByPath);
        assertEquals(6,rootFolderViewsByPath.size());
        assertTrue(rootFolderViewsByPath.contains(rootFolder0View));
        List folderPageViewsByPath = baseView.getNodeViews("*/p*[0-9].psml", rootFolderView, null, true, false, false);
        assertNotNull(folderPageViewsByPath);
        assertEquals(2,folderPageViewsByPath.size());
        assertTrue(folderPageViewsByPath.contains(folder0Page0View));

        // test aggregating SiteView
        SearchPathsSiteView aggregateView = new SearchPathsSiteView(pageManager, "/_user/user,/_role/role0,/_group/group,/", false);
        assertEquals("/_user/user,/_role/role0,/_group/group,/", aggregateView.getSearchPathsString());
        rootFolderView = aggregateView.getRootFolderView();
        assertNotNull(rootFolderView);
        assertEquals("/", rootFolderView.getName());
        assertEquals("user root", rootFolderView.getTitle());
        assertEquals("/_user/user", extractFileSystemPathFromId(rootFolderView.getId()));
        assertEquals(6, rootFolderView.getFolders().size());
        assertEquals(4, rootFolderView.getPages().size());
        assertEquals(2, rootFolderView.getLinks().size());
        assertEquals(2, rootFolderView.getDynamicPages().size());
        rootPage0View = rootFolderView.getPage("page0.psml");
        assertNotNull(rootPage0View);
        assertEquals(rootFolderView, rootPage0View.getParent());
        assertEquals("page0.psml", rootPage0View.getName());
        assertEquals("/page0.psml", extractFileSystemPathFromId(rootPage0View.getId()));
        List rootPage0ViewMenus = rootPage0View.getMenuDefinitions();
        assertNotNull(rootPage0ViewMenus);
        assertEquals(7 + aggregateView.getStandardMenuNames().size(), rootPage0ViewMenus.size());
        Iterator menusIter = rootPage0ViewMenus.iterator();
        MenuDefinition rootPage0ViewTemplateTestMenu = (MenuDefinition)menusIter.next();
        assertEquals("template-test", rootPage0ViewTemplateTestMenu.getName());
        assertEquals("/page2.psml", rootPage0ViewTemplateTestMenu.getOptions());
        MenuDefinition rootPage0ViewTopMenu = (MenuDefinition)menusIter.next();
        assertEquals("top", rootPage0ViewTopMenu.getName());
        assertEquals("/", rootPage0ViewTopMenu.getOptions());
        assertEquals(2, rootPage0ViewTopMenu.getDepth());
        assertEquals("dhtml-pull-down", rootPage0ViewTopMenu.getSkin());
        MenuDefinition rootPage0ViewBreadCrumbMenu = (MenuDefinition)menusIter.next();
        assertEquals("bread-crumbs", rootPage0ViewBreadCrumbMenu.getName());
        assertEquals("./", rootPage0ViewBreadCrumbMenu.getOptions());
        assertEquals(true, rootPage0ViewBreadCrumbMenu.isPaths());
        MenuDefinition rootPage0ViewCurrentPageTestMenu = (MenuDefinition)menusIter.next();
        assertEquals("current-page-test", rootPage0ViewCurrentPageTestMenu.getName());
        MenuDefinition rootPage0ViewCurrentPathTestMenu = (MenuDefinition)menusIter.next();
        assertEquals("current-path-test", rootPage0ViewCurrentPathTestMenu.getName());       
        MenuDefinition rootPage0SiteNavigationsMenu = (MenuDefinition)menusIter.next();
        assertEquals("site-navigations", rootPage0SiteNavigationsMenu.getName());       
        assertTrue(rootPage0SiteNavigationsMenu.isRegexp());       
        assertEquals("/*/,/*.psml", rootPage0SiteNavigationsMenu.getOptions());       
        assertEquals(-1, rootPage0SiteNavigationsMenu.getDepth());       
        MenuDefinition rootPage0RootedNavigationsMenu = (MenuDefinition)menusIter.next();
        assertEquals("rooted-navigations", rootPage0RootedNavigationsMenu.getName());       
        for (int i = 0; (i < aggregateView.getStandardMenuNames().size()); i++)
        {
            assertTrue(aggregateView.getStandardMenuNames().contains(((MenuDefinition)menusIter.next()).getName()));
        }
        Page rootPage2View = rootFolderView.getPage("page2.psml");
        assertNotNull(rootPage2View);
        assertEquals(rootFolderView, rootPage2View.getParent());
        assertEquals("page2.psml", rootPage2View.getName());
        assertEquals("/_user/user/page2.psml", extractFileSystemPathFromId(rootPage2View.getId()));
        List rootPage2ViewMenus = rootPage2View.getMenuDefinitions();
        assertNotNull(rootPage2ViewMenus);
        assertEquals(7 + aggregateView.getStandardMenuNames().size(), rootPage2ViewMenus.size());
        menusIter = rootPage2ViewMenus.iterator();
        MenuDefinition rootPage2ViewTopMenu = (MenuDefinition)menusIter.next();
        assertEquals("top", rootPage2ViewTopMenu.getName());
        assertEquals("/", rootPage2ViewTopMenu.getOptions());
        assertEquals(1, rootPage2ViewTopMenu.getDepth());
        MenuDefinition rootPage2ViewBreadCrumbMenu = (MenuDefinition)menusIter.next();
        assertEquals("bread-crumbs", rootPage2ViewBreadCrumbMenu.getName());
        MenuDefinition rootPage2ViewTemplateTestMenu = (MenuDefinition)menusIter.next();
        assertEquals("template-test", rootPage2ViewTemplateTestMenu.getName());
        assertEquals("/page0.psml", rootPage2ViewTemplateTestMenu.getOptions());
        MenuDefinition rootPage2ViewCurrentPageTestMenu = (MenuDefinition)menusIter.next();
        assertEquals("current-page-test", rootPage0ViewCurrentPageTestMenu.getName());
        MenuDefinition rootPage2ViewCurrentPathTestMenu = (MenuDefinition)menusIter.next();
        assertEquals("current-path-test", rootPage0ViewCurrentPathTestMenu.getName());       
        MenuDefinition rootPage2SiteNavigationsMenu = (MenuDefinition)menusIter.next();
        assertEquals("site-navigations", rootPage2SiteNavigationsMenu.getName());       
        MenuDefinition rootPage2RootedNavigationsMenu = (MenuDefinition)menusIter.next();
        assertEquals("rooted-navigations", rootPage2RootedNavigationsMenu.getName());       
        for (int i = 0; (i < aggregateView.getStandardMenuNames().size()); i++)
        {
            assertTrue(aggregateView.getStandardMenuNames().contains(((MenuDefinition)menusIter.next()).getName()));
        }
        rootLink0View = rootFolderView.getLink("link0.link");
        assertNotNull(rootLink0View);
        assertEquals(rootFolderView, rootLink0View.getParent());
        assertEquals("link0.link", rootLink0View.getName());
        assertEquals("/_group/group/link0.link", extractFileSystemPathFromId(rootLink0View.getId()));
        rootFolder0View = rootFolderView.getFolder("folder0");
        assertNotNull(rootFolder0View);
        assertEquals(rootFolderView, rootFolder0View.getParent());
        assertEquals(1, rootFolder0View.getPages().size());
        assertNull(rootFolder0View.getLinks());
        assertNull(rootFolder0View.getFolders());
        assertEquals("folder0", rootFolder0View.getName());
        assertEquals("folder0", rootFolder0View.getTitle());
        assertEquals("/folder0", extractFileSystemPathFromId(rootFolder0View.getId()));
        folder0Page0View = rootFolder0View.getPage("page0.psml");
        assertNotNull(folder0Page0View);
        assertEquals(rootFolder0View, folder0Page0View.getParent());
        assertEquals("page0.psml", folder0Page0View.getName());
        assertEquals("/folder0/page0.psml", extractFileSystemPathFromId(folder0Page0View.getId()));
        Folder rootFolder1View = rootFolderView.getFolder("folder1");
        assertNotNull(rootFolder1View);
        assertEquals(rootFolderView, rootFolder1View.getParent());
        assertEquals(2, rootFolder1View.getPages().size());
        assertNull(rootFolder1View.getLinks());
        assertNotNull(rootFolder1View.getFolders());
        assertEquals(1, rootFolder1View.getFolders().size());
        assertEquals("folder1", rootFolder1View.getName());
        assertEquals("group folder1", rootFolder1View.getTitle());
        assertEquals("/_user/user/folder1", extractFileSystemPathFromId(rootFolder1View.getId()));
        assertEquals("/_user/user", aggregateView.getUserFolderPath());
        assertEquals("/", aggregateView.getBaseFolderPath());

        // test degenerate aggregating SiteView
        aggregateView = new SearchPathsSiteView(pageManager, "/__subsite-root", false);
        assertEquals("/__subsite-root", aggregateView.getSearchPathsString());
        rootFolderView = aggregateView.getRootFolderView();
        assertNotNull(rootFolderView);
        assertEquals("/", rootFolderView.getName());
        assertEquals("subsite root", rootFolderView.getTitle());
        assertEquals("/__subsite-root", extractFileSystemPathFromId(rootFolderView.getId()));
        assertNull(rootFolderView.getFolders());
        assertEquals(1, rootFolderView.getPages().size());
        assertEquals(1, rootFolderView.getLinks().size());

        // test SiteView construction using profile locators
        JetspeedProfileLocator locator = new JetspeedProfileLocator();
        locator.init(null, "/");
        SearchPathsSiteView profileView = new SearchPathsSiteView(pageManager, locator, false);
        assertEquals("/", profileView.getSearchPathsString());
        locator = new JetspeedProfileLocator();
        locator.init(null, "/");
        locator.add("user", true, false, "user");
        locator.add("page", false, false, "default-page");
        profileView = new SearchPathsSiteView(pageManager, locator, false);
        assertEquals("/_user/user,/", profileView.getSearchPathsString());
        locator = new JetspeedProfileLocator();
        locator.init(null, "/");
        locator.add("page", false, false, "default-page");
        locator.add("user", true, false, "user");
        locator.add("mediatype", true, false, "html");
        locator.add("language", true, false, "en");
        locator.add("country", true, false, "US");
        profileView = new SearchPathsSiteView(pageManager, locator, false);
        assertEquals("/_user/user/_mediatype/html,/_user/user,/", profileView.getSearchPathsString());
        locator = new JetspeedProfileLocator();
        locator.init(null, "/");
        locator.add("page", false, false, "default-page");
        locator.add("role", true, false, "role0");
        locator.add("role", true, false, "role1");
        profileView = new SearchPathsSiteView(pageManager, locator, false);
        assertEquals("/_role/role0,/_role/role1,/", profileView.getSearchPathsString());
        locator = new JetspeedProfileLocator();
        locator.init(null, "/");
        locator.add("user", true, false, "user");
        locator.add("navigation", false, true, "/");
        locator.add("role", true, false, "role0");
        locator.add("navigation", false, true, "/");
        locator.add("group", true, false, "group");
        locator.add("page", false, false, "default-page");
        profileView = new SearchPathsSiteView(pageManager, locator, false);
        assertEquals("/_user/user,/_role/role0,/_group/group,/", profileView.getSearchPathsString());

        locator = new JetspeedProfileLocator();
        locator.init(null, "/");
        locator.add("hostname", true, false, "dash");
        locator.add("user", true, false, "joe");
        locator.add("page", false, false, "home");
        profileView = new SearchPathsSiteView(pageManager, locator, false);
        assertEquals("/_hostname/dash/_user/joe,/_hostname/dash,/", profileView.getSearchPathsString());
       
        locator = new JetspeedProfileLocator();
        locator.init(null, "/");
        locator.add("navigation", false, true, "subsite-root");
        profileView = new SearchPathsSiteView(pageManager, locator, false);
        assertEquals("/__subsite-root", profileView.getSearchPathsString());
        Map locators = new HashMap();
        locator = new JetspeedProfileLocator();
        locator.init(null, "/");
        locator.add("role", true, false, "role0");
        locator.add("role", true, false, "role1");
        locators.put(ProfileLocator.PAGE_LOCATOR, locator);
        locator = new JetspeedProfileLocator();
        locator.init(null, "/");
        locator.add("user", true, false, "user");
        locator.add("navigation", false, true, "/");
        locator.add("group", true, false, "group");
        locators.put("alternate-locator-name", locator);
        profileView = new SearchPathsSiteView(pageManager, locators, false);
        assertEquals("/_role/role0,/_role/role1,/_user/user,/_group/group,/", profileView.getSearchPathsString());
        rootFolderView = profileView.getRootFolderView();
        assertNotNull(rootFolderView);
        assertEquals("/", rootFolderView.getName());
        assertEquals("user root", rootFolderView.getTitle());
        assertEquals("/_role/role0", extractFileSystemPathFromId(rootFolderView.getId()));
        assertEquals(ProfileLocator.PAGE_LOCATOR, extractLocatorNameFromView(rootFolderView));
        rootPage2View = rootFolderView.getPage("page2.psml");
        assertNotNull(rootPage2View);
        assertEquals("page2.psml", rootPage2View.getName());
        assertEquals("/_role/role0/page2.psml", extractFileSystemPathFromId(rootPage2View.getId()));
        assertEquals(ProfileLocator.PAGE_LOCATOR, extractLocatorNameFromView(rootPage2View));
        rootFolder1View = rootFolderView.getFolder("folder1");
        assertNotNull(rootFolder1View);
        assertEquals("folder1", rootFolder1View.getName());
        assertEquals("group folder1", rootFolder1View.getTitle());
        assertEquals("/_user/user/folder1", extractFileSystemPathFromId(rootFolder1View.getId()));
        assertEquals("alternate-locator-name", extractLocatorNameFromView(rootFolder1View));
        Page folder1Page1View = rootFolder1View.getPage("page1.psml");
        assertNotNull(folder1Page1View);
        assertEquals("page1.psml", folder1Page1View.getName());
        assertEquals("/_group/group/folder1/page1.psml", extractFileSystemPathFromId(folder1Page1View.getId()));
        assertEquals("alternate-locator-name", extractLocatorNameFromView(folder1Page1View));
        assertEquals("/_user/user", profileView.getUserFolderPath());
        assertEquals("/", profileView.getBaseFolderPath());
       
        // test physical SiteView
        PhysicalSiteView basePhysicalView = new PhysicalSiteView(pageManager, "user");
        rootFolderView = basePhysicalView.getRootFolderView();
        assertNotNull(rootFolderView);
        assertEquals("/", rootFolderView.getName());
        assertEquals("root", rootFolderView.getTitle());
        assertEquals("/", extractFileSystemPathFromId(rootFolderView.getId()));
        assertEquals(11, rootFolderView.getFolders().size());
        foldersIter = rootFolderView.getFolders().iterator();
        assertEquals("__subsite-root", ((Folder)foldersIter.next()).getName());
        assertEquals("_group", ((Folder)foldersIter.next()).getName());
        assertEquals("_hostname", ((Folder)foldersIter.next()).getName());
        assertEquals("_role", ((Folder)foldersIter.next()).getName());
        assertEquals("_user", ((Folder)foldersIter.next()).getName());
        assertEquals("contentfolder", ((Folder)foldersIter.next()).getName());
        assertEquals("folder0", ((Folder)foldersIter.next()).getName());
        assertEquals("folder1", ((Folder)foldersIter.next()).getName());
        assertEquals("folder2", ((Folder)foldersIter.next()).getName());
        assertEquals("folder3", ((Folder)foldersIter.next()).getName());
        assertEquals("folder4", ((Folder)foldersIter.next()).getName());
        assertEquals(4, rootFolderView.getPages().size());
        pagesIter = rootFolderView.getPages().iterator();
        assertEquals("page2.psml", ((Page)pagesIter.next()).getName());
        assertEquals("page1.psml", ((Page)pagesIter.next()).getName());
        assertEquals("page0.psml", ((Page)pagesIter.next()).getName());
        assertEquals("hidden.psml", ((Page)pagesIter.next()).getName());
        assertEquals(2, rootFolderView.getLinks().size());
        linksIter = rootFolderView.getLinks().iterator();
        assertEquals("link1.link", ((Link)linksIter.next()).getName());
        assertEquals("link0.link", ((Link)linksIter.next()).getName());
        assertEquals(2, rootFolderView.getDynamicPages().size());
        dynamicPagesIter = rootFolderView.getDynamicPages().iterator();
        assertEquals("contentpage.dpsml", ((DynamicPage)dynamicPagesIter.next()).getName());
        assertEquals("docpage.dpsml", ((DynamicPage)dynamicPagesIter.next()).getName());
        rootPage0View = rootFolderView.getPage("page0.psml");
        assertNotNull(rootPage0View);
        assertEquals(rootFolderView, rootPage0View.getParent());
        assertEquals("page0.psml", rootPage0View.getName());
        assertEquals("/page0.psml", extractFileSystemPathFromId(rootPage0View.getId()));
        rootHiddenView = rootFolderView.getPage("hidden.psml");
        assertNotNull(rootHiddenView);
        assertEquals("hidden.psml", rootHiddenView.getName());
        assertTrue(rootHiddenView.isHidden());
        rootLink0View = rootFolderView.getLink("link0.link");
        assertNotNull(rootLink0View);
        assertEquals(rootFolderView, rootLink0View.getParent());
        assertEquals("link0.link", rootLink0View.getName());
        assertEquals("/link0.link", extractFileSystemPathFromId(rootLink0View.getId()));
        docPageView = rootFolderView.getDynamicPage("docpage.dpsml");       
        assertNotNull(docPageView);
        assertEquals(rootFolderView, docPageView.getParent());
        assertEquals("docpage.dpsml", docPageView.getName());
        assertEquals("/docpage.dpsml", extractFileSystemPathFromId(docPageView.getId()));
        rootFolder0View = rootFolderView.getFolder("folder0");
        assertNotNull(rootFolder0View);
        assertEquals(rootFolderView, rootFolder0View.getParent());
        assertEquals(1, rootFolder0View.getPages().size());
        assertEquals(0, rootFolder0View.getLinks().size());
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.page.DynamicPage

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.