Package org.apache.rave.portal.model

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


        assertThat(service.getSupportedWidgetTypes().contains("OpenSocial"), 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, 1);
        page.setRegions(Arrays.asList(region));

        Widget w = new Widget();
        w.setType("OpenSocial");
        w.setEntityId(1L);
        w.setTitle("Gadget Title");
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

    }      
   
    // returns a trusted Page object, either from the PageRepository, or the
    // cached container list
    private Page getTrustedPage(long pageId, List<Page> trustedPageContainer) {      
        Page p = null;
        if (trustedPageContainer.isEmpty()) {          
            p = pageRepository.get(pageId);
            trustedPageContainer.add(p);
        } else {
            p = trustedPageContainer.get(0);
View Full Code Here

  
    // checks to see if the Authentication object principal is the owner of the supplied page object
    // if trustedDomainObject is false, pull the entity from the database first to ensure
    // the model object is trusted and hasn't been modified
    private boolean isPageOwner(Authentication authentication, Page page, List<Page> trustedPageContainer, boolean trustedDomainObject) {       
        Page trustedPage = null;
        if (trustedDomainObject) {
            trustedPage = page;
        } else {
            trustedPage = getTrustedPage(page.getEntityId(), trustedPageContainer);
        }                 
       
        return isPageOwnerByUsername(authentication, trustedPage.getOwner().getUsername());
    }            
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

    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

    @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

        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

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.