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

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


    private Page convertTemplate(PageTemplate pt, User user) {
        Page p = new PageImpl();
        p.setName(pt.getName());
        p.setPageType(pt.getPageType());
        p.setOwnerId(user.getId());
        PageUser pageUser = new PageUserImpl(user.getId(), p, pt.getRenderSequence());
        pageUser.setPageStatus(PageInvitationStatus.OWNER);
        pageUser.setEditor(true);
        List<PageUser> members = new ArrayList<PageUser>();
        members.add(pageUser);
        p.setMembers(members);

        p.setPageLayout(pt.getPageLayout());
View Full Code Here


            lPage.setPageLayout(pt.getPageLayout());
            lPage.setParentPage(page);
            lPage.setRegions(convertRegions(pt.getPageTemplateRegions(), lPage));

            // create new pageUser tuple
            PageUser pageUser = new PageUserImpl(lPage.getOwnerId(), lPage, pt.getRenderSequence());
            pageUser.setPageStatus(PageInvitationStatus.OWNER);
            pageUser.setEditor(true);
            List<PageUser> members = new ArrayList<PageUser>();
            members.add(pageUser);
            lPage.setMembers(members);
            // recursive call
            lPage.setSubPages((pt.getSubPageTemplates() == null || pt.getSubPageTemplates().isEmpty()) ? null : convertPages(pt.getSubPageTemplates(), lPage));
View Full Code Here

        }
        return page;
    }

    public PageUserImpl convert(PageUser sourceUser) {
        PageUserImpl user = sourceUser instanceof PageUserImpl ? (PageUserImpl) sourceUser : new PageUserImpl();
        user.setId(sourceUser.getId() == null ? generateId() : sourceUser.getId());
        user.setUserId(sourceUser.getUserId());
        user.setEditor(sourceUser.isEditor());
        user.setPageStatus(sourceUser.getPageStatus());
        user.setRenderSequence(sourceUser.getRenderSequence());
        user.setPage(null);
        return user;
    }
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);
View Full Code Here

    //Convert user test
    @Test
    public void convertUser_valid() {

        PageUserImpl mongoUser;
        PageUser sourceUser = new PageUserImpl(USER1ID);
        sourceUser.setUserId(USER2ID);
        sourceUser.setEditor(true);
        sourceUser.setPageStatus(PageInvitationStatus.OWNER);
        sourceUser.setRenderSequence(1234L);

        mongoUser = converter.convert(sourceUser);
        assertThat(mongoUser.getId(), is(equalTo(USER1ID)));
        assertThat(mongoUser.getUserId(), is(equalTo(USER2ID)));
        assertTrue(mongoUser.isEditor());
View Full Code Here

    }//end convertUser_valid

    @Test
    public void convertUser_MongoInstance(){
        PageUser sourceUser = new PageUserImpl();
        sourceUser.setUserId("1234");

        PageUserImpl converted = converter.convert(sourceUser);
        assertNotNull(converted.getId());
    }
View Full Code Here

        page.getRegions().add(region1);
        page.getRegions().add(region2);

        page.setMembers(Lists.<PageUser>newLinkedList());
        PageUserImpl member1 = new PageUserImpl();
        PageUser member2 = new PageUserImpl();
        page.getMembers().add(member1);
        page.getMembers().add(member2);

        Region subRegion = new RegionImpl();
        subRegion.setRegionWidgets(Lists.<RegionWidget>newLinkedList());
        RegionWidget subRegionWidget = new RegionWidgetImpl();
        subRegion.getRegionWidgets().add(subRegionWidget);

        page.setSubPages(Lists.<Page>newLinkedList());
        MongoDbPage subPage1 = new MongoDbPage();
        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();
View Full Code Here

        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
View Full Code Here

    }

    @Transactional
    public Boolean addMemberToPage(String pageId, String userId){
        Page page = getPage(pageId);
        PageUser pageUser = new PageUserImpl();
        pageUser.setUserId(userService.getUserById(userId).getId());
        pageUser.setPage(page);
        pageUser.setPageStatus(PageInvitationStatus.PENDING);
        List<PageUser> thisUsersPages = pageRepository.getPagesForUser(userService.getUserById(userId).getId(), PageType.USER);
        pageUser.setRenderSequence(new Long(thisUsersPages.size() + 1));
        page.getMembers().add(pageUser);
        if(pageRepository.save(page) != null){
            return Boolean.TRUE;
        }else{
            return Boolean.FALSE;
View Full Code Here

        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);
        pageUser.setEditor(true);

        List<PageUser> members = new ArrayList<PageUser>();
        members.add(pageUser);
        page.setMembers(members);
View Full Code Here

TOP

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

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.