protected CollectionDatasource createCollectionDatasource() { return new CollectionDatasourceImpl(); }
protected void initRuntimePropertiesDatasources(View view) { rDS = new RuntimePropsDatasourceImpl(dsContext, dataSupplier, "rDS", datasource.getId(), null); MetaClass categoriesMeta = metadata.getSession().getClass(Category.class); categoriesDs = new CollectionDatasourceImpl(); ViewProperty categoryProperty = view.getProperty("category"); if (categoryProperty == null) { throw new IllegalArgumentException("Category property not found. Not a categorized entity?"); } categoriesDs.setup(dsContext, dataSupplier, "categoriesDs", categoriesMeta, categoryProperty.getView()); categoriesDs.setQuery(String.format("select c from sys$Category c where c.entityType='%s'", meta.getName())); categoriesDs.refresh(); dsContext.register(rDS); dsContext.register(categoriesDs); }
public Filter createFakeFilter() { if (filter != null) { return filter; } Filter fakeFilter = AppBeans.get(ComponentsFactory.NAME, ComponentsFactory.class).createComponent(Filter.class); ((HasXmlDescriptor) fakeFilter).setXmlDescriptor(Dom4j.readDocument("<filter/>").getRootElement()); CollectionDatasourceImpl fakeDatasource = new CollectionDatasourceImpl(); LegacyFrame legacyFrame = (LegacyFrame) this.frameOwner; DsContextImpl fakeDsContext = new DsContextImpl(legacyFrame.getDsContext().getDataSupplier()); FrameContextImpl fakeFrameContext = new FrameContextImpl((Frame) legacyFrame); fakeDsContext.setFrameContext(fakeFrameContext); fakeDatasource.setDsContext(fakeDsContext); //Attention: this query should match the logic in com.haulmont.reports.wizard.ReportingWizardBean.createJpqlDataSet() fakeDatasource.setQuery("select queryEntity from " + metaClass.getName() + " queryEntity"); fakeDatasource.setMetaClass(metaClass); fakeFilter.setDatasource(fakeDatasource); fakeFilter.setFrame(UiControllerUtils.getFrame(frameOwner)); return fakeFilter; }