EDMIService: Turn Postprocessing Steps into list
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user