Class DataWriter
java.lang.Object
ch.nolix.system.nodemiddata.datawriter.DataWriter
- All Implemented Interfaces:
Closeable, CloseStateRequestable, GroupCloseable, ChangeRequestable, IChangeSaver, IResettableChangeSaver, Resettable, IDataWriter, AutoCloseable
- Author:
- Silvan Wyss
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidclearMultiReference(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.voidclearMultiValue(String tableName, String entityId, String multiValueColumnName) 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.voiddeleteEntity(String tableName, EntityDeletionDto entity) Deletes the given entity from the database.voiddeleteMultiBackReferenceEntry(MultiBackReferenceEntryDeletionDto multiBackReferenceEntry) Deletes the given multiBackReferenceEntry from the database.voiddeleteMultiReferenceEntry(MultiReferenceEntryDeletionDto multiReferenceEntry) Deletes the given multiReferenceEntry from the database.voiddeleteMultiValueEntry(MultiValueEntryDto multiValueEntry) Deletes the given multiValueEntry from the database.voidexpectSchemaTimestamp(ITime schemaTimestamp) Will cause an error by saving if the database does not have the given schemaTimestamp.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.static DataWriterforNodeDatabaseAndDatabaseView(IMutableNode<?> nodeDatabase, DatabaseViewDto databaseView) intbooleanvoidinsertEntity(String tableName, EntityCreationDto entity) Inserts the given entity into the table with the given tableName on the database.voidinsertMultiBackReferenceEntry(MultiBackReferenceEntryDto multiBackReferenceEntry) Inserts the given multiBackReferenceEntry into the database.voidinsertMultiReferenceEntry(MultiReferenceEntryDto multiReferenceEntry) Inserts the given multiReferenceEntry into the database.voidinsertMultiValueEntry(MultiValueEntryDto multiValueEntry) Inserts the given multiValueEntry into the database.voidLets the currentGroupCloseablenote a close.voidreset()Resets the currentResettable.voidSaves the changes of the currentIChangeSaver.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, createCloseDependencyTo, isClosed
-
Field Details
-
INITIAL_ENTITY_SAVE_STAMP
public static final int INITIAL_ENTITY_SAVE_STAMP- See Also:
-
-
Method Details
-
forNodeDatabaseAndDatabaseView
public static DataWriter forNodeDatabaseAndDatabaseView(IMutableNode<?> nodeDatabase, DatabaseViewDto databaseView) -
clearMultiReference
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-multiValueColumnName-
-
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 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-
-
getSaveCount
public int getSaveCount()- Specified by:
getSaveCountin interfaceIResettableChangeSaver
-
hasChanges
public boolean hasChanges()- Specified by:
hasChangesin interfaceChangeRequestable- Returns:
- true if the current
ChangeRequestablehas uncomitted changes, false otherwise.
-
insertEntity
Inserts the given entity into the table with the given tableName on the database.- Specified by:
insertEntityin interfaceIDataWriter- Parameters:
tableName-entity-
-
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-
-
getStoredCloseController
- Specified by:
getStoredCloseControllerin interfaceGroupCloseable- Returns:
- the
ICloseControllerof the currentGroupCloseable.
-
noteClose
public void noteClose()Lets the currentGroupCloseablenote a close.- Specified by:
noteClosein interfaceGroupCloseable
-
reset
-
saveChanges
public void saveChanges()Saves the changes of the currentIChangeSaver.- Specified by:
saveChangesin interfaceIChangeSaver
-
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-
-