EDMIService: Turn Postprocessing Steps into list

This commit is contained in:
Jonathan Jenne
2021-12-13 10:50:09 +01:00
parent c322beb4d7
commit 957d7a3986
6 changed files with 79 additions and 27 deletions

View File

@@ -1,5 +1,6 @@
Imports System.IO
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Language
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Patterns
Imports DigitalData.Modules.ZooFlow.State
@@ -23,7 +24,7 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
Patterns = New Patterns2(pLogConfig)
Helpers = New Helpers(pLogConfig, pDatabase)
Logger.Info("Starting Automatic Indexing")
Logger.Info("Initializing Automatic Indexing")
End Sub
''' <summary>
@@ -96,18 +97,32 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
' 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)
Dim oTable = Database.GetDatatableWithConnection(oFinalSQLCommand, oConnectionString)
If oValue Is Nothing Then
If oTable 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)
Dim oValues As New List(Of String)
For Each oRow As DataRow In oTable.Rows
Try
Dim oValue As String = oRow.ItemArray(0)?.ToString()
If oValue IsNot Nothing AndAlso oValue.Length > 0 Then
oValues.Add(oValue)
End If
Catch ex As Exception
Logger.Warn("Error while parsing the Result from SQL Command. Skipping.")
Logger.Error(ex)
End Try
Next
Logger.Info("Value for Automatic Index [{0}] is [{1}]", pAutomaticIndex.Name, oValues.FirstOrDefault)
' TODO: Return multiple values
Return New UserAttributeValue With {
.Values = New List(Of String) From {oValue},
.Values = oValues,
.Name = pAutomaticIndex.Name,
.Id = pAutomaticIndex.Id
}