EDMIService: WIP

This commit is contained in:
Jonathan Jenne 2021-12-07 16:37:23 +01:00
parent 6be8b1bdb5
commit 2a6fd3555b
20 changed files with 498 additions and 364 deletions

View File

@ -116,7 +116,7 @@
<userSettings> <userSettings>
<DigitalData.GUIs.ZooFlow.Settings> <DigitalData.GUIs.ZooFlow.Settings>
<setting name="IDBOBJID" serializeAs="String"> <setting name="IDBOBJID" serializeAs="String">
<value>17255</value> <value />
</setting> </setting>
</DigitalData.GUIs.ZooFlow.Settings> </DigitalData.GUIs.ZooFlow.Settings>
</userSettings> </userSettings>

View File

@ -0,0 +1,4 @@
Public Class ClassStrings
Public Const TEXT_MISSING_INPUT = "Bitte vervollständigen Sie die Eingaben!"
Public Const TITLE_MISSING_INPUT = "Fehlende Eingaben"
End Class

View File

@ -0,0 +1,137 @@
Imports DigitalData.Controls.LookupGrid
Imports DigitalData.GUIs.ZooFlow.Base
Imports DigitalData.GUIs.ZooFlow.frmGlobix_Index
Imports DigitalData.Modules.EDMI.API
Imports DigitalData.Modules.Logging
Public Class ClassValidator
Inherits BaseClass
Private ReadOnly Client As Client
Public Sub New(pLogConfig As LogConfig, pClient As Client)
MyBase.New(pLogConfig)
Client = pClient
End Sub
Private Function TestIsIndexOptional(pDocType As DocType, pIndexName As String) As Boolean
Dim oIsOptional As Boolean = My.Helpers.GetValueFromDatatable(
My.Application.Globix.CURR_DT_MAN_INDEXE,
$"DOK_ID = {pDocType.Guid} AND INDEXNAME = '{pIndexName}'", "OPTIONAL", "")
Return oIsOptional
End Function
Private Sub ShowValidationMessage()
MsgBox(ClassStrings.TEXT_MISSING_INPUT, MsgBoxStyle.Exclamation, ClassStrings.TITLE_MISSING_INPUT)
End Sub
Function ValidateControls(pControls As ControlCollection, pDocType As DocType) As Boolean
Try
Logger.Debug("Starting [ValidateControls]")
Dim result As Boolean = True
For Each oControl As Control In pControls
' ========================= TEXT BOX =========================
If oControl.Name.StartsWith("txt") Then
Dim oTextBox As DevExpress.XtraEditors.TextEdit = oControl
If oTextBox.Text = "" Then
Dim oIndexName = Replace(oTextBox.Name, "txt", "")
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
If oOptional = False Then
ShowValidationMessage()
oTextBox.Focus()
Return False
End If
End If
End If
' ========================= LOOKUP =========================
If oControl.Name.StartsWith("cmbMulti") Then
Dim oLookup = DirectCast(oControl, LookupControl3)
Dim oValues As List(Of String) = oLookup.Properties.SelectedValues
If oValues.Count = 0 Then
Dim oIndexName = Replace(oLookup.Name, "cmbMulti", "")
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
If oOptional = False Then
ShowValidationMessage()
oLookup.Focus()
Return False
End If
End If
End If
' ========================= COMBO BOX =========================
If oControl.Name.StartsWith("cmbSingle") Then
Dim cmbSingle As TextBox = oControl
If cmbSingle.Text = "" Then
Dim oIndexName = Replace(cmbSingle.Name, "cmbSingle", "")
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
If oOptional = False Then
ShowValidationMessage()
cmbSingle.Focus()
Return False
End If
End If
End If
If oControl.Name.StartsWith("cmb") Then
Dim cmb As ComboBox = oControl
If cmb.Text = "" Then
Dim oIndexName = Replace(cmb.Name, "cmb", "")
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
If oOptional = False Then
ShowValidationMessage()
cmb.Focus()
Return False
End If
End If
End If
' ========================= DATE PICKER =========================
If oControl.Name.StartsWith("dtp") Then
Dim dtp As DevExpress.XtraEditors.DateEdit = oControl
Dim oIndexName As String = Replace(dtp.Name, "dtp", "")
If dtp.Text = String.Empty Then
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
If oOptional = False Then
ShowValidationMessage()
dtp.Focus()
Return False
End If
End If
End If
' ========================= CHECK BOX =========================
If oControl.Name.StartsWith("chk") Then
Dim chk As CheckBox = oControl
'result = True
End If
'If TypeOf (oControl) Is Button Then
' Continue For
'End If
'If oControl.Name.StartsWith("lbl") = False And result = False Then
' Logger.Info("Die Überprüfung der manuellen Indices ist fehlerhaft. Bitte informieren Sie den Systembetreuer")
' Return False
'End If
Next
Return True
Catch ex As Exception
Logger.Warn("Unvorhergesehener Fehler in ValidateControls")
Logger.Error(ex.Message)
Return False
End Try
End Function
End Class

View File

@ -52,9 +52,10 @@ Partial Class frmGlobix_Index
Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl() Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl()
Me.pnlIndex = New System.Windows.Forms.Panel() Me.pnlIndex = New System.Windows.Forms.Panel()
Me.Panel3 = New System.Windows.Forms.Panel() Me.Panel3 = New System.Windows.Forms.Panel()
Me.Button1 = New System.Windows.Forms.Button()
Me.btnAblageFlow = New System.Windows.Forms.Button() Me.btnAblageFlow = New System.Windows.Forms.Button()
Me.Panel1 = New System.Windows.Forms.Panel() Me.Panel1 = New System.Windows.Forms.Panel()
Me.ComboBoxEdit1 = New DevExpress.XtraEditors.ComboBoxEdit() Me.cmbDocType = New DevExpress.XtraEditors.ComboBoxEdit()
Me.DocumentViewer1 = New DigitalData.Controls.DocumentViewer.DocumentViewer() Me.DocumentViewer1 = New DigitalData.Controls.DocumentViewer.DocumentViewer()
Me.GlobixDataset = New DigitalData.GUIs.ZooFlow.GlobixDataset() Me.GlobixDataset = New DigitalData.GUIs.ZooFlow.GlobixDataset()
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit()
@ -62,7 +63,7 @@ Partial Class frmGlobix_Index
Me.SplitContainerControl1.SuspendLayout() Me.SplitContainerControl1.SuspendLayout()
Me.Panel3.SuspendLayout() Me.Panel3.SuspendLayout()
Me.Panel1.SuspendLayout() Me.Panel1.SuspendLayout()
CType(Me.ComboBoxEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.cmbDocType.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GlobixDataset, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GlobixDataset, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout() Me.SuspendLayout()
' '
@ -263,6 +264,7 @@ Partial Class frmGlobix_Index
' '
'Panel3 'Panel3
' '
Me.Panel3.Controls.Add(Me.Button1)
Me.Panel3.Controls.Add(Me.btnAblageFlow) Me.Panel3.Controls.Add(Me.btnAblageFlow)
Me.Panel3.Dock = System.Windows.Forms.DockStyle.Bottom Me.Panel3.Dock = System.Windows.Forms.DockStyle.Bottom
Me.Panel3.Location = New System.Drawing.Point(0, 433) Me.Panel3.Location = New System.Drawing.Point(0, 433)
@ -270,24 +272,35 @@ Partial Class frmGlobix_Index
Me.Panel3.Size = New System.Drawing.Size(522, 75) Me.Panel3.Size = New System.Drawing.Size(522, 75)
Me.Panel3.TabIndex = 2 Me.Panel3.TabIndex = 2
' '
'Button1
'
Me.Button1.Font = New System.Drawing.Font("Tahoma", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.Button1.Location = New System.Drawing.Point(317, 15)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(186, 44)
Me.Button1.TabIndex = 1
Me.Button1.Text = "Starte Ablage (Neu)"
Me.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.Button1.UseVisualStyleBackColor = True
'
'btnAblageFlow 'btnAblageFlow
' '
Me.btnAblageFlow.Dock = System.Windows.Forms.DockStyle.Fill Me.btnAblageFlow.Font = New System.Drawing.Font("Tahoma", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnAblageFlow.Font = New System.Drawing.Font("Tahoma", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnAblageFlow.Image = Global.DigitalData.GUIs.ZooFlow.My.Resources.Resources.ZooFlow_g_64___Kopie Me.btnAblageFlow.Image = Global.DigitalData.GUIs.ZooFlow.My.Resources.Resources.ZooFlow_g_64___Kopie
Me.btnAblageFlow.ImageAlign = System.Drawing.ContentAlignment.MiddleRight Me.btnAblageFlow.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnAblageFlow.Location = New System.Drawing.Point(0, 0) Me.btnAblageFlow.Location = New System.Drawing.Point(12, 6)
Me.btnAblageFlow.Name = "btnAblageFlow" Me.btnAblageFlow.Name = "btnAblageFlow"
Me.btnAblageFlow.Size = New System.Drawing.Size(522, 75) Me.btnAblageFlow.Size = New System.Drawing.Size(185, 63)
Me.btnAblageFlow.TabIndex = 1 Me.btnAblageFlow.TabIndex = 1
Me.btnAblageFlow.Text = "Starte Ablage" Me.btnAblageFlow.Text = "Starte Ablage (Alt)"
Me.btnAblageFlow.TextAlign = System.Drawing.ContentAlignment.MiddleLeft Me.btnAblageFlow.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnAblageFlow.UseVisualStyleBackColor = True Me.btnAblageFlow.UseVisualStyleBackColor = True
' '
'Panel1 'Panel1
' '
Me.Panel1.BackColor = System.Drawing.Color.Silver Me.Panel1.BackColor = System.Drawing.Color.Silver
Me.Panel1.Controls.Add(Me.ComboBoxEdit1) Me.Panel1.Controls.Add(Me.cmbDocType)
Me.Panel1.Dock = System.Windows.Forms.DockStyle.Top Me.Panel1.Dock = System.Windows.Forms.DockStyle.Top
Me.Panel1.Location = New System.Drawing.Point(0, 0) Me.Panel1.Location = New System.Drawing.Point(0, 0)
Me.Panel1.Name = "Panel1" Me.Panel1.Name = "Panel1"
@ -296,18 +309,18 @@ Partial Class frmGlobix_Index
' '
'ComboBoxEdit1 'ComboBoxEdit1
' '
Me.ComboBoxEdit1.Dock = System.Windows.Forms.DockStyle.Top Me.cmbDocType.Dock = System.Windows.Forms.DockStyle.Top
Me.ComboBoxEdit1.Location = New System.Drawing.Point(0, 0) Me.cmbDocType.Location = New System.Drawing.Point(0, 0)
Me.ComboBoxEdit1.MenuManager = Me.RibbonControl1 Me.cmbDocType.MenuManager = Me.RibbonControl1
Me.ComboBoxEdit1.Name = "ComboBoxEdit1" Me.cmbDocType.Name = "ComboBoxEdit1"
SerializableAppearanceObject1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(214, Byte), Integer), CType(CType(49, Byte), Integer)) SerializableAppearanceObject1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(214, Byte), Integer), CType(CType(49, Byte), Integer))
SerializableAppearanceObject1.Options.UseBackColor = True SerializableAppearanceObject1.Options.UseBackColor = True
Me.ComboBoxEdit1.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo, "", 20, True, True, False, EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, "", Nothing, Nothing, DevExpress.Utils.ToolTipAnchor.[Default])}) Me.cmbDocType.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo, "", 20, True, True, False, EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, "", Nothing, Nothing, DevExpress.Utils.ToolTipAnchor.[Default])})
Me.ComboBoxEdit1.Properties.ButtonsStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat Me.cmbDocType.Properties.ButtonsStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat
Me.ComboBoxEdit1.Properties.NullText = "Bitte wählen Sie ein Profil" Me.cmbDocType.Properties.NullText = "Bitte wählen Sie ein Profil"
Me.ComboBoxEdit1.Properties.Padding = New System.Windows.Forms.Padding(5) Me.cmbDocType.Properties.Padding = New System.Windows.Forms.Padding(5)
Me.ComboBoxEdit1.Size = New System.Drawing.Size(522, 30) Me.cmbDocType.Size = New System.Drawing.Size(522, 30)
Me.ComboBoxEdit1.TabIndex = 4 Me.cmbDocType.TabIndex = 4
' '
'DocumentViewer1 'DocumentViewer1
' '
@ -342,7 +355,7 @@ Partial Class frmGlobix_Index
Me.SplitContainerControl1.ResumeLayout(False) Me.SplitContainerControl1.ResumeLayout(False)
Me.Panel3.ResumeLayout(False) Me.Panel3.ResumeLayout(False)
Me.Panel1.ResumeLayout(False) Me.Panel1.ResumeLayout(False)
CType(Me.ComboBoxEdit1.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.cmbDocType.Properties, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GlobixDataset, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.GlobixDataset, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False) Me.ResumeLayout(False)
Me.PerformLayout() Me.PerformLayout()
@ -376,6 +389,7 @@ Partial Class frmGlobix_Index
Friend WithEvents pnlIndex As Panel Friend WithEvents pnlIndex As Panel
Friend WithEvents Panel3 As Panel Friend WithEvents Panel3 As Panel
Friend WithEvents GlobixDataset As GlobixDataset Friend WithEvents GlobixDataset As GlobixDataset
Friend WithEvents ComboBoxEdit1 As DevExpress.XtraEditors.ComboBoxEdit Friend WithEvents cmbDocType As DevExpress.XtraEditors.ComboBoxEdit
Friend WithEvents btnAblageFlow As Button Friend WithEvents btnAblageFlow As Button
Friend WithEvents Button1 As Button
End Class End Class

View File

@ -11,6 +11,7 @@ Imports DigitalData.Modules.Language.Utils
Imports DigitalData.Controls.LookupGrid Imports DigitalData.Controls.LookupGrid
Imports Independentsoft Imports Independentsoft
Imports DevExpress.XtraEditors.Controls Imports DevExpress.XtraEditors.Controls
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Public Class frmGlobix_Index Public Class frmGlobix_Index
#Region "+++++ Variablen ++++++" #Region "+++++ Variablen ++++++"
@ -51,11 +52,13 @@ Public Class frmGlobix_Index
Return Name Return Name
End Function End Function
End Class End Class
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
Public Property MultipleValues As Boolean = False Public Property MultipleValues As Boolean = False
End Class End Class
#End Region #End Region
Public Sub New(LogConfig As LogConfig) Public Sub New(LogConfig As LogConfig)
@ -260,12 +263,12 @@ Public Class frmGlobix_Index
checkItemPreselection.Checked = True checkItemPreselection.Checked = True
If My.Application.Globix.CURRENT_LASTDOCTYPE <> "" Then If My.Application.Globix.CURRENT_LASTDOCTYPE <> "" Then
Dim oFoundDocType = ComboBoxEdit1.Properties.Items. Dim oFoundDocType = cmbDocType.Properties.Items.
Cast(Of DocType)(). Cast(Of DocType)().
Where(Function(dt) dt.Name = My.Application.Globix.CURRENT_LASTDOCTYPE). Where(Function(dt) dt.Name = My.Application.Globix.CURRENT_LASTDOCTYPE).
FirstOrDefault() FirstOrDefault()
If oFoundDocType IsNot Nothing Then If oFoundDocType IsNot Nothing Then
ComboBoxEdit1.SelectedItem = oFoundDocType cmbDocType.SelectedItem = oFoundDocType
End If End If
@ -278,13 +281,13 @@ Public Class frmGlobix_Index
_Logger.Debug("There is a match on REGEX_DOCTYPE: [{0}]", oRoW.Item("DOCTYPE")) _Logger.Debug("There is a match on REGEX_DOCTYPE: [{0}]", oRoW.Item("DOCTYPE"))
_Logger.Debug("Regex: [{0}], FileName: [{1}]", oRoW.Item("Regex"), oOnlyFilename) _Logger.Debug("Regex: [{0}], FileName: [{1}]", oRoW.Item("Regex"), oOnlyFilename)
Dim oFoundDocType = ComboBoxEdit1.Properties.Items. Dim oFoundDocType = cmbDocType.Properties.Items.
Cast(Of DocType)(). Cast(Of DocType)().
Where(Function(dt) dt.Name = My.Application.Globix.CURRENT_LASTDOCTYPE). Where(Function(dt) dt.Name = My.Application.Globix.CURRENT_LASTDOCTYPE).
FirstOrDefault() FirstOrDefault()
If oFoundDocType IsNot Nothing Then If oFoundDocType IsNot Nothing Then
ComboBoxEdit1.SelectedItem = oFoundDocType cmbDocType.SelectedItem = oFoundDocType
End If End If
Exit For Exit For
End If End If
@ -307,7 +310,7 @@ Public Class frmGlobix_Index
DT_VWGI_DOCTYPE = _DataASorDB.GetDatatable("DD_ECM", oSql, "VWGI_DOCTYPE", oFilter, "SEQUENCE") DT_VWGI_DOCTYPE = _DataASorDB.GetDatatable("DD_ECM", oSql, "VWGI_DOCTYPE", oFilter, "SEQUENCE")
For Each oRow As DataRow In DT_VWGI_DOCTYPE.Rows For Each oRow As DataRow In DT_VWGI_DOCTYPE.Rows
ComboBoxEdit1.Properties.Items.Add(New DocType With { cmbDocType.Properties.Items.Add(New DocType With {
.Guid = oRow.Item("DOCTYPE_ID"), .Guid = oRow.Item("DOCTYPE_ID"),
.Name = oRow.Item("DOCTYPE") .Name = oRow.Item("DOCTYPE")
}) })
@ -319,9 +322,9 @@ Public Class frmGlobix_Index
End Sub End Sub
Private Sub ComboBoxEdit1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBoxEdit1.SelectedIndexChanged Private Sub ComboBoxEdit1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbDocType.SelectedIndexChanged
If ComboBoxEdit1.SelectedIndex <> -1 And FormLoaded = True Then If cmbDocType.SelectedIndex <> -1 And FormLoaded = True Then
Dim oSelectedItem As DocType = ComboBoxEdit1.SelectedItem Dim oSelectedItem As DocType = cmbDocType.SelectedItem
My.Application.Globix.CURRENT_DOCTYPE_ID = oSelectedItem.Guid My.Application.Globix.CURRENT_DOCTYPE_ID = oSelectedItem.Guid
@ -393,8 +396,8 @@ Public Class frmGlobix_Index
_Controls = oControls _Controls = oControls
If DT_INDEXEMAN.Rows.Count = 0 Then If DT_INDEXEMAN.Rows.Count = 0 Then
ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboBoxEdit1.Text & " definiert") ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDocType.Text & " definiert")
_Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboBoxEdit1.Text & " definiert") _Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDocType.Text & " definiert")
End If End If
For Each oRow As DataRow In DT_INDEXEMAN.Rows For Each oRow As DataRow In DT_INDEXEMAN.Rows
@ -778,13 +781,15 @@ Public Class frmGlobix_Index
Private Sub GlobixFlow() Private Sub GlobixFlow()
ClearError() ClearError()
ClearNotice() ClearNotice()
Me.Cursor = Cursors.WaitCursor Cursor = Cursors.WaitCursor
Refresh_RegexTable() Refresh_RegexTable()
For Each rowregex As DataRow In My.Application.Globix.DT_FUNCTION_REGEX.Rows For Each rowregex As DataRow In My.Application.Globix.DT_FUNCTION_REGEX.Rows
If rowregex.Item("FUNCTION_NAME") = "CLEAN_FILENAME" Then If rowregex.Item("FUNCTION_NAME") = "CLEAN_FILENAME" Then
My.Application.Globix.REGEX_CLEAN_FILENAME = rowregex.Item("REGEX") My.Application.Globix.REGEX_CLEAN_FILENAME = rowregex.Item("REGEX")
End If End If
Next Next
If chkMultiindexing.Visibility = DevExpress.XtraBars.BarItemVisibility.Always And chkMultiindexing.Checked = True Then If chkMultiindexing.Visibility = DevExpress.XtraBars.BarItemVisibility.Always And chkMultiindexing.Checked = True Then
'Die erste Datei indexieren 'Die erste Datei indexieren
If WORK_FILE() = True Then If WORK_FILE() = True Then
@ -854,7 +859,7 @@ Public Class frmGlobix_Index
_Logger.Debug("Manuelle Indexe geladen") _Logger.Debug("Manuelle Indexe geladen")
If My.Application.Globix.CURR_DT_MAN_INDEXE.Rows.Count > 0 Then If My.Application.Globix.CURR_DT_MAN_INDEXE.Rows.Count > 0 Then
Dim oDokart As DocType = ComboBoxEdit1.SelectedItem Dim oDokart As DocType = cmbDocType.SelectedItem
My.Application.Globix.CURRENT_DOCTYPE_ID = oDokart.Guid My.Application.Globix.CURRENT_DOCTYPE_ID = oDokart.Guid
If CheckWrite_IndexeMan(oDokart.Guid) = True Then If CheckWrite_IndexeMan(oDokart.Guid) = True Then
@ -2404,11 +2409,48 @@ Public Class frmGlobix_Index
End Function End Function
Private Sub PictureEdit1_EditValueChanged(sender As Object, e As EventArgs)
End Sub
Private Sub btnAblageFlow_Click(sender As Object, e As EventArgs) Handles btnAblageFlow.Click Private Sub btnAblageFlow_Click(sender As Object, e As EventArgs) Handles btnAblageFlow.Click
GlobixFlow() GlobixFlow()
End Sub End Sub
Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim oDokart As DocType = cmbDocType.SelectedItem
Await GlobixFlowNew(oDokart)
End Sub
Private Async Function GlobixFlowNew(pDocType As DocType) As Threading.Tasks.Task(Of Boolean)
Try
ClearError()
ClearNotice()
Cursor = Cursors.WaitCursor
Dim oValidator As New ClassValidator(My.LogConfig, My.Application.Service.Client)
If oValidator.ValidateControls(pnlIndex.Controls, pDocType) = False Then
Return False
End If
'TODO: Globix File Import
Dim oFileName As String
Dim oObjectStore As String
Dim oObjectKind As String
Dim oBusinessENtity As String
Dim oProfileId As Integer
Dim oAttributes As List(Of UserAttributeValue)
Dim oOptions As New Modules.EDMI.API.Options.ImportFileOptions
Await My.Application.Service.Client.ImportFileAsync(oFileName, oProfileId, oAttributes, oObjectStore, oObjectKind, oBusinessENtity, oOptions)
Return True
Catch ex As Exception
_Logger.Error(ex)
MsgBox("Indexierung fehlgeschlagen!", MsgBoxStyle.Critical, Text)
Finally
Cursor = Cursors.Default
End Try
End Function
End Class End Class

View File

@ -14,7 +14,7 @@ Option Explicit On
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0"), _ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class Settings Partial Friend NotInheritable Class Settings
Inherits Global.System.Configuration.ApplicationSettingsBase Inherits Global.System.Configuration.ApplicationSettingsBase
@ -97,7 +97,7 @@ Partial Friend NotInheritable Class Settings
<Global.System.Configuration.UserScopedSettingAttribute(), _ <Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("17255")> _ Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public Property IDBOBJID() As String Public Property IDBOBJID() As String
Get Get
Return CType(Me("IDBOBJID"),String) Return CType(Me("IDBOBJID"),String)

View File

@ -29,7 +29,7 @@
<Value Profile="(Default)">Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM;Persist Security Info=True;User ID=sa;Password=dd</Value> <Value Profile="(Default)">Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM;Persist Security Info=True;User ID=sa;Password=dd</Value>
</Setting> </Setting>
<Setting Name="IDBOBJID" Type="System.String" Scope="User"> <Setting Name="IDBOBJID" Type="System.String" Scope="User">
<Value Profile="(Default)">17255</Value> <Value Profile="(Default)" />
</Setting> </Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@ -200,6 +200,7 @@
<Compile Include="ApplicationEvents.vb" /> <Compile Include="ApplicationEvents.vb" />
<Compile Include="Base\BaseClass.vb" /> <Compile Include="Base\BaseClass.vb" />
<Compile Include="ClassDragDrop.vb" /> <Compile Include="ClassDragDrop.vb" />
<Compile Include="ClassStrings.vb" />
<Compile Include="ClipboardWatcher\ClassProfileLoader.vb" /> <Compile Include="ClipboardWatcher\ClassProfileLoader.vb" />
<Compile Include="ClipboardWatcher\Watcher.vb" /> <Compile Include="ClipboardWatcher\Watcher.vb" />
<Compile Include="ClassCommandlineArgs.vb" /> <Compile Include="ClassCommandlineArgs.vb" />
@ -235,6 +236,7 @@
</Compile> </Compile>
<Compile Include="Globix\ClassExclusions.vb" /> <Compile Include="Globix\ClassExclusions.vb" />
<Compile Include="ClassHelpers.vb" /> <Compile Include="ClassHelpers.vb" />
<Compile Include="Globix\ClassValidator.vb" />
<Compile Include="Globix\frmGlobixNameconvention.Designer.vb"> <Compile Include="Globix\frmGlobixNameconvention.Designer.vb">
<DependentUpon>frmGlobixNameconvention.vb</DependentUpon> <DependentUpon>frmGlobixNameconvention.vb</DependentUpon>
</Compile> </Compile>

View File

@ -23,28 +23,19 @@ Partial Class frmtest
<System.Diagnostics.DebuggerStepThrough()> _ <System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent() Private Sub InitializeComponent()
Me.Label2 = New System.Windows.Forms.Label() Me.Label2 = New System.Windows.Forms.Label()
Me.txtIDB_OBJ_ID = New System.Windows.Forms.TextBox()
Me.txtFile2Import = New System.Windows.Forms.TextBox() Me.txtFile2Import = New System.Windows.Forms.TextBox()
Me.Button4 = New System.Windows.Forms.Button() Me.btnOpenFile = New System.Windows.Forms.Button()
Me.Button5 = New System.Windows.Forms.Button()
Me.CheckBoxKeepExtension = New System.Windows.Forms.CheckBox()
Me.Button6 = New System.Windows.Forms.Button()
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog() Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
Me.Button7 = New System.Windows.Forms.Button() Me.btnNewFile = New System.Windows.Forms.Button()
Me.Button8 = New System.Windows.Forms.Button()
Me.Label4 = New System.Windows.Forms.Label() Me.Label4 = New System.Windows.Forms.Label()
Me.Label5 = New System.Windows.Forms.Label() Me.Label5 = New System.Windows.Forms.Label()
Me.cmbObjectStoreType = New System.Windows.Forms.ComboBox() Me.cmbObjectStoreType = New System.Windows.Forms.ComboBox()
Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker() Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker()
Me.Label6 = New System.Windows.Forms.Label() Me.Label6 = New System.Windows.Forms.Label()
Me.TextBox1 = New System.Windows.Forms.TextBox() Me.btnImportFile = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label() Me.Label1 = New System.Windows.Forms.Label()
Me.GroupBox1 = New System.Windows.Forms.GroupBox() Me.txtProfileId = New System.Windows.Forms.TextBox()
Me.ListBox1 = New System.Windows.Forms.ListBox() Me.txtIDB_OBJ_ID = New System.Windows.Forms.TextBox()
Me.txtAttributeName = New System.Windows.Forms.TextBox()
Me.Button2 = New System.Windows.Forms.Button()
Me.txtAttibuteValue = New System.Windows.Forms.TextBox()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout() Me.SuspendLayout()
' '
'Label2 'Label2
@ -56,15 +47,6 @@ Partial Class frmtest
Me.Label2.TabIndex = 6 Me.Label2.TabIndex = 6
Me.Label2.Text = "FileStoreType" Me.Label2.Text = "FileStoreType"
' '
'txtIDB_OBJ_ID
'
Me.txtIDB_OBJ_ID.DataBindings.Add(New System.Windows.Forms.Binding("Text", Global.DigitalData.GUIs.ZooFlow.Settings.Default, "IDBOBJID", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged))
Me.txtIDB_OBJ_ID.Location = New System.Drawing.Point(137, 38)
Me.txtIDB_OBJ_ID.Name = "txtIDB_OBJ_ID"
Me.txtIDB_OBJ_ID.Size = New System.Drawing.Size(100, 20)
Me.txtIDB_OBJ_ID.TabIndex = 9
Me.txtIDB_OBJ_ID.Text = Global.DigitalData.GUIs.ZooFlow.Settings.Default.IDBOBJID
'
'txtFile2Import 'txtFile2Import
' '
Me.txtFile2Import.Location = New System.Drawing.Point(137, 12) Me.txtFile2Import.Location = New System.Drawing.Point(137, 12)
@ -72,66 +54,27 @@ Partial Class frmtest
Me.txtFile2Import.Size = New System.Drawing.Size(426, 20) Me.txtFile2Import.Size = New System.Drawing.Size(426, 20)
Me.txtFile2Import.TabIndex = 11 Me.txtFile2Import.TabIndex = 11
' '
'Button4 'btnOpenFile
' '
Me.Button4.Location = New System.Drawing.Point(16, 345) Me.btnOpenFile.Location = New System.Drawing.Point(569, 9)
Me.Button4.Name = "Button4" Me.btnOpenFile.Name = "btnOpenFile"
Me.Button4.Size = New System.Drawing.Size(286, 23) Me.btnOpenFile.Size = New System.Drawing.Size(75, 23)
Me.Button4.TabIndex = 13 Me.btnOpenFile.TabIndex = 16
Me.Button4.Text = "4A. Reopen from AppServ" Me.btnOpenFile.Text = "Select File"
Me.Button4.UseVisualStyleBackColor = True Me.btnOpenFile.UseVisualStyleBackColor = True
'
'Button5
'
Me.Button5.Location = New System.Drawing.Point(16, 374)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(286, 23)
Me.Button5.TabIndex = 14
Me.Button5.Text = "4B. Alternative stream/append"
Me.Button5.UseVisualStyleBackColor = True
'
'CheckBoxKeepExtension
'
Me.CheckBoxKeepExtension.AutoSize = True
Me.CheckBoxKeepExtension.Checked = True
Me.CheckBoxKeepExtension.CheckState = System.Windows.Forms.CheckState.Checked
Me.CheckBoxKeepExtension.Location = New System.Drawing.Point(16, 19)
Me.CheckBoxKeepExtension.Name = "CheckBoxKeepExtension"
Me.CheckBoxKeepExtension.Size = New System.Drawing.Size(100, 17)
Me.CheckBoxKeepExtension.TabIndex = 15
Me.CheckBoxKeepExtension.Text = "Keep Extension"
Me.CheckBoxKeepExtension.UseVisualStyleBackColor = True
'
'Button6
'
Me.Button6.Location = New System.Drawing.Point(569, 9)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(75, 23)
Me.Button6.TabIndex = 16
Me.Button6.Text = "Select File"
Me.Button6.UseVisualStyleBackColor = True
' '
'OpenFileDialog1 'OpenFileDialog1
' '
Me.OpenFileDialog1.FileName = "OpenFileDialog1" Me.OpenFileDialog1.FileName = "OpenFileDialog1"
' '
'Button7 'btnNewFile
' '
Me.Button7.Location = New System.Drawing.Point(16, 403) Me.btnNewFile.Location = New System.Drawing.Point(12, 142)
Me.Button7.Name = "Button7" Me.btnNewFile.Name = "btnNewFile"
Me.Button7.Size = New System.Drawing.Size(286, 23) Me.btnNewFile.Size = New System.Drawing.Size(187, 23)
Me.Button7.TabIndex = 14 Me.btnNewFile.TabIndex = 17
Me.Button7.Text = "4C. Alternative" Me.btnNewFile.Text = "NewFile"
Me.Button7.UseVisualStyleBackColor = True Me.btnNewFile.UseVisualStyleBackColor = True
'
'Button8
'
Me.Button8.Location = New System.Drawing.Point(12, 142)
Me.Button8.Name = "Button8"
Me.Button8.Size = New System.Drawing.Size(187, 23)
Me.Button8.TabIndex = 17
Me.Button8.Text = "Import File"
Me.Button8.UseVisualStyleBackColor = True
' '
'Label4 'Label4
' '
@ -177,93 +120,61 @@ Partial Class frmtest
Me.Label6.TabIndex = 6 Me.Label6.TabIndex = 6
Me.Label6.Text = "Date" Me.Label6.Text = "Date"
' '
'TextBox1 'btnImportFile
' '
Me.TextBox1.Location = New System.Drawing.Point(137, 183) Me.btnImportFile.Location = New System.Drawing.Point(205, 142)
Me.TextBox1.Name = "TextBox1" Me.btnImportFile.Name = "btnImportFile"
Me.TextBox1.Size = New System.Drawing.Size(426, 20) Me.btnImportFile.Size = New System.Drawing.Size(187, 23)
Me.TextBox1.TabIndex = 21 Me.btnImportFile.TabIndex = 17
Me.btnImportFile.Text = "ImportFile (GLOBIX)"
Me.btnImportFile.UseVisualStyleBackColor = True
' '
'Label1 'Label1
' '
Me.Label1.AutoSize = True Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(9, 186) Me.Label1.Location = New System.Drawing.Point(410, 44)
Me.Label1.Name = "Label1" Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(98, 13) Me.Label1.Size = New System.Drawing.Size(45, 13)
Me.Label1.TabIndex = 18 Me.Label1.TabIndex = 18
Me.Label1.Text = "File Path (Imported)" Me.Label1.Text = "ProfileId"
' '
'GroupBox1 'txtProfileId
' '
Me.GroupBox1.Controls.Add(Me.CheckBoxKeepExtension) Me.txtProfileId.Location = New System.Drawing.Point(461, 41)
Me.GroupBox1.Location = New System.Drawing.Point(653, 12) Me.txtProfileId.Name = "txtProfileId"
Me.GroupBox1.Name = "GroupBox1" Me.txtProfileId.Size = New System.Drawing.Size(100, 20)
Me.GroupBox1.Size = New System.Drawing.Size(200, 100) Me.txtProfileId.TabIndex = 21
Me.GroupBox1.TabIndex = 22 Me.txtProfileId.Text = "1"
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Import Options"
' '
'ListBox1 'txtIDB_OBJ_ID
' '
Me.ListBox1.FormattingEnabled = True Me.txtIDB_OBJ_ID.DataBindings.Add(New System.Windows.Forms.Binding("Text", Global.DigitalData.GUIs.ZooFlow.Settings.Default, "IDBOBJID", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged))
Me.ListBox1.Location = New System.Drawing.Point(653, 118) Me.txtIDB_OBJ_ID.Location = New System.Drawing.Point(137, 38)
Me.ListBox1.Name = "ListBox1" Me.txtIDB_OBJ_ID.Name = "txtIDB_OBJ_ID"
Me.ListBox1.Size = New System.Drawing.Size(200, 329) Me.txtIDB_OBJ_ID.Size = New System.Drawing.Size(100, 20)
Me.ListBox1.TabIndex = 23 Me.txtIDB_OBJ_ID.TabIndex = 9
' Me.txtIDB_OBJ_ID.Text = Global.DigitalData.GUIs.ZooFlow.Settings.Default.IDBOBJID
'txtAttributeName
'
Me.txtAttributeName.Location = New System.Drawing.Point(205, 236)
Me.txtAttributeName.Name = "txtAttributeName"
Me.txtAttributeName.Size = New System.Drawing.Size(115, 20)
Me.txtAttributeName.TabIndex = 24
Me.txtAttributeName.Text = "InvoiceNr"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(12, 234)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(187, 23)
Me.Button2.TabIndex = 17
Me.Button2.Text = "GetAttribute"
Me.Button2.UseVisualStyleBackColor = True
'
'txtAttibuteValue
'
Me.txtAttibuteValue.Location = New System.Drawing.Point(326, 236)
Me.txtAttibuteValue.Name = "txtAttibuteValue"
Me.txtAttibuteValue.Size = New System.Drawing.Size(100, 20)
Me.txtAttibuteValue.TabIndex = 25
' '
'frmtest 'frmtest
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(865, 450) Me.ClientSize = New System.Drawing.Size(865, 450)
Me.Controls.Add(Me.txtAttibuteValue) Me.Controls.Add(Me.txtProfileId)
Me.Controls.Add(Me.txtAttributeName)
Me.Controls.Add(Me.ListBox1)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.DateTimePicker1) Me.Controls.Add(Me.DateTimePicker1)
Me.Controls.Add(Me.cmbObjectStoreType) Me.Controls.Add(Me.cmbObjectStoreType)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label4) Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.btnImportFile)
Me.Controls.Add(Me.Button8) Me.Controls.Add(Me.btnNewFile)
Me.Controls.Add(Me.Button6) Me.Controls.Add(Me.btnOpenFile)
Me.Controls.Add(Me.Button7)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.txtFile2Import) Me.Controls.Add(Me.txtFile2Import)
Me.Controls.Add(Me.txtIDB_OBJ_ID) Me.Controls.Add(Me.txtIDB_OBJ_ID)
Me.Controls.Add(Me.Label6) Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.Label2)
Me.Name = "frmtest" Me.Name = "frmtest"
Me.Text = "frmtest" Me.Text = "frmtest"
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox1.PerformLayout()
Me.ResumeLayout(False) Me.ResumeLayout(False)
Me.PerformLayout() Me.PerformLayout()
@ -271,23 +182,15 @@ Partial Class frmtest
Friend WithEvents Label2 As Label Friend WithEvents Label2 As Label
Friend WithEvents txtIDB_OBJ_ID As TextBox Friend WithEvents txtIDB_OBJ_ID As TextBox
Friend WithEvents txtFile2Import As TextBox Friend WithEvents txtFile2Import As TextBox
Friend WithEvents Button4 As Button Friend WithEvents btnOpenFile As Button
Friend WithEvents Button5 As Button
Friend WithEvents CheckBoxKeepExtension As CheckBox
Friend WithEvents Button6 As Button
Friend WithEvents OpenFileDialog1 As OpenFileDialog Friend WithEvents OpenFileDialog1 As OpenFileDialog
Friend WithEvents Button7 As Button Friend WithEvents btnNewFile As Button
Friend WithEvents Button8 As Button
Friend WithEvents Label4 As Label Friend WithEvents Label4 As Label
Friend WithEvents Label5 As Label Friend WithEvents Label5 As Label
Friend WithEvents cmbObjectStoreType As ComboBox Friend WithEvents cmbObjectStoreType As ComboBox
Friend WithEvents DateTimePicker1 As DateTimePicker Friend WithEvents DateTimePicker1 As DateTimePicker
Friend WithEvents Label6 As Label Friend WithEvents Label6 As Label
Friend WithEvents TextBox1 As TextBox Friend WithEvents btnImportFile As Button
Friend WithEvents Label1 As Label Friend WithEvents Label1 As Label
Friend WithEvents GroupBox1 As GroupBox Friend WithEvents txtProfileId As TextBox
Friend WithEvents ListBox1 As ListBox
Friend WithEvents txtAttributeName As TextBox
Friend WithEvents Button2 As Button
Friend WithEvents txtAttibuteValue As TextBox
End Class End Class

View File

@ -6,96 +6,19 @@ Imports System.Text
Imports DigitalData.Modules.EDMI.API.Client Imports DigitalData.Modules.EDMI.API.Client
Public Class frmtest Public Class frmtest
'Private Sub Button1_Click(sender As Object, e As EventArgs)
' My.Settings.Save()
' Dim oString As String
' Dim oextension = ""
' Dim oKeepExtension As Boolean = False
' If CheckBoxKeepExtension.Checked Then
' If txtFile2Import.Text <> String.Empty Then
' oextension = Path.GetExtension(txtFile2Import.Text)
' oKeepExtension = True
' End If
' End If
' oString = My.Application.Service.Client.CreateFileStoreObject(txtIDB_OBJ_ID.Text, txtFilestoreType.Text, txtDate.Text, oextension, oKeepExtension)
' txtIDBFOPath.Text = oString
'End Sub Private Sub frmtest_Load(sender As Object, e As EventArgs) Handles MyBase.Load
cmbObjectStoreType.SelectedIndex = 0
'Private Sub Button2_Click(sender As Object, e As EventArgs)
' Dim oString As String
' oString = My.Application.Service.Client.CreateObjectId("DOC", My.Application.User.UserName, "")
' txtIDB_OBJ_ID.Text = oString
'End Sub
'Private Async Sub Button3_Click(sender As Object, e As EventArgs)
' Try
' Dim oResult As Boolean = False
' Using oStream As New FileStream(txtFile2Import.Text, FileMode.Open, FileAccess.Read)
' Using oMemoryStream As New MemoryStream
' oStream.CopyTo(oMemoryStream)
' Dim oContents As Byte() = oMemoryStream.ToArray()
' oResult = Await My.Application.Service.Client.ImportFileObjectAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, "WORK", txtIDBFOPath.Text)
' End Using
' End Using
' If oResult = False Then
' MsgBox("Oh no error", MsgBoxStyle.Critical)
' Else
' MsgBox("#Nailedit")
' End If
' Catch ex As Exception
' MsgBox(ex.Message)
' End Try
'End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Try
Dim oextension = Path.GetExtension(txtFile2Import.Text)
Dim oFile = $"E:\file{oextension}"
Using oInputStream As New FileStream(TextBox1.Text, FileMode.Open)
Using oFileStream As New FileStream(oFile, FileMode.Create, FileAccess.Write)
oInputStream.CopyTo(oFileStream)
End Using
End Using
Dim oPAth = Path.GetDirectoryName(oFile)
MsgBox($"File [{oFile}] created!", MsgBoxStyle.Information)
Process.Start(oPAth)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical)
End Try
End Sub End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click Private Sub btnOpenFile_Click(sender As Object, e As EventArgs) Handles btnOpenFile.Click
Try
Dim wFile As System.IO.FileStream
Dim byteData() As Byte
Dim oextension = Path.GetExtension(txtFile2Import.Text)
byteData = Encoding.ASCII.GetBytes(txtFile2Import.Text)
wFile = New FileStream($"E:\file{oextension}", FileMode.Append)
wFile.Write(byteData, 0, byteData.Length)
wFile.Close()
Catch ex As IOException
MsgBox(ex.ToString)
End Try
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
txtFile2Import.Text = OpenFileDialog1.FileName txtFile2Import.Text = OpenFileDialog1.FileName
End If End If
End Sub End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click Private Async Sub btnNewFile_Click(sender As Object, e As EventArgs) Handles btnNewFile.Click
Dim oExt = Path.GetExtension(txtFile2Import.Text)
Dim oFile = $"E:\file{oExt}"
File.Copy(TextBox1.Text, oFile)
End Sub
Private Async Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
Dim oObjectId As Long = Await My.Application.Service.Client.NewFileAsync( Dim oObjectId As Long = Await My.Application.Service.Client.NewFileAsync(
txtFile2Import.Text, txtFile2Import.Text,
"WORK", "WORK",
@ -111,23 +34,22 @@ Public Class frmtest
txtIDB_OBJ_ID.Text = oObjectId txtIDB_OBJ_ID.Text = oObjectId
End Sub End Sub
Private Sub frmtest_Load(sender As Object, e As EventArgs) Handles MyBase.Load
cmbObjectStoreType.SelectedIndex = 0
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button2.Click Private Async Sub btnImportFile_Click_(sender As Object, e As EventArgs) Handles btnImportFile.Click
Try Dim oObjectId As Long = Await My.Application.Service.Client.ImportFileAsync(
Dim oValue = My.Application.Service.Client.GetVariableValue(txtIDB_OBJ_ID.Text, txtAttributeName.Text) txtFile2Import.Text,
txtProfileId.Text,
New List(Of EDMIServiceReference.UserAttributeValue),
"WORK",
"DOC",
"DEFAULT"
)
If oValue.Type Is Nothing Then If oObjectId <> INVALID_OBEJCT_ID Then
ListBox1.Items.Add("Value is nothing") MsgBox("File Imported!", MsgBoxStyle.Information, Text)
Else Else
ListBox1.Items.Add(oValue.Value) MsgBox("File was not imported. Check the server logs!")
txtAttibuteValue.Text = oValue.Value End If
End If txtIDB_OBJ_ID.Text = oObjectId
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub End Sub
End Class End Class

View File

@ -179,11 +179,19 @@ Public Class Client
End Try End Try
End Function End Function
Public Async Function ImportFileAsync(pFilePath As String, pObjectStoreName As String, pObjectKind As String, pBusinessEntity As String, Optional pImportOptions As Options.NewFileOptions = Nothing) As Task(Of Long) Public Async Function ImportFileAsync(
pFilePath As String,
pProfileId As Integer,
pAttributeValues As List(Of UserAttributeValue),
pObjectStoreName As String,
pObjectKind As String,
pBusinessEntity As String,
Optional pImportOptions As Options.ImportFileOptions = Nothing
) As Task(Of Long)
Try Try
' Set default options ' Set default options
If pImportOptions Is Nothing Then If pImportOptions Is Nothing Then
pImportOptions = New Options.NewFileOptions() pImportOptions = New Options.ImportFileOptions()
End If End If
' Check if file exists ' Check if file exists
@ -221,7 +229,9 @@ Public Class Client
.User = New UserState() With { .User = New UserState() With {
.UserName = pImportOptions.Username, .UserName = pImportOptions.Username,
.Language = pImportOptions.Language .Language = pImportOptions.Language
} },
.ProfileId = pProfileId,
.AttributeValues = pAttributeValues.ToArray
}) })
If oFileImportResponse.OK = False Then If oFileImportResponse.OK = False Then
Throw New ApplicationException("Could not Import File Contents!") Throw New ApplicationException("Could not Import File Contents!")

View File

@ -25,6 +25,15 @@
Public Property DateImported As Date = Date.Now Public Property DateImported As Date = Date.Now
End Class End Class
Public Class ImportFileOptions
Inherits BaseOptions
''' <summary>
''' Date when the file was imported. Can be in the past. Defaults to now.
''' </summary>
Public Property DateImported As Date = Date.Now
End Class
Public Class GetVariableValueOptions Public Class GetVariableValueOptions
Inherits BaseOptions Inherits BaseOptions
End Class End Class

View File

@ -94,6 +94,7 @@ Public Class Patterns2
End Function End Function
Public Function ReplaceUserValues(pInput As String, pUser As State.UserState) As String Public Function ReplaceUserValues(pInput As String, pUser As State.UserState) As String
Logger.Debug("Replacing User Values")
Dim oResult = pInput Dim oResult = pInput
Dim oModule = GetModule(Of Modules.User)() Dim oModule = GetModule(Of Modules.User)()
@ -104,9 +105,10 @@ Public Class Patterns2
End Function End Function
Public Function ReplaceFileValues(pInput As String, pFileInfo As FileInfo) As String Public Function ReplaceFileValues(pInput As String, pFileInfo As FileInfo) As String
Logger.Debug("Replacing File Values")
Dim oResult = pInput Dim oResult = pInput
Dim oModule = GetModule(Of Modules.User)() Dim oModule = GetModule(Of Modules.FileInformation)()
Dim oArgs = GetReplaceMapForModule(oModule, pFileInfo:=pFileInfo) Dim oArgs = GetReplaceMapForModule(oModule, pFileInfo:=pFileInfo)
oResult = DoReplaceForModule(oResult, oModule, oArgs) oResult = DoReplaceForModule(oResult, oModule, oArgs)
@ -114,6 +116,7 @@ Public Class Patterns2
End Function End Function
Public Function ReplaceControlValues(pInput As String, pPanel As Panel) As String Public Function ReplaceControlValues(pInput As String, pPanel As Panel) As String
Logger.Debug("Replacing Control Values")
Dim oResult = pInput Dim oResult = pInput
Dim oModule = GetModule(Of Modules.Controls)() Dim oModule = GetModule(Of Modules.Controls)()
@ -124,6 +127,7 @@ Public Class Patterns2
End Function End Function
Public Function ReplaceWindreamValues(pInput As String, pWMObject As WMObject) As String Public Function ReplaceWindreamValues(pInput As String, pWMObject As WMObject) As String
Logger.Debug("Replacing Windream Values")
Dim oResult = pInput Dim oResult = pInput
Dim oModule = GetModule(Of Modules.Windream)() Dim oModule = GetModule(Of Modules.Windream)()
@ -134,6 +138,7 @@ Public Class Patterns2
End Function End Function
Public Function ReplaceInternalValues(pInput As String) As String Public Function ReplaceInternalValues(pInput As String) As String
Logger.Debug("Replacing Internal Values")
Dim oResult = pInput Dim oResult = pInput
Dim oInternalModule = GetModule(Of Modules.Internal)() Dim oInternalModule = GetModule(Of Modules.Internal)()
@ -148,6 +153,7 @@ Public Class Patterns2
End Function End Function
Public Function ReplaceGlobixValues(pInput As String, pGlobixIndexes As Dictionary(Of String, List(Of String))) As String Public Function ReplaceGlobixValues(pInput As String, pGlobixIndexes As Dictionary(Of String, List(Of String))) As String
Logger.Debug("Replacing Globix Values")
Dim oResult = pInput Dim oResult = pInput
Dim oGlobixModule = GetModule(Of Modules.Globix)() Dim oGlobixModule = GetModule(Of Modules.Globix)()
@ -161,6 +167,12 @@ Public Class Patterns2
Private Function DoReplaceForModule(pInput As String, pModule As IModule, pArgs As Dictionary(Of String, Object)) As String Private Function DoReplaceForModule(pInput As String, pModule As IModule, pArgs As Dictionary(Of String, Object)) As String
Try Try
If pModule IsNot Nothing AndAlso pModule?.GetType?.Name IsNot Nothing Then
Logger.Debug("Calling Replace for Module [{0}]", pModule.GetType.Name)
End If
Logger.Debug("Calling Replace for Input String [{0}]", pInput)
pInput = pModule.Replace(pInput, pArgs) pInput = pModule.Replace(pInput, pArgs)
Catch ex As Exception Catch ex As Exception
Logger.Warn("Placeholders for String [{0}] could not be replaced completely in Module [{1}]. Skipping.", pInput, pModule.GetType.Name) Logger.Warn("Placeholders for String [{0}] could not be replaced completely in Module [{1}]. Skipping.", pInput, pModule.GetType.Name)
@ -186,6 +198,7 @@ Public Class Patterns2
Dim oArgs As New Dictionary(Of String, Object) Dim oArgs As New Dictionary(Of String, Object)
If TypeOf pModule Is Modules.Clipboard Then If TypeOf pModule Is Modules.Clipboard Then
Logger.Debug("Adding Arguments for Clipboard Module")
Try Try
oArgs.Add(Patterns.Modules.Clipboard.CLIP_VALUE_BOARD, My.Computer.Clipboard.GetText()) oArgs.Add(Patterns.Modules.Clipboard.CLIP_VALUE_BOARD, My.Computer.Clipboard.GetText())
Catch ex As Exception Catch ex As Exception
@ -193,6 +206,7 @@ Public Class Patterns2
End Try End Try
ElseIf TypeOf pModule Is Modules.FileInformation Then ElseIf TypeOf pModule Is Modules.FileInformation Then
Logger.Debug("Adding Arguments for File Module")
Try Try
oArgs.Add(Patterns.Modules.FileInformation.FILE_VALUE_FILEINFO, pFileInfo) oArgs.Add(Patterns.Modules.FileInformation.FILE_VALUE_FILEINFO, pFileInfo)
Catch ex As Exception Catch ex As Exception
@ -200,6 +214,7 @@ Public Class Patterns2
End Try End Try
ElseIf TypeOf pModule Is Modules.User Then ElseIf TypeOf pModule Is Modules.User Then
Logger.Debug("Adding Arguments for User Module")
Try Try
oArgs.Add(Patterns.Modules.User.USER_VALUE_EMAIL, pUser.Email) oArgs.Add(Patterns.Modules.User.USER_VALUE_EMAIL, pUser.Email)
oArgs.Add(Patterns.Modules.User.USER_VALUE_LANGUAGE, pUser.Language) oArgs.Add(Patterns.Modules.User.USER_VALUE_LANGUAGE, pUser.Language)
@ -213,6 +228,7 @@ Public Class Patterns2
End Try End Try
ElseIf TypeOf pModule Is Modules.Controls Then ElseIf TypeOf pModule Is Modules.Controls Then
Logger.Debug("Adding Arguments for Controls Module")
Try Try
oArgs.Add(Patterns.Modules.Controls.CTRL_VALUE_PANEL, pPanel) oArgs.Add(Patterns.Modules.Controls.CTRL_VALUE_PANEL, pPanel)
Catch ex As Exception Catch ex As Exception
@ -220,6 +236,7 @@ Public Class Patterns2
End Try End Try
ElseIf TypeOf pModule Is Modules.Windream Then ElseIf TypeOf pModule Is Modules.Windream Then
Logger.Debug("Adding Arguments for Windream Module")
Try Try
oArgs.Add(Patterns.Modules.Windream.WM_VALUE_DOCUMENT, pWMObject) oArgs.Add(Patterns.Modules.Windream.WM_VALUE_DOCUMENT, pWMObject)
Catch ex As Exception Catch ex As Exception
@ -227,6 +244,7 @@ Public Class Patterns2
End Try End Try
ElseIf TypeOf pModule Is Modules.Globix Then ElseIf TypeOf pModule Is Modules.Globix Then
Logger.Debug("Adding Arguments for Globix Module")
Try Try
oArgs.Add(Patterns.Modules.Globix.GBX_VALUE_INDICIES, pGlobixIndexes) oArgs.Add(Patterns.Modules.Globix.GBX_VALUE_INDICIES, pGlobixIndexes)
Catch ex As Exception Catch ex As Exception

View File

@ -12,9 +12,6 @@ Namespace Methods.GlobalIndexer.ImportFile
Private ReadOnly GetDatatable As GetDatatableFromCacheMethod Private ReadOnly GetDatatable As GetDatatableFromCacheMethod
Private Profile As DataRow Private Profile As DataRow
Private ManualIndexes As List(Of ManualIndex)
Private AutomaticIndexes As List(Of AutomaticIndex)
Private ManualIndexesPostProcessing As DataTable
Private Const VIEW_PROFILE = "VWGI_DOCTYPE_IDB" Private Const VIEW_PROFILE = "VWGI_DOCTYPE_IDB"
Private Const VIEW_INDEX_MANUAL = "VWDDINDEX_MAN" Private Const VIEW_INDEX_MANUAL = "VWDDINDEX_MAN"
@ -41,7 +38,9 @@ Namespace Methods.GlobalIndexer.ImportFile
' TODO: Add missing user properties in UserState from TBDD_USER ' TODO: Add missing user properties in UserState from TBDD_USER
'pData.User = ResolveUserFromUserName(pData.User.UserName) 'pData.User = ResolveUserFromUserName(pData.User.UserName)
LoadIndexes(pData.ProfileId) Dim oManualIndexes = LoadManualIndexes(pData.ProfileId)
Dim oAutomaticIndexes = LoadAutomaticIndexes(pData.ProfileId)
Dim oPostProcessingSteps As DataTable = LoadPostProcessingSteps(oManualIndexes)
LoadProfile(pData.ProfileId) LoadProfile(pData.ProfileId)
@ -49,13 +48,11 @@ Namespace Methods.GlobalIndexer.ImportFile
Dim oFileName As String = GetFilenameByNameconvention(pData.File.FileName, Profile.Item("NAMENKONVENTION")) Dim oFileName As String = GetFilenameByNameconvention(pData.File.FileName, Profile.Item("NAMENKONVENTION"))
' Apply post processing ' Apply post processing
Dim oPostProcessing = New Steps.PostProcessing(LogConfig, ManualIndexesPostProcessing) Dim oPostProcessing = New Steps.PostProcessing(LogConfig, oPostProcessingSteps)
oFinalAttributes = oPostProcessing.ApplyManualPostprocessing(oFinalAttributes) oFinalAttributes = oPostProcessing.ApplyManualPostprocessing(oFinalAttributes)
' Apply automatic attributes ' Apply automatic attributes
Dim oAutomaticIndexing = New Steps.AutomaticIndexing(LogConfig, Database, AutomaticIndexes, GlobalState) Dim oAutomaticIndexing = New Steps.AutomaticIndexing(LogConfig, Database, oAutomaticIndexes, GlobalState)
oFinalAttributes = oAutomaticIndexing.ApplyAutomaticeAttributes(oFinalAttributes, pData.File.FileInfoRaw, pData.User) oFinalAttributes = oAutomaticIndexing.ApplyAutomaticeAttributes(oFinalAttributes, pData.File.FileInfoRaw, pData.User)
' Import the file ' Import the file
@ -69,6 +66,7 @@ Namespace Methods.GlobalIndexer.ImportFile
}) })
If oResponse.OK Then If oResponse.OK Then
Logger.Info("Import of file [{0}] under ObjectId [{1}] successful!", pData.File.FileName, oResponse.ObjectId)
Return New ImportFileResponse(oResponse.ObjectId) Return New ImportFileResponse(oResponse.ObjectId)
Else Else
Throw New ApplicationException(oResponse.ErrorMessage) Throw New ApplicationException(oResponse.ErrorMessage)
@ -87,14 +85,6 @@ Namespace Methods.GlobalIndexer.ImportFile
Return pFileName Return pFileName
End Function End Function
Private Sub LoadIndexes(pProfileId As Integer)
Logger.Debug("Start of Method [LoadIndexes]")
LoadManualIndexes(pProfileId)
LoadAutomaticIndexes(pProfileId)
LoadPostProcessingSteps()
End Sub
''' <summary> ''' <summary>
''' Load Profiles for this Import ''' Load Profiles for this Import
''' </summary> ''' </summary>
@ -118,15 +108,18 @@ Namespace Methods.GlobalIndexer.ImportFile
End Try End Try
End Sub End Sub
Private Sub LoadAutomaticIndexes(pProfileId As Integer) ''' <summary>
''' Load automatic indexes for this Import
''' </summary>
Private Function LoadAutomaticIndexes(pProfileId As Integer) As List(Of AutomaticIndex)
Logger.Debug("Start of Method [LoadAutomaticIndexes]") Logger.Debug("Start of Method [LoadAutomaticIndexes]")
Try Try
' Load automatic Indexes for this Import ' Load automatic Indexes for this Import
Dim oAutomaticIndexes = GetDatatable.Run( Dim oAutomaticIndexes = GetDatatable.Run(
New GetDatatableFromCacheRequest With { New GetDatatableFromCacheRequest With {
.DataTable = VIEW_INDEX_MANUAL, .DataTable = VIEW_INDEX_AUTOMATIC,
.FilterExpression = $"DOK_ID = {pProfileId}" .FilterExpression = $"DOCTYPE_ID = {pProfileId}"
}) })
If oAutomaticIndexes.OK = False Then If oAutomaticIndexes.OK = False Then
@ -145,15 +138,22 @@ Namespace Methods.GlobalIndexer.ImportFile
.Sequence = oRow.ItemEx(Of String)("SEQUENCE"), .Sequence = oRow.ItemEx(Of String)("SEQUENCE"),
.Value = oRow.ItemEx(Of String)("VALUE") .Value = oRow.ItemEx(Of String)("VALUE")
} }
oIndexes.Add(oAutomaticIndex)
Next Next
AutomaticIndexes = oIndexes Logger.Info("[{0}] automatic indexes loaded.", oIndexes)
Return oIndexes
Catch ex As Exception Catch ex As Exception
LogAndThrow(ex, "Error while automatic loading indexes!") LogAndThrow(ex, "Error while automatic loading indexes!")
End Try End Try
End Sub End Function
Private Sub LoadManualIndexes(pProfileId As Integer) ''' <summary>
''' Load manual indexes for this Import
''' </summary>
Private Function LoadManualIndexes(pProfileId As Integer) As List(Of ManualIndex)
Logger.Debug("Start of Method [LoadManualIndexes]") Logger.Debug("Start of Method [LoadManualIndexes]")
Try Try
@ -182,23 +182,32 @@ Namespace Methods.GlobalIndexer.ImportFile
.DefaultValue = oRow.ItemEx(Of String)("DEFAULT_VALUE"), .DefaultValue = oRow.ItemEx(Of String)("DEFAULT_VALUE"),
.DataType = oRow.ItemEx(Of String)("DATA_TYPE") .DataType = oRow.ItemEx(Of String)("DATA_TYPE")
} }
oIndexes.Add(oManualIndex)
Next Next
ManualIndexes = oIndexes Return oIndexes
Catch ex As Exception Catch ex As Exception
LogAndThrow(ex, "Error while loading indexes!") LogAndThrow(ex, "Error while loading indexes!")
End Try End Try
End Sub End Function
Private Sub LoadPostProcessingSteps() Private Function LoadPostProcessingSteps(pManualIndexes As List(Of ManualIndex)) As DataTable
Logger.Debug("Start of Method [LoadPostProcessingSteps]") Logger.Debug("Start of Method [LoadPostProcessingSteps]")
Try Try
' Generate a string containing all index ids joined into a string ' Generate a string containing all index ids joined into a string
Dim oIndexIdList As List(Of Integer) = ManualIndexes.Select(Function(index) index.Id).ToList() Dim oIndexIdList As List(Of Integer) = pManualIndexes.
Select(Function(index) index.Id).
ToList()
Dim oIndexIds As String = String.Join(",", oIndexIdList) Dim oIndexIds As String = String.Join(",", oIndexIdList)
If oIndexIdList.Count = 0 Then
Logger.Debug("No Postprocessing steps found for this profile. Exiting.")
Return Nothing
End If
' Load all relevant postprocessing steps ' Load all relevant postprocessing steps
Dim oPostProcessingSteps = GetDatatable.Run( Dim oPostProcessingSteps = GetDatatable.Run(
New GetDatatableFromCacheRequest With { New GetDatatableFromCacheRequest With {
@ -210,11 +219,11 @@ Namespace Methods.GlobalIndexer.ImportFile
LogAndThrow(oPostProcessingSteps.ErrorMessage) LogAndThrow(oPostProcessingSteps.ErrorMessage)
End If End If
ManualIndexesPostProcessing = oPostProcessingSteps.Table Return oPostProcessingSteps.Table
Catch ex As Exception Catch ex As Exception
LogAndThrow(ex, "Error while loading post processing steps!") LogAndThrow(ex, "Error while loading post processing steps!")
End Try End Try
End Sub End Function
End Class End Class
End Namespace End Namespace

View File

@ -40,7 +40,7 @@ Namespace Methods.GlobalIndexer.ImportFile
''' Attribute Name/Attribute Value/ControlName ''' Attribute Name/Attribute Value/ControlName
''' </summary> ''' </summary>
<DataMember> <DataMember>
Public Property AttributeValues As List(Of UserAttributeValue) Public Property AttributeValues As New List(Of UserAttributeValue)
''' <summary> ''' <summary>
''' User Importing the file ''' User Importing the file

View File

@ -20,17 +20,30 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
GlobalState = pGlobalState GlobalState = pGlobalState
AutomaticIndexes = pAutomaticIndexes AutomaticIndexes = pAutomaticIndexes
Patterns = New Patterns2(pLogConfig) Patterns = New Patterns2(pLogConfig)
Logger.Info("Starting Automatic Indexing")
End Sub End Sub
Public Function ApplyAutomaticeAttributes(pManualAttributes As List(Of UserAttributeValue), pFileInfo As FileInfo, pUserState As UserState) As List(Of UserAttributeValue) Public Function ApplyAutomaticeAttributes(pUserAttributes As List(Of UserAttributeValue), pFileInfo As FileInfo, pUserState As UserState) As List(Of UserAttributeValue)
Logger.Debug("Start of Method [ApplyAutomaticeAttributes]") Logger.Debug("Start of Method [ApplyAutomaticAttributes]")
Dim oAttributes = pManualAttributes
If AutomaticIndexes Is Nothing OrElse AutomaticIndexes.Count = 0 Then
Logger.Warn("No Automatix Indexes supplied. Exiting.")
Return pUserAttributes
End If
Logger.Info("Processing [{0}] automatic indexes", AutomaticIndexes.Count)
Dim oAttributes As List(Of UserAttributeValue) = pUserAttributes
For Each oAutomaticIndex In AutomaticIndexes For Each oAutomaticIndex In AutomaticIndexes
' We add oAttributes from the previous run into the current run so it is in theory possible to reference ' We add oAttributes from the previous run into the current run so it is in theory possible to reference
' automatic attributes which have been set just before. ' automatic attributes which have been set just before.
Dim oAttribute = ApplyAutomaticIndex(oAutomaticIndex, pFileInfo, pUserState, oAttributes) Dim oAttribute = ApplyAutomaticIndex(oAutomaticIndex, pFileInfo, pUserState, oAttributes)
oAttributes.Add(oAttribute)
If oAttribute IsNot Nothing Then
Logger.Info("Adding Attribute [{0}]", oAttribute)
oAttributes.Add(oAttribute)
End If
Next Next
Return oAttributes Return oAttributes
@ -38,41 +51,65 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
Private Function ApplyAutomaticIndex(pAutomaticIndex As AutomaticIndex, pFileInfo As FileInfo, pUserState As UserState, pAttributes As List(Of UserAttributeValue)) As UserAttributeValue Private Function ApplyAutomaticIndex(pAutomaticIndex As AutomaticIndex, pFileInfo As FileInfo, pUserState As UserState, pAttributes As List(Of UserAttributeValue)) As UserAttributeValue
Dim oAttributeDict = pAttributes.ToDictionary( Try
Function(attr) attr.AttributeName, Dim oAttributeDict = pAttributes.ToDictionary(
Function(attr) attr.AttributeValues) Function(attr) attr.AttributeName,
Function(attr) attr.AttributeValues)
' If there is no SQL command, we use the Value property and replace all placeholders in it. Logger.Info("Applying Automatic Index [{0}]", pAutomaticIndex.Name)
If pAutomaticIndex.HasSqlCommand = False Then
Dim oResult As String = GetPlaceholderValue(pAutomaticIndex.Value, pFileInfo, pUserState, oAttributeDict)
Dim oHasSqlCommand As Boolean = pAutomaticIndex.HasSqlCommand
Logger.Debug("Index has SQLCommand: [{0}]", oHasSqlCommand)
' If there is no SQL command, we use the Value property and replace all placeholders in it.
If oHasSqlCommand = False Then
Dim oResult As String = GetPlaceholderValue(pAutomaticIndex.Value, pFileInfo, pUserState, oAttributeDict)
Return New UserAttributeValue With {
.AttributeValues = New List(Of String) From {oResult},
.AttributeName = pAutomaticIndex.Name,
.AttributeId = pAutomaticIndex.Id
}
End If
' Otherwise we will replace placeholders in the SQL command and then execute it
Dim oConnectionString As String = GlobalState.GetConnectionString(pAutomaticIndex.SQLConnectionId)
Dim oFinalSQLCommand = pAutomaticIndex.SQLCommand
Logger.Debug("SQL Command is: [{0}]", oFinalSQLCommand)
oFinalSQLCommand = GetPlaceholderValue(oFinalSQLCommand, pFileInfo, pUserState, oAttributeDict)
' Now we have a SQL command which only contains vector placeholders
' Next, we execute the command to get our result
Dim oValue = Database.GetScalarValueWithConnection(oFinalSQLCommand, oConnectionString)
If oValue Is Nothing Then
Logger.Warn("SQL for Automatic Index [{0}] returned an error. Exiting.")
Return Nothing
End If
Logger.Info("Value for Automatic Index [{0}] is [{1}]", pAutomaticIndex.Name, oValue.ToString)
' TODO: Return multiple values
Return New UserAttributeValue With { Return New UserAttributeValue With {
.AttributeValues = New List(Of String) From {oResult}, .AttributeValues = New List(Of String) From {oValue},
.AttributeName = pAutomaticIndex.Name, .AttributeName = pAutomaticIndex.Name,
.AttributeId = pAutomaticIndex.Id .AttributeId = pAutomaticIndex.Id
} }
End If Catch ex As Exception
Logger.Warn("Automatic Indexing for index failed.")
Logger.Error(ex)
' Otherwise we will replace placeholders in the SQL command and then execute it Return Nothing
Dim oConnectionString As String = GlobalState.GetConnectionString(pAutomaticIndex.SQLConnectionId) End Try
Dim oFinalSQLCommand = pAutomaticIndex.SQLCommand
oFinalSQLCommand = GetPlaceholderValue(oFinalSQLCommand, pFileInfo, pUserState, oAttributeDict)
' Now we have a SQL command which only contains vector placeholders
' Next, we execute the command to get our result
Dim oValue = Database.GetScalarValueWithConnection(oFinalSQLCommand, oConnectionString)
' TODO: Return multiple values
Return New UserAttributeValue With {
.AttributeValues = New List(Of String) From {oValue},
.AttributeName = pAutomaticIndex.Name,
.AttributeId = pAutomaticIndex.Id
}
End Function End Function
Private Function GetPlaceholderValue(pValue As String, pFileInfo As FileInfo, pUserState As UserState, pAttributes As Dictionary(Of String, List(Of String))) As String Private Function GetPlaceholderValue(pValue As String, pFileInfo As FileInfo, pUserState As UserState, pAttributes As Dictionary(Of String, List(Of String))) As String
Dim oResult As String = pValue Dim oResult As String = pValue
oResult = Patterns.ReplaceInternalValues(oResult) oResult = Patterns.ReplaceInternalValues(oResult)
oResult = Patterns.ReplaceFileValues(oResult, pFileInfo) oResult = Patterns.ReplaceFileValues(oResult, pFileInfo)
oResult = Patterns.ReplaceUserValues(oResult, pUserState) oResult = Patterns.ReplaceUserValues(oResult, pUserState)

View File

@ -14,33 +14,53 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
Public Sub New(pLogConfig As LogConfig, pPostProcessingSteps As DataTable) Public Sub New(pLogConfig As LogConfig, pPostProcessingSteps As DataTable)
MyBase.New(pLogConfig) MyBase.New(pLogConfig)
PostprocessingSteps = pPostProcessingSteps PostprocessingSteps = pPostProcessingSteps
Logger.Info("Starting Postprocessing of Manual Indexes")
End Sub End Sub
Public Function ApplyManualPostprocessing(pManualAttributes As List(Of UserAttributeValue)) As List(Of UserAttributeValue) Public Function ApplyManualPostprocessing(pManualAttributes As List(Of UserAttributeValue)) As List(Of UserAttributeValue)
Logger.Debug("Start of Method [ApplyManualPostprocessing]")
Dim oAttributes = pManualAttributes Dim oAttributes = pManualAttributes
For Each oProcessingRow As DataRow In PostprocessingSteps.Rows Try
Logger.Debug("Start of Method [ApplyManualPostprocessing]")
Dim oIndexId = oProcessingRow.ItemEx(Of Integer)("IDXMAN_ID") If PostprocessingSteps Is Nothing Then
Dim oIndex As UserAttributeValue = pManualAttributes. Logger.Debug("No Postprocessing steps found. Exiting.")
Where(Function(attr) attr.AttributeId = oProcessingRow.ItemEx(Of Integer)("IDXMAN_ID")). Return oAttributes
FirstOrDefault() End If
Dim oValue = GetPostprocessingValue(oIndex.AttributeValues, oProcessingRow) For Each oProcessingRow As DataRow In PostprocessingSteps.Rows
Dim oIndexId = oProcessingRow.ItemEx(Of Integer)("IDXMAN_ID")
Dim oIndex As UserAttributeValue = pManualAttributes.
Where(Function(attr) attr.AttributeId = oProcessingRow.ItemEx(Of Integer)("IDXMAN_ID")).
FirstOrDefault()
Dim oIndexPosition = pManualAttributes.IndexOf(oIndex)
oAttributes.Add(New UserAttributeValue With { Logger.Info("Postprocessing Index [{0}]", oIndex.AttributeName)
.AttributeId = oIndexId,
.AttributeName = oIndex.AttributeName,
.AttributeValues = oIndex.AttributeValues,
.ControlName = oIndex.ControlName
})
Next
Return oAttributes Dim oValues = GetPostprocessingValue(oIndex.AttributeValues, oProcessingRow)
Logger.Info("New Value for Index [{0}] is [{1}]", oIndex.AttributeName, String.Join(",", oValues))
' Replace the old AttributeValue with the new one
oAttributes.Item(oIndexPosition) = New UserAttributeValue With {
.AttributeId = oIndexId,
.AttributeName = oIndex.AttributeName,
.AttributeValues = oValues,
.ControlName = oIndex.ControlName
}
Next
Return oAttributes
Catch ex As Exception
Logger.Warn("Postprocessing failed. Returning incomplete Attributes.")
Logger.Error(ex)
Return oAttributes
End Try
End Function End Function
Public Function GetPostprocessingValue(pValues As List(Of String), pRow As DataRow) Public Function GetPostprocessingValue(pValues As List(Of String), pRow As DataRow) As List(Of String)
Logger.Debug("Start of Method [GetPostprocessingValue]") Logger.Debug("Start of Method [GetPostprocessingValue]")
Dim oType = pRow.Item("TYPE") Dim oType = pRow.Item("TYPE")
@ -88,7 +108,8 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
Next Next
Case Else Case Else
LogAndThrow($"Postprocessing type [{oType}] is not supported!") Logger.Warn("Postprocessing type [{0}] is not supported!", oType)
End Select End Select
Return oResult Return oResult

View File

@ -5,6 +5,10 @@
Public Property AttributeName As String Public Property AttributeName As String
Public Property AttributeValues As List(Of String) Public Property AttributeValues As List(Of String)
Public Property ControlName As String Public Property ControlName As String
Public Overrides Function ToString() As String
Return AttributeName
End Function
End Class End Class
End Namespace End Namespace

View File

@ -22,7 +22,7 @@ Public Class Scheduler
Public Sub New(LogConfig As LogConfig, MSSQL_ECM As MSSQLServer, TableStore As DataSet) Public Sub New(LogConfig As LogConfig, MSSQL_ECM As MSSQLServer, TableStore As DataSet)
_LogConfig = LogConfig _LogConfig = LogConfig
_Logger = LogConfig.GetLoggerFor("Scheduler") _Logger = LogConfig.GetLogger()
_Factory = New StdSchedulerFactory(_Props) _Factory = New StdSchedulerFactory(_Props)
_MSSQL = MSSQL_ECM _MSSQL = MSSQL_ECM

View File

@ -12,6 +12,7 @@ Public Class WindowsService
Private _ServiceHost As ServiceHost(Of EDMIService) Private _ServiceHost As ServiceHost(Of EDMIService)
Private _LogConfig As LogConfig Private _LogConfig As LogConfig
Private _LogConfigScheduler As LogConfig
Private _Logger As Logger Private _Logger As Logger
Private _Firebird As Firebird Private _Firebird As Firebird
@ -39,6 +40,7 @@ Public Class WindowsService
Dim oServicePath As String = AppDomain.CurrentDomain.BaseDirectory Dim oServicePath As String = AppDomain.CurrentDomain.BaseDirectory
_LogConfig = New LogConfig(LogConfig.PathType.CustomPath, IO.Path.Combine(oServicePath, "Log"), FileKeepRangeInDays:=3) _LogConfig = New LogConfig(LogConfig.PathType.CustomPath, IO.Path.Combine(oServicePath, "Log"), FileKeepRangeInDays:=3)
_LogConfigScheduler = New LogConfig(LogConfig.PathType.CustomPath, IO.Path.Combine(oServicePath, "Log"), Suffix:="Scheduler", FileKeepRangeInDays:=3)
_Logger = _LogConfig.GetLogger() _Logger = _LogConfig.GetLogger()
_Logger.Info("Service {0} is starting...", SERVICE_DISPLAY_NAME) _Logger.Info("Service {0} is starting...", SERVICE_DISPLAY_NAME)
@ -71,7 +73,7 @@ Public Class WindowsService
_Archive = New EDMI.File.Archive(_LogConfig) _Archive = New EDMI.File.Archive(_LogConfig)
_Filesystem = New Filesystem.File(_LogConfig) _Filesystem = New Filesystem.File(_LogConfig)
_Global = New GlobalState(_LogConfig, _MSSQL_IDB, _MSSQL_ECM) _Global = New GlobalState(_LogConfig, _MSSQL_IDB, _MSSQL_ECM)
_Scheduler = New Scheduler(_LogConfig, _MSSQL_ECM, _Global.TableStore) _Scheduler = New Scheduler(_LogConfigScheduler, _MSSQL_ECM, _Global.TableStore)
_Logger.Debug("Loading Global Data") _Logger.Debug("Loading Global Data")
_Global.LoadObjectStores() _Global.LoadObjectStores()