EDMI: changes in newfile and updatefile method

This commit is contained in:
Jonathan Jenne
2022-02-08 16:29:43 +01:00
parent 5e44adccd7
commit 607f7e6445
8 changed files with 46 additions and 29 deletions

View File

@@ -29,6 +29,8 @@ Namespace Methods.IDB.UpdateFile
'TODO: Create a view that collects all information about an idb object
Dim oResultObjectId As Long
Logger.Debug("Creating new Version: [{0}]", pData.CreateNewVersion)
If pData.CreateNewVersion = False Then
' ----------------------------------------------
' -- Replace the existing file-object
@@ -71,7 +73,12 @@ Namespace Methods.IDB.UpdateFile
Dim oObjectRow As DataRow = oObjectTable.Rows.Item(0)
Dim oKind As String = oObjectRow.Item("KIND_NAME")
Dim oBusinessEntity As String = oObjectRow.Item("BE_NAME")
Dim oStore As String = oObjectRow.ItemArray("STORE_NAME")
Dim oStore As String = oObjectRow.Item("STORE_NAME")
Logger.Debug("Getting information for ObjectId [{0}]", pData.ObjectId)
Logger.Debug("Kind: [{0}]", oKind)
Logger.Debug("BE: [{0}]", oBusinessEntity)
Logger.Debug("Store: [{0}]", oStore)
Dim oNewFileMethod As New NewFile.NewFileMethod(LogConfig, DatabaseIDB, DatabaseECM, GlobalState)
Dim oNewFileRequest As New NewFile.NewFileRequest With {
@@ -82,11 +89,17 @@ Namespace Methods.IDB.UpdateFile
.User = pData.User
}
Dim oNewFileResponse = oNewFileMethod.Run(oNewFileRequest)
Dim oNewObjectId = oNewFileResponse.ObjectId
If oNewFileResponse.OK = False Then
LogAndThrow(oNewFileResponse.ErrorMessage)
End If
Dim oNewObjectId As Long = oNewFileResponse.ObjectId
Logger.Debug("New file Version has ObjectId [{0}]", oNewObjectId)
Dim oSql As String = $"EXEC PRIDB_NEW_VERSION_OBJECT '{pData.ObjectId}', '{oNewObjectId}', '{pData.User.UserName}'"
DatabaseIDB.ExecuteNonQuery(oSql)
Logger.Debug("Versioning complete from [{0}] to [{1}]", pData.ObjectId, oNewObjectId)
oResultObjectId = oNewObjectId
@@ -97,7 +110,7 @@ Namespace Methods.IDB.UpdateFile
Return New UpdateFileResponse(oResultObjectId)
Catch ex As Exception
Logger.Warn("Error occurred while creating file!")
Logger.Warn("Error occurred while updating file!")
Logger.Error(ex)
Logger.Info("Rolling back transaction.")