Package org.apache.rave.portal.model

Examples of org.apache.rave.portal.model.Page


        userService = createMock(UserService.class);
        pageService = createMock(PageService.class);
        pageController = new PageController(pageService, userService);
        model = new ExtendedModelMap();
       
        defaultPage = new Page(DEFAULT_PAGE_ID);
        otherPage = new Page(OTHER_PAGE_ID);
       
        allPages = new ArrayList<Page>();
        allPages.add(defaultPage);  
        allPages.add(otherPage);           
       
View Full Code Here


    public String view(@PathVariable Long pageId, Model model) {
        User user = userService.getAuthenticatedUser();
        logger.debug("attempting to get pageId " + pageId + " for " + user);
       
        List<Page> pages = getAllPagesForAuthenticatedUser();
        Page page = pageService.getPageFromList(pageId, pages);
              
        model.addAttribute(ModelKeys.PAGE, page);
        model.addAttribute(ModelKeys.PAGES, pages);
        return ViewNames.HOME;
    }
View Full Code Here

       
    }

    @Test
    public void getById_valid_subPagePage() {
        Page p = repository.get(SUB_PAGE_ID);
        assertThat(p, is(notNullValue()));
        assertThat(p.getEntityId(), is(equalTo(SUB_PAGE_ID)));
        assertThat(p.getPageType(), is(PageType.SUB_PAGE));
        assertThat(p.getParentPage(), is(notNullValue(Page.class)));
        assertThat(p.getSubPages().isEmpty(), is(true));
    }
View Full Code Here

        assertThat(p.getSubPages().isEmpty(), is(true));
    }

    @Test
    public void getById_invalid() {
        Page p = repository.get(-1L);
        assertThat(p, is(nullValue()));
    }
View Full Code Here

   
    @Test
    @Transactional(readOnly = false)
    @Rollback(true)
    public void createPageForUser_validUser(){
        Page page = repository.createPageForUser(user, defaultPageTemplate);
        assertSame(user, page.getOwner());
        assertEquals(page.getName(), defaultPageTemplate.getName());
        assertNull(page.getParentPage());
        assertEquals(2, page.getSubPages().size());
        assertNotNull(page.getRenderSequence());
        assertNotNull(page.getPageLayout());
        assertEquals("person_profile", page.getPageLayout().getCode());
        assertEquals(1, page.getRegions().size());
        assertEquals(PageType.PERSON_PROFILE, page.getPageType());
        Page subPage1 = page.getSubPages().get(0);
        Page subPage2 = page.getSubPages().get(1);
        assertEquals("Widgets on sub page 1", 2, subPage1.getRegions().get(0).getRegionWidgets().size());
        assertEquals("Widgets on sub page 2", 1, subPage2.getRegions().get(0).getRegionWidgets().size());
        assertEquals("Regions on sub page 1", 1, subPage1.getRegions().size());
        assertEquals("Regions on sub page 2", 1, subPage2.getRegions().size());
        assertNull("no sub pages of sub page 1", subPage1.getSubPages());
        assertNull("no sub pages of sub page 2", subPage2.getSubPages());
        assertEquals("sub page 1 refers to parent page", page.getEntityId(), subPage1.getParentPage().getEntityId());
        assertEquals("sub page 2 refers to parent page", page.getEntityId(), subPage2.getParentPage().getEntityId());
        assertEquals("sub page 1 regions refers to sub page 1", subPage1.getEntityId(), subPage1.getRegions().get(0).getPage().getEntityId());
        assertEquals("sub page 2 regions refers to sub page 2", subPage2.getEntityId(), subPage2.getRegions().get(0).getPage().getEntityId());
        assertEquals("sub page 1 has one column layout", "columns_1", subPage1.getPageLayout().getCode());
        assertEquals("sub page 2 has one column layout", "columns_1", subPage2.getPageLayout().getCode());
        assertEquals(PageType.SUB_PAGE, subPage1.getPageType());
        assertEquals(defaultPageTemplate.getSubPageTemplates().get(0).getName(), subPage1.getName());
        assertEquals(PageType.SUB_PAGE, subPage2.getPageType());
        assertEquals(defaultPageTemplate.getSubPageTemplates().get(1).getName(), subPage2.getName());
        assertSame(user, subPage1.getOwner());
        assertSame(user, subPage2.getOwner());
        assertNotNull(subPage1.getRenderSequence());
        assertNotNull(subPage2.getRenderSequence());
    }
View Full Code Here

        validPageLayout = new PageLayout();
        validPageLayout.setEntityId(33L);
        validPageLayout.setCode(VALID_PAGE_LAYOUT_CODE);

        defaultPage = new Page(DEFAULT_PAGE_ID);
        defaultPage.setPageLayout(validPageLayout);
        otherPage = new Page(OTHER_PAGE_ID);
        otherPage.setPageLayout(validPageLayout);
       
        allPages = new ArrayList<Page>();
        allPages.add(defaultPage);  
        allPages.add(otherPage);
View Full Code Here

        assertThat(pages.isEmpty(), is(true));
    }

    @Test
    public void getById_valid_userPage() {
        Page p = repository.get(USER_PAGE_ID);
        assertThat(p, is(notNullValue()));
        assertThat(p.getEntityId(), is(equalTo(USER_PAGE_ID)));
        assertThat(p.getPageType(), is(PageType.USER));
        assertThat(p.getParentPage(), is(nullValue(Page.class)));
        assertThat(p.getSubPages().isEmpty(), is(true));
    }
View Full Code Here

        assertThat(p.getSubPages().isEmpty(), is(true));
    }

    @Test
    public void getById_valid_personProfilePage() {
        Page p = repository.get(PERSON_PROFILE_PAGE_ID);
        assertThat(p.getEntityId(), is(equalTo(PERSON_PROFILE_PAGE_ID)));
        assertThat(p.getPageType(), is(PageType.PERSON_PROFILE));
        assertThat(p.getParentPage(), is(nullValue(Page.class)));
        assertThat(p.getSubPages().isEmpty(), is(false));

        // verify that the sub pages are in proper order
        Long lastRenderSequence = -1L;
        for (Page subPage : p.getSubPages()) {
            Long currentRenderSequence = subPage.getRenderSequence();
            assertThat(currentRenderSequence > lastRenderSequence, is(true));
            lastRenderSequence = currentRenderSequence;
        }
       
View Full Code Here


    @RequestMapping(value = {"/page/view", "/index.html"}, method = RequestMethod.GET)
    public String viewDefault(Model model, HttpServletRequest request) {
        List<Page> pages = getAllPagesForAuthenticatedUser();
        Page page = pageService.getDefaultPageFromList(pages);
        List<PageLayout> pageLayouts = pageLayoutService.getAllUserSelectable();
        addAttributesToModel(model, page, pages, pageLayouts);
        return ControllerUtils.getDeviceAppropriateView(request, ViewNames.getPageView(page.getPageLayout().getCode()), ViewNames.MOBILE_HOME);
    }         
View Full Code Here

    public String view(@PathVariable Long pageId, Model model, HttpServletRequest request) {
        User user = userService.getAuthenticatedUser();
        logger.debug("attempting to get pageId {} for {}", pageId, user);
       
        List<Page> pages = getAllPagesForAuthenticatedUser();
        Page page = pageService.getPageFromList(pageId, pages);
        List<PageLayout> pageLayouts = pageLayoutService.getAllUserSelectable();
        addAttributesToModel(model, page, pages, pageLayouts);
        return ControllerUtils.getDeviceAppropriateView(request, ViewNames.getPageView(page.getPageLayout().getCode()), ViewNames.MOBILE_HOME);
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.Page

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.