private void initCollectionDatasourceAttributes(Element element, MetaClass metaClass) { String id = getDatasourceId(element); String viewName = element.attributeValue("view"); String deletion = element.attributeValue("softDeletion"); boolean softDeletion = deletion == null || Boolean.parseBoolean(deletion); boolean cacheable = Boolean.parseBoolean(element.attributeValue("cacheable")); builder.reset() .setMetaClass(metaClass) .setId(id) .setViewName(viewName) .setSoftDeletion(softDeletion) .setCacheable(cacheable) .setRefreshMode(getRefreshMode(element)) .setMaxResults(getMaxResults(element)) .setAllowCommit(getAllowCommit(element)); }
private void initDatasourceAttributes(Element element) { String id = getDatasourceId(element); MetaClass metaClass = loadMetaClass(element); String viewName = element.attributeValue("view"); builder.reset() .setMetaClass(metaClass) .setId(id) .setViewName(viewName) .setAllowCommit(getAllowCommit(element)); }
@SuppressWarnings("unchecked") @Override public Datasource getItemDatasource(Entity item) { if (fieldDatasources == null) { fieldDatasources = new WeakHashMap<>(); } Object fieldDatasource = fieldDatasources.get(item); if (fieldDatasource instanceof Datasource) { return (Datasource) fieldDatasource; } Datasource datasource = DsBuilder.create() .setAllowCommit(false) .setMetaClass(getDatasource().getMetaClass()) .setRefreshMode(CollectionDatasource.RefreshMode.NEVER) .setViewName("_local") .buildDatasource(); ((DatasourceImplementation) datasource).valid(); datasource.setItem(item); fieldDatasources.put(item, datasource); return datasource; }
private void initPropertyDatasourceAttributes(Element element, Datasource ds, String property) { String id = getDatasourceId(element); MetaClass metaClass = ds.getMetaClass(); metaClass.getPropertyNN(property); // check property existence builder.reset() .setMetaClass(metaClass) .setId(id) .setMaster(ds) .setProperty(property) .setAllowCommit(getAllowCommit(element)); }
protected Datasource createItemDatasource(E item) { EntityDataGridItems<E> items = getEntityDataGridItemsNN(); Datasource fieldDatasource = DsBuilder.create() .setAllowCommit(false) .setMetaClass(items.getEntityMetaClass()) .setRefreshMode(CollectionDatasource.RefreshMode.NEVER) .setViewName(View.LOCAL) .buildDatasource(); ((DatasourceImplementation) fieldDatasource).valid(); //noinspection unchecked fieldDatasource.setItem(item); return fieldDatasource; }
.setMetaClass(entityMetaClass) .setViewName(View.LOCAL) .setAllowCommit(false) .buildCollectionDatasource();