EDMIService: WIP
This commit is contained in:
@@ -14,33 +14,53 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
|
||||
Public Sub New(pLogConfig As LogConfig, pPostProcessingSteps As DataTable)
|
||||
MyBase.New(pLogConfig)
|
||||
PostprocessingSteps = pPostProcessingSteps
|
||||
|
||||
Logger.Info("Starting 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
|
||||
|
||||
For Each oProcessingRow As DataRow In PostprocessingSteps.Rows
|
||||
Try
|
||||
Logger.Debug("Start of Method [ApplyManualPostprocessing]")
|
||||
|
||||
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()
|
||||
If PostprocessingSteps Is Nothing Then
|
||||
Logger.Debug("No Postprocessing steps found. Exiting.")
|
||||
Return oAttributes
|
||||
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 {
|
||||
.AttributeId = oIndexId,
|
||||
.AttributeName = oIndex.AttributeName,
|
||||
.AttributeValues = oIndex.AttributeValues,
|
||||
.ControlName = oIndex.ControlName
|
||||
})
|
||||
Next
|
||||
Logger.Info("Postprocessing Index [{0}]", oIndex.AttributeName)
|
||||
|
||||
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
|
||||
|
||||
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]")
|
||||
|
||||
Dim oType = pRow.Item("TYPE")
|
||||
@@ -88,7 +108,8 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
|
||||
Next
|
||||
|
||||
Case Else
|
||||
LogAndThrow($"Postprocessing type [{oType}] is not supported!")
|
||||
Logger.Warn("Postprocessing type [{0}] is not supported!", oType)
|
||||
|
||||
End Select
|
||||
|
||||
Return oResult
|
||||
|
||||
Reference in New Issue
Block a user