Zooflow: EDMI Service WIP
This commit is contained in:
@@ -5,8 +5,8 @@ Namespace Methods.GetAttributeValue
|
||||
Public Class GetAttributeValueMethod
|
||||
Inherits BaseMethod
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer)
|
||||
MyBase.New(pLogConfig, pDatabase)
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pGlobalState As GlobalState)
|
||||
MyBase.New(pLogConfig, pDatabase, pGlobalState)
|
||||
End Sub
|
||||
|
||||
Public Function Run(pData As GetAttributeValueRequest) As GetAttributeValueResponse
|
||||
|
||||
@@ -6,11 +6,8 @@ Namespace Methods.GetDatatableFromCache
|
||||
Public Class GetDatatableFromCacheMethod
|
||||
Inherits BaseMethod
|
||||
|
||||
Private ReadOnly TableStore As DataSet
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pTableStore As DataSet)
|
||||
MyBase.New(pLogConfig, pMSSQLServer)
|
||||
TableStore = pTableStore
|
||||
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pGlobalState As GlobalState)
|
||||
MyBase.New(pLogConfig, pMSSQLServer, pGlobalState)
|
||||
End Sub
|
||||
|
||||
Public Function Run(pData As GetDatatableFromCacheRequest) As GetDatatableFromCacheResponse
|
||||
@@ -19,10 +16,10 @@ Namespace Methods.GetDatatableFromCache
|
||||
|
||||
Dim oDataTable As DataTable = Nothing
|
||||
|
||||
Logger.Debug("ReturnDatatableFromCache: DataSet contains [{0}] datatables", TableStore.Tables.Count)
|
||||
Logger.Debug("ReturnDatatableFromCache: DataSet contains [{0}] datatables", GlobalState.TableStore.Tables.Count)
|
||||
|
||||
If TableStore.Tables.Contains(pData.DataTable) Then
|
||||
oDataTable = TableStore.Tables.Item(pData.DataTable).Copy()
|
||||
If GlobalState.TableStore.Tables.Contains(pData.DataTable) Then
|
||||
oDataTable = GlobalState.TableStore.Tables.Item(pData.DataTable).Copy()
|
||||
|
||||
' Apply filter and sorting to data
|
||||
Dim oFilterExpression As String = Utils.NotNull(pData.FilterExpression, String.Empty)
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -15,6 +15,24 @@ Namespace Methods.GlobalIndexer.ImportFile
|
||||
''' </summary>
|
||||
Public Property ProfileId As Integer
|
||||
|
||||
''' <summary>
|
||||
''' The business entity of the file, ex DEFAULT
|
||||
''' </summary>
|
||||
<DataMember>
|
||||
Public Property BusinessEntity As String
|
||||
|
||||
''' <summary>
|
||||
''' The kind of object to be created, ex. DOC
|
||||
''' </summary>
|
||||
<DataMember>
|
||||
Public Property KindType As String
|
||||
|
||||
''' <summary>
|
||||
''' Name/title of the ObjectStore to save the file to, ex. Work
|
||||
''' </summary>
|
||||
<DataMember>
|
||||
Public Property StoreName As String
|
||||
|
||||
''' <summary>
|
||||
''' The attribute values given by the user in the form of
|
||||
''' Attribute Name/Attribute Value/ControlName
|
||||
|
||||
@@ -8,13 +8,11 @@ Imports DigitalData.Services.EDMIService.GlobalState
|
||||
Public Class NewFileMethod
|
||||
Inherits BaseMethod
|
||||
|
||||
Private ReadOnly ObjectStores As List(Of ObjectStore)
|
||||
Private ReadOnly Connection As SqlConnection
|
||||
Private ReadOnly Transaction As SqlTransaction
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pObjectStores As List(Of ObjectStore))
|
||||
MyBase.New(pLogConfig, pMSSQLServer)
|
||||
ObjectStores = pObjectStores
|
||||
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pGlobalState As GlobalState)
|
||||
MyBase.New(pLogConfig, pMSSQLServer, pGlobalState)
|
||||
|
||||
Connection = Database.GetConnection()
|
||||
Transaction = Connection.BeginTransaction()
|
||||
@@ -37,7 +35,7 @@ Public Class NewFileMethod
|
||||
|
||||
' Find ObjectStore by Title
|
||||
Logger.Debug("Checking for DataStore [{0}].", pData.StoreName)
|
||||
Dim oStore = ObjectStores.
|
||||
Dim oStore = GlobalState.ObjectStores.
|
||||
Where(Function(store) store.Title.Equals(pData.StoreName, StringComparison.OrdinalIgnoreCase)).
|
||||
SingleOrDefault()
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ Namespace Methods.SetAttributeValue
|
||||
Private Connection As SqlConnection
|
||||
Private Transaction As SqlTransaction
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer)
|
||||
MyBase.New(pLogConfig, pDatabase)
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pGlobalState As GlobalState)
|
||||
MyBase.New(pLogConfig, pDatabase, pGlobalState)
|
||||
|
||||
Connection = Database.GetConnection()
|
||||
Transaction = Connection.BeginTransaction()
|
||||
|
||||
Reference in New Issue
Block a user