Package org.apache.rave.portal.model.impl

Examples of org.apache.rave.portal.model.impl.PageImpl


    }

    @Test
    public void save_null(){
        Page page = new PageImpl("1234L");
        List<Region> regions = Lists.newArrayList();
        Region item = new RegionImpl();
        item.setPage(page);
        regions.add(item);
        page.setRegions(regions);

        expect(template.get("1234L")).andReturn(page);
        expect(template.save(isA(Page.class))).andReturn(page);
        replay(template);
View Full Code Here


    }

    @Test
     public void delete(){
        Page page = new PageImpl("1234L");
        List<Region> regions = Lists.newArrayList();
        Region item = new RegionImpl("1111L");
        regions.add(item);
        page.setRegions(regions);

        expect(template.findOne(new Query(Criteria.where("regions").elemMatch(Criteria.where("_id").is("1111L"))))).andReturn(page);
        expect(template.save(isA(Page.class))).andReturn(page);
        replay(template);
View Full Code Here

    }

    @Test (expected = IllegalStateException.class)
    public void delete_null(){
        Page page = new PageImpl("1234L");
        List<Region> regions = Lists.newArrayList();
        Region item = new RegionImpl();
        regions.add(item);
        page.setRegions(regions);

        repo.delete(item);
    }
View Full Code Here

    @Test
    public void convertPage_valid() {

        MongoDbPage results;
        PageUser pageUser = new PageUserImpl(USER1ID);
        Page sourcePage = new PageImpl();
        pageUser.setUserId(USER2ID);

        List<PageUser> pageMembers = Lists.newArrayList();
        pageMembers.add(pageUser);
        sourcePage.setMembers(pageMembers);

        Region region = new RegionImpl();
        region.setRegionWidgets(Lists.<RegionWidget>newLinkedList());
        RegionWidgetImpl rw = new RegionWidgetImpl();
        rw.setId("2222");
        rw.setWidgetId("3333");
        rw.setPreferences(Lists.<RegionWidgetPreference>newLinkedList());

        region.getRegionWidgets().add(rw);
        sourcePage.setRegions(Lists.<Region>newLinkedList());
        sourcePage.getRegions().add(region);

        Page parentPage = new PageImpl();
        PageLayout pagelayout = new PageLayoutImpl();
        pagelayout.setCode("asdf");

        sourcePage.setId(PAGEID);
        sourcePage.setOwnerId(USER2ID);
View Full Code Here

        PageUserImpl subMember = new PageUserImpl();
        subPage1.setMembers(Lists.<PageUser>newLinkedList());
        subPage1.setRegions(Lists.<Region>newLinkedList());
        subPage1.getMembers().add(subMember);
        subPage1.getRegions().add(subRegion);
        Page subPage2 = new PageImpl();
        subPage2.setMembers(Lists.<PageUser>newLinkedList());
        subPage2.setRegions(Lists.<Region>newLinkedList());
        page.getSubPages().add(subPage1);
        page.getSubPages().add(subPage2);

        PageLayout pageLayout = new PageLayoutImpl();
        pageLayout.setCode("asdf");
        page.setPageLayoutCode(pageLayout.getCode());

        expect(pageLayoutRepository.getByPageLayoutCode(page.getPageLayoutCode())).andReturn(pageLayout);
        replay(pageLayoutRepository);

        converter.hydrate(page);
        assertThat(page.getPageLayout(), is(sameInstance(pageLayout)));
        assertThat(page.getMembers().get(0), is(instanceOf(PageUserImpl.class)));
        assertThat((MongoDbPage)region1.getPage(), is(sameInstance(page)));
        assertThat((MongoDbPage)subPage1.getParentPage(), is(sameInstance(page)));
        assertThat((MongoDbPage)subPage2.getParentPage(), is(sameInstance(page)));
        assertThat(page.getRegions().get(0).getRegionWidgets().get(0), is(sameInstance(rw1)));

    }//end hydratePage_valid
View Full Code Here

    @Transactional(readOnly=false)
    @Rollback(true)
    public void deletePage_implObject() {
        Page p = repository.get(USER_ID);
        assertThat(p, is(notNullValue()));
        PageImpl impl = new PageImpl(p.getId());

        repository.delete(impl);
        p = repository.get(USER_ID);
        assertThat(p, is(nullValue()));
    }
View Full Code Here

            regions.add(region);
        }

        // Create a Page object and register it.
        long renderSequence = (parentPage.getSubPages() != null) ? parentPage.getSubPages().size() + 1 : 1;
        Page page = new PageImpl();
        page.setName(pageName);
        page.setOwnerId(user.getId());
        page.setPageLayout(pageLayout);
        page.setRegions(regions);
        // set this as a "sub-page" page type
        page.setPageType(PageType.SUB_PAGE);

        PageUser pageUser = new PageUserImpl(page.getOwnerId(), page, renderSequence);
        pageUser.setPageStatus(PageInvitationStatus.OWNER);
        List<PageUser> members = new ArrayList<PageUser>();
        members.add(pageUser);
        page.setMembers(members);

        // Properly sets both sides of the circular parent-child reference
        page.setParentPage(parentPage);
        if (parentPage.getSubPages() != null){
            parentsSubPages = parentPage.getSubPages();
        }
        parentsSubPages.add(page);
        parentPage.setSubPages(parentsSubPages);
View Full Code Here

        }

        // If we have a page already or if there was an exception from above then create the page
        // Create the new page for the user
        long renderSequence = defaultUserPage.size() + 1;
        page = new PageImpl();
        page.setName(pageName);
        page.setOwnerId(user.getId());
        page.setPageLayout(pageLayout);
        PageUser pageUser = new PageUserImpl(page.getOwnerId(), page, renderSequence);
        pageUser.setPageStatus(PageInvitationStatus.OWNER);
View Full Code Here

            regions.add(region);
        }

        // Create a Page object and register it.
        long renderSequence = (parentPage.getSubPages() != null) ? parentPage.getSubPages().size() + 1 : 1;
        Page page = new PageImpl();
        page.setName(pageName);
        page.setOwner(user);
        page.setPageLayout(pageLayout);
        page.setRegions(regions);
        // set this as a "sub-page" page type
        page.setPageType(PageType.SUB_PAGE);

        PageUser pageUser = new PageUserImpl(page.getOwner(), page, renderSequence);
        pageUser.setPageStatus(PageInvitationStatus.OWNER);
        List<PageUser> members = new ArrayList<PageUser>();
        members.add(pageUser);
        page.setMembers(members);

        // Properly sets both sides of the circular parent-child reference
        page.setParentPage(parentPage);
        if (parentPage.getSubPages() != null){
            parentsSubPages = parentPage.getSubPages();
        }
        parentsSubPages.add(page);
        parentPage.setSubPages(parentsSubPages);
View Full Code Here

        }

        // If we have a page already or if there was an exception from above then create the page
        // Create the new page for the user
        long renderSequence = defaultUserPage.size() + 1;
        page = new PageImpl();
        page.setName(pageName);
        page.setOwner(user);
        page.setPageLayout(pageLayout);
        PageUser pageUser = new PageUserImpl(page.getOwner(), page, renderSequence);
        pageUser.setPageStatus(PageInvitationStatus.OWNER);
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.impl.PageImpl

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.