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

@ -5,14 +5,15 @@ Imports DigitalData.Services.EDMIService.IDB
Public MustInherit Class BaseMethod
Inherits BaseClass
Friend ReadOnly Database As MSSQLServer
Friend ReadOnly DatabaseIDB As MSSQLServer
Friend ReadOnly DatabaseECM As MSSQLServer
Friend ReadOnly Helpers As Helpers
Friend ReadOnly GlobalState As GlobalState
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pGlobalState As GlobalState)
Public Sub New(pLogConfig As LogConfig, pDatabaseIDB As MSSQLServer, pDatabaseECM As MSSQLServer, pGlobalState As GlobalState)
MyBase.New(pLogConfig)
Database = pMSSQLServer
Helpers = New Helpers(pLogConfig, pMSSQLServer)
DatabaseIDB = pDatabaseIDB
Helpers = New Helpers(pLogConfig, pDatabaseIDB)
GlobalState = pGlobalState
End Sub
End Class

View File

@ -5,8 +5,8 @@ Namespace Methods.GetAttributeValue
Public Class GetAttributeValueMethod
Inherits BaseMethod
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pGlobalState As GlobalState)
MyBase.New(pLogConfig, pDatabase, pGlobalState)
Public Sub New(pLogConfig As LogConfig, pDatabaseIDB As MSSQLServer, pDatabaseECM As MSSQLServer, pGlobalState As GlobalState)
MyBase.New(pLogConfig, pDatabaseIDB, pDatabaseECM, pGlobalState)
End Sub
Public Function Run(pData As GetAttributeValueRequest) As GetAttributeValueResponse

View File

@ -6,8 +6,8 @@ Namespace Methods.GetDatatableFromCache
Public Class GetDatatableFromCacheMethod
Inherits BaseMethod
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)
End Sub
Public Function Run(pData As GetDatatableFromCacheRequest) As GetDatatableFromCacheResponse

View File

@ -7,8 +7,8 @@ Namespace Methods.GetFileObject
Public Class GetFileObjectMethod
Inherits BaseMethod
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)
End Sub
Public Function Run(pData As GetFileObjectRequest) As GetFileObjectResponse
@ -18,7 +18,7 @@ Namespace Methods.GetFileObject
End If
Dim oSQL = $"SELECT * FROM VWIDB_FILE_OBJECT WHERE IDB_OBJ_ID = {pData.ObjectId}"
Dim oTable = Database.GetDatatable(oSQL)
Dim oTable = DatabaseIDB.GetDatatable(oSQL)
If oTable Is Nothing OrElse oTable.Rows.Count = 0 Then
LogAndThrow("Error while getting FileObject data!")

View File

@ -18,12 +18,12 @@ Namespace Methods.GlobalIndexer.ImportFile
Private User As UserState
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)
Patterns = New Patterns2(pLogConfig)
Loader = New Loader(pLogConfig, Database, pGlobalState)
Connection = Database.GetConnection()
Loader = New Loader(pLogConfig, DatabaseIDB, pDatabaseECM, pGlobalState)
Connection = DatabaseIDB.GetConnection()
Transaction = Connection.BeginTransaction()
End Sub
@ -55,11 +55,11 @@ Namespace Methods.GlobalIndexer.ImportFile
oUserAttributes = oPostProcessing.ApplyManualPostprocessing(oUserAttributes)
' Apply automatic attributes
Dim oAutomaticIndexing = New Steps.AutomaticIndexing(LogConfig, Database, oAutomaticIndexes, GlobalState)
Dim oAutomaticIndexing = New Steps.AutomaticIndexing(LogConfig, DatabaseIDB, oAutomaticIndexes, GlobalState)
oAutoAttributes = oAutomaticIndexing.ApplyAutomaticeAttributes(oUserAttributes, pData.File.FileInfoRaw, User)
' Import the file
Dim oNewFile As New NewFileMethod(LogConfig, Database, GlobalState)
Dim oNewFile As New NewFileMethod(LogConfig, DatabaseIDB, DatabaseECM, GlobalState)
Dim oResponse = oNewFile.Run(New NewFile.NewFileRequest With {
.File = pData.File,
.BusinessEntity = pData.BusinessEntity,

View File

@ -14,9 +14,9 @@ Namespace Methods.GlobalIndexer
Private GetDatatable As GetDatatableFromCacheMethod
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pGlobalState As GlobalState)
Public Sub New(pLogConfig As LogConfig, pDatabaseIDB As MSSQLServer, pDatabaseECM As MSSQLServer, pGlobalState As GlobalState)
MyBase.New(pLogConfig)
GetDatatable = New GetDatatableFromCacheMethod(pLogConfig, pDatabase, pGlobalState)
GetDatatable = New GetDatatableFromCacheMethod(pLogConfig, pDatabaseIDB, pDatabaseECM, pGlobalState)
End Sub
''' <summary>

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

View File

@ -10,10 +10,10 @@ Namespace Methods.SetAttributeValue
Private Connection As SqlConnection
Private Transaction As SqlTransaction
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pGlobalState As GlobalState)
MyBase.New(pLogConfig, pDatabase, 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