Package org.apache.rave.portal.model

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


    @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


        RegionWidget regionWidget = new RegionWidget();
        regionWidget.setRenderOrder(position);
        regionWidget.setWidget(widget);
        region.getRegionWidgets().add(position, regionWidget);
        updateRenderSequences(region.getRegionWidgets());
        Region persistedRegion = regionRepository.save(region);
        return persistedRegion.getRegionWidgets().get(position);
    }
View Full Code Here

        replaceRegionWidget(regionWidgetId, newPosition, target, target);
        updateRenderSequences(target.getRegionWidgets());
    }

    private void moveBetweenRegions(long regionWidgetId, int newPosition, long fromRegion, Region target) {
        Region source = getFromRepository(fromRegion, regionRepository);
        replaceRegionWidget(regionWidgetId, newPosition, target, source);
        updateRenderSequences(source.getRegionWidgets());
        updateRenderSequences(target.getRegionWidgets());
        regionRepository.save(source);
    }
View Full Code Here

       
        // Create regions
        List<Region> regions = new ArrayList<Region>();
        int regionCount;
        for (regionCount = 0; regionCount < pageLayout.getNumberOfRegions(); regionCount++) {
            Region region = new Region();
            regions.add(region);
        }

        // Create a Page object and register it.
        long renderSequence = getAllPages(user.getId()).size() + 1;
View Full Code Here

    }

    @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");
        w.setUrl("http://www.example.com/gadget.xml");

        RegionWidget rw = new RegionWidget(1L, w, region);
        region.setRegionWidgets(Arrays.asList(rw));

        String rendered = service.render(rw);
        assertThat(rendered, is(notNullValue()));
        assertThat(rendered.contains("widgets.push({"), is(true));
    }
View Full Code Here

    @Autowired
    private RegionRepository repository;

    @Test
    public void getById_validId() {
        Region region = repository.get(REGION_ID);
        assertThat(region, is(notNullValue()));
        assertThat(region.getId(), is(equalTo(1L)));
        assertThat(region.getRegionWidgets().size(), is(equalTo(2)));
    }
View Full Code Here

        assertThat(region.getRegionWidgets().size(), is(equalTo(2)));
    }

    @Test
    public void getById_invalidId() {
        Region region = repository.get(INVALID_REGION_ID);
        assertThat(region, is(nullValue()));
    }
View Full Code Here

    }

    @Test
    @Rollback(true)
    public void save_newEntity() {
        Region region = new Region();
        region.setRegionWidgets(new ArrayList<RegionWidget>());
        Region saved = repository.save(region);
        manager.flush();
        assertThat(saved, is(sameInstance(region)));
        assertThat(saved.getId(), is(notNullValue()));
    }
View Full Code Here

    }

    @Test
    @Rollback(true)
    public void save_existingEntity() {
        Region region = new Region();
        region.setId(1L);
        region.setRegionWidgets(new ArrayList<RegionWidget>());
        Region saved = repository.save(region);
        manager.flush();
        assertThat(saved, is(not(sameInstance(region))));
        assertThat(saved.getId(), is(equalTo(region.getId())));
    }
View Full Code Here

        assertThat(saved.getId(), is(equalTo(region.getId())));
    }

    @Test
    public void save_cascadePersist() {
        Region region = new Region();
        region.setRegionWidgets(new ArrayList<RegionWidget>());
        RegionWidget regionWidget = new RegionWidget();
        region.getRegionWidgets().add(regionWidget);

        Region saved = repository.save(region);
        manager.flush();

        assertThat(saved.getRegionWidgets().size(), is(equalTo(1)));
        RegionWidget actual = saved.getRegionWidgets().get(0);

        assertThat(actual, is(sameInstance(regionWidget)));
        assertThat(actual.getId(), is(notNullValue()));
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.Region

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.