EDMIService: Improve logging, avoid confusion with import file methods
This commit is contained in:
@@ -19,19 +19,42 @@ Namespace Methods.IDB.NewFile
|
||||
End Sub
|
||||
|
||||
Public Function Run(pData As NewFileRequest) As NewFileResponse
|
||||
Logger.Debug("Running [NewFileMethod].")
|
||||
Dim oFilePath As String = Nothing
|
||||
|
||||
Dim oExistingObjectId = Helpers.TestFileChecksumExists(pData.File.FileChecksum)
|
||||
If oExistingObjectId > 0 Then
|
||||
Return New NewFileResponse(oExistingObjectId)
|
||||
End If
|
||||
|
||||
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)
|
||||
If oExistingObjectId > 0 Then
|
||||
Return New NewFileResponse(oExistingObjectId)
|
||||
End If
|
||||
|
||||
Logger.Debug("Creating New ObjectId..")
|
||||
Dim oObjectId = Helpers.NewObjectIdWithTransaction(pData.KindType, pData.User.UserName, Connection, Transaction)
|
||||
If oObjectId = 0 Then
|
||||
LogAndThrow("Could not create new ObjectId!")
|
||||
End If
|
||||
Logger.Debug("New ObjectId [{0}] created!", oObjectId)
|
||||
|
||||
' Find ObjectStore by Title
|
||||
Logger.Debug("Checking for DataStore [{0}].", pData.StoreName)
|
||||
@@ -42,6 +65,7 @@ Namespace Methods.IDB.NewFile
|
||||
If oStore Is Nothing Then
|
||||
LogAndThrow($"DataStore [{pData.StoreName}] does not exist. Exiting.")
|
||||
End If
|
||||
Logger.Debug("Using DataStore [{0}].", pData.StoreName)
|
||||
|
||||
' Get Store base and final path
|
||||
Logger.Debug("Store BasePath is [{0}]", oStore.Path)
|
||||
|
||||
Reference in New Issue
Block a user