diff --git a/Modules.EDMIAPI/Client.vb b/Modules.EDMIAPI/Client.vb index 2b30dc27..3bdc2db6 100644 --- a/Modules.EDMIAPI/Client.vb +++ b/Modules.EDMIAPI/Client.vb @@ -176,6 +176,59 @@ Public Class Client End Try 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 + ''' ''' Sets a value to an attribute ''' diff --git a/Modules.Patterns/Modules/Controls.vb b/Modules.Patterns/Modules/Controls.vb index ff843eaa..874c1cc9 100644 --- a/Modules.Patterns/Modules/Controls.vb +++ b/Modules.Patterns/Modules/Controls.vb @@ -14,11 +14,9 @@ Namespace Modules Public Property PatternIdentifier As String = "CTRL" Implements IModule.PatternIdentifier Public Property IsComplex As Boolean = True Implements IModule.IsComplex - Private ReadOnly Logger As Logger Public Sub New(pLogConfig As LogConfig) MyBase.New(pLogConfig) - Logger = pLogConfig.GetLogger() End Sub Public Function Replace(pInput As String, pReplaceMap As Dictionary(Of String, Object)) As String Implements IModule.Replace diff --git a/Modules.Patterns/Modules/Globix.vb b/Modules.Patterns/Modules/Globix.vb new file mode 100644 index 00000000..edda84bc --- /dev/null +++ b/Modules.Patterns/Modules/Globix.vb @@ -0,0 +1,55 @@ +Imports DigitalData.Modules.Logging + +Namespace Modules + ''' + ''' Patterns for Generating a Filename in Global Indexer + ''' + 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 diff --git a/Modules.Patterns/Modules/IDB.vb b/Modules.Patterns/Modules/IDB.vb index 7ecf2770..d9a2472d 100644 --- a/Modules.Patterns/Modules/IDB.vb +++ b/Modules.Patterns/Modules/IDB.vb @@ -15,11 +15,8 @@ Namespace Modules Public Property PatternIdentifier As String = "IDB" Implements IModule.PatternIdentifier Public Property IsComplex As Boolean = True Implements IModule.IsComplex - Private ReadOnly Logger As Logger - Public Sub New(pLogConfig As LogConfig) MyBase.New(pLogConfig) - Logger = pLogConfig.GetLogger() End Sub Public Function Replace(pInput As String, pReplaceMap As Dictionary(Of String, Object)) As String Implements IModule.Replace diff --git a/Modules.Patterns/Modules/Windream.vb b/Modules.Patterns/Modules/Windream.vb index 97ea3a02..3cae5fdd 100644 --- a/Modules.Patterns/Modules/Windream.vb +++ b/Modules.Patterns/Modules/Windream.vb @@ -15,11 +15,8 @@ Namespace Modules Public Property PatternIdentifier As String = "WMI" Implements IModule.PatternIdentifier Public Property IsComplex As Boolean = True Implements IModule.IsComplex - Private ReadOnly Logger As Logger - Public Sub New(pLogConfig As LogConfig) MyBase.New(pLogConfig) - Logger = pLogConfig.GetLogger() End Sub Public Function Replace(pInput As String, pReplaceMap As Dictionary(Of String, Object)) As String Implements IModule.Replace diff --git a/Modules.Patterns/Patterns.vbproj b/Modules.Patterns/Patterns.vbproj index 891c1639..201ccb22 100644 --- a/Modules.Patterns/Patterns.vbproj +++ b/Modules.Patterns/Patterns.vbproj @@ -82,6 +82,7 @@ + diff --git a/Modules.Patterns/Patterns2.vb b/Modules.Patterns/Patterns2.vb index 8d65e35f..8b7d114f 100644 --- a/Modules.Patterns/Patterns2.vb +++ b/Modules.Patterns/Patterns2.vb @@ -135,6 +135,16 @@ Public Class Patterns2 Return oResult 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 Try pInput = pModule.Replace(pInput, pArgs) @@ -152,7 +162,12 @@ Public Class Patterns2 SingleOrDefault() 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) If TypeOf pModule Is Modules.Clipboard Then @@ -199,6 +214,12 @@ Public Class Patterns2 Logger.Error(ex) 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 Return oArgs diff --git a/Service.EDMIService/BaseMethod.vb b/Service.EDMIService/BaseMethod.vb index 85871ff0..e09a29c4 100644 --- a/Service.EDMIService/BaseMethod.vb +++ b/Service.EDMIService/BaseMethod.vb @@ -7,11 +7,13 @@ Public MustInherit Class BaseMethod Friend ReadOnly Database As MSSQLServer 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) Database = pMSSQLServer Helpers = New Helpers(pLogConfig, pMSSQLServer) + GlobalState = pGlobalState End Sub Public Sub LogAndThrow(pMessage As String) diff --git a/Service.EDMIService/EDMIService.vb b/Service.EDMIService/EDMIService.vb index 7534cb77..acb34cef 100644 --- a/Service.EDMIService/EDMIService.vb +++ b/Service.EDMIService/EDMIService.vb @@ -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.Language Imports DigitalData.Modules -Imports System.IO -Imports System.ServiceModel -Imports System.Data.SqlClient -Imports System.ServiceModel.Description -Imports DigitalData.Services.EDMIService.Messages +Imports DigitalData.Modules.EDMI +Imports DigitalData.Modules.EDMI.File Imports DigitalData.Modules.EDMI.API.Rights +Imports DigitalData.Services.EDMIService.Messages Imports DigitalData.Services.EDMIService.Exceptions -Imports DigitalData.Services.EDMIService.GlobalState Imports DigitalData.Services.EDMIService.Methods Imports DigitalData.Services.EDMIService.Methods.SetAttributeValue @@ -33,13 +33,12 @@ Public Class EDMIService Private ReadOnly _Logger As Logger Private ReadOnly _Debug As Boolean = False Private ReadOnly _Username As String - - Private _IDBHelpers As IDB.Helpers + Private ReadOnly _IDBHelpers As IDB.Helpers Public Shared Sub Configure(Config As ServiceConfiguration) Dim oBaseAddress = Config.BaseAddresses.Item(0) - Dim oBinding = EDMI.API.Channel.GetBinding() + Dim oBinding = API.Channel.GetBinding() Dim oAddress = New EndpointAddress(oBaseAddress) ' See: https://stackoverflow.com/questions/42327988/addserviceendpoint-throws-key-is-null 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 _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) End Function Public Function SetAttributeValue(Data As SetAttributeValue.SetAttributeValueRequest) As SetAttributeValue.SetAttributeValueResponse Implements IEDMIService.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) 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 ===" Public Function Heartbeat() As Boolean Implements IEDMIService.Heartbeat Return True @@ -81,7 +86,7 @@ Public Class EDMIService #Region "=== Database ===" 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 { .DataTable = Name, .FilterExpression = FilterExpression, diff --git a/Service.EDMIService/IEDMIService.vb b/Service.EDMIService/IEDMIService.vb index 9e2ac29d..717056d6 100644 --- a/Service.EDMIService/IEDMIService.vb +++ b/Service.EDMIService/IEDMIService.vb @@ -69,9 +69,12 @@ Interface IEDMIService Function SetAttributeValue(Data As SetAttributeValue.SetAttributeValueRequest) As SetAttributeValue.SetAttributeValueResponse - '----------------------------------------------------- - ' Everything below this line is subject to change! - '----------------------------------------------------- + + Function ImportFile(Data As GlobalIndexer.ImportFile.ImportFileRequest) As GlobalIndexer.ImportFile.ImportFileResponse + +#End Region + +#Region "Document (Old)" @@ -86,7 +89,6 @@ Interface IEDMIService Function ListFilesForUser() As DocumentListResponse - #End Region #Region "Helpers" diff --git a/Service.EDMIService/Methods/GetAttributeValue/GetAttributeValueMethod.vb b/Service.EDMIService/Methods/GetAttributeValue/GetAttributeValueMethod.vb index 76dd97e4..782a96a3 100644 --- a/Service.EDMIService/Methods/GetAttributeValue/GetAttributeValueMethod.vb +++ b/Service.EDMIService/Methods/GetAttributeValue/GetAttributeValueMethod.vb @@ -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 diff --git a/Service.EDMIService/Methods/GetDatatableFromCache/GetDatatableFromCacheMethod.vb b/Service.EDMIService/Methods/GetDatatableFromCache/GetDatatableFromCacheMethod.vb index a8d6a4c1..696b83ce 100644 --- a/Service.EDMIService/Methods/GetDatatableFromCache/GetDatatableFromCacheMethod.vb +++ b/Service.EDMIService/Methods/GetDatatableFromCache/GetDatatableFromCacheMethod.vb @@ -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) diff --git a/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileMethod.vb b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileMethod.vb index 41d13746..c05449b2 100644 --- a/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileMethod.vb +++ b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileMethod.vb @@ -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 ''' @@ -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 + ''' + ''' Load Profiles for this Import + ''' + 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( diff --git a/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileRequest.vb b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileRequest.vb index 34ede782..6c17c4ab 100644 --- a/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileRequest.vb +++ b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileRequest.vb @@ -15,6 +15,24 @@ Namespace Methods.GlobalIndexer.ImportFile ''' Public Property ProfileId As Integer + ''' + ''' The business entity of the file, ex DEFAULT + ''' + + Public Property BusinessEntity As String + + ''' + ''' The kind of object to be created, ex. DOC + ''' + + Public Property KindType As String + + ''' + ''' Name/title of the ObjectStore to save the file to, ex. Work + ''' + + Public Property StoreName As String + ''' ''' The attribute values given by the user in the form of ''' Attribute Name/Attribute Value/ControlName diff --git a/Service.EDMIService/Methods/NewFile/NewFileMethod.vb b/Service.EDMIService/Methods/NewFile/NewFileMethod.vb index f08b822d..327072e9 100644 --- a/Service.EDMIService/Methods/NewFile/NewFileMethod.vb +++ b/Service.EDMIService/Methods/NewFile/NewFileMethod.vb @@ -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() diff --git a/Service.EDMIService/Methods/SetAttributeValue/SetAttributeValueMethod.vb b/Service.EDMIService/Methods/SetAttributeValue/SetAttributeValueMethod.vb index b9c17373..70a78040 100644 --- a/Service.EDMIService/Methods/SetAttributeValue/SetAttributeValueMethod.vb +++ b/Service.EDMIService/Methods/SetAttributeValue/SetAttributeValueMethod.vb @@ -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()