Package org.apache.rave.portal.model

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


    public RpcResult<Page> movePage(@PathVariable final long pageId,
                                    @RequestParam(required=false) final Long moveAfterPageId) {
        return new RpcOperation<Page>() {
            @Override
            public Page execute() {
                Page page = null;
                if (moveAfterPageId == null) {
                    page = pageService.movePageToDefault(pageId);
                } else {
                    page = pageService.movePage(pageId, moveAfterPageId);
                }
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 = pageService.getAllPages(user.getId());
        Page page = pageService.getPageFromList(pageId, pages);
              
        model.addAttribute(ModelKeys.PAGE, page);
        model.addAttribute(ModelKeys.PAGES, pages);
        model.addAttribute(ModelKeys.OPENSOCIAL_ENVIRONMENT, openSocialEnvironment);
        return ViewNames.HOME;
View Full Code Here

    @Before
    public void setup() {
        pageService = createMock(PageService.class);
        pageApi = new PageApi(pageService);
       
        page = new Page(PAGE_ID);
        page2 = new Page(PAGE_2_ID);
    }
View Full Code Here

    @Test
    public void addPage_validParams() {
        final String PAGE_NAME = "My New Page";
        final String PAGE_LAYOUT_CODE = "layout1";

        expect(pageService.addNewPage(PAGE_NAME, PAGE_LAYOUT_CODE)).andReturn(new Page());
        replay(pageService);
        RpcResult result = pageApi.addPage(PAGE_NAME, PAGE_LAYOUT_CODE);
        verify(pageService);
        assertThat(result, is(notNullValue()));
        assertThat(result.getResult(), is(notNullValue()));
View Full Code Here

        pageLayout = new PageLayout();
        pageLayout.setId(1L);
        pageLayout.setCode(PAGE_LAYOUT_CODE);
        pageLayout.setNumberOfRegions(3L);
       
        page = new Page(PAGE_ID, user);
        page.setRenderSequence(1L);
        page2 = new Page(99L, user);
        page2.setRenderSequence(2L);
       
        pageList = new ArrayList<Page>();       
        pageList.add(page2);
        pageList.add(page);
View Full Code Here

    @Test
    public void addNewPage_noExistingPages() {
        final String PAGE_NAME = "my new page";
        final Long EXPECTED_RENDER_SEQUENCE = 1L;
                     
        Page expectedPage = new Page();
        expectedPage.setName(PAGE_NAME);      
        expectedPage.setOwner(user);
        expectedPage.setPageLayout(pageLayout);
        expectedPage.setRenderSequence(EXPECTED_RENDER_SEQUENCE);
        expectedPage.setRegions(createEmptyRegionList(pageLayout.getNumberOfRegions()));   
               
        expect(userService.getAuthenticatedUser()).andReturn(user);
        expect(pageLayoutRepository.getByPageLayoutCode(PAGE_LAYOUT_CODE)).andReturn(pageLayout);
        expect(pageRepository.save(expectedPage)).andReturn(expectedPage);
        expect(pageRepository.getAllPages(user.getId())).andReturn(new ArrayList<Page>());
        replay(userService);
        replay(pageLayoutRepository);
        replay(pageRepository);            

        Page newPage = pageService.addNewPage(PAGE_NAME, PAGE_LAYOUT_CODE);               
        assertThat(newPage.getRenderSequence(), is(EXPECTED_RENDER_SEQUENCE));
        assertThat(newPage.getName(), is(PAGE_NAME));
        assertThat(newPage.getRegions().size(), is(pageLayout.getNumberOfRegions().intValue()));
       
        verify(userService);
        verify(pageLayoutRepository);
        verify(pageRepository);
    }
View Full Code Here

    @Test
    public void addNewPage_existingPages() {
        final String PAGE_NAME = "my new page";
        final Long EXPECTED_RENDER_SEQUENCE = 2L;
        List<Page> existingPages = new ArrayList<Page>();
        existingPages.add(new Page());
                     
        Page expectedPage = new Page();
        expectedPage.setName(PAGE_NAME);      
        expectedPage.setOwner(user);
        expectedPage.setPageLayout(pageLayout);
        expectedPage.setRenderSequence(EXPECTED_RENDER_SEQUENCE);
        expectedPage.setRegions(createEmptyRegionList(pageLayout.getNumberOfRegions()));   
               
        expect(userService.getAuthenticatedUser()).andReturn(user);
        expect(pageLayoutRepository.getByPageLayoutCode(PAGE_LAYOUT_CODE)).andReturn(pageLayout);
        expect(pageRepository.save(expectedPage)).andReturn(expectedPage);
        expect(pageRepository.getAllPages(user.getId())).andReturn(existingPages);
        replay(userService);
        replay(pageLayoutRepository);
        replay(pageRepository);            

        Page newPage = pageService.addNewPage(PAGE_NAME, PAGE_LAYOUT_CODE);               
        assertThat(newPage.getRenderSequence(), is(EXPECTED_RENDER_SEQUENCE));
        assertThat(newPage.getName(), is(PAGE_NAME));
        assertThat(newPage.getRegions().size(), is(pageLayout.getNumberOfRegions().intValue()));
       
        verify(userService);
        verify(pageLayoutRepository);
        verify(pageRepository);
    }   
View Full Code Here

   */
  @RequestMapping(value = {"/{username:.*}"}, method = RequestMethod.GET)
  public String viewProfile(@PathVariable String username, ModelMap model, @RequestParam(required = false) Long referringPageId) {
    logger.debug("Viewing person profile for: " + username);
    User user = userService.getUserByUsername(username);
        Page personProfilePage = pageService.getPersonProfilePage(user.getId());
        addAttributesToModel(model, user, referringPageId);
        model.addAttribute(ModelKeys.PAGE, personProfilePage);
    String view =  ViewNames.getPersonPageView(personProfilePage.getPageLayout().getCode());
        addNavItemsToModel(view, model, referringPageId, user);
        return view;
  }
View Full Code Here

    final int modelSize = 4;
    final String username="Canonical";
        user.setUsername(username);
        user.setId(USER_ID);
    String userProfile = new String(ModelKeys.USER_PROFILE);
        Page personProfile = new PageImpl();
        PageLayout pageLayout = new PageLayoutImpl();
        pageLayout.setCode(VALID_PAGE_LAYOUT_CODE);
        personProfile.setPageLayout(pageLayout);

    expect(userService.getUserByUsername(username)).andReturn(user).once();
        expect(pageService.getPersonProfilePage(user.getId())).andReturn(personProfile);

    replay(userService, pageService);
View Full Code Here

        //creating a mock user
        final User user = null;
        final ModelMap model = new ModelMap();
        final int modelSize = 4;
        final String username="Canonical";
        Page personProfile = new PageImpl();
        PageLayout pageLayout = new PageLayoutImpl();
        pageLayout.setCode("person_profile");
        personProfile.setPageLayout(pageLayout);

        expect(userService.getUserByUsername(username)).andThrow(new UsernameNotFoundException("Username does not exist"));

        replay(userService, pageService);
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.