15-12-2022
This commit is contained in:
@@ -138,42 +138,16 @@ Public Class State
|
||||
For Each oRow As DataRow In oTable.Rows
|
||||
Dim oTypeId = oRow.ItemEx("PROFILE_ID", 0)
|
||||
|
||||
Dim oScope As ImportProfileStep.StepScope
|
||||
Select Case oRow.ItemEx("SCOPE", "FILE")
|
||||
Case "FOLDER"
|
||||
oScope = ImportProfileStep.StepScope.FOLDER
|
||||
Case "FILE"
|
||||
oScope = ImportProfileStep.StepScope.FILE
|
||||
End Select
|
||||
|
||||
Dim oMethod As ImportProfileStep.StepMethod
|
||||
Select Case oRow.ItemEx("METHOD", "ALL")
|
||||
Case "SUBSTRING"
|
||||
oScope = ImportProfileStep.StepMethod.SUBSTRING
|
||||
|
||||
Case "SPLIT"
|
||||
oScope = ImportProfileStep.StepMethod.SPLIT
|
||||
|
||||
Case "REGEX"
|
||||
oScope = ImportProfileStep.StepMethod.REGEX
|
||||
|
||||
Case "STATIC"
|
||||
oScope = ImportProfileStep.StepMethod.VALUE
|
||||
|
||||
Case Else
|
||||
oScope = ImportProfileStep.StepMethod.ALL
|
||||
End Select
|
||||
|
||||
Dim oStep As New ImportProfileStep With {
|
||||
.Id = oRow.ItemEx("GUID", 0),
|
||||
.ProfileId = oRow.ItemEx("PROFILE_ID", 0),
|
||||
.IndexName = oRow.Item("IDX_NAME"),
|
||||
.Method = oMethod,
|
||||
.Argument1 = oRow.ItemEx("ARGUMENT1", ""),
|
||||
.Argument2 = oRow.ItemEx("ARGUMENT2", ""),
|
||||
.Argument3 = oRow.ItemEx("ARGUMENT3", ""),
|
||||
.Scope = oScope,
|
||||
.Active = oRow.ItemEx("ACTIVE", 0)
|
||||
.Active = oRow.ItemEx("ACTIVE", 0),
|
||||
.Method = oRow.ItemEx("METHOD", "ALL"),
|
||||
.Scope = oRow.ItemEx("SCOPE", "FILE")
|
||||
}
|
||||
|
||||
oSteps.Add(oStep)
|
||||
@@ -207,7 +181,6 @@ Public Class State
|
||||
Logger.Info("[{0}] Import Profiles loaded!", oTable.Rows.Count)
|
||||
|
||||
For Each oRow As DataRow In oTable.Rows
|
||||
Dim oTypeId = oRow.ItemEx("JOB_TYPE_ID", 0)
|
||||
Dim oProfile As New ImportProfile With {
|
||||
.Id = oRow.ItemEx("GUID", 0),
|
||||
.JobId = oRow.ItemEx("JR_JOB_ID", 0),
|
||||
@@ -222,12 +195,23 @@ Public Class State
|
||||
.Active = oRow.ItemEx("ACTIVE", 0)
|
||||
}
|
||||
|
||||
Logger.Debug("ProfileId: [{0}]", oProfile.Id)
|
||||
Logger.Debug("JobId: [{0}]", oProfile.JobId)
|
||||
Logger.Debug("ObjectType: [{0}]", oProfile.ObjectTypeName)
|
||||
Logger.Debug("SourceFolder: [{0}]", oProfile.SourceFolder)
|
||||
Logger.Debug("TargetFolder: [{0}]", oProfile.TargetFolder)
|
||||
|
||||
|
||||
oProfiles.Add(oProfile)
|
||||
|
||||
Logger.Debug("Adding Import Profile for Folder [{0}]", oProfile.SourceFolder)
|
||||
Next
|
||||
|
||||
Return oProfiles
|
||||
Return oProfiles.
|
||||
Select(Function(p) FillJobForProfile(p, JobDefinitions)).
|
||||
Select(Function(p) FillStepsForProfile(p, ProfileDefintions.ImportProfileSteps)).
|
||||
Select(Function(p) FillObjectTypeForProfile(p, ObjectTypes)).
|
||||
ToList()
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
@@ -236,6 +220,33 @@ Public Class State
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function FillJobForProfile(pProfile As ImportProfile, pJobDefinitions As List(Of JobDefinition)) As ImportProfile
|
||||
Dim oJob = pJobDefinitions.
|
||||
Where(Function(job) job.Id = pProfile.JobId).
|
||||
FirstOrDefault()
|
||||
|
||||
pProfile.Job = oJob
|
||||
Return pProfile
|
||||
End Function
|
||||
|
||||
Private Function FillObjectTypeForProfile(pProfile As ImportProfile, pObjectTypes As List(Of ObjectType)) As ImportProfile
|
||||
Dim oObjectType = pObjectTypes.
|
||||
Where(Function(t) t.Name = pProfile.ObjectTypeName).
|
||||
FirstOrDefault()
|
||||
|
||||
pProfile.ObjectType = oObjectType
|
||||
Return pProfile
|
||||
End Function
|
||||
|
||||
Private Function FillStepsForProfile(pProfile As ImportProfile, pProfileSteps As List(Of ImportProfileStep)) As ImportProfile
|
||||
Dim oSteps = pProfileSteps.
|
||||
Where(Function(s) s.ProfileId = pProfile.Id).
|
||||
ToList()
|
||||
|
||||
pProfile.Steps = oSteps
|
||||
Return pProfile
|
||||
End Function
|
||||
|
||||
Private Function GetJobDefinitions(pJobTypes As List(Of JobType)) As List(Of JobDefinition)
|
||||
Dim oJobs As New List(Of JobDefinition)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user