EDMIService: Improve logging, avoid confusion with import file methods
This commit is contained in:
parent
4e07e23c88
commit
70807ee06f
@ -110,13 +110,13 @@ Public Class EDMIService
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function ImportFile(pData As ImportFile.ImportFileRequest) As ImportFile.ImportFileResponse Implements IEDMIService.ImportFile
|
Public Function ImportFile(pData As ImportFile.ImportFileRequest) As ImportFile.ImportFileResponse Implements IEDMIService.ImportFile
|
||||||
_Logger.Debug("Start of Method [ImportFile]")
|
_Logger.Debug("Start of Method [IDB.ImportFile]")
|
||||||
Dim oImportFile As New ImportFile.ImportFileMethod(LogConfig, MSSQL_IDB, MSSQL_ECM, GlobalState)
|
Dim oImportFile As New ImportFile.ImportFileMethod(LogConfig, MSSQL_IDB, MSSQL_ECM, GlobalState)
|
||||||
Return oImportFile.Run(pData)
|
Return oImportFile.Run(pData)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function Globix_ImportFile(pData As GlobalIndexer.ImportFile.Globix_ImportFileRequest) As GlobalIndexer.ImportFile.Globix_ImportFileResponse Implements IEDMIService.Globix_ImportFile
|
Public Function Globix_ImportFile(pData As GlobalIndexer.ImportFile.Globix_ImportFileRequest) As GlobalIndexer.ImportFile.Globix_ImportFileResponse Implements IEDMIService.Globix_ImportFile
|
||||||
_Logger.Debug("Start of Method [Globix_ImportFile]")
|
_Logger.Debug("Start of Method [Globix.ImportFile]")
|
||||||
Dim oImportFile As New GlobalIndexer.ImportFile.ImportFileMethod(LogConfig, MSSQL_IDB, MSSQL_ECM, GlobalState)
|
Dim oImportFile As New GlobalIndexer.ImportFile.ImportFileMethod(LogConfig, MSSQL_IDB, MSSQL_ECM, GlobalState)
|
||||||
Return oImportFile.Run(pData)
|
Return oImportFile.Run(pData)
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
@ -76,19 +76,22 @@ Namespace IDB
|
|||||||
|
|
||||||
Public Function TestFileChecksumExists(pChecksum As String) As Long
|
Public Function TestFileChecksumExists(pChecksum As String) As Long
|
||||||
Try
|
Try
|
||||||
|
Logger.Debug("Checking for Checksum [{0}]..", pChecksum)
|
||||||
|
|
||||||
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 = Database.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 with ObjectId [{0}] because Checksum [{1}] already exists.", oExistingObjectId, pChecksum)
|
||||||
Return oExistingObjectId
|
Return oExistingObjectId
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return Nothing
|
Logger.Debug("Checksum does not exist.")
|
||||||
|
Return 0
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Logger.Error(ex)
|
Logger.Error(ex)
|
||||||
Return Nothing
|
Return 0
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
@ -41,6 +41,31 @@ Namespace Methods.GlobalIndexer.ImportFile
|
|||||||
Try
|
Try
|
||||||
User = pData.User
|
User = pData.User
|
||||||
|
|
||||||
|
|
||||||
|
If pData.File Is Nothing Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.File))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If pData.KindType Is Nothing Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.KindType))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If pData.StoreName Is Nothing Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.StoreName))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If pData.User Is Nothing Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.User))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If IsNothing(pData.ProfileId) Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.ProfileId))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If IsNothing(pData.IDBDoctypeId) Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.IDBDoctypeId))
|
||||||
|
End If
|
||||||
|
|
||||||
' TODO: Add missing user properties in UserState from TBDD_USER
|
' TODO: Add missing user properties in UserState from TBDD_USER
|
||||||
'pData.User = ResolveUserFromUserName(pData.User.UserName)
|
'pData.User = ResolveUserFromUserName(pData.User.UserName)
|
||||||
|
|
||||||
@ -48,6 +73,7 @@ Namespace Methods.GlobalIndexer.ImportFile
|
|||||||
Dim oAutomaticIndexes = Loader.LoadAutomaticIndexes(pData.ProfileId)
|
Dim oAutomaticIndexes = Loader.LoadAutomaticIndexes(pData.ProfileId)
|
||||||
Dim oPostProcessingSteps = Loader.LoadPostProcessingSteps(oManualIndexes)
|
Dim oPostProcessingSteps = Loader.LoadPostProcessingSteps(oManualIndexes)
|
||||||
Dim oProfile = Loader.LoadProfile(pData.ProfileId)
|
Dim oProfile = Loader.LoadProfile(pData.ProfileId)
|
||||||
|
Logger.Debug("")
|
||||||
|
|
||||||
Dim oUserAttributes = pData.AttributeValues
|
Dim oUserAttributes = pData.AttributeValues
|
||||||
Dim oAutoAttributes As List(Of UserAttributeValue) = Nothing
|
Dim oAutoAttributes As List(Of UserAttributeValue) = Nothing
|
||||||
|
|||||||
@ -33,9 +33,35 @@ Namespace Methods.IDB.ImportFile
|
|||||||
'''
|
'''
|
||||||
''' </remarks>
|
''' </remarks>
|
||||||
Public Function Run(pData As ImportFileRequest)
|
Public Function Run(pData As ImportFileRequest)
|
||||||
|
Logger.Debug("Running [ImportFileMethod].")
|
||||||
|
|
||||||
Try
|
Try
|
||||||
User = pData.User
|
User = pData.User
|
||||||
|
|
||||||
|
If pData.File Is Nothing Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.File))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If pData.KindType Is Nothing Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.KindType))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If pData.StoreName Is Nothing Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.StoreName))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If pData.User Is Nothing Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.User))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If IsNothing(pData.ProfileId) Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.ProfileId))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If IsNothing(pData.IDBDoctypeId) Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.IDBDoctypeId))
|
||||||
|
End If
|
||||||
|
|
||||||
' TODO: Add missing user properties in UserState from TBDD_USER
|
' TODO: Add missing user properties in UserState from TBDD_USER
|
||||||
'pData.User = ResolveUserFromUserName(pData.User.UserName)
|
'pData.User = ResolveUserFromUserName(pData.User.UserName)
|
||||||
|
|
||||||
|
|||||||
@ -19,19 +19,42 @@ Namespace Methods.IDB.NewFile
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Function Run(pData As NewFileRequest) As NewFileResponse
|
Public Function Run(pData As NewFileRequest) As NewFileResponse
|
||||||
|
Logger.Debug("Running [NewFileMethod].")
|
||||||
Dim oFilePath As String = Nothing
|
Dim oFilePath As String = Nothing
|
||||||
|
|
||||||
|
Try
|
||||||
|
If pData.File Is Nothing Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.File))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If pData.KindType Is Nothing Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.KindType))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If pData.StoreName Is Nothing Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.StoreName))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If pData.User Is Nothing Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.User))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If IsNothing(pData.IDBDoctypeId) Then
|
||||||
|
Throw New ArgumentNullException(NameOf(pData.IDBDoctypeId))
|
||||||
|
End If
|
||||||
|
|
||||||
|
Logger.Debug("Checking if checksum already exists..")
|
||||||
Dim oExistingObjectId = Helpers.TestFileChecksumExists(pData.File.FileChecksum)
|
Dim oExistingObjectId = Helpers.TestFileChecksumExists(pData.File.FileChecksum)
|
||||||
If oExistingObjectId > 0 Then
|
If oExistingObjectId > 0 Then
|
||||||
Return New NewFileResponse(oExistingObjectId)
|
Return New NewFileResponse(oExistingObjectId)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Try
|
Logger.Debug("Creating New ObjectId..")
|
||||||
|
|
||||||
Dim oObjectId = Helpers.NewObjectIdWithTransaction(pData.KindType, pData.User.UserName, Connection, Transaction)
|
Dim oObjectId = Helpers.NewObjectIdWithTransaction(pData.KindType, pData.User.UserName, Connection, Transaction)
|
||||||
If oObjectId = 0 Then
|
If oObjectId = 0 Then
|
||||||
LogAndThrow("Could not create new ObjectId!")
|
LogAndThrow("Could not create new ObjectId!")
|
||||||
End If
|
End If
|
||||||
|
Logger.Debug("New ObjectId [{0}] created!", oObjectId)
|
||||||
|
|
||||||
' Find ObjectStore by Title
|
' Find ObjectStore by Title
|
||||||
Logger.Debug("Checking for DataStore [{0}].", pData.StoreName)
|
Logger.Debug("Checking for DataStore [{0}].", pData.StoreName)
|
||||||
@ -42,6 +65,7 @@ Namespace Methods.IDB.NewFile
|
|||||||
If oStore Is Nothing Then
|
If oStore Is Nothing Then
|
||||||
LogAndThrow($"DataStore [{pData.StoreName}] does not exist. Exiting.")
|
LogAndThrow($"DataStore [{pData.StoreName}] does not exist. Exiting.")
|
||||||
End If
|
End If
|
||||||
|
Logger.Debug("Using DataStore [{0}].", pData.StoreName)
|
||||||
|
|
||||||
' Get Store base and final path
|
' Get Store base and final path
|
||||||
Logger.Debug("Store BasePath is [{0}]", oStore.Path)
|
Logger.Debug("Store BasePath is [{0}]", oStore.Path)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user