EDMIService: First working version of ImportFile

This commit is contained in:
Jonathan Jenne
2021-12-08 13:09:25 +01:00
parent d75272a17f
commit 3e5918297c
9 changed files with 180 additions and 118 deletions

View File

@@ -127,13 +127,13 @@ Public Class NewFileMethod
'TODO: File dates in try catch
Dim oDefaultAttributes As New Dictionary(Of String, Object) From {
Dim oSystemAttributes As New Dictionary(Of String, Object) From {
{"OriginFileName", pData.File.FileName},
{"OriginCreationDatetime", pData.File.FileCreatedAt},
{"OriginChangedDatetime", pData.File.FileChangedAt}
}
For Each oAttribute As KeyValuePair(Of String, Object) In oDefaultAttributes
For Each oAttribute As KeyValuePair(Of String, Object) In oSystemAttributes
Try
' Dont write empty attributes
If oAttribute.Value Is Nothing Then
@@ -142,9 +142,9 @@ Public Class NewFileMethod
Dim oSuccess = Helpers.SetAttributeValue(Connection, Transaction, oObjectId, oAttribute.Key, oAttribute.Value, pData.User.Language, pData.User.UserName)
If oSuccess Then
Logger.Debug("Default Attribute [{0}] written with value [{1}]", oAttribute.Key, oAttribute.Value)
Logger.Debug("System Attribute [{0}] written with value [{1}]", oAttribute.Key, oAttribute.Value)
Else
Logger.Warn("Default attribute value could not be written")
Logger.Warn("System attribute value could not be written")
End If
Catch ex As Exception
LogAndThrow(ex, $"System attribute [{oAttribute.Key}] could not be written!")
@@ -158,7 +158,7 @@ Public Class NewFileMethod
Return New NewFile.NewFileResponse(oObjectId)
Catch ex As Exception
Logger.Warn("Error occurred while importing file!")
Logger.Warn("Error occurred while creating file!")
Logger.Error(ex)
Logger.Info("Cleaning up files.")