@Component(value="cuba_DsBuilder")
@Scope(value="prototype")
public class DsBuilder
extends java.lang.Object
Use setters to provide parameters and then invoke one of the build* methods to obtain the datasource implementation.
Sample usage:
CollectionDatasource usersDs = DsBuilder.create(getDsContext()) .setMetaClass(metaClass) .setId("usersDs") .setViewName(View.MINIMAL) .buildCollectionDatasource();If you set
master
and property
properties you will get a PropertyDatasource
implementation.
In order to provide your own implementations of standard datasources, create a subclass, override corresponding
createXYZDatasource()
methods and register the subclass in spring.xml
, for example:
<bean id="cuba_DsBuilder" class="com.company.sample.gui.MyDsBuilder" scope="prototype"/>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
Constructor and Description |
---|
DsBuilder()
INTERNAL
|
DsBuilder(DsContext dsContext)
INTERNAL
|
public static final java.lang.String NAME
public DsBuilder()
public DsBuilder(@Nullable DsContext dsContext)
public static DsBuilder create()
DsContext
.public static DsBuilder create(@Nullable DsContext dsContext)
DsContext
.dsContext
- context instance or nullprotected Datasource createDatasource()
protected NestedDatasource createPropertyDatasource()
protected NestedDatasource createEmbeddedDatasource()
protected CollectionDatasource createCollectionDatasource()
protected CollectionDatasource createCollectionPropertyDatasource()
protected GroupDatasource createGroupDatasource()
protected GroupDatasource createGroupPropertyDatasource()
protected HierarchicalDatasource createHierarchicalDatasource()
protected HierarchicalDatasource createHierarchicalPropertyDatasource()
protected ValueCollectionDatasourceImpl createValueCollectionDatasource()
protected ValueGroupDatasourceImpl createValueGroupDatasource()
protected ValueHierarchicalDatasourceImpl createValueHierarchicalDatasource()
protected PersistenceManagerService getPersistenceManager()
protected ViewRepository getViewRepository()
protected Metadata getMetadata()
public DsContext getDsContext()
public DataSupplier getDataSupplier()
public DsBuilder setDataSupplier(DataSupplier dataSupplier)
public java.lang.String getId()
public MetaClass getMetaClass()
public java.lang.Class getJavaClass()
public DsBuilder setJavaClass(java.lang.Class javaClass)
public boolean isAllowCommit()
public DsBuilder setAllowCommit(boolean allowCommit)
public View getView()
public java.lang.String getViewName()
public DsBuilder setId(java.lang.String id)
public DsBuilder setViewName(java.lang.String viewName)
public boolean isSoftDeletion()
public DsBuilder setSoftDeletion(boolean softDeletion)
public boolean isCacheable()
public DsBuilder setCacheable(boolean cacheable)
public Datasource getMaster()
public DsBuilder setMaster(Datasource master)
public java.lang.String getProperty()
public DsBuilder setProperty(java.lang.String property)
public CollectionDatasource.RefreshMode getRefreshMode()
public DsBuilder setRefreshMode(CollectionDatasource.RefreshMode refreshMode)
public int getMaxResults()
public DsBuilder setMaxResults(int maxResults)
public java.lang.Class<?> getDsClass()
public DsBuilder setDsClass(java.lang.Class<?> dsClass)
public DsBuilder reset()
protected void init()
public Datasource buildDatasource()
public <T> T buildCollectionDatasource(java.lang.Class<T> datasourceClass)
CollectionDatasource
with the specified implementation class.public CollectionDatasource buildCollectionDatasource()
CollectionDatasource
with the standard implementation.public <T> T buildHierarchicalDatasource(java.lang.Class<T> datasourceClass)
HierarchicalDatasource
with the specified implementation class.public HierarchicalDatasource buildHierarchicalDatasource()
HierarchicalDatasource
with the standard implementation.public <T> T buildGroupDatasource(java.lang.Class<T> datasourceClass)
GroupDatasource
with the specified implementation class.public GroupDatasource buildGroupDatasource()
GroupDatasource
with the standard implementation.public RuntimePropsDatasource buildRuntimePropsDatasource(java.lang.String mainDsId, @Nullable MetaClass categorizedEntityClass)
public ValueCollectionDatasourceImpl buildValuesCollectionDatasource()
ValueCollectionDatasourceImpl
with the standard implementation.public <T> T buildValuesCollectionDatasource(java.lang.Class<T> datasourceClass)
ValueCollectionDatasourceImpl
with the specified implementation class.public ValueGroupDatasourceImpl buildValuesGroupDatasource()
ValueGroupDatasourceImpl
with the standard implementation.public <T> T buildValuesGroupDatasource(java.lang.Class<T> datasourceClass)
ValueGroupDatasourceImpl
with the specified implementation class.public ValueHierarchicalDatasourceImpl buildValuesHierarchicalDatasource()
ValueHierarchicalDatasourceImpl
with the standard implementation.public <T> T buildValuesHierarchicalDatasource(java.lang.Class<T> datasourceClass)
ValueHierarchicalDatasourceImpl
with the specified implementation class.