Package org.apache.rave.portal.model

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


    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);
        List<Person> personObjects = new ArrayList<Person>();

    expect(userService.getUserByUsername(username)).andReturn(user).once();
        expect(pageService.getPersonProfilePage(user.getId())).andReturn(personProfile);
    expect(userService.getFriendRequestsReceived(username)).andReturn(personObjects);
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);
        List<Person> personObjects = new ArrayList<Person>();

    expect(userService.getUserById(USER_ID)).andReturn(user).once();
        expect(pageService.getPersonProfilePage(user.getId())).andReturn(personProfile);
    expect(userService.getFriendRequestsReceived(username)).andReturn(personObjects);
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

   */
  @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());
        List<Person> friendRequests = userService.getFriendRequestsReceived(username);
        addNavItemsToModel(view, model, referringPageId, user, friendRequests);
        return view;
  }
View Full Code Here

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

    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

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

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

    @Test
    public void addWigetToPage_valid() {
        final long WIDGET_ID = 1L;

        Page value = new Page();
        value.setRegions(new ArrayList<Region>());
        value.getRegions().add(originalRegion);
        value.getRegions().add(targetRegion);
        Widget widget = new Widget();

        expect(pageRepository.get(PAGE_ID)).andReturn(value);
        expect(widgetRepository.get(WIDGET_ID)).andReturn(widget);
        expect(regionRepository.save(originalRegion)).andReturn(originalRegion);
View Full Code Here

    }

    @Test(expected = IllegalArgumentException.class)
    public void addWidgetToPage_invalidWidget() {
        long WIDGET_ID = -1L;
        expect(pageRepository.get(PAGE_ID)).andReturn(new Page());
        expect(widgetRepository.get(WIDGET_ID)).andReturn(null);
        replay(pageRepository);
        replay(regionRepository);
        replay(widgetRepository);
View Full Code Here

        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

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.