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

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


        widgetRepository.save(widget);
    }

    @Test
    public void save_Id_Null_Page_Null_Region_Valid_Page_Null() {
        RegionWidget widget = new RegionWidgetImpl();
        Region region = new RegionImpl();
        widget.setRegion(region);

        thrown.expect(IllegalStateException.class);
        thrown.expectMessage("Unable to find page for region");

        widgetRepository.save(widget);
View Full Code Here


        widgetRepository.save(widget);
    }

    @Test
    public void save_Id_Null_Page_Null_Region_Valid_Page_Valid_Id_Null() {
        RegionWidget widget = new RegionWidgetImpl();
        Region region = new RegionImpl();
        widget.setRegion(region);
        Page page = new PageImpl();
        region.setPage(page);

        thrown.expect(IllegalStateException.class);
        thrown.expectMessage("Unable to find page for region");
View Full Code Here

        widgetRepository.save(widget);
    }

    @Test
    public void save_Id_Null_Page_Valid_Region_Null() {
        RegionWidget item = new RegionWidgetImpl();
        Region region = new RegionImpl();
        item.setRegion(region);
        String id = "123";
        Page page = new PageImpl();
        region.setPage(page);
        page.setId(id);
        page.setRegions(new ArrayList<Region>());
View Full Code Here

        widgetRepository.save(item);
    }

    @Test
    public void delete_Valid() {
        RegionWidgetImpl widget = new RegionWidgetImpl();
        String id = "123";
        widget.setId(id);
        Page found = new PageImpl();
        Region region = new RegionImpl();
        List<RegionWidget> regionWidgets = new ArrayList<RegionWidget>();
        regionWidgets.add(widget);
        List<Region> regions = new ArrayList<Region>();
View Full Code Here

        verify(template);
    }

    @Test
    public void delete_Null() {
        RegionWidgetImpl item = new RegionWidgetImpl();
        String id = "123";
        item.setId(id);
        Page page = new PageImpl();
        page.setRegions(new ArrayList<Region>());

        expect(template.findOne(getQuery(id))).andReturn(page);
        replay(template);
View Full Code Here

        return new Query(new Criteria().orOperator(where("subPages").elemMatch(where("regions").elemMatch(where("regionWidgets").elemMatch(where("_id").is(id)))),where("regions").elemMatch(where("regionWidgets").elemMatch(where("_id").is(id)))));
    }

    @Test
    public void delete_DifferentId() {
        RegionWidgetImpl widget = new RegionWidgetImpl();
        Region region = new RegionImpl();
        Page page = new PageImpl();
        page.setRegions(Arrays.asList(region));
        region.setRegionWidgets(Arrays.<RegionWidget>asList(widget));
        widget.setId("345345");

        RegionWidgetImpl item = new RegionWidgetImpl();
        String id = "4344";
        item.setId(id);

        expect(template.findOne(getQuery(id))).andReturn(page);
        replay(template);

        thrown.expect(IllegalStateException.class);
View Full Code Here

    @Test
    @Rollback(true)
    public void delete_implObject() {
        RegionWidget regionWidget = repository.get(VALID_REGION_WIDGET_ID.toString());
        assertThat(regionWidget, is(notNullValue()));
        RegionWidgetImpl impl = new RegionWidgetImpl(regionWidget.getId());
        repository.delete(impl);
        regionWidget = repository.get(VALID_REGION_WIDGET_ID.toString());
        assertThat(regionWidget, is(nullValue()));
    }
View Full Code Here

     * @return List of RegionWidget
     */
    private List<RegionWidget> convertWidgets(List<PageTemplateWidget> pageTemplateWidgets, Region region){
        List<RegionWidget> widgets = new ArrayList<RegionWidget>();
        for (PageTemplateWidget ptw : pageTemplateWidgets){
            RegionWidget regionWidget = new RegionWidgetImpl();
            regionWidget.setRegion(region);
            regionWidget.setCollapsed(false);
            regionWidget.setLocked(ptw.isLocked());
            regionWidget.setHideChrome(ptw.isHideChrome());
            regionWidget.setRenderOrder((int) ptw.getRenderSeq());
            regionWidget.setWidgetId(ptw.getWidgetId());
            widgets.add(regionWidget);
        }
        return widgets;
    }
View Full Code Here

    public void hydrate(RegionWidgetImpl widget, Region region) {
        widget.setRegion(region);
    }

    public RegionWidgetImpl convert(RegionWidget sourceRegionWidget) {
        RegionWidgetImpl regionWidget = sourceRegionWidget instanceof RegionWidgetImpl ? (RegionWidgetImpl) sourceRegionWidget : new RegionWidgetImpl();
        //RegionWidgetIds MUST be a Long due to the mapping of ModuleID in Shindig.
        regionWidget.setId(sourceRegionWidget.getId() == null ? generateLongId().toString() : sourceRegionWidget.getId());
        regionWidget.setWidgetId(sourceRegionWidget.getWidgetId());
        regionWidget.setRegion(null);
        regionWidget.setPreferences(sourceRegionWidget.getPreferences());
        updatePreferences(regionWidget);
        updateProperties(sourceRegionWidget, regionWidget);
        return regionWidget;
    }
View Full Code Here

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

TOP

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

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.