@Override public DataSupplier getDataSupplier() { return masterDs.getDataSupplier(); }
@Override public DataSupplier getDataSupplier() { return masterDs.getDataSupplier(); }
protected Map<DataSupplier, Collection<Datasource<Entity>>> collectCommitData() { Collection<Datasource> datasources = new ArrayList<>(); for (DsContext childDsContext : children) { datasources.addAll(childDsContext.getAll()); } datasources.addAll(datasourceMap.values()); Map<DataSupplier, Collection<Datasource<Entity>>> commitDatasources = new HashMap<>(); for (Datasource datasource : datasources) { if (Datasource.CommitMode.DATASTORE == datasource.getCommitMode() && datasource.isAllowCommit() && (datasource.isModified() || !((DatasourceImplementation) datasource).getItemsToCreate().isEmpty())) { DataSupplier dataservice = datasource.getDataSupplier(); Collection<Datasource<Entity>> collection = commitDatasources.get(dataservice); if (collection == null) { collection = new ArrayList<>(); commitDatasources.put(dataservice, collection); } collection.add(datasource); } } return commitDatasources; }
protected void notifyAllDsCommited(DataSupplier dataservice, Set<Entity> committedEntities) { // Notify all datasources in context List<Datasource> datasources = new ArrayList<>(); for (DsContext childDsContext : children) { for (Datasource ds : childDsContext.getAll()) { if (Objects.equals(ds.getDataSupplier(), dataservice) && ds.getCommitMode() == Datasource.CommitMode.DATASTORE) { datasources.add(ds); } } } for (Datasource ds : datasourceMap.values()) { if (Objects.equals(ds.getDataSupplier(), dataservice) && ds.getCommitMode() == Datasource.CommitMode.DATASTORE) { datasources.add(ds); } } List<Datasource> sortedList = new DsTree(datasources).toDsList(); for (Datasource datasource : sortedList) { ((DatasourceImplementation) datasource).committed(committedEntities); } }
@Override public void setItem(Entity item) { Entity newItem = valuesFormatsDs.getDataSupplier().newInstance(valuesFormatsDs.getMetaClass()); metadata.getTools().copy(item, newItem); ((ReportValueFormat) newItem).setId((UUID) item.getId()); super.setItem(newItem); } }
protected DataSupplier getDataSupplier() { if (getDatasource() != null) { return getDatasource().getDataSupplier(); } Window window = ComponentsHelper.getWindowNN(this); if (window.getFrameOwner() instanceof LegacyFrame) { DsContext dsContext = ((LegacyFrame) window.getFrameOwner()).getDsContext(); if (dsContext != null && dsContext.getDataSupplier() != null) { return dsContext.getDataSupplier(); } } return null; }
@SuppressWarnings("unchecked") protected void setItemInternal(Entity item) { Datasource ds = getDatasourceInternal(); DataSupplier dataservice = ds.getDataSupplier(); Entity newItem = ds.getDataSupplier().newInstance(ds.getMetaClass()); MetadataTools metadataTools = getBeanLocator().get(MetadataTools.NAME); metadataTools.copy(item, newItem);