public class EmbeddedDatasourceImpl<T extends EmbeddableEntity> extends AbstractDatasource<T> implements Datasource<T>, DatasourceImplementation<T>, EmbeddedDatasource<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 Datasource |
masterDs |
protected com.haulmont.chile.core.model.MetaProperty |
metaProperty |
allowCommit, backgroundWorker, commitMode, id, itemsToCreate, itemsToDelete, itemsToUpdate, listener, listenersEnabled, loadDynamicAttributes, metadata, modified, parentDs
Constructor and Description |
---|
EmbeddedDatasourceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
commit()
Performs commit
|
void |
committed(java.util.Set<Entity> entities)
Invoked after commit.
|
DataSupplier |
getDataSupplier() |
DsContext |
getDsContext() |
T |
getItem() |
protected T |
getItem(com.haulmont.chile.core.model.Instance item) |
T |
getItemIfValid() |
java.util.Collection<T> |
getItemsToCreate()
New instances to be committed.
|
java.util.Collection<T> |
getItemsToDelete()
Deleted instances to be committed.
|
java.util.Collection<T> |
getItemsToUpdate()
Modified instances to be committed.
|
Datasource |
getMaster() |
com.haulmont.chile.core.model.MetaClass |
getMetaClass() |
com.haulmont.chile.core.model.MetaProperty |
getProperty() |
Datasource.State |
getState() |
View |
getView() |
void |
initialized()
Moves the datasource to
State#INVALID . |
protected void |
initParentDsListeners() |
void |
invalidate()
Clears internal data and sets the datasource in
Datasource.State.INVALID state. |
void |
modified(T item)
Invoked when the given instance is modified.
|
protected void |
reattachListeners(Entity prevItem,
Entity item) |
void |
refresh()
Refreshes the datasource moving it to the
Datasource.State.VALID state |
void |
setItem(T item)
Set current entity in the datasource.
|
void |
setup(java.lang.String id,
Datasource masterDs,
java.lang.String property)
Setup the datasource right after creation.
|
void |
valid()
Moves the datasource to
State#VALID . |
addItemChangeListener, addItemPropertyChangeListener, addParentsToNested, addStateChangeListener, attachListener, clearCommitLists, deleted, detachListener, enableListeners, fireItemChanged, fireStateChanged, getCommitMode, getEventRouter, getId, getLoadDynamicAttributes, getParent, isAllowCommit, isModified, removeItemChangeListener, removeItemPropertyChangeListener, removeStateChangeListener, setAllowCommit, setCommitMode, setLoadDynamicAttributes, setModified, setParent, setup, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
clearCommitLists, deleted, enableListeners, getParent, setCommitMode, setModified, setParent
addItemChangeListener, addItemPropertyChangeListener, addStateChangeListener, getCommitMode, getId, getLoadDynamicAttributes, isAllowCommit, isModified, removeItemChangeListener, removeItemPropertyChangeListener, removeStateChangeListener, setAllowCommit, setLoadDynamicAttributes, setup
protected Datasource masterDs
protected com.haulmont.chile.core.model.MetaProperty metaProperty
public void setup(java.lang.String id, Datasource masterDs, java.lang.String property)
NestedDatasource
setup
in interface NestedDatasource<T extends EmbeddableEntity>
id
- datasource IDmasterDs
- master datasourceproperty
- property of the master datasource to bound this datasource toprotected void initParentDsListeners()
public DsContext getDsContext()
getDsContext
in interface Datasource<T extends EmbeddableEntity>
public DataSupplier getDataSupplier()
getDataSupplier
in interface Datasource<T extends EmbeddableEntity>
public void commit()
Datasource
commit
in interface Datasource<T extends EmbeddableEntity>
public Datasource.State getState()
getState
in interface Datasource<T extends EmbeddableEntity>
public T getItem()
getItem
in interface Datasource<T extends EmbeddableEntity>
@Nullable public T getItemIfValid()
getItemIfValid
in interface Datasource<T extends EmbeddableEntity>
protected T getItem(com.haulmont.chile.core.model.Instance item)
public void setItem(T item)
Datasource
setItem
in interface Datasource<T extends EmbeddableEntity>
item
- entity instancepublic com.haulmont.chile.core.model.MetaClass getMetaClass()
getMetaClass
in interface Datasource<T extends EmbeddableEntity>
public View getView()
getView
in interface Datasource<T extends EmbeddableEntity>
public void committed(java.util.Set<Entity> entities)
DatasourceImplementation
committed
in interface DatasourceImplementation<T extends EmbeddableEntity>
entities
- committed entities returned from middlewarepublic Datasource getMaster()
getMaster
in interface NestedDatasource<T extends EmbeddableEntity>
public com.haulmont.chile.core.model.MetaProperty getProperty()
getProperty
in interface NestedDatasource<T extends EmbeddableEntity>
public void invalidate()
Datasource
Datasource.State.INVALID
state.
In Datasource.State.NOT_INITIALIZED
does nothing.invalidate
in interface Datasource<T extends EmbeddableEntity>
public void refresh()
Datasource
Datasource.State.VALID
staterefresh
in interface Datasource<T extends EmbeddableEntity>
public void initialized()
DatasourceImplementation
State#INVALID
.initialized
in interface DatasourceImplementation<T extends EmbeddableEntity>
public void valid()
DatasourceImplementation
State#VALID
.valid
in interface DatasourceImplementation<T extends EmbeddableEntity>
public void modified(T item)
DatasourceImplementation
modified
in interface DatasourceImplementation<T extends EmbeddableEntity>
modified
in class AbstractDatasource<T extends EmbeddableEntity>
public java.util.Collection<T> getItemsToCreate()
DatasourceImplementation
getItemsToCreate
in interface DatasourceImplementation<T extends EmbeddableEntity>
getItemsToCreate
in class AbstractDatasource<T extends EmbeddableEntity>
public java.util.Collection<T> getItemsToUpdate()
DatasourceImplementation
getItemsToUpdate
in interface DatasourceImplementation<T extends EmbeddableEntity>
getItemsToUpdate
in class AbstractDatasource<T extends EmbeddableEntity>
public java.util.Collection<T> getItemsToDelete()
DatasourceImplementation
getItemsToDelete
in interface DatasourceImplementation<T extends EmbeddableEntity>
getItemsToDelete
in class AbstractDatasource<T extends EmbeddableEntity>