@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
|
Modifier and Type | Method and Description |
---|---|
CollectionDatasource |
buildCollectionDatasource()
Build a
CollectionDatasource with the standard implementation. |
<T> T |
buildCollectionDatasource(java.lang.Class<T> datasourceClass)
Build a
CollectionDatasource with the specified implementation class. |
Datasource |
buildDatasource() |
GroupDatasource |
buildGroupDatasource()
Build a
GroupDatasource with the standard implementation. |
<T> T |
buildGroupDatasource(java.lang.Class<T> datasourceClass)
Build a
GroupDatasource with the specified implementation class. |
HierarchicalDatasource |
buildHierarchicalDatasource()
Build a
HierarchicalDatasource with the standard implementation. |
<T> T |
buildHierarchicalDatasource(java.lang.Class<T> datasourceClass)
Build a
HierarchicalDatasource with the specified implementation class. |
RuntimePropsDatasource |
buildRuntimePropsDatasource(java.lang.String mainDsId,
MetaClass categorizedEntityClass) |
ValueCollectionDatasourceImpl |
buildValuesCollectionDatasource()
Build a
ValueCollectionDatasourceImpl with the standard implementation. |
<T> T |
buildValuesCollectionDatasource(java.lang.Class<T> datasourceClass)
Build a
ValueCollectionDatasourceImpl with the specified implementation class. |
ValueGroupDatasourceImpl |
buildValuesGroupDatasource()
Build a
ValueGroupDatasourceImpl with the standard implementation. |
<T> T |
buildValuesGroupDatasource(java.lang.Class<T> datasourceClass)
Build a
ValueGroupDatasourceImpl with the specified implementation class. |
ValueHierarchicalDatasourceImpl |
buildValuesHierarchicalDatasource()
Build a
ValueHierarchicalDatasourceImpl with the standard implementation. |
<T> T |
buildValuesHierarchicalDatasource(java.lang.Class<T> datasourceClass)
Build a
ValueHierarchicalDatasourceImpl with the specified implementation class. |
static DsBuilder |
create()
Creates DsBuilder for building datasources not belonging to a
DsContext . |
static DsBuilder |
create(DsContext dsContext)
Creates DsBuilder for building datasources for the given
DsContext . |
DataSupplier |
getDataSupplier() |
java.lang.Class<?> |
getDsClass() |
DsContext |
getDsContext() |
java.lang.String |
getId() |
java.lang.Class |
getJavaClass() |
Datasource |
getMaster() |
int |
getMaxResults() |
MetaClass |
getMetaClass() |
java.lang.String |
getProperty() |
CollectionDatasource.RefreshMode |
getRefreshMode() |
View |
getView() |
java.lang.String |
getViewName() |
boolean |
isAllowCommit() |
boolean |
isCacheable() |
boolean |
isSoftDeletion() |
DsBuilder |
reset() |
DsBuilder |
setAllowCommit(boolean allowCommit) |
DsBuilder |
setCacheable(boolean cacheable) |
DsBuilder |
setDataSupplier(DataSupplier dataSupplier) |
DsBuilder |
setDsClass(java.lang.Class<?> dsClass)
Set datasource implementation class.
|
DsBuilder |
setId(java.lang.String id) |
DsBuilder |
setJavaClass(java.lang.Class javaClass) |
DsBuilder |
setMaster(Datasource master) |
DsBuilder |
setMaxResults(int maxResults) |
DsBuilder |
setMetaClass(MetaClass metaClass) |
DsBuilder |
setProperty(java.lang.String property) |
DsBuilder |
setRefreshMode(CollectionDatasource.RefreshMode refreshMode) |
DsBuilder |
setSoftDeletion(boolean softDeletion) |
DsBuilder |
setView(View view) |
DsBuilder |
setViewName(java.lang.String viewName) |
public static final java.lang.String NAME
public DsBuilder()
public DsBuilder(DsContext dsContext)
public static DsBuilder create()
DsContext
.public static DsBuilder create(@Nullable DsContext dsContext)
DsContext
.dsContext
- context instance or nullpublic 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()
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.