Package org.apache.rave.portal.model

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


        // get attributes about the sub page this regionWidget is on.  This is needed to assist the client in
        // determining which gadgets are on visible tabs/sub pages initially to make widget rendering more efficient
        Long pageId = null;
        String pageName = "";
        boolean isDefault = false;
        Page page =  item.getRegion().getPage();
        if (PageType.SUB_PAGE.equals(page.getPageType())) {
            pageId = page.getId();
            pageName = page.getName();
            // check to see if this regionWidget is on the first sub page, which will be the default
            // subpage rendered if the user doesn't specify which subpage via the URL hash
            isDefault = isDefaultSubPage(page);
        }
View Full Code Here


    public void deleteUser() {
        final int NUM_COMMENTS = 33;
        final int NUM_RATINGS = 99;
        final int NUM_WIDGETS_OWNED = 4;
        UserImpl user = new UserImpl(USER_ID, USER_NAME);
        Page page = new PageImpl(1L, user);
        List<Page> pages = new ArrayList<Page>();
        pages.add(page);

        expect(userRepository.get(USER_ID)).andReturn(user);
        expect(pageRepository.deletePages(USER_ID, PageType.USER)).andReturn(pages.size());
View Full Code Here

        return pageRepository.getAllPages(userId);
    }
   
    @Override
    public Page getPageFromList(long pageId, List<Page> pages) {
        Page pageToFind = new Page(pageId);
        int index = pages.indexOf(pageToFind);
        return index == -1 ? null : pages.get(index);
    }
View Full Code Here

    }

    @Override
    @Transactional
    public RegionWidget addWidgetToPage(long pageId, long widgetId) {
        Page page = getFromRepository(pageId, pageRepository);
        Widget widget = getFromRepository(widgetId, widgetRepository);
        Region region = page.getRegions().get(0);
        return createWidgetInstance(widget, region, 0);
    }
View Full Code Here

            regions.add(region);
        }

        // Create a Page object and register it.
        long renderSequence = getAllPages(user.getId()).size() + 1;
        Page page = new Page();
        page.setName(pageName);      
        page.setOwner(user);
        page.setPageLayout(pageLayout);
        page.setRenderSequence(renderSequence);
        page.setRegions(regions);       
        pageRepository.save(page);
       
        return page;
    }
View Full Code Here

    //TODO: If there is a reason why this is annotated @Transactional when the calling public method is @Transactional, note it in comments
    @Transactional(readOnly = false)
    private void updatePageRenderSequences(List<Page> pages) {      
        if (pages != null && !pages.isEmpty()) {
            for (int i = 0; i < pages.size(); i++) {
                Page p = pages.get(i);               
                p.setRenderSequence((long)i+1);                              
            }

            for (Page page : pages) {
                pageRepository.save(page);
            }
View Full Code Here

    private Page doMovePage(long pageId, long moveAfterPageId) {
        // get the logged in user
        User user = userService.getAuthenticatedUser();

        // get the page to move and the page to move after
        Page movingPage = pageRepository.get(pageId);
        Page afterPage = null;
        int newIndex = 0;
       
        // check to see if we should move the page to beginning
        if (moveAfterPageId != MOVE_PAGE_DEFAULT_POSITION_INDEX) {
            afterPage = pageRepository.get(moveAfterPageId);
View Full Code Here

        assertThat(service.getSupportedWidgetTypes().contains("W3C"), is(true));
    }

    @Test
    public void renderOpenSocial() {
        Page page = new Page(1L, new User(VALID_USER_ID, VALID_USER_NAME));
        Region region = new Region(1L, page);
        page.setRegions(Arrays.asList(region));

        Widget w = new Widget();
        w.setType("OpenSocial");
        w.setId(1L);
        w.setTitle("Gadget Title");
View Full Code Here

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

    @Test
    public void getById_valid() {
        Page p = repository.get(1L);
        assertThat(p, is(notNullValue()));
        assertThat(p.getId(), is(equalTo(1L)));
    }
View Full Code Here

        assertThat(p.getId(), is(equalTo(1L)));
    }

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

TOP

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

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.