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 Public MustInherit Class BaseMethod
Inherits BaseClass Inherits BaseClass
Friend ReadOnly Database As MSSQLServer Friend ReadOnly DatabaseIDB As MSSQLServer
Friend ReadOnly DatabaseECM As MSSQLServer
Friend ReadOnly Helpers As Helpers Friend ReadOnly Helpers As Helpers
Friend ReadOnly GlobalState As GlobalState 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) MyBase.New(pLogConfig)
Database = pMSSQLServer DatabaseIDB = pDatabaseIDB
Helpers = New Helpers(pLogConfig, pMSSQLServer) Helpers = New Helpers(pLogConfig, pDatabaseIDB)
GlobalState = pGlobalState GlobalState = pGlobalState
End Sub End Sub
End Class End Class

View File

@ -5,8 +5,8 @@ Namespace Methods.GetAttributeValue
Public Class GetAttributeValueMethod Public Class GetAttributeValueMethod
Inherits BaseMethod Inherits BaseMethod
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, pDatabase, pGlobalState) MyBase.New(pLogConfig, pDatabaseIDB, pDatabaseECM, pGlobalState)
End Sub End Sub
Public Function Run(pData As GetAttributeValueRequest) As GetAttributeValueResponse Public Function Run(pData As GetAttributeValueRequest) As GetAttributeValueResponse

View File

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

View File

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

View File

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

View File

@ -14,9 +14,9 @@ Namespace Methods.GlobalIndexer
Private GetDatatable As GetDatatableFromCacheMethod 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) MyBase.New(pLogConfig)
GetDatatable = New GetDatatableFromCacheMethod(pLogConfig, pDatabase, pGlobalState) GetDatatable = New GetDatatableFromCacheMethod(pLogConfig, pDatabaseIDB, pDatabaseECM, pGlobalState)
End Sub End Sub
''' <summary> ''' <summary>

View File

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

View File

@ -10,10 +10,10 @@ Namespace Methods.SetAttributeValue
Private Connection As SqlConnection Private Connection As SqlConnection
Private Transaction As SqlTransaction Private Transaction As SqlTransaction
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, pDatabase, pGlobalState) MyBase.New(pLogConfig, pDatabaseIDB, pDatabaseECM, pGlobalState)
Connection = Database.GetConnection() Connection = DatabaseIDB.GetConnection()
Transaction = Connection.BeginTransaction() Transaction = Connection.BeginTransaction()
End Sub End Sub