2 Commits

Author SHA1 Message Date
Jonathan Jenne
1dd8639835 Zooflow: Remove ClassDataASorDB 2021-12-14 12:20:04 +01:00
Jonathan Jenne
6a182d60c8 Zooflow: Actually show errors in service calls 2021-12-14 12:19:40 +01:00
11 changed files with 53 additions and 44 deletions

View File

@@ -10,20 +10,18 @@ Public Class ClassIDBData
''' <param name="BusinessEntity">Title of Business Entity</param>
''' <returns>Array with all Indices</returns>
Private _Logger As Logger
Private _DataASorDB As ClassDataASorDB
Private _Database As DatabaseWithFallback
Public Sub New(LogConfig As LogConfig)
_Logger = LogConfig.GetLogger
_Database = New DatabaseWithFallback(LogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB)
_DataASorDB = New ClassDataASorDB(LogConfig)
Dim oSQL = $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE LANG_ID = {My.Application.User.LanguageId}"
DTVWIDB_BE_ATTRIBUTE = _Database.GetDatatable("VWIDB_BE_ATTRIBUTE", oSQL, DatabaseType.IDB, $"LANG_ID = {My.Application.User.LanguageId}")
'DTVWIDB_BE_ATTRIBUTE = _DataASorDB.GetDatatable("IDB", oSQL, "VWIDB_BE_ATTRIBUTE", $"LANG_ID = {My.Application.User.LanguageID}")
End Sub
Public IDBSystemIndices As List(Of String)
Public Function GetIndicesByBE(ByVal pBusinessEntity As String) As List(Of String)
Try
IDBSystemIndices = New List(Of String) From {

View File

@@ -18,7 +18,6 @@ Public Class ClassInit
Inherits Base.BaseClass
Private ReadOnly _MainForm As frmFlowForm
Private ReadOnly _DataASorDB As ClassDataASorDB
Private ReadOnly _Database As DatabaseWithFallback
Private _Loader As ClassInitLoader
@@ -27,9 +26,6 @@ Public Class ClassInit
Public Sub New(LogConfig As LogConfig, ParentForm As frmFlowForm)
MyBase.New(LogConfig)
_MainForm = ParentForm
'TODO: Remove when Globix uses DatabaseWithFallback
clsDataASorDB = New ClassDataASorDB(LogConfig)
End Sub
Public Sub InitializeApplication()

View File

@@ -129,7 +129,7 @@ Public Class ClassValidator
End Try
End Function
Function GetControlValues(pPanel As Panel)
Function GetControlValues(pPanel As Panel) As List(Of UserAttributeValue)
Dim oAttributeValues As New List(Of UserAttributeValue)
For Each oControl As Control In pPanel.Controls

View File

@@ -99,16 +99,16 @@ Public Class frmGlobixBasicConfig
Private Sub frmGlobixBasicConfig_Load(sender As Object, e As EventArgs) Handles Me.Load
Logger = My.LogConfig.GetLogger()
clsFW = New ClassFolderwatcher()
clsFW = New ClassFolderwatcher(My.LogConfig)
Try
oReload = True
Dim oFolderwatch = My.DatabaseECM.GetScalarValue("SELECT FOLDER_PATH FROM TBGI_FOLDERWATCH_USER WHERE FOLDER_TYPE = 'DEFAULT' AND USER_ID = " & My.Application.User.UserId)
If Not oFolderwatch Is Nothing Then
If oFolderwatch IsNot Nothing Then
My.Application.Globix.CurrentFolderWatchPath = oFolderwatch
End If
Me.txtFolderWatch.Text = My.Application.Globix.CurrentFolderWatchPath
Dim oSCANFolderwatch = My.DatabaseECM.GetScalarValue("SELECT FOLDER_PATH FROM TBGI_FOLDERWATCH_USER WHERE FOLDER_TYPE = 'SCAN' AND USER_ID = " & My.Application.User.UserId)
If Not oSCANFolderwatch Is Nothing Then
If oSCANFolderwatch IsNot Nothing Then
My.Application.Globix.CURRENT_SCAN_FOLDERWATCH = oSCANFolderwatch
End If
Me.txtFolderWatch.Text = My.Application.Globix.CurrentFolderWatchPath

View File

@@ -36,12 +36,9 @@ Public Class frmGlobix_Index
Public Property SelectedDocType As DocType
Private Property WindowLocation As ClassWindowLayout
Private Property _DataASorDB As ClassDataASorDB
Private Property Database As DatabaseWithFallback
Private Property Patterns2 As Patterns2
Public Class ControlMeta
Public Property IndexName As String
Public Property IndexType As String
@@ -57,8 +54,6 @@ Public Class frmGlobix_Index
Logger = pLogConfig.GetLogger()
LogConfig = pLogConfig
_DataASorDB = New ClassDataASorDB(pLogConfig)
Database = New DatabaseWithFallback(pLogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB)
WindowLocation = New ClassWindowLayout(pLogConfig)
Patterns2 = New Patterns2(pLogConfig)
@@ -353,7 +348,8 @@ Public Class frmGlobix_Index
ORDER BY T.SEQUENCE"
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)
For Each oRow As DataRow In oTable.Rows
@@ -753,28 +749,51 @@ Public Class frmGlobix_Index
ClearNotice()
Cursor = Cursors.WaitCursor
Logger.Info("Validating user values")
Dim oValidator As New ClassValidator(My.LogConfig, My.Application.Service.Client, ManualIndexes)
If oValidator.ValidateControls(pnlIndex, pDocType) = False Then
Return False
End If
Logger.Info("Collecting user values")
Dim oValues = oValidator.GetControlValues(pnlIndex)
Logger.Info("Preparing method parameters")
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 oBusinessEntity As String = "DEFAULT"
Dim oProfileId As Integer = SelectedDocType.Guid
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)
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
Catch ex As Exception
Logger.Error(ex)
MsgBox("Indexierung fehlgeschlagen!", MsgBoxStyle.Critical, Text)
@@ -793,6 +812,7 @@ Public Class frmGlobix_Index
Exit Sub
End If
Logger.Info("Importing file with DocumentType [{0}]", oDokart.Name)
Dim oResult = Await GlobixFlowNew(oDokart)
If oResult = True Then
DocumentViewer1.CloseDocument()

View File

@@ -35,7 +35,9 @@ Module ModuleHelpers
Dim connectionString As String = ""
Try
Dim oSQL = "SELECT * FROM TBDD_CONNECTION WHERE GUID = " & id
Dim DTConnection As DataTable = clsDataASorDB.GetDatatable("DD_ECM", oSQL, "TBDD_CONNECTION", "GUID = " & id, "")
Dim DTConnection As DataTable = My.Database.GetDatatable("TBDD_CONNECTION", oSQL, Modules.EDMI.API.Constants.DatabaseType.ECM, $"GUID = {id}")
If DTConnection.Rows.Count = 1 Then
Dim CSType = DTConnection.Rows(0).Item("SQL_PROVIDER").ToString.ToUpper
Select Case CSType

View File

@@ -22,7 +22,6 @@ Public Class frmFlowForm
' Common Helpers Classes
Private Init As ClassInit
Private AppServerOrDB As ClassDataASorDB
Private FileClass As Filesystem.File
' Globix Helper Classes
@@ -69,10 +68,6 @@ Public Class frmFlowForm
' === Show Splash Screen ===
SplashScreenManager.ShowForm(Me, GetType(frmSplash), False, False)
' === Initialize AppServer Database Connection with Failover
AppServerOrDB = New ClassDataASorDB(My.LogConfig)
' === Initialization ===
Init = New ClassInit(My.LogConfig, Me)
AddHandler Init.Completed, AddressOf Init_Completed
@@ -182,7 +177,7 @@ Public Class frmFlowForm
End If
oSQL = "SELECT * FROM TBIDB_ATTRIBUTE"
My.Tables.DTIDB_ATTRIBUTE = AppServerOrDB.GetDatatable("IDB", oSQL, "TBIDB_ATTRIBUTE", "", "")
My.Tables.DTIDB_ATTRIBUTE = My.Database.GetDatatable("TBIDB_ATTRIBUTE", "SELECT * FROM TBIDB_ATTRIBUTE", EDMI.API.Constants.DatabaseType.IDB)
Me.Cursor = Cursors.Default
End Sub
@@ -190,8 +185,7 @@ Public Class frmFlowForm
Public Sub Init_Folderwatch()
Try
Dim oSql As String = "SELECT FOLDER_PATH FROM TBGI_FOLDERWATCH_USER WHERE FOLDER_TYPE = 'DEFAULT' AND USER_ID = " & My.Application.User.UserId
Dim oDT As DataTable = AppServerOrDB.GetDatatable("DD_ECM", oSql, "TBGI_FOLDERWATCH_USER", $"FOLDER_TYPE = 'DEFAULT' AND USER_ID = {My.Application.User.UserId}")
Dim oDT = My.Database.GetDatatable("TBGI_FOLDERWATCH_USER", oSql, EDMI.API.Constants.DatabaseType.ECM, $"FOLDER_TYPE = 'DEFAULT' AND USER_ID = {My.Application.User.UserId}")
If oDT.Rows.Count = 0 Then
'Throw New ApplicationException("No Default Path configured for User!")

View File

@@ -4,6 +4,7 @@ Imports DigitalData.Modules.EDMI.API
Imports System.IO
Imports System.Text
Imports DigitalData.Modules.EDMI.API.Client
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Public Class frmtest
@@ -36,7 +37,7 @@ Public Class frmtest
Private Async Sub btnImportFile_Click_(sender As Object, e As EventArgs) Handles btnImportFile.Click
Dim oObjectId As Long = Await My.Application.Service.Client.ImportFileAsync(
Dim oResponse As ImportFileResponse = Await My.Application.Service.Client.ImportFileAsync(
txtFile2Import.Text,
txtProfileId.Text,
New List(Of EDMIServiceReference.UserAttributeValue) From {
@@ -50,11 +51,13 @@ Public Class frmtest
"DEFAULT"
)
If oObjectId <> INVALID_OBEJCT_ID Then
If oResponse.OK Then
MsgBox("File Imported!", MsgBoxStyle.Information, Text)
txtIDB_OBJ_ID.Text = oResponse.ObjectId
Else
MsgBox("File was not imported. Check the server logs!")
MsgBox("File was not imported. Check the server logs!", MsgBoxStyle.Critical, Text)
End If
txtIDB_OBJ_ID.Text = oObjectId
End Sub
End Class

View File

@@ -12,6 +12,5 @@ Module modCurrent
Public Property NI_TITLE As String = ""
Public Property NI_MESSAGE As String = ""
Public Property NI_TYPE As String = "INFO"
Public Property clsDataASorDB As ClassDataASorDB
Public Property GLOBIX_JUMP_DOCTYPE_ID As Integer
End Module

View File

@@ -187,7 +187,7 @@ Public Class Client
pObjectKind As String,
pBusinessEntity As String,
Optional pImportOptions As Options.ImportFileOptions = Nothing
) As Task(Of Long)
) As Task(Of ImportFileResponse)
Try
' Set default options
If pImportOptions Is Nothing Then
@@ -233,16 +233,13 @@ Public Class Client
.ProfileId = pProfileId,
.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
Catch ex As Exception
_logger.Error(ex)
Return INVALID_OBEJCT_ID
Return Nothing
End Try
End Function

View File

@@ -48,7 +48,7 @@ Public Class DatabaseWithFallback
End Try
If oTableResult Is Nothing OrElse oTableResult.OK = False Then
_Logger.Warn("Datatable [{0}] could not be fetched from AppServer Cache. Falling back to direct Database Access.")
_Logger.Warn("Datatable [{0}] could not be fetched from AppServer Cache. Falling back to direct Database Access.", pDataTableName)
Return GetDatatableFromDatabase(pFallbackSQL, pFallbackType)
End If