EDMIService: First working version of ImportFile
This commit is contained in:
@@ -33,24 +33,29 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
|
||||
End If
|
||||
|
||||
Logger.Info("Processing [{0}] automatic indexes", AutomaticIndexes.Count)
|
||||
Dim oAttributes As List(Of UserAttributeValue) = pUserAttributes
|
||||
Dim oUserAttributes As List(Of UserAttributeValue) = pUserAttributes
|
||||
Dim oAutoAttributes As New List(Of UserAttributeValue)
|
||||
|
||||
For Each oAutomaticIndex In AutomaticIndexes
|
||||
' 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.
|
||||
Dim oAttribute = ApplyAutomaticIndex(oAutomaticIndex, pFileInfo, pUserState, oAttributes)
|
||||
Dim oAttribute = ApplyAutomaticIndex(oAutomaticIndex, pFileInfo, pUserState, oUserAttributes, oAutoAttributes)
|
||||
|
||||
If oAttribute IsNot Nothing Then
|
||||
Logger.Info("Adding Attribute [{0}]", oAttribute)
|
||||
oAttributes.Add(oAttribute)
|
||||
Logger.Debug("Adding Attribute [{0}]", oAttribute)
|
||||
oAutoAttributes.Add(oAttribute)
|
||||
End If
|
||||
Next
|
||||
|
||||
Return oAttributes
|
||||
oUserAttributes.AddRange(oAutoAttributes)
|
||||
Return oUserAttributes
|
||||
End Function
|
||||
|
||||
|
||||
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),
|
||||
pAutoAttributes As List(Of UserAttributeValue)) As UserAttributeValue
|
||||
Try
|
||||
Dim oAttributeDict = pAttributes.ToDictionary(
|
||||
Function(attr) attr.AttributeName,
|
||||
@@ -77,6 +82,8 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
|
||||
Dim oConnectionString As String = GlobalState.GetConnectionString(pAutomaticIndex.SQLConnectionId)
|
||||
Dim oFinalSQLCommand = pAutomaticIndex.SQLCommand
|
||||
|
||||
' TODO: Dont show the unmasked conn string
|
||||
Logger.Debug("SQL Connection String is: [{0}]", oConnectionString)
|
||||
Logger.Debug("SQL Command is: [{0}]", oFinalSQLCommand)
|
||||
|
||||
oFinalSQLCommand = GetPlaceholderValue(oFinalSQLCommand, pFileInfo, pUserState, oAttributeDict)
|
||||
@@ -109,11 +116,12 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
|
||||
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
|
||||
|
||||
|
||||
oResult = Patterns.ReplaceInternalValues(oResult)
|
||||
oResult = Patterns.ReplaceFileValues(oResult, pFileInfo)
|
||||
oResult = Patterns.ReplaceUserValues(oResult, pUserState)
|
||||
oResult = Patterns.ReplaceGlobixValues(oResult, pAttributes)
|
||||
|
||||
' TODO: Get the automatic indexes in here too
|
||||
oResult = Patterns.ReplaceGlobixValues(oResult, New Dictionary(Of String, List(Of String)), pAttributes)
|
||||
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user