diff --git a/Service.EDMIService/EDMIService.vbproj b/Service.EDMIService/EDMIService.vbproj
index e629449f..da72cb41 100644
--- a/Service.EDMIService/EDMIService.vbproj
+++ b/Service.EDMIService/EDMIService.vbproj
@@ -147,6 +147,7 @@
+
diff --git a/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileMethod.vb b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileMethod.vb
index 1e5f56df..0ab714ab 100644
--- a/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileMethod.vb
+++ b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileMethod.vb
@@ -44,7 +44,7 @@ Namespace Methods.GlobalIndexer.ImportFile
Dim oManualIndexes = Loader.LoadManualIndexes(pData.ProfileId)
Dim oAutomaticIndexes = Loader.LoadAutomaticIndexes(pData.ProfileId)
- Dim oPostProcessingSteps As DataTable = Loader.LoadPostProcessingSteps(oManualIndexes)
+ Dim oPostProcessingSteps = Loader.LoadPostProcessingSteps(oManualIndexes)
Dim oProfile = Loader.LoadProfile(pData.ProfileId)
Dim oUserAttributes = pData.AttributeValues
@@ -126,6 +126,7 @@ Namespace Methods.GlobalIndexer.ImportFile
Dim oDynamicPath As String = Helpers.GetPlaceholderValue(pPathConvention, pFileInfo, pUser, oUserAttributeDict, oAutoAttributeDict)
Logger.Info("Virtual Path for file [{0}] is [{1}]", pFileInfo.Name, oDynamicPath)
+
Return oDynamicPath
End Function
@@ -142,6 +143,7 @@ Namespace Methods.GlobalIndexer.ImportFile
End If
Dim oFileName As String = Helpers.GetPlaceholderValue(pNameconvention, pFileInfo, pUser, oUserAttributeDict, oAutoAttributeDict)
+ Logger.Info("Display Filename for file [{0}] is [{1}]", pFileInfo.Name, oFileName)
Return oFileName & pFileInfo.Extension
End Function
@@ -160,7 +162,7 @@ Namespace Methods.GlobalIndexer.ImportFile
' Now make the call to the database
Dim oSuccess = Helpers.SetAttributeValue(Connection, Transaction, pObjectId, oAttribute.Key, oValue, User.Language, User.UserName)
If oSuccess Then
- Logger.Info("Attribute [{0}] written with value [{1}]", oAttribute.Key, oAttribute.Value.First())
+ Logger.Info("Attribute written [{0}] => [{1}]", oAttribute.Key, oAttribute.Value.First())
Else
Logger.Warn("Attribute value could not be written")
End If
diff --git a/Service.EDMIService/Methods/GlobalIndexer/ImportFile/Steps/AutomaticIndexing.vb b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/Steps/AutomaticIndexing.vb
index f5110e6c..cedf6633 100644
--- a/Service.EDMIService/Methods/GlobalIndexer/ImportFile/Steps/AutomaticIndexing.vb
+++ b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/Steps/AutomaticIndexing.vb
@@ -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
'''
@@ -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
}
diff --git a/Service.EDMIService/Methods/GlobalIndexer/ImportFile/Steps/PostProcessing.vb b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/Steps/PostProcessing.vb
index 940891f0..650cde8a 100644
--- a/Service.EDMIService/Methods/GlobalIndexer/ImportFile/Steps/PostProcessing.vb
+++ b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/Steps/PostProcessing.vb
@@ -9,36 +9,35 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
Public Const TYPE_VBREPLACE = "VBREPLACE"
Public Const TYPE_REGEXPRESSION = "REG. EXPRESSION"
- Private PostprocessingSteps As DataTable
+ Private PostprocessingSteps As List(Of PostProcessingStep)
- Public Sub New(pLogConfig As LogConfig, pPostProcessingSteps As DataTable)
+ Public Sub New(pLogConfig As LogConfig, pPostProcessingSteps As List(Of PostProcessingStep))
MyBase.New(pLogConfig)
PostprocessingSteps = pPostProcessingSteps
- Logger.Info("Starting Postprocessing of Manual Indexes")
+ Logger.Info("Initializing Postprocessing of Manual Indexes")
End Sub
Public Function ApplyManualPostprocessing(pManualAttributes As List(Of UserAttributeValue)) As List(Of UserAttributeValue)
+ Logger.Debug("Start of Method [ApplyManualPostprocessing]")
Dim oAttributes = pManualAttributes
Try
- Logger.Debug("Start of Method [ApplyManualPostprocessing]")
-
If PostprocessingSteps Is Nothing Then
Logger.Debug("No Postprocessing steps found. Exiting.")
Return oAttributes
End If
- For Each oProcessingRow As DataRow In PostprocessingSteps.Rows
- Dim oIndexId = oProcessingRow.ItemEx(Of Integer)("IDXMAN_ID")
+ For Each oStep As PostProcessingStep In PostprocessingSteps
+ Dim oIndexId = oStep.IndexId
Dim oIndex As UserAttributeValue = pManualAttributes.
- Where(Function(attr) attr.Id = oProcessingRow.ItemEx(Of Integer)("IDXMAN_ID")).
+ Where(Function(attr) attr.Id = oStep.IndexId).
FirstOrDefault()
Dim oIndexPosition = pManualAttributes.IndexOf(oIndex)
Logger.Info("Postprocessing Index [{0}]", oIndex.Name)
- Dim oValues = GetPostprocessingValue(oIndex.Values, oProcessingRow)
+ Dim oValues = GetPostprocessingValue(oIndex.Values, oStep)
Logger.Info("New Value for Index [{0}] is [{1}]", oIndex.Name, String.Join(",", oValues))
@@ -60,18 +59,17 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
End Try
End Function
- Public Function GetPostprocessingValue(pValues As List(Of String), pRow As DataRow) As List(Of String)
+ Public Function GetPostprocessingValue(pValues As List(Of String), pStep As PostProcessingStep) As List(Of String)
Logger.Debug("Start of Method [GetPostprocessingValue]")
- Dim oType = pRow.Item("TYPE")
Dim oResult As New List(Of String)
- Logger.Debug("Type of Postprocessing is [{0}]", oType)
+ Logger.Debug("Type of Postprocessing is [{0}]", pStep.Type)
- Select Case oType
+ Select Case pStep.Type
Case TYPE_VBREPLACE
- Dim oFindString = pRow.Item("TEXT1")
- Dim oReplaceString = pRow.Item("TEXT2")
+ Dim oFindString = pStep.Text1
+ Dim oReplaceString = pStep.Text2
Logger.Debug("Replacing [{0}] with [{1}]", oFindString, oReplaceString)
@@ -87,9 +85,9 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
Next
Case TYPE_VBSPLIT
- Dim oSeparator As String = pRow.Item("TEXT1")
+ Dim oSeparator As String = pStep.Text1
Dim oSplitIndex As Integer = 0
- Integer.TryParse(pRow.Item("TEXT2"), oSplitIndex)
+ Integer.TryParse(pStep.Text1, oSplitIndex)
Logger.Debug("Splitting String at Separator [{0}] and Index [{1}]", oSeparator, oSplitIndex)
@@ -108,7 +106,7 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
Next
Case Else
- Logger.Warn("Postprocessing type [{0}] is not supported!", oType)
+ Logger.Warn("Postprocessing type [{0}] is not supported!", pStep.Type)
End Select
diff --git a/Service.EDMIService/Methods/GlobalIndexer/Loader.vb b/Service.EDMIService/Methods/GlobalIndexer/Loader.vb
index faba5096..f6b6e773 100644
--- a/Service.EDMIService/Methods/GlobalIndexer/Loader.vb
+++ b/Service.EDMIService/Methods/GlobalIndexer/Loader.vb
@@ -143,7 +143,7 @@ Namespace Methods.GlobalIndexer
End Try
End Function
- Public Function LoadPostProcessingSteps(pManualIndexes As List(Of ManualIndex)) As DataTable
+ Public Function LoadPostProcessingSteps(pManualIndexes As List(Of ManualIndex)) As List(Of PostProcessingStep)
Logger.Debug("Start of Method [LoadPostProcessingSteps]")
Try
@@ -169,7 +169,26 @@ Namespace Methods.GlobalIndexer
LogAndThrow(oPostProcessingSteps.ErrorMessage)
End If
- Return oPostProcessingSteps.Table
+ Dim oSteps As New List(Of PostProcessingStep)
+
+ For Each oRow As DataRow In oPostProcessingSteps.Table.Rows
+ Dim oStep As New PostProcessingStep With {
+ .Id = oRow.ItemEx(Of Integer)("GUID"),
+ .IndexId = oRow.ItemEx(Of Integer)("IDXMAN_ID"),
+ .[Variant] = oRow.ItemEx(Of String)("VARIANT"),
+ .Type = oRow.ItemEx(Of String)("TYPE"),
+ .Function1 = oRow.ItemEx(Of String)("FUNCTION1"),
+ .Function2 = oRow.ItemEx(Of String)("FUNCTION2"),
+ .Text1 = oRow.ItemEx(Of String)("Text1"),
+ .Text2 = oRow.ItemEx(Of String)("Text2"),
+ .Text3 = oRow.ItemEx(Of String)("Text3"),
+ .Sequence = oRow.ItemEx(Of Integer)("SEQUENCE")
+ }
+
+ oSteps.Add(oStep)
+ Next
+
+ Return oSteps
Catch ex As Exception
LogAndThrow(ex, "Error while loading post processing steps!")
Return Nothing
diff --git a/Service.EDMIService/Methods/GlobalIndexer/PostProcessingStep.vb b/Service.EDMIService/Methods/GlobalIndexer/PostProcessingStep.vb
new file mode 100644
index 00000000..fe1a4873
--- /dev/null
+++ b/Service.EDMIService/Methods/GlobalIndexer/PostProcessingStep.vb
@@ -0,0 +1,17 @@
+Namespace Methods.GlobalIndexer
+ Public Class PostProcessingStep
+ Public Id As Integer
+ Public IndexId As Integer
+ Public [Variant] As String
+
+ Public Type As String
+ Public Function1 As String
+ Public Function2 As String
+ Public Text1 As String
+ Public Text2 As String
+ Public Text3 As String
+
+ Public Sequence As Integer
+ End Class
+End Namespace
+