Zooflow: EDMI Service WIP

This commit is contained in:
Jonathan Jenne
2021-12-02 16:23:00 +01:00
parent 77621193f2
commit 34517ce209
16 changed files with 240 additions and 50 deletions

View File

@@ -8,14 +8,15 @@ Namespace Methods.GlobalIndexer.ImportFile
Public Class ImportFileMethod
Inherits BaseMethod
Private ReadOnly TableStore As DataSet
Private ReadOnly Patterns As Patterns2
Private ReadOnly GetDatatable As GetDatatableFromCacheMethod
Private Profile As DataRow
Private ManualIndexes As DataTable
Private AutomaticIndexes As DataTable
Private ManualIndexesPostProcessing As DataTable
Private Const VIEW_PROFILE = "VWGI_DOCTYPE_IDB"
Private Const VIEW_INDEX_MANUAL = "VWDDINDEX_MAN"
Private Const VIEW_INDEX_AUTOMATIC = "VWDDINDEX_AUTOM"
Private Const TABLE_POST_PROCESSING = "TBDD_INDEX_MAN_POSTPROCESSING"
@@ -24,12 +25,11 @@ Namespace Methods.GlobalIndexer.ImportFile
Private Const TYPE_VBREPLACE = "VBREPLACE"
Private Const TYPE_REGEXPRESSION = "REG. EXPRESSION"
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pTableStore As DataSet)
MyBase.New(pLogConfig, pMSSQLServer)
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pGlobalState As GlobalState)
MyBase.New(pLogConfig, pMSSQLServer, pGlobalState)
TableStore = pTableStore
Patterns = New Patterns2(pLogConfig)
GetDatatable = New GetDatatableFromCacheMethod(LogConfig, Database, TableStore)
GetDatatable = New GetDatatableFromCacheMethod(LogConfig, Database, GlobalState)
End Sub
''' <summary>
@@ -43,8 +43,10 @@ Namespace Methods.GlobalIndexer.ImportFile
Public Function Run(pData As ImportFileRequest)
Try
LoadIndexes(pData.ProfileId)
LoadProfile(pData.ProfileId)
Dim oFinalAttributes = pData.AttributeValues
Dim oFileName As String = GetFilenameByNameconvention(pData.File.FileName, Profile.Item("NAMENKONVENTION"))
' apply the post processing
oFinalAttributes = ApplyManualPostprocessing(oFinalAttributes, ManualIndexesPostProcessing)
@@ -52,6 +54,22 @@ Namespace Methods.GlobalIndexer.ImportFile
' TODO: apply the manual attributes
oFinalAttributes = ApplyAutomaticeAttributes(oFinalAttributes)
' Import the file
Dim oNewFile As New NewFileMethod(LogConfig, Database, GlobalState)
Dim oResponse = oNewFile.Run(New NewFile.NewFileRequest With {
.File = pData.File,
.BusinessEntity = pData.BusinessEntity,
.KindType = pData.KindType,
.Language = pData.Language,
.Who = pData.Who,
.StoreName = pData.StoreName
})
If oResponse.OK Then
Return New ImportFileResponse(oResponse.ObjectId)
Else
Throw New ApplicationException(oResponse.ErrorMessage)
End If
Catch ex As Exception
Return New ImportFileResponse(ex)
@@ -141,6 +159,12 @@ Namespace Methods.GlobalIndexer.ImportFile
End Select
Return oResult
End Function
Private Function GetFilenameByNameconvention(pFileName As String, pNameconvention As String) As String
End Function
Private Sub LoadIndexes(pProfileId As Integer)
@@ -151,6 +175,29 @@ Namespace Methods.GlobalIndexer.ImportFile
LoadPostProcessingSteps()
End Sub
''' <summary>
''' Load Profiles for this Import
''' </summary>
Private Sub LoadProfile(pProfileId As Integer)
Logger.Debug("Start of Method [LoadAutomaticIndexes]")
Try
Dim oProfile = GetDatatable.Run(
New GetDatatableFromCacheRequest With {
.DataTable = VIEW_PROFILE,
.FilterExpression = $"DOCTYPE_ID = {pProfileId}"
})
If oProfile.OK = False Then
LogAndThrow(oProfile.ErrorMessage)
End If
Profile = oProfile.Table.Rows.Item(0)
Catch ex As Exception
LogAndThrow(ex, "Error while automatic loading indexes!")
End Try
End Sub
Private Sub LoadAutomaticIndexes(pProfileId As Integer)
Logger.Debug("Start of Method [LoadAutomaticIndexes]")
@@ -175,7 +222,6 @@ Namespace Methods.GlobalIndexer.ImportFile
Private Sub LoadManualIndexes(pProfileId As Integer)
Logger.Debug("Start of Method [LoadManualIndexes]")
Try
' Load manual Indexes for this Import
Dim oManualIndexes = GetDatatable.Run(