T
- public class DatasourceImpl<T extends Entity> extends AbstractDatasource<T> implements DatasourceImplementation<T>
AbstractDatasource.ItemListener
Datasource.CommitMode, Datasource.ItemChangeEvent<T extends Entity>, Datasource.ItemChangeListener<T extends Entity>, Datasource.ItemPropertyChangeEvent<T extends Entity>, Datasource.ItemPropertyChangeListener<T extends Entity>, Datasource.State, Datasource.StateChangeEvent<T extends Entity>, Datasource.StateChangeListener<T extends Entity>
Modifier and Type | Field and Description |
---|---|
protected DataSupplier |
dataSupplier |
protected DsContext |
dsContext |
protected T |
item |
protected MetaClass |
metaClass |
protected Datasource.State |
state |
protected View |
view |
allowCommit, backgroundWorker, commitMode, id, itemsToCreate, itemsToDelete, itemsToUpdate, listener, listenersEnabled, loadDynamicAttributes, metadata, modified, parentDs
Constructor and Description |
---|
DatasourceImpl() |
Modifier and Type | Method and Description |
---|---|
protected void |
__setItem(T item) |
void |
commit()
Performs commit
|
void |
committed(java.util.Set<Entity> entities)
Invoked after commit.
|
DataSupplier |
getDataSupplier() |
DsContext |
getDsContext() |
T |
getItem() |
T |
getItemIfValid() |
MetaClass |
getMetaClass() |
Datasource.State |
getState() |
View |
getView() |
void |
initialized()
Moves the datasource to
State#INVALID . |
void |
invalidate()
Clears internal data and sets the datasource in
Datasource.State.INVALID state. |
void |
refresh()
Refreshes the datasource moving it to the
Datasource.State.VALID state |
void |
setDataSupplier(DataSupplier dataService) |
void |
setDsContext(DsContext dsContext) |
void |
setItem(T item)
Set current entity in the datasource.
|
void |
setMetaClass(MetaClass metaClass) |
void |
setup(DsContext dsContext,
DataSupplier dataSupplier,
java.lang.String id,
MetaClass metaClass,
View view)
Setup the datasource right after creation.
|
void |
setView(java.lang.String viewName) |
void |
setView(View view) |
void |
valid()
Moves the datasource to
State#VALID . |
addItemChangeListener, addItemPropertyChangeListener, addParentsToNested, addStateChangeListener, attachListener, clearCommitLists, deleted, detachListener, enableListeners, fireItemChanged, fireStateChanged, getCommitMode, getEventRouter, getId, getItemsToCreate, getItemsToDelete, getItemsToUpdate, getLoadDynamicAttributes, getParent, isAllowCommit, isModified, modified, removeItemChangeListener, removeItemPropertyChangeListener, removeStateChangeListener, setAllowCommit, setCommitMode, setLoadDynamicAttributes, setModified, setParent, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
clearCommitLists, deleted, enableListeners, getItemsToCreate, getItemsToDelete, getItemsToUpdate, getParent, modified, setCommitMode, setModified, setParent
addItemChangeListener, addItemPropertyChangeListener, addStateChangeListener, getCommitMode, getId, getLoadDynamicAttributes, isAllowCommit, isModified, removeItemChangeListener, removeItemPropertyChangeListener, removeStateChangeListener, setAllowCommit, setLoadDynamicAttributes
protected DsContext dsContext
protected DataSupplier dataSupplier
protected MetaClass metaClass
protected View view
protected Datasource.State state
public void setup(DsContext dsContext, DataSupplier dataSupplier, java.lang.String id, MetaClass metaClass, @Nullable View view)
Datasource
setup
in interface Datasource<T extends Entity>
setup
in class AbstractDatasource<T extends Entity>
dsContext
- DsContext instancedataSupplier
- DataSupplier instanceid
- datasource IDmetaClass
- MetaClass of an entity that will be stored in this datasourceview
- a view that will be used to load entities form DB, can be nullpublic void setView(View view)
public void setView(java.lang.String viewName)
public DsContext getDsContext()
getDsContext
in interface Datasource<T extends Entity>
public void setDsContext(DsContext dsContext)
public DataSupplier getDataSupplier()
getDataSupplier
in interface Datasource<T extends Entity>
public void setDataSupplier(DataSupplier dataService)
public void commit()
Datasource
commit
in interface Datasource<T extends Entity>
public MetaClass getMetaClass()
getMetaClass
in interface Datasource<T extends Entity>
public void setMetaClass(MetaClass metaClass)
public View getView()
getView
in interface Datasource<T extends Entity>
public Datasource.State getState()
getState
in interface Datasource<T extends Entity>
public T getItem()
getItem
in interface Datasource<T extends Entity>
@Nullable public T getItemIfValid()
getItemIfValid
in interface Datasource<T extends Entity>
public void refresh()
Datasource
Datasource.State.VALID
staterefresh
in interface Datasource<T extends Entity>
public void setItem(T item)
Datasource
setItem
in interface Datasource<T extends Entity>
item
- entity instanceprotected void __setItem(T item)
public void invalidate()
Datasource
Datasource.State.INVALID
state.
In Datasource.State.NOT_INITIALIZED
does nothing.invalidate
in interface Datasource<T extends Entity>
public void initialized()
DatasourceImplementation
State#INVALID
.initialized
in interface DatasourceImplementation<T extends Entity>
public void valid()
DatasourceImplementation
State#VALID
.valid
in interface DatasourceImplementation<T extends Entity>
public void committed(java.util.Set<Entity> entities)
DatasourceImplementation
committed
in interface DatasourceImplementation<T extends Entity>
entities
- committed entities returned from middleware