Class AbstractDataAdapter
java.lang.Object
ch.nolix.system.middata.adapter.AbstractDataAdapter
- All Implemented Interfaces:
IDatabaseNameHolder, Closeable, CloseStateRequestable, GroupCloseable, ChangeRequestable, IChangeSaver, IResettableChangeSaver, Resettable, IDataAdapter, IDataReader, IDataWriter, AutoCloseable
- Direct Known Subclasses:
AbstractDataAdapterAndSchemaReader, AbstractSqlDataAdapter, NodeDataAdapter
- Author:
- Silvan Wyss
-
Method Summary
Modifier and TypeMethodDescriptionfinal voidclearMultiReference(String tableName, String entityId, String multiReferenceColumnName) Deletes the references of the multi reference, that is in the multi reference column with the given multiReferenceColumnName and belongs to the entity, that has the given entityId and belongs to the table with the given tableName, from the database.final voidclearMultiValue(String tableName, String entityId, String multiFieldColumn) Deletes the values of the multi value, that is in the multi value column with the given multiValueColumnName and belongs to the entity, that has the given entityId and belongs to the table with the given tableName, from the database.final voidcreateCloseDependencyTo(GroupCloseable element) Creates a close dependency between the currentGroupCloseableand the given element.final voiddeleteEntity(String tableName, EntityDeletionDto entity) Deletes the given entity from the database.final voiddeleteMultiBackReferenceEntry(MultiBackReferenceEntryDeletionDto multiBackReferenceEntry) Deletes the given multiBackReferenceEntry from the database.final voiddeleteMultiReferenceEntry(MultiReferenceEntryDeletionDto multiReferenceEntry) Deletes the given multiReferenceEntry from the database.final voiddeleteMultiValueEntry(MultiValueEntryDto multiValueEntry) Deletes the given multiValueEntry from the database.final voidexpectSchemaTimestamp(ITime schemaTimestamp) Will cause an error by saving if the database does not have the given schemaTimestamp.final voidexpectTableContainsEntity(String tableName, String entityId) Will cause an error by saving if on the database the table with the given tableName does not contain an entity with the given entityId.final Stringfinal intgetEntityCount(String tableName) final intfinal ITimefinal ICloseControllerfinal booleanfinal voidinsertEntity(String tableName, EntityCreationDto newEntity) Inserts the given entity into the table with the given tableName on the database.final voidinsertMultiBackReferenceEntry(MultiBackReferenceEntryDto multiBackReferenceEntry) Inserts the given multiBackReferenceEntry into the database.voidinsertMultiReferenceEntry(MultiReferenceEntryDto multiReferenceEntry) Inserts the given multiReferenceEntry into the database.final voidinsertMultiValueEntry(MultiValueEntryDto multiValueEntry) Inserts the given multiValueEntry into the database.final IContainer<EntityLoadingDto> loadEntities(String tableName) final EntityLoadingDtoloadEntity(String tableName, String id) final IContainer<String> loadMultiBackReferenceBackReferencedEntityIds(String tableName, String entityId, String multiBackReferenceColumnName) loadMultiBackReferenceEntries(TableIdentification table, String entityId, ColumnIdentification multiBackReferenceColumn) final IContainer<MultiReferenceEntryDto> loadMultiReferenceEntries(String tableName, String entityId, String multiReferenceColumnName) final IContainer<Object> loadMultiValueValues(String tableName, String entityId, String multiFieldColumnName) final voidLets the currentGroupCloseablenote a close.final voidreset()Resets the currentResettable.final voidSaves the changes of the currentIChangeSaver.final booleantableContainsEntity(String tableName, String entityId) final booleantableContainsEntityWithValueAtColumn(String tableName, String columnName, String value) final booleantableContainsEntityWithValueAtColumnIgnoringEntities(String tableName, String columnName, String value, IContainer<String> entitiesToIgnoreIds) final voidupdateEntity(String tableName, EntityUpdateDto entityUpdate) Updates the entity, that belongs to the table with the given tableName, in the database according to the given entityUpdate.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChangeRequestable
isChangeFreeMethods inherited from interface CloseStateRequestable
isOpenMethods inherited from interface GroupCloseable
close, isClosedMethods inherited from interface IDatabaseNameHolder
getDatabaseNameInQuotes
-
Method Details
-
clearMultiReference
public final void clearMultiReference(String tableName, String entityId, String multiReferenceColumnName) Deletes the references of the multi reference, that is in the multi reference column with the given multiReferenceColumnName and belongs to the entity, that has the given entityId and belongs to the table with the given tableName, from the database.- Specified by:
clearMultiReferencein interfaceIDataWriter- Parameters:
tableName-entityId-multiReferenceColumnName-
-
clearMultiValue
Deletes the values of the multi value, that is in the multi value column with the given multiValueColumnName and belongs to the entity, that has the given entityId and belongs to the table with the given tableName, from the database.- Specified by:
clearMultiValuein interfaceIDataWriter- Parameters:
tableName-entityId-multiFieldColumn-
-
createCloseDependencyTo
Creates a close dependency between the currentGroupCloseableand the given element. When aGroupCloseableis closed, all elements, the currentGroupCloseablehas a close dependency to, will be closed too and vice versa.- Specified by:
createCloseDependencyToin interfaceGroupCloseable- Parameters:
element-
-
deleteEntity
Deletes the given entity from the database. Will cause an error by saving if the given entity was deleted or changed on the database in the meanwhile.- Specified by:
deleteEntityin interfaceIDataWriter- Parameters:
tableName-entity-
-
deleteMultiBackReferenceEntry
public final void deleteMultiBackReferenceEntry(MultiBackReferenceEntryDeletionDto multiBackReferenceEntry) Deletes the given multiBackReferenceEntry from the database.- Specified by:
deleteMultiBackReferenceEntryin interfaceIDataWriter- Parameters:
multiBackReferenceEntry-
-
deleteMultiReferenceEntry
Deletes the given multiReferenceEntry from the database.- Specified by:
deleteMultiReferenceEntryin interfaceIDataWriter- Parameters:
multiReferenceEntry-
-
deleteMultiValueEntry
Deletes the given multiValueEntry from the database.- Specified by:
deleteMultiValueEntryin interfaceIDataWriter- Parameters:
multiValueEntry-
-
expectSchemaTimestamp
Will cause an error by saving if the database does not have the given schemaTimestamp. This method can be used to prevent from saving changes when the schemaTimestamp was changed in the meanwhile- Specified by:
expectSchemaTimestampin interfaceIDataWriter- Parameters:
schemaTimestamp-
-
expectTableContainsEntity
Will cause an error by saving if on the database the table with the given tableName does not contain an entity with the given entityId. This method can be used to prevent from referencing an entity that was deleted in the meanwhile.- Specified by:
expectTableContainsEntityin interfaceIDataWriter- Parameters:
tableName-entityId-
-
getDatabaseName
- Specified by:
getDatabaseNamein interfaceIDatabaseNameHolder- Returns:
- the database name of the current
IDatabaseNameHolder.
-
getEntityCount
- Specified by:
getEntityCountin interfaceIDataReader- Parameters:
tableName-- Returns:
- the number of the entities of the table with the given tableName from the database.
-
getSaveCount
public final int getSaveCount()- Specified by:
getSaveCountin interfaceIResettableChangeSaver
-
getSchemaTimestamp
- Specified by:
getSchemaTimestampin interfaceIDataReader- Returns:
- the schema timestamp from the database.
-
getStoredCloseController
- Specified by:
getStoredCloseControllerin interfaceGroupCloseable- Returns:
- the
ICloseControllerof the currentGroupCloseable.
-
hasChanges
public final boolean hasChanges()- Specified by:
hasChangesin interfaceChangeRequestable- Returns:
- true if the current
ChangeRequestablehas uncomitted changes, false otherwise.
-
loadEntities
- Specified by:
loadEntitiesin interfaceIDataReader- Parameters:
tableName-- Returns:
- the entities, that are in the table with the given tableName, from the database.
-
loadEntity
- Specified by:
loadEntityin interfaceIDataReader- Parameters:
tableName-id-- Returns:
- the entity, that is in the table with the given tableName and has the given entityId, from the database.
-
insertEntity
Inserts the given entity into the table with the given tableName on the database.- Specified by:
insertEntityin interfaceIDataWriter- Parameters:
tableName-newEntity-
-
insertMultiBackReferenceEntry
Inserts the given multiBackReferenceEntry into the database.- Specified by:
insertMultiBackReferenceEntryin interfaceIDataWriter- Parameters:
multiBackReferenceEntry-
-
insertMultiReferenceEntry
Inserts the given multiReferenceEntry into the database.- Specified by:
insertMultiReferenceEntryin interfaceIDataWriter- Parameters:
multiReferenceEntry-
-
insertMultiValueEntry
Inserts the given multiValueEntry into the database.- Specified by:
insertMultiValueEntryin interfaceIDataWriter- Parameters:
multiValueEntry-
-
loadMultiBackReferenceBackReferencedEntityIds
public final IContainer<String> loadMultiBackReferenceBackReferencedEntityIds(String tableName, String entityId, String multiBackReferenceColumnName) - Specified by:
loadMultiBackReferenceBackReferencedEntityIdsin interfaceIDataReader- Parameters:
tableName-entityId-multiBackReferenceColumnName-- Returns:
- the entity ids of the multi back reference, that is in the multi back reference column with the given multiBackReferenceColumnName and belongs to the entity, that has the given entityId and is in the table with the given tableName, from the database.
-
loadMultiBackReferenceEntries
public IContainer<MultiBackReferenceEntryDto> loadMultiBackReferenceEntries(TableIdentification table, String entityId, ColumnIdentification multiBackReferenceColumn) - Specified by:
loadMultiBackReferenceEntriesin interfaceIDataReader- Parameters:
table-entityId-multiBackReferenceColumn-- Returns:
- the multi back reference entries of the multi back reference that is in the given table and in the entity with the given entityId and in the given multiBackReferenceColumn.
-
loadMultiReferenceEntries
public final IContainer<MultiReferenceEntryDto> loadMultiReferenceEntries(String tableName, String entityId, String multiReferenceColumnName) - Specified by:
loadMultiReferenceEntriesin interfaceIDataReader- Parameters:
tableName-entityId-multiReferenceColumnName-- Returns:
- the multi reference entries of the the multi reference field, that is in the multi reference column with the given multiReferenceColumnName and belongs to the entity, that has the given entityId and is in the table with the given tableName, from the database.
-
loadMultiValueValues
public final IContainer<Object> loadMultiValueValues(String tableName, String entityId, String multiFieldColumnName) - Specified by:
loadMultiValueValuesin interfaceIDataReader- Parameters:
tableName-entityId-multiFieldColumnName-- Returns:
- the values of the multi value, that is in the multi value column with the given multiValueColumnName and belongs to the entity, that has the given entityId and is in the table with the given tableName, from the database.
-
noteClose
public final void noteClose()Lets the currentGroupCloseablenote a close.- Specified by:
noteClosein interfaceGroupCloseable
-
reset
public final void reset()Resets the currentResettable.- Specified by:
resetin interfaceResettable
-
saveChanges
public final void saveChanges()Saves the changes of the currentIChangeSaver.- Specified by:
saveChangesin interfaceIChangeSaver
-
tableContainsEntity
- Specified by:
tableContainsEntityin interfaceIDataReader- Parameters:
tableName-entityId-- Returns:
- true if the table with the given tableName contains an entity with the given entityId on the database, false otherwise.
-
tableContainsEntityWithValueAtColumn
public final boolean tableContainsEntityWithValueAtColumn(String tableName, String columnName, String value) - Specified by:
tableContainsEntityWithValueAtColumnin interfaceIDataReader- Parameters:
tableName-columnName-value-- Returns:
- true if the table with the given tableName contains in the column with the given columnName the given value on the database, false otherwise.
-
tableContainsEntityWithValueAtColumnIgnoringEntities
public final boolean tableContainsEntityWithValueAtColumnIgnoringEntities(String tableName, String columnName, String value, IContainer<String> entitiesToIgnoreIds) - Specified by:
tableContainsEntityWithValueAtColumnIgnoringEntitiesin interfaceIDataReader- Parameters:
tableName-columnName-value-entitiesToIgnoreIds-- Returns:
- true if the table with the given tableName contains in the column with the given columnName the given value ignoring the entities with the given entitiesToIgnoreIds on the database, false otherwise.
-
updateEntity
Updates the entity, that belongs to the table with the given tableName, in the database according to the given entityUpdate.- Specified by:
updateEntityin interfaceIDataWriter- Parameters:
tableName-entityUpdate-
-