EDMIService: WIP
This commit is contained in:
@@ -12,9 +12,6 @@ Namespace Methods.GlobalIndexer.ImportFile
|
||||
Private ReadOnly GetDatatable As GetDatatableFromCacheMethod
|
||||
|
||||
Private Profile As DataRow
|
||||
Private ManualIndexes As List(Of ManualIndex)
|
||||
Private AutomaticIndexes As List(Of AutomaticIndex)
|
||||
Private ManualIndexesPostProcessing As DataTable
|
||||
|
||||
Private Const VIEW_PROFILE = "VWGI_DOCTYPE_IDB"
|
||||
Private Const VIEW_INDEX_MANUAL = "VWDDINDEX_MAN"
|
||||
@@ -41,7 +38,9 @@ Namespace Methods.GlobalIndexer.ImportFile
|
||||
' TODO: Add missing user properties in UserState from TBDD_USER
|
||||
'pData.User = ResolveUserFromUserName(pData.User.UserName)
|
||||
|
||||
LoadIndexes(pData.ProfileId)
|
||||
Dim oManualIndexes = LoadManualIndexes(pData.ProfileId)
|
||||
Dim oAutomaticIndexes = LoadAutomaticIndexes(pData.ProfileId)
|
||||
Dim oPostProcessingSteps As DataTable = LoadPostProcessingSteps(oManualIndexes)
|
||||
LoadProfile(pData.ProfileId)
|
||||
|
||||
|
||||
@@ -49,13 +48,11 @@ Namespace Methods.GlobalIndexer.ImportFile
|
||||
Dim oFileName As String = GetFilenameByNameconvention(pData.File.FileName, Profile.Item("NAMENKONVENTION"))
|
||||
|
||||
' Apply post processing
|
||||
Dim oPostProcessing = New Steps.PostProcessing(LogConfig, ManualIndexesPostProcessing)
|
||||
Dim oPostProcessing = New Steps.PostProcessing(LogConfig, oPostProcessingSteps)
|
||||
oFinalAttributes = oPostProcessing.ApplyManualPostprocessing(oFinalAttributes)
|
||||
|
||||
' Apply automatic attributes
|
||||
Dim oAutomaticIndexing = New Steps.AutomaticIndexing(LogConfig, Database, AutomaticIndexes, GlobalState)
|
||||
|
||||
|
||||
Dim oAutomaticIndexing = New Steps.AutomaticIndexing(LogConfig, Database, oAutomaticIndexes, GlobalState)
|
||||
oFinalAttributes = oAutomaticIndexing.ApplyAutomaticeAttributes(oFinalAttributes, pData.File.FileInfoRaw, pData.User)
|
||||
|
||||
' Import the file
|
||||
@@ -69,6 +66,7 @@ Namespace Methods.GlobalIndexer.ImportFile
|
||||
})
|
||||
|
||||
If oResponse.OK Then
|
||||
Logger.Info("Import of file [{0}] under ObjectId [{1}] successful!", pData.File.FileName, oResponse.ObjectId)
|
||||
Return New ImportFileResponse(oResponse.ObjectId)
|
||||
Else
|
||||
Throw New ApplicationException(oResponse.ErrorMessage)
|
||||
@@ -87,14 +85,6 @@ Namespace Methods.GlobalIndexer.ImportFile
|
||||
Return pFileName
|
||||
End Function
|
||||
|
||||
Private Sub LoadIndexes(pProfileId As Integer)
|
||||
Logger.Debug("Start of Method [LoadIndexes]")
|
||||
|
||||
LoadManualIndexes(pProfileId)
|
||||
LoadAutomaticIndexes(pProfileId)
|
||||
LoadPostProcessingSteps()
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Load Profiles for this Import
|
||||
''' </summary>
|
||||
@@ -118,15 +108,18 @@ Namespace Methods.GlobalIndexer.ImportFile
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub LoadAutomaticIndexes(pProfileId As Integer)
|
||||
''' <summary>
|
||||
''' Load automatic indexes for this Import
|
||||
''' </summary>
|
||||
Private Function LoadAutomaticIndexes(pProfileId As Integer) As List(Of AutomaticIndex)
|
||||
Logger.Debug("Start of Method [LoadAutomaticIndexes]")
|
||||
|
||||
Try
|
||||
' Load automatic Indexes for this Import
|
||||
Dim oAutomaticIndexes = GetDatatable.Run(
|
||||
New GetDatatableFromCacheRequest With {
|
||||
.DataTable = VIEW_INDEX_MANUAL,
|
||||
.FilterExpression = $"DOK_ID = {pProfileId}"
|
||||
.DataTable = VIEW_INDEX_AUTOMATIC,
|
||||
.FilterExpression = $"DOCTYPE_ID = {pProfileId}"
|
||||
})
|
||||
|
||||
If oAutomaticIndexes.OK = False Then
|
||||
@@ -145,15 +138,22 @@ Namespace Methods.GlobalIndexer.ImportFile
|
||||
.Sequence = oRow.ItemEx(Of String)("SEQUENCE"),
|
||||
.Value = oRow.ItemEx(Of String)("VALUE")
|
||||
}
|
||||
|
||||
oIndexes.Add(oAutomaticIndex)
|
||||
Next
|
||||
|
||||
AutomaticIndexes = oIndexes
|
||||
Logger.Info("[{0}] automatic indexes loaded.", oIndexes)
|
||||
|
||||
Return oIndexes
|
||||
Catch ex As Exception
|
||||
LogAndThrow(ex, "Error while automatic loading indexes!")
|
||||
End Try
|
||||
End Sub
|
||||
End Function
|
||||
|
||||
Private Sub LoadManualIndexes(pProfileId As Integer)
|
||||
''' <summary>
|
||||
''' Load manual indexes for this Import
|
||||
''' </summary>
|
||||
Private Function LoadManualIndexes(pProfileId As Integer) As List(Of ManualIndex)
|
||||
Logger.Debug("Start of Method [LoadManualIndexes]")
|
||||
|
||||
Try
|
||||
@@ -182,23 +182,32 @@ Namespace Methods.GlobalIndexer.ImportFile
|
||||
.DefaultValue = oRow.ItemEx(Of String)("DEFAULT_VALUE"),
|
||||
.DataType = oRow.ItemEx(Of String)("DATA_TYPE")
|
||||
}
|
||||
|
||||
oIndexes.Add(oManualIndex)
|
||||
Next
|
||||
|
||||
ManualIndexes = oIndexes
|
||||
Return oIndexes
|
||||
|
||||
Catch ex As Exception
|
||||
LogAndThrow(ex, "Error while loading indexes!")
|
||||
End Try
|
||||
End Sub
|
||||
End Function
|
||||
|
||||
Private Sub LoadPostProcessingSteps()
|
||||
Private Function LoadPostProcessingSteps(pManualIndexes As List(Of ManualIndex)) As DataTable
|
||||
Logger.Debug("Start of Method [LoadPostProcessingSteps]")
|
||||
|
||||
Try
|
||||
' Generate a string containing all index ids joined into a string
|
||||
Dim oIndexIdList As List(Of Integer) = ManualIndexes.Select(Function(index) index.Id).ToList()
|
||||
Dim oIndexIdList As List(Of Integer) = pManualIndexes.
|
||||
Select(Function(index) index.Id).
|
||||
ToList()
|
||||
Dim oIndexIds As String = String.Join(",", oIndexIdList)
|
||||
|
||||
If oIndexIdList.Count = 0 Then
|
||||
Logger.Debug("No Postprocessing steps found for this profile. Exiting.")
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
' Load all relevant postprocessing steps
|
||||
Dim oPostProcessingSteps = GetDatatable.Run(
|
||||
New GetDatatableFromCacheRequest With {
|
||||
@@ -210,11 +219,11 @@ Namespace Methods.GlobalIndexer.ImportFile
|
||||
LogAndThrow(oPostProcessingSteps.ErrorMessage)
|
||||
End If
|
||||
|
||||
ManualIndexesPostProcessing = oPostProcessingSteps.Table
|
||||
Return oPostProcessingSteps.Table
|
||||
Catch ex As Exception
|
||||
LogAndThrow(ex, "Error while loading post processing steps!")
|
||||
End Try
|
||||
End Sub
|
||||
End Function
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
Reference in New Issue
Block a user