EDMIService: Include ECM Database in Methods

This commit is contained in:
Jonathan Jenne
2022-01-10 15:50:13 +01:00
parent 7e952093c7
commit 724ada9753
8 changed files with 29 additions and 28 deletions

View File

@@ -11,10 +11,10 @@ Public Class NewFileMethod
Private ReadOnly Connection As SqlConnection
Private ReadOnly Transaction As SqlTransaction
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pGlobalState As GlobalState)
MyBase.New(pLogConfig, pMSSQLServer, pGlobalState)
Public Sub New(pLogConfig As LogConfig, pDatabaseIDB As MSSQLServer, pDatabaseECM As MSSQLServer, pGlobalState As GlobalState)
MyBase.New(pLogConfig, pDatabaseIDB, pDatabaseECM, pGlobalState)
Connection = Database.GetConnection()
Connection = DatabaseIDB.GetConnection()
Transaction = Connection.BeginTransaction()
End Sub
@@ -117,7 +117,7 @@ Public Class NewFileMethod
'{oObjectId}',
{oStore.Id}"
Dim oResult As Boolean = Database.ExecuteNonQueryWithConnectionObject(oSQL, Connection, ExternalTransaction, Transaction)
Dim oResult As Boolean = DatabaseIDB.ExecuteNonQueryWithConnectionObject(oSQL, Connection, ExternalTransaction, Transaction)
If oResult = False Then
LogAndThrow("IDB FileObject could not be created!")
@@ -182,7 +182,7 @@ Public Class NewFileMethod
Private Function TestFileChecksumExists(pChecksum As String) As Long
Try
Dim oChecksumSQL = $"SELECT IDB_OBJ_ID FROM TBIDB_FILE_OBJECT WHERE FILE_HASH = '{pChecksum}'"
Dim oExistingObjectId As Long = Database.GetScalarValue(oChecksumSQL)
Dim oExistingObjectId As Long = DatabaseIDB.GetScalarValue(oChecksumSQL)
If oExistingObjectId > 0 Then
Logger.Info("Returning early with ObjectId [{0}] because Checksum [{1}] already exists.", oExistingObjectId, pChecksum)
@@ -203,7 +203,7 @@ Public Class NewFileMethod
Dim oNewObjectIdSQL = $"DECLARE @NEW_IDB_OBJ_ID BIGINT
EXEC PRIDB_NEW_OBJECT '{pKindType}','{pWho}','{pBusinessEntity}',0, @IDB_OBJ_ID = @NEW_IDB_OBJ_ID OUTPUT;
SELECT @NEW_IDB_OBJ_ID"
Dim oObjectId As Long = Database.GetScalarValueWithConnectionObject(oNewObjectIdSQL, Connection, ExternalTransaction, Transaction)
Dim oObjectId As Long = DatabaseIDB.GetScalarValueWithConnectionObject(oNewObjectIdSQL, Connection, ExternalTransaction, Transaction)
Logger.Info("New Object with Id [{0}] created!", oObjectId)
If IsNothing(oObjectId) Then