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

@@ -23,10 +23,8 @@ Partial Class frmFilesystem
<System.Diagnostics.DebuggerStepThrough()> _ <System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent() Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button() Me.Button1 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button() Me.btnStreamSimpleFile = New System.Windows.Forms.Button()
Me.GroupBox1 = New System.Windows.Forms.GroupBox() Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.Button3 = New System.Windows.Forms.Button()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.SaveFileDialog1 = New System.Windows.Forms.SaveFileDialog() Me.SaveFileDialog1 = New System.Windows.Forms.SaveFileDialog()
Me.txtServiceAddress = New DevExpress.XtraEditors.TextEdit() Me.txtServiceAddress = New DevExpress.XtraEditors.TextEdit()
Me.Label1 = New System.Windows.Forms.Label() Me.Label1 = New System.Windows.Forms.Label()
@@ -40,52 +38,35 @@ Partial Class frmFilesystem
' '
'Button1 'Button1
' '
Me.Button1.Location = New System.Drawing.Point(59, 343) Me.Button1.Location = New System.Drawing.Point(42, 234)
Me.Button1.Name = "Button1" Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(288, 23) Me.Button1.Size = New System.Drawing.Size(288, 23)
Me.Button1.TabIndex = 0 Me.Button1.TabIndex = 0
Me.Button1.Text = "CreateDateDirectory" Me.Button1.Text = "CreateDateDirectory"
Me.Button1.UseVisualStyleBackColor = True Me.Button1.UseVisualStyleBackColor = True
' '
'Button2 'btnStreamSimpleFile
' '
Me.Button2.Location = New System.Drawing.Point(6, 71) Me.btnStreamSimpleFile.Location = New System.Drawing.Point(6, 19)
Me.Button2.Name = "Button2" Me.btnStreamSimpleFile.Name = "btnStreamSimpleFile"
Me.Button2.Size = New System.Drawing.Size(288, 23) Me.btnStreamSimpleFile.Size = New System.Drawing.Size(288, 23)
Me.Button2.TabIndex = 1 Me.btnStreamSimpleFile.TabIndex = 1
Me.Button2.Text = "Stream simple file" Me.btnStreamSimpleFile.Text = "Stream simple file"
Me.Button2.UseVisualStyleBackColor = True Me.btnStreamSimpleFile.UseVisualStyleBackColor = True
' '
'GroupBox1 'GroupBox1
' '
Me.GroupBox1.Controls.Add(Me.Button3) Me.GroupBox1.Controls.Add(Me.btnStreamSimpleFile)
Me.GroupBox1.Controls.Add(Me.TextBox1)
Me.GroupBox1.Controls.Add(Me.Button2)
Me.GroupBox1.Location = New System.Drawing.Point(36, 153) Me.GroupBox1.Location = New System.Drawing.Point(36, 153)
Me.GroupBox1.Name = "GroupBox1" Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(709, 157) Me.GroupBox1.Size = New System.Drawing.Size(709, 58)
Me.GroupBox1.TabIndex = 2 Me.GroupBox1.TabIndex = 2
Me.GroupBox1.TabStop = False Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Stream simple file" Me.GroupBox1.Text = "Stream simple file"
' '
'Button3
'
Me.Button3.Location = New System.Drawing.Point(6, 19)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(181, 23)
Me.Button3.TabIndex = 3
Me.Button3.Text = "1. Choose file"
Me.Button3.UseVisualStyleBackColor = True
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(6, 45)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(669, 20)
Me.TextBox1.TabIndex = 2
'
'txtServiceAddress 'txtServiceAddress
' '
Me.txtServiceAddress.EditValue = "172.24.12.12"
Me.txtServiceAddress.Location = New System.Drawing.Point(36, 37) Me.txtServiceAddress.Location = New System.Drawing.Point(36, 37)
Me.txtServiceAddress.Name = "txtServiceAddress" Me.txtServiceAddress.Name = "txtServiceAddress"
Me.txtServiceAddress.Size = New System.Drawing.Size(485, 20) Me.txtServiceAddress.Size = New System.Drawing.Size(485, 20)
@@ -96,9 +77,9 @@ Partial Class frmFilesystem
Me.Label1.AutoSize = True Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(33, 21) Me.Label1.Location = New System.Drawing.Point(33, 21)
Me.Label1.Name = "Label1" Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(81, 13) Me.Label1.Size = New System.Drawing.Size(136, 13)
Me.Label1.TabIndex = 6 Me.Label1.TabIndex = 6
Me.Label1.Text = "ServiceAdresse" Me.Label1.Text = "EDMI Service Adresse: (IP)"
' '
'txtServicePort 'txtServicePort
' '
@@ -114,7 +95,7 @@ Partial Class frmFilesystem
' '
Me.Button4.Location = New System.Drawing.Point(36, 89) Me.Button4.Location = New System.Drawing.Point(36, 89)
Me.Button4.Name = "Button4" Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(75, 23) Me.Button4.Size = New System.Drawing.Size(85, 23)
Me.Button4.TabIndex = 8 Me.Button4.TabIndex = 8
Me.Button4.Text = "Connect" Me.Button4.Text = "Connect"
Me.Button4.UseVisualStyleBackColor = True Me.Button4.UseVisualStyleBackColor = True
@@ -123,7 +104,7 @@ Partial Class frmFilesystem
' '
Me.txtStatus.Location = New System.Drawing.Point(527, 37) Me.txtStatus.Location = New System.Drawing.Point(527, 37)
Me.txtStatus.Name = "txtStatus" Me.txtStatus.Name = "txtStatus"
Me.txtStatus.Size = New System.Drawing.Size(100, 20) Me.txtStatus.Size = New System.Drawing.Size(184, 20)
Me.txtStatus.TabIndex = 9 Me.txtStatus.TabIndex = 9
' '
'frmFilesystem 'frmFilesystem
@@ -141,7 +122,6 @@ Partial Class frmFilesystem
Me.Name = "frmFilesystem" Me.Name = "frmFilesystem"
Me.Text = "frmFilesystem" Me.Text = "frmFilesystem"
Me.GroupBox1.ResumeLayout(False) Me.GroupBox1.ResumeLayout(False)
Me.GroupBox1.PerformLayout()
CType(Me.txtServiceAddress.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.txtServiceAddress.Properties, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtServicePort.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.txtServicePort.Properties, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False) Me.ResumeLayout(False)
@@ -150,10 +130,8 @@ Partial Class frmFilesystem
End Sub End Sub
Friend WithEvents Button1 As Button Friend WithEvents Button1 As Button
Friend WithEvents Button2 As Button Friend WithEvents btnStreamSimpleFile As Button
Friend WithEvents GroupBox1 As GroupBox Friend WithEvents GroupBox1 As GroupBox
Friend WithEvents Button3 As Button
Friend WithEvents TextBox1 As TextBox
Friend WithEvents SaveFileDialog1 As SaveFileDialog Friend WithEvents SaveFileDialog1 As SaveFileDialog
Friend WithEvents txtServiceAddress As DevExpress.XtraEditors.TextEdit Friend WithEvents txtServiceAddress As DevExpress.XtraEditors.TextEdit
Friend WithEvents Label1 As Label Friend WithEvents Label1 As Label

View File

@@ -9,9 +9,11 @@ Imports DigitalData.Modules.EDMI.API
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.ZooFlow.State Imports DigitalData.Modules.ZooFlow.State
Imports DigitalData.Services.EDMIService
Imports DigitalData.Services.EDMIService.GlobalState
Public Class frmFilesystem Public Class frmFilesystem
Private Client As Client Private EDMIClient As Client
Private Logger As Logger Private Logger As Logger
Private Const STATUS_CONNECTED = "Connection Established" Private Const STATUS_CONNECTED = "Connection Established"
@@ -59,17 +61,73 @@ Public Class frmFilesystem
Dim oDateString = MYDD_Filesystem.CreateDateDirectory("E:\") Dim oDateString = MYDD_Filesystem.CreateDateDirectory("E:\")
End Sub 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 If SaveFileDialog1.ShowDialog = DialogResult.OK Then
' Fallback: einfache Textdatei schreiben ' Fallback: einfache Textdatei schreiben
System.IO.File.WriteAllText(SaveFileDialog1.FileName, "Some text data") System.IO.File.WriteAllText(SaveFileDialog1.FileName, "Some text data")
End If End If
End Sub 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 ' Import a file via EDMI Globix ImportFile API to test Service.EDMIService ImportFileMethod
Try 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) MsgBox("Bitte zuerst Verbindung zum EDMI Service herstellen.", MsgBoxStyle.Exclamation, Text)
Return Return
End If End If
@@ -92,7 +150,7 @@ Public Class frmFilesystem
.LanguageId = 1031 .LanguageId = 1031
} }
Dim oObjectStore As String = "SelectedDocType.ObjectStore" Dim oObjectStore As String = "WORK"
Dim oIDBDoctypeId As Long = 1 Dim oIDBDoctypeId As Long = 1
Dim oObjectKind As String = "DOC" Dim oObjectKind As String = "DOC"
Dim oProfileId As Integer = 1 Dim oProfileId As Integer = 1
@@ -105,89 +163,11 @@ Public Class frmFilesystem
Logger.Debug("ProfileId: [{0}]", oProfileId) Logger.Debug("ProfileId: [{0}]", oProfileId)
Logger.Debug("IDB DoctypeId: [{0}]", oIDBDoctypeId) 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 End Using
Catch ex As Exception Catch ex As Exception
If Logger IsNot Nothing Then Logger.Error(ex) If Logger IsNot Nothing Then Logger.Error(ex)
MsgBox("Fehler beim Datei-Import.", MsgBoxStyle.Critical, Text) MsgBox("Fehler beim Datei-Import.", MsgBoxStyle.Critical, Text)
End Try 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 Sub
End Class End Class

View File

@@ -86,14 +86,7 @@ Namespace Methods.GlobalIndexer.ImportFile
oAutoAttributes = oAutomaticIndexing.ApplyAutomaticeAttributes(oUserAttributes, pData.File.FileInfoRaw, User) oAutoAttributes = oAutomaticIndexing.ApplyAutomaticeAttributes(oUserAttributes, pData.File.FileInfoRaw, User)
' Import the file ' Import the file
Dim oNewFile As New NewFile.NewFileMethod(LogConfig, DatabaseIDB, DatabaseECM, GlobalState) Dim oResponse = ImportFile(pData)
Dim oResponse = oNewFile.Run(New NewFile.NewFileRequest With {
.File = pData.File,
.IDBDoctypeId = pData.IDBDoctypeId,
.KindType = pData.KindType,
.StoreName = pData.StoreName,
.User = User
})
If oResponse.OK Then If oResponse.OK Then
Logger.Info("Import of file [{0}] under ObjectId [{1}] successful!", pData.File.FileName, oResponse.ObjectId) Logger.Info("Import of file [{0}] under ObjectId [{1}] successful!", pData.File.FileName, oResponse.ObjectId)
@@ -147,7 +140,16 @@ Namespace Methods.GlobalIndexer.ImportFile
Return New Globix_ImportFileResponse(ex) Return New Globix_ImportFileResponse(ex)
End Try End Try
End Function End Function
Private Function ImportFile(pData As Globix_ImportFileRequest) As NewFile.NewFileResponse
Dim oNewFile As New NewFile.NewFileMethod(LogConfig, DatabaseIDB, DatabaseECM, GlobalState)
Return oNewFile.Run(New NewFile.NewFileRequest With {
.File = pData.File,
.IDBDoctypeId = pData.IDBDoctypeId,
.KindType = pData.KindType,
.StoreName = pData.StoreName,
.User = User
})
End Function
Private Function GetVirtualPath(pFileInfo As FileInfo, pPathConvention As String, pUser As UserState, pUserAttributes As List(Of UserAttributeValue), pAutoAttributes As List(Of UserAttributeValue)) Private Function GetVirtualPath(pFileInfo As FileInfo, pPathConvention As String, pUser As UserState, pUserAttributes As List(Of UserAttributeValue), pAutoAttributes As List(Of UserAttributeValue))
Logger.Info("Generating virtual path for file [{0}]", pFileInfo.Name) Logger.Info("Generating virtual path for file [{0}]", pFileInfo.Name)