Filesystem EDMI

This commit is contained in:
Developer01
2025-12-23 13:02:14 +01:00
parent 1d17afb400
commit 0ef5a3b339
3 changed files with 91 additions and 131 deletions

View File

@@ -9,9 +9,11 @@ Imports DigitalData.Modules.EDMI.API
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.ZooFlow.State
Imports DigitalData.Services.EDMIService
Imports DigitalData.Services.EDMIService.GlobalState
Public Class frmFilesystem
Private Client As Client
Private EDMIClient As Client
Private Logger As Logger
Private Const STATUS_CONNECTED = "Connection Established"
@@ -59,17 +61,73 @@ Public Class frmFilesystem
Dim oDateString = MYDD_Filesystem.CreateDateDirectory("E:\")
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Private Sub Button3_Click(sender As Object, e As EventArgs)
If SaveFileDialog1.ShowDialog = DialogResult.OK Then
' Fallback: einfache Textdatei schreiben
System.IO.File.WriteAllText(SaveFileDialog1.FileName, "Some text data")
End If
End Sub
Private Async Function Button2_ClickAsync(sender As Object, e As EventArgs) As Task Handles Button2.Click
Public Class SecureStorageHandler
End Class
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Try
Dim oIPAddress = txtServiceAddress.Text
Dim oPort = Integer.Parse(txtServicePort.Text)
EDMIClient = New Client(LogConfig, oIPAddress, oPort)
txtStatus.Text = STATUS_CONNECTING
Dim oResult = EDMIClient.Connect()
If oResult = True Then
ServiceAddress = $"{oIPAddress}:{oPort}"
ServiceOnline = True
txtStatus.Text = STATUS_CONNECTED
txtStatus.BackColor = Color.LightGreen
My.Application.Service.Client = EDMIClient
Logger.Debug("Loading client config..")
Dim oClientConfig = My.Application.Service.Client.ClientConfig
Logger.Debug("Establishing ECM connection..")
Dim oECMConnectionString = oClientConfig.ConnectionStringECM
My.DatabaseECM = New MSSQLServer(LogConfig, oECMConnectionString)
Logger.Debug("Establishing IDB connection..")
Dim oIDBConnectionString = oClientConfig.ConnectionStringIDB
My.DatabaseIDB = New MSSQLServer(LogConfig, oIDBConnectionString)
Logger.Debug("Establishing Database connection with fallback..")
My.Database = New DatabaseWithFallback(LogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB)
Else
ServiceAddress = ""
ServiceOnline = True
txtStatus.Text = STATUS_FAILED
txtStatus.BackColor = Color.LightCoral
' TODO: Make a connection test that is as elaborate as this one :D
'Select Case oResult
' Case ClassService.ConnectionTestResult.NotFound
' lblStatus.Text = "Dienst konnte nicht gefunden werden. Bitte überprüfen sie Addresse und Port."
' Case ClassService.ConnectionTestResult.EmptyURI
' lblStatus.Text = "Bitte tragen Sie eine gültige Dienst Adresse ein."
' Case ClassService.ConnectionTestResult.Authentication
' lblStatus.Text = "Authentifizierungsfehler. Prüfen Sie, ob sich Ihr Gerät in der korrekten Domäne befindet."
' Case Else
' lblStatus.Text = "Unbekannter Fehler."
'End Select
End If
Catch ex As Exception
If Logger IsNot Nothing Then Logger.Error(ex)
MsgBox("Fehler beim Verbindungsaufbau", MsgBoxStyle.Critical, Text)
End Try
End Sub
Private Sub Button2_ClickAsync(sender As Object, e As EventArgs) Handles btnStreamSimpleFile.Click
' Import a file via EDMI Globix ImportFile API to test Service.EDMIService ImportFileMethod
Try
If Client Is Nothing OrElse ServiceOnline = False Then
If EDMIClient Is Nothing OrElse ServiceOnline = False Then
MsgBox("Bitte zuerst Verbindung zum EDMI Service herstellen.", MsgBoxStyle.Exclamation, Text)
Return
End If
@@ -92,7 +150,7 @@ Public Class frmFilesystem
.LanguageId = 1031
}
Dim oObjectStore As String = "SelectedDocType.ObjectStore"
Dim oObjectStore As String = "WORK"
Dim oIDBDoctypeId As Long = 1
Dim oObjectKind As String = "DOC"
Dim oProfileId As Integer = 1
@@ -105,89 +163,11 @@ Public Class frmFilesystem
Logger.Debug("ProfileId: [{0}]", oProfileId)
Logger.Debug("IDB DoctypeId: [{0}]", oIDBDoctypeId)
Logger.Info("Running Import")
Dim oResult = Await My.Application.Service.Client.Globix_ImportFileAsync(
oFilePath, oProfileId, oAttributes, oObjectStore, oObjectKind, oIDBDoctypeId, oOptions)
Logger.Info("Import result: [{0}]", oResult.OK)
Logger.Info("Imported file got ObjectId [{0}]", oResult.ObjectId)
If oResult.OK Then
MsgBox("Alles OK")
Else
Logger.Warn("Import failed with message: [{0}] and details [{1}]", oResult.ErrorMessage, oResult.ErrorDetails)
Dim oMsg As String, oTitle As String
If My.Application.User.Language = "de-DE" Then
oMsg = $"Die Datei wurde nicht verarbeitet.{vbNewLine}{vbNewLine}Fehler: {oResult.ErrorMessage}"
oTitle = "Achtung"
Else
oMsg = $"Unexpected Error in FileFlow{vbNewLine}{vbNewLine}Fehler: {oResult.ErrorMessage}"
oTitle = "Attention"
End If
MsgBox("Fehler")
End If
End Using
Catch ex As Exception
If Logger IsNot Nothing Then Logger.Error(ex)
MsgBox("Fehler beim Datei-Import.", MsgBoxStyle.Critical, Text)
End Try
End Function
Public Class SecureStorageHandler
End Class
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Try
Dim oIPAddress = txtServiceAddress.Text
Dim oPort = Integer.Parse(txtServicePort.Text)
Client = New Client(LogConfig, oIPAddress, oPort)
txtStatus.Text = STATUS_CONNECTING
Dim oResult = Client.Connect()
If oResult = True Then
ServiceAddress = $"{oIPAddress}:{oPort}"
ServiceOnline = True
txtStatus.Text = STATUS_CONNECTED
My.Application.Service.Client = Client
Logger.Debug("Loading client config..")
Dim oClientConfig = My.Application.Service.Client.ClientConfig
Logger.Debug("Establishing ECM connection..")
Dim oECMConnectionString = oClientConfig.ConnectionStringECM
My.DatabaseECM = New MSSQLServer(My.LogConfig, oECMConnectionString)
Logger.Debug("Establishing IDB connection..")
Dim oIDBConnectionString = oClientConfig.ConnectionStringIDB
My.DatabaseIDB = New MSSQLServer(My.LogConfig, oIDBConnectionString)
Logger.Debug("Establishing Database connection with fallback..")
My.Database = New DatabaseWithFallback(LogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB)
Else
ServiceAddress = ""
ServiceOnline = True
txtStatus.Text = STATUS_FAILED
' TODO: Make a connection test that is as elaborate as this one :D
'Select Case oResult
' Case ClassService.ConnectionTestResult.NotFound
' lblStatus.Text = "Dienst konnte nicht gefunden werden. Bitte überprüfen sie Addresse und Port."
' Case ClassService.ConnectionTestResult.EmptyURI
' lblStatus.Text = "Bitte tragen Sie eine gültige Dienst Adresse ein."
' Case ClassService.ConnectionTestResult.Authentication
' lblStatus.Text = "Authentifizierungsfehler. Prüfen Sie, ob sich Ihr Gerät in der korrekten Domäne befindet."
' Case Else
' lblStatus.Text = "Unbekannter Fehler."
'End Select
End If
Catch ex As Exception
If Logger IsNot Nothing Then Logger.Error(ex)
MsgBox("Fehler beim Verbindungsaufbau", MsgBoxStyle.Critical, Text)
End Try
End Sub
End Class