Zooflow: Actually show errors in service calls

This commit is contained in:
Jonathan Jenne 2021-12-14 12:19:40 +01:00
parent 44e273137d
commit 6a182d60c8
2 changed files with 34 additions and 17 deletions

View File

@ -36,12 +36,9 @@ Public Class frmGlobix_Index
Public Property SelectedDocType As DocType Public Property SelectedDocType As DocType
Private Property WindowLocation As ClassWindowLayout Private Property WindowLocation As ClassWindowLayout
Private Property _DataASorDB As ClassDataASorDB
Private Property Database As DatabaseWithFallback Private Property Database As DatabaseWithFallback
Private Property Patterns2 As Patterns2 Private Property Patterns2 As Patterns2
Public Class ControlMeta Public Class ControlMeta
Public Property IndexName As String Public Property IndexName As String
Public Property IndexType As String Public Property IndexType As String
@ -57,8 +54,6 @@ Public Class frmGlobix_Index
Logger = pLogConfig.GetLogger() Logger = pLogConfig.GetLogger()
LogConfig = pLogConfig LogConfig = pLogConfig
_DataASorDB = New ClassDataASorDB(pLogConfig)
Database = New DatabaseWithFallback(pLogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB) Database = New DatabaseWithFallback(pLogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB)
WindowLocation = New ClassWindowLayout(pLogConfig) WindowLocation = New ClassWindowLayout(pLogConfig)
Patterns2 = New Patterns2(pLogConfig) Patterns2 = New Patterns2(pLogConfig)
@ -353,7 +348,8 @@ Public Class frmGlobix_Index
ORDER BY T.SEQUENCE" ORDER BY T.SEQUENCE"
Dim oFilter = "DOK_ID = " & dokartid Dim oFilter = "DOK_ID = " & dokartid
Dim oTable = _DataASorDB.GetDatatable("DD_ECM", oSql, "DT_INDEXE_MAN", oFilter, "SEQUENCE") Dim oTable = My.Database.GetDatatable("DT_INDEXE_MAN", oSql, Modules.EDMI.API.Constants.DatabaseType.ECM, pSortByColumn:="SEQUENCE")
Dim oManualIndexes As New List(Of ManualIndex) Dim oManualIndexes As New List(Of ManualIndex)
For Each oRow As DataRow In oTable.Rows For Each oRow As DataRow In oTable.Rows
@ -753,28 +749,51 @@ Public Class frmGlobix_Index
ClearNotice() ClearNotice()
Cursor = Cursors.WaitCursor Cursor = Cursors.WaitCursor
Logger.Info("Validating user values")
Dim oValidator As New ClassValidator(My.LogConfig, My.Application.Service.Client, ManualIndexes) Dim oValidator As New ClassValidator(My.LogConfig, My.Application.Service.Client, ManualIndexes)
If oValidator.ValidateControls(pnlIndex, pDocType) = False Then If oValidator.ValidateControls(pnlIndex, pDocType) = False Then
Return False Return False
End If End If
Logger.Info("Collecting user values")
Dim oValues = oValidator.GetControlValues(pnlIndex) Dim oValues = oValidator.GetControlValues(pnlIndex)
Logger.Info("Preparing method parameters")
Dim oFilePath As String = My.Application.Globix.CurrentWorkfile.FilePath Dim oFilePath As String = My.Application.Globix.CurrentWorkfile.FilePath
Dim oObjectStore As String = SelectedDocType.Name Dim oObjectStore As String = SelectedDocType.ObjectStore
Dim oObjectKind As String = "DOC" Dim oObjectKind As String = "DOC"
Dim oBusinessEntity As String = "DEFAULT" Dim oBusinessEntity As String = "DEFAULT"
Dim oProfileId As Integer = SelectedDocType.Guid Dim oProfileId As Integer = SelectedDocType.Guid
Dim oAttributes As List(Of UserAttributeValue) = oValues Dim oAttributes As List(Of UserAttributeValue) = oValues
Dim oOptions As New Modules.EDMI.API.Options.ImportFileOptions Dim oOptions As New Options.ImportFileOptions
Await My.Application.Service.Client.ImportFileAsync( Logger.Debug("FilePath: [{0}]", oFilePath)
Logger.Debug("ObjectStore: [{0}]", oObjectStore)
Logger.Debug("ObjectKind: [{0}]", oObjectKind)
Logger.Debug("BusinessEntity: [{0}]", oBusinessEntity)
Logger.Debug("ProfileId: [{0}]", oProfileId)
Logger.Debug("BusinessEntity: [{0}]", oBusinessEntity)
Logger.Info("Running Import")
Dim oResult = Await My.Application.Service.Client.ImportFileAsync(
oFilePath, oProfileId, oAttributes, oObjectStore, oObjectKind, oBusinessEntity, oOptions) oFilePath, oProfileId, oAttributes, oObjectStore, oObjectKind, oBusinessEntity, oOptions)
MsgBox("Die Datei wurde erfolgreich verarbeitet!", MsgBoxStyle.Information, Text) Logger.Info("Import result: [{0}]", oResult.OK)
Logger.Info("Imported file got ObjectId [{0}]", oResult.ObjectId)
If oResult.OK Then
MsgBox("Die Datei wurde erfolgreich verarbeitet!", MsgBoxStyle.Information, Text)
Return True
Else
Logger.Warn("Import failed with message: [{0}] and details [{1}]", oResult.ErrorMessage, oResult.ErrorDetails)
MsgBox($"Die Datei wurde nicht verarbeitet. Fehler: [{oResult.ErrorMessage}]", MsgBoxStyle.Critical, Text)
Return False
End If
Return True
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)
MsgBox("Indexierung fehlgeschlagen!", MsgBoxStyle.Critical, Text) MsgBox("Indexierung fehlgeschlagen!", MsgBoxStyle.Critical, Text)
@ -793,6 +812,7 @@ Public Class frmGlobix_Index
Exit Sub Exit Sub
End If End If
Logger.Info("Importing file with DocumentType [{0}]", oDokart.Name)
Dim oResult = Await GlobixFlowNew(oDokart) Dim oResult = Await GlobixFlowNew(oDokart)
If oResult = True Then If oResult = True Then
DocumentViewer1.CloseDocument() DocumentViewer1.CloseDocument()

View File

@ -187,7 +187,7 @@ Public Class Client
pObjectKind As String, pObjectKind As String,
pBusinessEntity As String, pBusinessEntity As String,
Optional pImportOptions As Options.ImportFileOptions = Nothing Optional pImportOptions As Options.ImportFileOptions = Nothing
) As Task(Of Long) ) As Task(Of ImportFileResponse)
Try Try
' Set default options ' Set default options
If pImportOptions Is Nothing Then If pImportOptions Is Nothing Then
@ -233,16 +233,13 @@ Public Class Client
.ProfileId = pProfileId, .ProfileId = pProfileId,
.AttributeValues = pAttributeValues.ToArray .AttributeValues = pAttributeValues.ToArray
}) })
If oFileImportResponse.OK = False Then
Throw New ApplicationException("Could not Import File Contents!")
End If
Return oFileImportResponse.ObjectId Return oFileImportResponse
End Using End Using
End Using End Using
Catch ex As Exception Catch ex As Exception
_logger.Error(ex) _logger.Error(ex)
Return INVALID_OBEJCT_ID Return Nothing
End Try End Try
End Function End Function