Zooflow: EDMI Service WIP
This commit is contained in:
parent
77621193f2
commit
34517ce209
@ -176,6 +176,59 @@ Public Class Client
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
'Public Function ImportFileAsync(pFilePath As String, pObjectStoreName As String, pObjectKind As String, pBusinessEntity As String, Optional pImportOptions As NewFileOptions = Nothing)
|
||||||
|
' Try
|
||||||
|
' ' Set default options
|
||||||
|
' If pImportOptions Is Nothing Then
|
||||||
|
' pImportOptions = New NewFileOptions()
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' ' Check if file exists
|
||||||
|
' If File.Exists(pFilePath) = False Then
|
||||||
|
' Throw New FileNotFoundException("Path does not exist")
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' Dim oFileInfo As New FileInfo(pFilePath)
|
||||||
|
' Dim oExtension As String = oFileInfo.Extension
|
||||||
|
|
||||||
|
' Dim oFileName As String = oFileInfo.Name
|
||||||
|
' Dim oFileCreatedAt As Date = oFileInfo?.CreationTime
|
||||||
|
' Dim oFileModifiedAt As Date = oFileInfo?.LastWriteTime
|
||||||
|
' Dim oFileHash As String = _FileEx.GetChecksum(oFileInfo.FullName)
|
||||||
|
|
||||||
|
' ' Importing the file now
|
||||||
|
' Using oFileStream As New FileStream(pFilePath, FileMode.Open, FileAccess.Read)
|
||||||
|
' Using oMemoryStream As New MemoryStream()
|
||||||
|
' oFileStream.CopyTo(oMemoryStream)
|
||||||
|
' Dim oContents = oMemoryStream.ToArray()
|
||||||
|
|
||||||
|
' Dim oFileImportResponse = Await _channel.NewFIleAsync (New NewFileRequest With {
|
||||||
|
' .BusinessEntity = pBusinessEntity,
|
||||||
|
' .File = New FileProperties With {
|
||||||
|
' .FileName = oFileInfo.Name,
|
||||||
|
' .FileCreatedAt = oFileCreatedAt,
|
||||||
|
' .FileChangedAt = oFileModifiedAt,
|
||||||
|
' .FileContents = oContents,
|
||||||
|
' .FileImportedAt = pImportOptions.DateImported,
|
||||||
|
' .FileChecksum = oFileHash
|
||||||
|
' },
|
||||||
|
' .KindType = pObjectKind,
|
||||||
|
' .StoreName = pObjectStoreName,
|
||||||
|
' .Who = pImportOptions.Username
|
||||||
|
' })
|
||||||
|
' If oFileImportResponse.OK = False Then
|
||||||
|
' Throw New ApplicationException("Could not Import File Contents!")
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' Return oFileImportResponse.ObjectId
|
||||||
|
' End Using
|
||||||
|
' End Using
|
||||||
|
' Catch ex As Exception
|
||||||
|
' _logger.Error(ex)
|
||||||
|
' Return INVALID_OBEJCT_ID
|
||||||
|
' End Try
|
||||||
|
'End Function
|
||||||
|
|
||||||
''' <summary>
|
''' <summary>
|
||||||
''' Sets a value to an attribute
|
''' Sets a value to an attribute
|
||||||
''' </summary>
|
''' </summary>
|
||||||
|
|||||||
@ -14,11 +14,9 @@ Namespace Modules
|
|||||||
|
|
||||||
Public Property PatternIdentifier As String = "CTRL" Implements IModule.PatternIdentifier
|
Public Property PatternIdentifier As String = "CTRL" Implements IModule.PatternIdentifier
|
||||||
Public Property IsComplex As Boolean = True Implements IModule.IsComplex
|
Public Property IsComplex As Boolean = True Implements IModule.IsComplex
|
||||||
Private ReadOnly Logger As Logger
|
|
||||||
|
|
||||||
Public Sub New(pLogConfig As LogConfig)
|
Public Sub New(pLogConfig As LogConfig)
|
||||||
MyBase.New(pLogConfig)
|
MyBase.New(pLogConfig)
|
||||||
Logger = pLogConfig.GetLogger()
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Function Replace(pInput As String, pReplaceMap As Dictionary(Of String, Object)) As String Implements IModule.Replace
|
Public Function Replace(pInput As String, pReplaceMap As Dictionary(Of String, Object)) As String Implements IModule.Replace
|
||||||
|
|||||||
55
Modules.Patterns/Modules/Globix.vb
Normal file
55
Modules.Patterns/Modules/Globix.vb
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
|
Namespace Modules
|
||||||
|
''' <summary>
|
||||||
|
''' Patterns for Generating a Filename in Global Indexer
|
||||||
|
''' </summary>
|
||||||
|
Public Class Globix
|
||||||
|
Inherits BaseModule
|
||||||
|
Implements IModule
|
||||||
|
|
||||||
|
Public Const GBX_VALUE_INDICIES = "GLOBIX_INDICIES"
|
||||||
|
|
||||||
|
Public Property PatternIdentifier As String = "GBX" Implements IModule.PatternIdentifier
|
||||||
|
Public Property IsComplex As Boolean = True Implements IModule.IsComplex
|
||||||
|
|
||||||
|
Public Sub New(pLogConfig As LogConfig)
|
||||||
|
MyBase.New(pLogConfig)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Function Replace(pInput As String, pReplaceMap As Dictionary(Of String, Object)) As String Implements IModule.Replace
|
||||||
|
Dim oResult = pInput
|
||||||
|
Dim oCounter = 0
|
||||||
|
Dim pIndexes As Dictionary(Of String, List(Of String)) = pReplaceMap.Item(GBX_VALUE_INDICIES)
|
||||||
|
|
||||||
|
While ContainsPattern(oResult, PatternIdentifier)
|
||||||
|
Try
|
||||||
|
Dim oIndexName As String = GetNextPattern(oResult, PatternIdentifier).Value
|
||||||
|
|
||||||
|
If pIndexes.ContainsKey(oIndexName) = False Then
|
||||||
|
Logger.Warn("Value for Index [{0}] does not exist and will not be used for replacing. Skipping.", oIndexName)
|
||||||
|
End If
|
||||||
|
|
||||||
|
' TODO: If Index contains multiple values, only the first value will be used as value
|
||||||
|
Dim oIndexValues As List(Of String) = pIndexes.Item(oIndexName)
|
||||||
|
Dim oFirstValue As String = oIndexValues.FirstOrDefault()
|
||||||
|
|
||||||
|
If oFirstValue Is Nothing Then
|
||||||
|
Logger.Warn("Value for Index [{0}] is empty and will not be used for replacing. Skipping.")
|
||||||
|
Return oResult
|
||||||
|
End If
|
||||||
|
|
||||||
|
oResult = ReplacePattern(oResult, PatternIdentifier, oFirstValue)
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
Logger.Error(ex)
|
||||||
|
Return oResult
|
||||||
|
Finally
|
||||||
|
IncrementCounterOrThrow(oCounter)
|
||||||
|
End Try
|
||||||
|
End While
|
||||||
|
|
||||||
|
Return oResult
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
@ -15,11 +15,8 @@ Namespace Modules
|
|||||||
Public Property PatternIdentifier As String = "IDB" Implements IModule.PatternIdentifier
|
Public Property PatternIdentifier As String = "IDB" Implements IModule.PatternIdentifier
|
||||||
Public Property IsComplex As Boolean = True Implements IModule.IsComplex
|
Public Property IsComplex As Boolean = True Implements IModule.IsComplex
|
||||||
|
|
||||||
Private ReadOnly Logger As Logger
|
|
||||||
|
|
||||||
Public Sub New(pLogConfig As LogConfig)
|
Public Sub New(pLogConfig As LogConfig)
|
||||||
MyBase.New(pLogConfig)
|
MyBase.New(pLogConfig)
|
||||||
Logger = pLogConfig.GetLogger()
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Function Replace(pInput As String, pReplaceMap As Dictionary(Of String, Object)) As String Implements IModule.Replace
|
Public Function Replace(pInput As String, pReplaceMap As Dictionary(Of String, Object)) As String Implements IModule.Replace
|
||||||
|
|||||||
@ -15,11 +15,8 @@ Namespace Modules
|
|||||||
Public Property PatternIdentifier As String = "WMI" Implements IModule.PatternIdentifier
|
Public Property PatternIdentifier As String = "WMI" Implements IModule.PatternIdentifier
|
||||||
Public Property IsComplex As Boolean = True Implements IModule.IsComplex
|
Public Property IsComplex As Boolean = True Implements IModule.IsComplex
|
||||||
|
|
||||||
Private ReadOnly Logger As Logger
|
|
||||||
|
|
||||||
Public Sub New(pLogConfig As LogConfig)
|
Public Sub New(pLogConfig As LogConfig)
|
||||||
MyBase.New(pLogConfig)
|
MyBase.New(pLogConfig)
|
||||||
Logger = pLogConfig.GetLogger()
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Function Replace(pInput As String, pReplaceMap As Dictionary(Of String, Object)) As String Implements IModule.Replace
|
Public Function Replace(pInput As String, pReplaceMap As Dictionary(Of String, Object)) As String Implements IModule.Replace
|
||||||
|
|||||||
@ -82,6 +82,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Constants.vb" />
|
<Compile Include="Constants.vb" />
|
||||||
<Compile Include="Modules\IDB.vb" />
|
<Compile Include="Modules\IDB.vb" />
|
||||||
|
<Compile Include="Modules\Globix.vb" />
|
||||||
<Compile Include="Modules\Windream.vb" />
|
<Compile Include="Modules\Windream.vb" />
|
||||||
<Compile Include="Modules\User.vb" />
|
<Compile Include="Modules\User.vb" />
|
||||||
<Compile Include="IModule.vb" />
|
<Compile Include="IModule.vb" />
|
||||||
|
|||||||
@ -135,6 +135,16 @@ Public Class Patterns2
|
|||||||
Return oResult
|
Return oResult
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Function ReplaceGlobixValues(pInput As String) As String
|
||||||
|
Dim oResult = pInput
|
||||||
|
|
||||||
|
Dim oGlobixModule = GetModule(Of Modules.Globix)()
|
||||||
|
Dim oGlobixArgs = GetReplaceMapForModule(oGlobixModule)
|
||||||
|
oResult = DoReplaceForModule(oResult, oGlobixModule, oGlobixArgs)
|
||||||
|
|
||||||
|
Return oResult
|
||||||
|
End Function
|
||||||
|
|
||||||
Private Function DoReplaceForModule(pInput As String, pModule As IModule, pArgs As Dictionary(Of String, Object)) As String
|
Private Function DoReplaceForModule(pInput As String, pModule As IModule, pArgs As Dictionary(Of String, Object)) As String
|
||||||
Try
|
Try
|
||||||
pInput = pModule.Replace(pInput, pArgs)
|
pInput = pModule.Replace(pInput, pArgs)
|
||||||
@ -152,7 +162,12 @@ Public Class Patterns2
|
|||||||
SingleOrDefault()
|
SingleOrDefault()
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function GetReplaceMapForModule(pModule As IModule, Optional pPanel As Panel = Nothing, Optional pUser As State.UserState = Nothing, Optional pWMObject As WMObject = Nothing) As Dictionary(Of String, Object)
|
Private Function GetReplaceMapForModule(pModule As IModule,
|
||||||
|
Optional pPanel As Panel = Nothing,
|
||||||
|
Optional pUser As State.UserState = Nothing,
|
||||||
|
Optional pWMObject As WMObject = Nothing,
|
||||||
|
Optional pGlobixIndexes As Dictionary(Of String, List(Of String)) = Nothing
|
||||||
|
) As Dictionary(Of String, Object)
|
||||||
Dim oArgs As New Dictionary(Of String, Object)
|
Dim oArgs As New Dictionary(Of String, Object)
|
||||||
|
|
||||||
If TypeOf pModule Is Modules.Clipboard Then
|
If TypeOf pModule Is Modules.Clipboard Then
|
||||||
@ -199,6 +214,12 @@ Public Class Patterns2
|
|||||||
Logger.Error(ex)
|
Logger.Error(ex)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
|
ElseIf TypeOf pModule Is Modules.Globix Then
|
||||||
|
Try
|
||||||
|
oArgs.Add(Patterns.Modules.Globix.GBX_VALUE_INDICIES, pGlobixIndexes)
|
||||||
|
Catch ex As Exception
|
||||||
|
Logger.Error(ex)
|
||||||
|
End Try
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return oArgs
|
Return oArgs
|
||||||
|
|||||||
@ -7,11 +7,13 @@ Public MustInherit Class BaseMethod
|
|||||||
|
|
||||||
Friend ReadOnly Database As MSSQLServer
|
Friend ReadOnly Database As MSSQLServer
|
||||||
Friend ReadOnly Helpers As Helpers
|
Friend ReadOnly Helpers As Helpers
|
||||||
|
Friend ReadOnly GlobalState As GlobalState
|
||||||
|
|
||||||
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer)
|
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pGlobalState As GlobalState)
|
||||||
MyBase.New(pLogConfig)
|
MyBase.New(pLogConfig)
|
||||||
Database = pMSSQLServer
|
Database = pMSSQLServer
|
||||||
Helpers = New Helpers(pLogConfig, pMSSQLServer)
|
Helpers = New Helpers(pLogConfig, pMSSQLServer)
|
||||||
|
GlobalState = pGlobalState
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub LogAndThrow(pMessage As String)
|
Public Sub LogAndThrow(pMessage As String)
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
Imports DigitalData.Modules.Database
|
Imports System.IO
|
||||||
|
Imports System.ServiceModel
|
||||||
|
Imports System.ServiceModel.Description
|
||||||
|
Imports DigitalData.Modules.Database
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
Imports DigitalData.Modules.Language
|
Imports DigitalData.Modules.Language
|
||||||
Imports DigitalData.Modules
|
Imports DigitalData.Modules
|
||||||
Imports System.IO
|
Imports DigitalData.Modules.EDMI
|
||||||
Imports System.ServiceModel
|
Imports DigitalData.Modules.EDMI.File
|
||||||
Imports System.Data.SqlClient
|
|
||||||
Imports System.ServiceModel.Description
|
|
||||||
Imports DigitalData.Services.EDMIService.Messages
|
|
||||||
Imports DigitalData.Modules.EDMI.API.Rights
|
Imports DigitalData.Modules.EDMI.API.Rights
|
||||||
|
Imports DigitalData.Services.EDMIService.Messages
|
||||||
Imports DigitalData.Services.EDMIService.Exceptions
|
Imports DigitalData.Services.EDMIService.Exceptions
|
||||||
Imports DigitalData.Services.EDMIService.GlobalState
|
|
||||||
Imports DigitalData.Services.EDMIService.Methods
|
Imports DigitalData.Services.EDMIService.Methods
|
||||||
Imports DigitalData.Services.EDMIService.Methods.SetAttributeValue
|
Imports DigitalData.Services.EDMIService.Methods.SetAttributeValue
|
||||||
|
|
||||||
@ -33,13 +33,12 @@ Public Class EDMIService
|
|||||||
Private ReadOnly _Logger As Logger
|
Private ReadOnly _Logger As Logger
|
||||||
Private ReadOnly _Debug As Boolean = False
|
Private ReadOnly _Debug As Boolean = False
|
||||||
Private ReadOnly _Username As String
|
Private ReadOnly _Username As String
|
||||||
|
Private ReadOnly _IDBHelpers As IDB.Helpers
|
||||||
Private _IDBHelpers As IDB.Helpers
|
|
||||||
|
|
||||||
|
|
||||||
Public Shared Sub Configure(Config As ServiceConfiguration)
|
Public Shared Sub Configure(Config As ServiceConfiguration)
|
||||||
Dim oBaseAddress = Config.BaseAddresses.Item(0)
|
Dim oBaseAddress = Config.BaseAddresses.Item(0)
|
||||||
Dim oBinding = EDMI.API.Channel.GetBinding()
|
Dim oBinding = API.Channel.GetBinding()
|
||||||
Dim oAddress = New EndpointAddress(oBaseAddress)
|
Dim oAddress = New EndpointAddress(oBaseAddress)
|
||||||
' See: https://stackoverflow.com/questions/42327988/addserviceendpoint-throws-key-is-null
|
' See: https://stackoverflow.com/questions/42327988/addserviceendpoint-throws-key-is-null
|
||||||
Dim oDescription = ContractDescription.GetContract(GetType(IEDMIService), GetType(EDMIService))
|
Dim oDescription = ContractDescription.GetContract(GetType(IEDMIService), GetType(EDMIService))
|
||||||
@ -63,16 +62,22 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Public Function NewFile(Data As NewFile.NewFileRequest) As NewFile.NewFileResponse Implements IEDMIService.NewFile
|
Public Function NewFile(Data As NewFile.NewFileRequest) As NewFile.NewFileResponse Implements IEDMIService.NewFile
|
||||||
_Logger.Debug("Start of Method [NewFile]")
|
_Logger.Debug("Start of Method [NewFile]")
|
||||||
Dim oNewFile As New NewFileMethod(LogConfig, MSSQL_IDB, GlobalState.ObjectStores)
|
Dim oNewFile As New NewFileMethod(LogConfig, MSSQL_IDB, GlobalState)
|
||||||
Return oNewFile.Run(Data)
|
Return oNewFile.Run(Data)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function SetAttributeValue(Data As SetAttributeValue.SetAttributeValueRequest) As SetAttributeValue.SetAttributeValueResponse Implements IEDMIService.SetAttributeValue
|
Public Function SetAttributeValue(Data As SetAttributeValue.SetAttributeValueRequest) As SetAttributeValue.SetAttributeValueResponse Implements IEDMIService.SetAttributeValue
|
||||||
_Logger.Debug("Start of Method [SetAttributeValue]")
|
_Logger.Debug("Start of Method [SetAttributeValue]")
|
||||||
Dim oSetAttributeValue As New SetAttributeValueMethod(LogConfig, MSSQL_IDB)
|
Dim oSetAttributeValue As New SetAttributeValueMethod(LogConfig, MSSQL_IDB, GlobalState)
|
||||||
Return oSetAttributeValue.Run(Data)
|
Return oSetAttributeValue.Run(Data)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Function ImportFile(pData As GlobalIndexer.ImportFile.ImportFileRequest) As GlobalIndexer.ImportFile.ImportFileResponse Implements IEDMIService.ImportFile
|
||||||
|
_Logger.Debug("Start of Method [ImportFile]")
|
||||||
|
Dim oImportFile As New GlobalIndexer.ImportFile.ImportFileMethod(LogConfig, MSSQL_IDB, GlobalState)
|
||||||
|
Return oImportFile.Run(pData)
|
||||||
|
End Function
|
||||||
|
|
||||||
#Region "=== Heartbeat ==="
|
#Region "=== Heartbeat ==="
|
||||||
Public Function Heartbeat() As Boolean Implements IEDMIService.Heartbeat
|
Public Function Heartbeat() As Boolean Implements IEDMIService.Heartbeat
|
||||||
Return True
|
Return True
|
||||||
@ -81,7 +86,7 @@ Public Class EDMIService
|
|||||||
|
|
||||||
#Region "=== Database ==="
|
#Region "=== Database ==="
|
||||||
Public Function ReturnDatatableFromCache(Name As String, FilterExpression As String, SortByColumn As String) As TableResult Implements IEDMIService.ReturnDatatableFromCache
|
Public Function ReturnDatatableFromCache(Name As String, FilterExpression As String, SortByColumn As String) As TableResult Implements IEDMIService.ReturnDatatableFromCache
|
||||||
Dim oReturnDatatableFromCache As New GetDatatableFromCache.GetDatatableFromCacheMethod(LogConfig, MSSQL_ECM, GlobalState.TableStore)
|
Dim oReturnDatatableFromCache As New GetDatatableFromCache.GetDatatableFromCacheMethod(LogConfig, MSSQL_ECM, GlobalState)
|
||||||
Dim oResult = oReturnDatatableFromCache.Run(New GetDatatableFromCache.GetDatatableFromCacheRequest With {
|
Dim oResult = oReturnDatatableFromCache.Run(New GetDatatableFromCache.GetDatatableFromCacheRequest With {
|
||||||
.DataTable = Name,
|
.DataTable = Name,
|
||||||
.FilterExpression = FilterExpression,
|
.FilterExpression = FilterExpression,
|
||||||
|
|||||||
@ -69,9 +69,12 @@ Interface IEDMIService
|
|||||||
<OperationContract>
|
<OperationContract>
|
||||||
Function SetAttributeValue(Data As SetAttributeValue.SetAttributeValueRequest) As SetAttributeValue.SetAttributeValueResponse
|
Function SetAttributeValue(Data As SetAttributeValue.SetAttributeValueRequest) As SetAttributeValue.SetAttributeValueResponse
|
||||||
|
|
||||||
'-----------------------------------------------------
|
<OperationContract>
|
||||||
' Everything below this line is subject to change!
|
Function ImportFile(Data As GlobalIndexer.ImportFile.ImportFileRequest) As GlobalIndexer.ImportFile.ImportFileResponse
|
||||||
'-----------------------------------------------------
|
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
#Region "Document (Old)"
|
||||||
|
|
||||||
<OperationContract>
|
<OperationContract>
|
||||||
<FaultContract(GetType(ObjectDoesNotExistFault))>
|
<FaultContract(GetType(ObjectDoesNotExistFault))>
|
||||||
@ -86,7 +89,6 @@ Interface IEDMIService
|
|||||||
<FaultContract(GetType(UnexpectedErrorFault))>
|
<FaultContract(GetType(UnexpectedErrorFault))>
|
||||||
Function ListFilesForUser() As DocumentListResponse
|
Function ListFilesForUser() As DocumentListResponse
|
||||||
|
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "Helpers"
|
#Region "Helpers"
|
||||||
|
|||||||
@ -5,8 +5,8 @@ Namespace Methods.GetAttributeValue
|
|||||||
Public Class GetAttributeValueMethod
|
Public Class GetAttributeValueMethod
|
||||||
Inherits BaseMethod
|
Inherits BaseMethod
|
||||||
|
|
||||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer)
|
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pGlobalState As GlobalState)
|
||||||
MyBase.New(pLogConfig, pDatabase)
|
MyBase.New(pLogConfig, pDatabase, pGlobalState)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Function Run(pData As GetAttributeValueRequest) As GetAttributeValueResponse
|
Public Function Run(pData As GetAttributeValueRequest) As GetAttributeValueResponse
|
||||||
|
|||||||
@ -6,11 +6,8 @@ Namespace Methods.GetDatatableFromCache
|
|||||||
Public Class GetDatatableFromCacheMethod
|
Public Class GetDatatableFromCacheMethod
|
||||||
Inherits BaseMethod
|
Inherits BaseMethod
|
||||||
|
|
||||||
Private ReadOnly TableStore As DataSet
|
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pGlobalState As GlobalState)
|
||||||
|
MyBase.New(pLogConfig, pMSSQLServer, pGlobalState)
|
||||||
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pTableStore As DataSet)
|
|
||||||
MyBase.New(pLogConfig, pMSSQLServer)
|
|
||||||
TableStore = pTableStore
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Function Run(pData As GetDatatableFromCacheRequest) As GetDatatableFromCacheResponse
|
Public Function Run(pData As GetDatatableFromCacheRequest) As GetDatatableFromCacheResponse
|
||||||
@ -19,10 +16,10 @@ Namespace Methods.GetDatatableFromCache
|
|||||||
|
|
||||||
Dim oDataTable As DataTable = Nothing
|
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
|
If GlobalState.TableStore.Tables.Contains(pData.DataTable) Then
|
||||||
oDataTable = TableStore.Tables.Item(pData.DataTable).Copy()
|
oDataTable = GlobalState.TableStore.Tables.Item(pData.DataTable).Copy()
|
||||||
|
|
||||||
' Apply filter and sorting to data
|
' Apply filter and sorting to data
|
||||||
Dim oFilterExpression As String = Utils.NotNull(pData.FilterExpression, String.Empty)
|
Dim oFilterExpression As String = Utils.NotNull(pData.FilterExpression, String.Empty)
|
||||||
|
|||||||
@ -8,14 +8,15 @@ Namespace Methods.GlobalIndexer.ImportFile
|
|||||||
Public Class ImportFileMethod
|
Public Class ImportFileMethod
|
||||||
Inherits BaseMethod
|
Inherits BaseMethod
|
||||||
|
|
||||||
Private ReadOnly TableStore As DataSet
|
|
||||||
Private ReadOnly Patterns As Patterns2
|
Private ReadOnly Patterns As Patterns2
|
||||||
Private ReadOnly GetDatatable As GetDatatableFromCacheMethod
|
Private ReadOnly GetDatatable As GetDatatableFromCacheMethod
|
||||||
|
|
||||||
|
Private Profile As DataRow
|
||||||
Private ManualIndexes As DataTable
|
Private ManualIndexes As DataTable
|
||||||
Private AutomaticIndexes As DataTable
|
Private AutomaticIndexes As DataTable
|
||||||
Private ManualIndexesPostProcessing As DataTable
|
Private ManualIndexesPostProcessing As DataTable
|
||||||
|
|
||||||
|
Private Const VIEW_PROFILE = "VWGI_DOCTYPE_IDB"
|
||||||
Private Const VIEW_INDEX_MANUAL = "VWDDINDEX_MAN"
|
Private Const VIEW_INDEX_MANUAL = "VWDDINDEX_MAN"
|
||||||
Private Const VIEW_INDEX_AUTOMATIC = "VWDDINDEX_AUTOM"
|
Private Const VIEW_INDEX_AUTOMATIC = "VWDDINDEX_AUTOM"
|
||||||
Private Const TABLE_POST_PROCESSING = "TBDD_INDEX_MAN_POSTPROCESSING"
|
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_VBREPLACE = "VBREPLACE"
|
||||||
Private Const TYPE_REGEXPRESSION = "REG. EXPRESSION"
|
Private Const TYPE_REGEXPRESSION = "REG. EXPRESSION"
|
||||||
|
|
||||||
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pTableStore As DataSet)
|
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pGlobalState As GlobalState)
|
||||||
MyBase.New(pLogConfig, pMSSQLServer)
|
MyBase.New(pLogConfig, pMSSQLServer, pGlobalState)
|
||||||
|
|
||||||
TableStore = pTableStore
|
|
||||||
Patterns = New Patterns2(pLogConfig)
|
Patterns = New Patterns2(pLogConfig)
|
||||||
GetDatatable = New GetDatatableFromCacheMethod(LogConfig, Database, TableStore)
|
GetDatatable = New GetDatatableFromCacheMethod(LogConfig, Database, GlobalState)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
''' <summary>
|
''' <summary>
|
||||||
@ -43,8 +43,10 @@ Namespace Methods.GlobalIndexer.ImportFile
|
|||||||
Public Function Run(pData As ImportFileRequest)
|
Public Function Run(pData As ImportFileRequest)
|
||||||
Try
|
Try
|
||||||
LoadIndexes(pData.ProfileId)
|
LoadIndexes(pData.ProfileId)
|
||||||
|
LoadProfile(pData.ProfileId)
|
||||||
|
|
||||||
Dim oFinalAttributes = pData.AttributeValues
|
Dim oFinalAttributes = pData.AttributeValues
|
||||||
|
Dim oFileName As String = GetFilenameByNameconvention(pData.File.FileName, Profile.Item("NAMENKONVENTION"))
|
||||||
|
|
||||||
' apply the post processing
|
' apply the post processing
|
||||||
oFinalAttributes = ApplyManualPostprocessing(oFinalAttributes, ManualIndexesPostProcessing)
|
oFinalAttributes = ApplyManualPostprocessing(oFinalAttributes, ManualIndexesPostProcessing)
|
||||||
@ -52,6 +54,22 @@ Namespace Methods.GlobalIndexer.ImportFile
|
|||||||
' TODO: apply the manual attributes
|
' TODO: apply the manual attributes
|
||||||
oFinalAttributes = ApplyAutomaticeAttributes(oFinalAttributes)
|
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
|
Catch ex As Exception
|
||||||
Return New ImportFileResponse(ex)
|
Return New ImportFileResponse(ex)
|
||||||
@ -141,6 +159,12 @@ Namespace Methods.GlobalIndexer.ImportFile
|
|||||||
End Select
|
End Select
|
||||||
|
|
||||||
Return oResult
|
Return oResult
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function GetFilenameByNameconvention(pFileName As String, pNameconvention As String) As String
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Sub LoadIndexes(pProfileId As Integer)
|
Private Sub LoadIndexes(pProfileId As Integer)
|
||||||
@ -151,6 +175,29 @@ Namespace Methods.GlobalIndexer.ImportFile
|
|||||||
LoadPostProcessingSteps()
|
LoadPostProcessingSteps()
|
||||||
End Sub
|
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)
|
Private Sub LoadAutomaticIndexes(pProfileId As Integer)
|
||||||
Logger.Debug("Start of Method [LoadAutomaticIndexes]")
|
Logger.Debug("Start of Method [LoadAutomaticIndexes]")
|
||||||
|
|
||||||
@ -175,7 +222,6 @@ Namespace Methods.GlobalIndexer.ImportFile
|
|||||||
Private Sub LoadManualIndexes(pProfileId As Integer)
|
Private Sub LoadManualIndexes(pProfileId As Integer)
|
||||||
Logger.Debug("Start of Method [LoadManualIndexes]")
|
Logger.Debug("Start of Method [LoadManualIndexes]")
|
||||||
|
|
||||||
|
|
||||||
Try
|
Try
|
||||||
' Load manual Indexes for this Import
|
' Load manual Indexes for this Import
|
||||||
Dim oManualIndexes = GetDatatable.Run(
|
Dim oManualIndexes = GetDatatable.Run(
|
||||||
|
|||||||
@ -15,6 +15,24 @@ Namespace Methods.GlobalIndexer.ImportFile
|
|||||||
''' </summary>
|
''' </summary>
|
||||||
Public Property ProfileId As Integer
|
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>
|
''' <summary>
|
||||||
''' The attribute values given by the user in the form of
|
''' The attribute values given by the user in the form of
|
||||||
''' Attribute Name/Attribute Value/ControlName
|
''' Attribute Name/Attribute Value/ControlName
|
||||||
|
|||||||
@ -8,13 +8,11 @@ Imports DigitalData.Services.EDMIService.GlobalState
|
|||||||
Public Class NewFileMethod
|
Public Class NewFileMethod
|
||||||
Inherits BaseMethod
|
Inherits BaseMethod
|
||||||
|
|
||||||
Private ReadOnly ObjectStores As List(Of ObjectStore)
|
|
||||||
Private ReadOnly Connection As SqlConnection
|
Private ReadOnly Connection As SqlConnection
|
||||||
Private ReadOnly Transaction As SqlTransaction
|
Private ReadOnly Transaction As SqlTransaction
|
||||||
|
|
||||||
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pObjectStores As List(Of ObjectStore))
|
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pGlobalState As GlobalState)
|
||||||
MyBase.New(pLogConfig, pMSSQLServer)
|
MyBase.New(pLogConfig, pMSSQLServer, pGlobalState)
|
||||||
ObjectStores = pObjectStores
|
|
||||||
|
|
||||||
Connection = Database.GetConnection()
|
Connection = Database.GetConnection()
|
||||||
Transaction = Connection.BeginTransaction()
|
Transaction = Connection.BeginTransaction()
|
||||||
@ -37,7 +35,7 @@ Public Class NewFileMethod
|
|||||||
|
|
||||||
' Find ObjectStore by Title
|
' Find ObjectStore by Title
|
||||||
Logger.Debug("Checking for DataStore [{0}].", pData.StoreName)
|
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)).
|
Where(Function(store) store.Title.Equals(pData.StoreName, StringComparison.OrdinalIgnoreCase)).
|
||||||
SingleOrDefault()
|
SingleOrDefault()
|
||||||
|
|
||||||
|
|||||||
@ -10,8 +10,8 @@ Namespace Methods.SetAttributeValue
|
|||||||
Private Connection As SqlConnection
|
Private Connection As SqlConnection
|
||||||
Private Transaction As SqlTransaction
|
Private Transaction As SqlTransaction
|
||||||
|
|
||||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer)
|
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pGlobalState As GlobalState)
|
||||||
MyBase.New(pLogConfig, pDatabase)
|
MyBase.New(pLogConfig, pDatabase, pGlobalState)
|
||||||
|
|
||||||
Connection = Database.GetConnection()
|
Connection = Database.GetConnection()
|
||||||
Transaction = Connection.BeginTransaction()
|
Transaction = Connection.BeginTransaction()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user