diff --git a/GUIs.Test.EDMIBenchmark/Form1.Designer.vb b/GUIs.Test.EDMIBenchmark/Form1.Designer.vb
index 5f10168d..aac11258 100644
--- a/GUIs.Test.EDMIBenchmark/Form1.Designer.vb
+++ b/GUIs.Test.EDMIBenchmark/Form1.Designer.vb
@@ -32,7 +32,7 @@ Partial Class Form1
Me.ButtonImportFiles = New DevExpress.XtraBars.BarButtonItem()
Me.buttonClearLog = New DevExpress.XtraBars.BarButtonItem()
Me.buttonClearFiles = New DevExpress.XtraBars.BarButtonItem()
- Me.TextboxObejctId = New DevExpress.XtraBars.BarEditItem()
+ Me.TextboxObjectId = New DevExpress.XtraBars.BarEditItem()
Me.RepositoryItemTextEdit1 = New DevExpress.XtraEditors.Repository.RepositoryItemTextEdit()
Me.ButtonLoadFile = New DevExpress.XtraBars.BarButtonItem()
Me.BarListItem1 = New DevExpress.XtraBars.BarListItem()
@@ -110,7 +110,7 @@ Partial Class Form1
'RibbonControl1
'
Me.RibbonControl1.ExpandCollapseItem.Id = 0
- Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.ButtonSelectFiles, Me.ButtonImportFiles, Me.buttonClearLog, Me.buttonClearFiles, Me.TextboxObejctId, Me.ButtonLoadFile, Me.BarListItem1, Me.BarButtonItem2, Me.BarToggleSwitchItem1, Me.BarDockingMenuItem1, Me.BarMdiChildrenListItem1, Me.BarButtonItem1})
+ Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.ButtonSelectFiles, Me.ButtonImportFiles, Me.buttonClearLog, Me.buttonClearFiles, Me.TextboxObjectId, Me.ButtonLoadFile, Me.BarListItem1, Me.BarButtonItem2, Me.BarToggleSwitchItem1, Me.BarDockingMenuItem1, Me.BarMdiChildrenListItem1, Me.BarButtonItem1})
Me.RibbonControl1.Location = New System.Drawing.Point(0, 0)
Me.RibbonControl1.MaxItemId = 14
Me.RibbonControl1.Name = "RibbonControl1"
@@ -151,12 +151,12 @@ Partial Class Form1
'
'TextboxObejctId
'
- Me.TextboxObejctId.Caption = "Document Id"
- Me.TextboxObejctId.Edit = Me.RepositoryItemTextEdit1
- Me.TextboxObejctId.EditWidth = 100
- Me.TextboxObejctId.Id = 5
- Me.TextboxObejctId.ImageOptions.SvgImage = CType(resources.GetObject("TextboxObejctId.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
- Me.TextboxObejctId.Name = "TextboxObejctId"
+ Me.TextboxObjectId.Caption = "Document Id"
+ Me.TextboxObjectId.Edit = Me.RepositoryItemTextEdit1
+ Me.TextboxObjectId.EditWidth = 100
+ Me.TextboxObjectId.Id = 5
+ Me.TextboxObjectId.ImageOptions.SvgImage = CType(resources.GetObject("TextboxObejctId.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
+ Me.TextboxObjectId.Name = "TextboxObejctId"
'
'RepositoryItemTextEdit1
'
@@ -218,7 +218,7 @@ Partial Class Form1
'
'RibbonPageGroup4
'
- Me.RibbonPageGroup4.ItemLinks.Add(Me.TextboxObejctId)
+ Me.RibbonPageGroup4.ItemLinks.Add(Me.TextboxObjectId)
Me.RibbonPageGroup4.ItemLinks.Add(Me.BarToggleSwitchItem1)
Me.RibbonPageGroup4.ItemLinks.Add(Me.ButtonLoadFile)
Me.RibbonPageGroup4.ItemLinks.Add(Me.BarButtonItem2)
@@ -497,7 +497,7 @@ Partial Class Form1
Friend WithEvents buttonClearLog As DevExpress.XtraBars.BarButtonItem
Friend WithEvents RibbonPageGroup3 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
Friend WithEvents buttonClearFiles As DevExpress.XtraBars.BarButtonItem
- Friend WithEvents TextboxObejctId As DevExpress.XtraBars.BarEditItem
+ Friend WithEvents TextboxObjectId As DevExpress.XtraBars.BarEditItem
Friend WithEvents RepositoryItemTextEdit1 As DevExpress.XtraEditors.Repository.RepositoryItemTextEdit
Friend WithEvents ButtonLoadFile As DevExpress.XtraBars.BarButtonItem
Friend WithEvents RibbonPageGroup4 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
diff --git a/GUIs.Test.EDMIBenchmark/Form1.vb b/GUIs.Test.EDMIBenchmark/Form1.vb
index a83430ee..aac64917 100644
--- a/GUIs.Test.EDMIBenchmark/Form1.vb
+++ b/GUIs.Test.EDMIBenchmark/Form1.vb
@@ -4,22 +4,19 @@ Imports DigitalData.Modules.EDMI.API
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Controls
Imports System.IO
+Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Public Class Form1
- Private _Channel As EDMIServiceReference.IEDMIServiceChannel
Private _LogConfig As LogConfig
Private _Logger As Logger
+ Private _Client As Client
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
_LogConfig = New LogConfig(LogConfig.PathType.Temp, Nothing, "EDMIBenschmark")
_Logger = _LogConfig.GetLogger()
-
- Dim oChannelFactory As New ChannelFactory(Of EDMIServiceReference.IEDMIServiceChannel)(
- Channel.GetBinding(TcpClientCredentialType.Windows),
- "net.tcp://172.24.12.39:9000/DigitalData/Services/Main")
- _Channel = oChannelFactory.CreateChannel()
- _Channel.Open()
+ _Client = New Client(_LogConfig, "net.tcp://172.24.12.39:9000/DigitalData/Services/Main")
+ _Client.Connect()
DocumentViewer1.Init(_LogConfig, "21182889975216572111813147150675976632")
Catch ex As Exception
@@ -61,18 +58,8 @@ Public Class Form1
AddLogMessage($"Importing {oFileInfo.Name}... ({FormatBytes(oFileInfo.Length)})")
- Dim oContents As Byte() = New Byte(oFileInfo.Length) {}
-
- Using oStream As New FileStream(oFileName, FileMode.Open)
- Await oStream.ReadAsync(oContents, 0, oFileInfo.Length)
- End Using
-
- Dim oResult As EDMIServiceReference.DocumentResult = Await _Channel.ImportFileAsync(oFileInfo.Name, oContents, 1, "WichtigesDokument", 0)
- If oResult.OK Then
- AddLogMessage($"File [{oFileInfo.Name}] with Id [{oResult.Document.FileId}] imported!")
- Else
- AddLogMessage($"Import Error: {oResult.ErrorMessage}")
- End If
+ Dim oObjectId As Long = Await _Client.ImportFileAsync(oFileInfo.Name, "WichtigesDokument", 1, 0)
+ AddLogMessage($"File with Id [{oObjectId}] imported!")
oSW.Stop()
AddLogMessage($"Import Time: {FormatTime(oSW.ElapsedMilliseconds)}")
AddLogMessage("")
@@ -135,18 +122,14 @@ Public Class Form1
Dim oSWTotal As New Stopwatch()
oSWTotal.Start()
- If TextboxObejctId.EditValue = "" Then
+ If TextboxObjectId.EditValue = "" Then
MsgBox("Please enter an object id!", MsgBoxStyle.Exclamation, "Uh oh!")
End If
- Dim oObjectId As Integer = TextboxObejctId.EditValue
+ Dim oObjectId As Integer = TextboxObjectId.EditValue
+ Dim oResponse As Client.StreamedFile = Await _Client.GetFileByObjectIdAsync(oObjectId)
- Dim oResponse = Await _Channel.GetFileByObjectIdAsync(New EDMIServiceReference.DocumentStreamRequest() With {.ObjectId = oObjectId})
- Dim oMemoryStream As New MemoryStream()
- oResponse.FileContents.CopyTo(oMemoryStream)
- oMemoryStream.Position = 0
-
- DocumentViewer1.LoadFile(oResponse.FileName, oMemoryStream)
+ DocumentViewer1.LoadFile(oResponse.FileName, oResponse.Stream)
oSWTotal.Stop()
AddLogMessage($"File [{oResponse.FileName}] loaded: [{FormatTime(oSWTotal.ElapsedMilliseconds)}]")
@@ -159,7 +142,7 @@ Public Class Form1
Private Async Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
Try
- Dim oResult = Await _Channel.ListFilesForUserAsync()
+ Dim oResult As Client.FileList = Await _Client.ListFilesForUserAsync()
BindingSource1.DataSource = oResult.Datatable
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Uh oh!")
@@ -177,13 +160,10 @@ Public Class Form1
Dim oSWTotal As New Stopwatch()
oSWTotal.Start()
- Dim oObjectId As Int64 = oRow.Item("IDB_OBJ_ID")
- Dim oResponse = Await _Channel.GetFileByObjectIdAsync(New EDMIServiceReference.DocumentStreamRequest() With {.ObjectId = oObjectId})
- Dim oMemoryStream As New MemoryStream()
- oResponse.FileContents.CopyTo(oMemoryStream)
- oMemoryStream.Position = 0
+ Dim oObjectId As Long = oRow.Item("IDB_OBJ_ID")
+ Dim oResponse As Client.StreamedFile = Await _Client.GetFileByObjectIdAsync(oObjectId)
- DocumentViewer1.LoadFile(oResponse.FileName, oMemoryStream)
+ DocumentViewer1.LoadFile(oResponse.FileName, oResponse.Stream)
oSWTotal.Stop()
AddLogMessage($"File [{oResponse.FileName}] loaded: [{FormatTime(oSWTotal.ElapsedMilliseconds)}]")
@@ -199,14 +179,11 @@ Public Class Form1
Dim oSWTotal As New Stopwatch()
oSWTotal.Start()
- Dim oObjectId As Integer = TextboxObejctId.EditValue
+ Dim oObjectId As Integer = TextboxObjectId.EditValue
- Dim oResponse = Await _Channel.GetFileByObjectIdAsync(New EDMIServiceReference.DocumentStreamRequest() With {.ObjectId = oObjectId})
- Dim oMemoryStream As New MemoryStream()
- oResponse.FileContents.CopyTo(oMemoryStream)
- oMemoryStream.Position = 0
+ Dim oResponse As Client.StreamedFile = Await _Client.GetFileByObjectIdAsync(oObjectId)
- DocumentViewer1.LoadFile(oResponse.FileName, oMemoryStream)
+ DocumentViewer1.LoadFile(oResponse.FileName, oResponse.Stream)
oSWTotal.Stop()
AddLogMessage($"File [{oResponse.FileName}] loaded: [{FormatTime(oSWTotal.ElapsedMilliseconds)}]")
@@ -217,7 +194,7 @@ Public Class Form1
Private Sub BarToggleSwitchItem1_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarToggleSwitchItem1.CheckedChanged
If BarToggleSwitchItem1.Checked Then
- If TextboxObejctId.EditValue = "" Then
+ If TextboxObjectId.EditValue = "" Then
Timer1.Stop()
MsgBox("Please set a ObjectId!", MsgBoxStyle.Critical, Text)
Else
diff --git a/Modules.EDMIAPI/Channel.vb b/Modules.EDMIAPI/Channel.vb
deleted file mode 100644
index 8520bc60..00000000
--- a/Modules.EDMIAPI/Channel.vb
+++ /dev/null
@@ -1,24 +0,0 @@
-Imports System.ServiceModel
-Imports System.Xml
-
-Public Class Channel
- Public Shared Function GetBinding(Optional AuthenticationMode As TcpClientCredentialType = TcpClientCredentialType.Windows) As NetTcpBinding
- Return New NetTcpBinding() With {
- .MaxReceivedMessageSize = Constants.MAX_RECEIVED_MESSAGE_SIZE,
- .MaxBufferSize = Constants.MAX_BUFFER_SIZE,
- .MaxBufferPoolSize = Constants.MAX_BUFFER_POOL_SIZE,
- .MaxConnections = Constants.MAX_CONNECTIONS,
- .TransferMode = TransferMode.Streamed,
- .Security = New NetTcpSecurity() With {
- .Mode = SecurityMode.Transport,
- .Transport = New TcpTransportSecurity() With {
- .ClientCredentialType = AuthenticationMode
- }
- },
- .ReaderQuotas = New XmlDictionaryReaderQuotas() With {
- .MaxArrayLength = Constants.MAX_ARRAY_LENGTH,
- .MaxStringContentLength = Constants.MAX_STRING_CONTENT_LENGTH
- }
- }
- End Function
-End Class
diff --git a/Modules.EDMIAPI/Client.vb b/Modules.EDMIAPI/Client.vb
new file mode 100644
index 00000000..2ca1d33e
--- /dev/null
+++ b/Modules.EDMIAPI/Client.vb
@@ -0,0 +1,152 @@
+Imports DigitalData.Modules.Logging
+Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
+Imports System.ServiceModel
+Imports System.IO
+
+Public Class Client
+ Private ReadOnly _logger As Logger
+ Private ReadOnly _channelFactory As ChannelFactory(Of IEDMIServiceChannel)
+ Private _channel As IEDMIServiceChannel
+
+ Public Class StreamedFile
+ Public Stream As MemoryStream
+ Public FileName As String
+ End Class
+
+ Public Class FileList
+ Public Datatable As DataTable
+ End Class
+
+ '''
+ ''' Creates a new EDMIAPI object
+ '''
+ ''' LogConfig object
+ ''' The full service url to connect to
+ Public Sub New(LogConfig As LogConfig, ServiceAdress As String)
+ _logger = LogConfig.GetLogger()
+
+ Try
+ Dim oBinding = Channel.GetBinding()
+ Dim oAddress = New EndpointAddress(ServiceAdress)
+ Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress)
+
+ _channelFactory = oFactory
+ Catch ex As Exception
+ _logger.Error(ex)
+ End Try
+ End Sub
+
+ '''
+ ''' Connect to the service
+ '''
+ ''' True if connection was successful, false otherwise
+ Public Function Connect() As Boolean
+ Try
+ _channel = GetChannel()
+
+ _logger.Debug("Opening channel..")
+ _channel.Open()
+
+ _logger.Info("Connection to Service established!")
+ Return True
+ Catch ex As Exception
+ _logger.Error(ex)
+ Return False
+ End Try
+ End Function
+
+ '''
+ ''' Imports a file by filename
+ '''
+ ''' A document object
+ Public Async Function ImportFileAsync(FilePath As String, DocumentType As String, ObjectStoreId As Long, Optional RetentionDays As Integer = 0) As Task(Of Long)
+ Try
+ Dim oFileInfo As New FileInfo(FilePath)
+ If oFileInfo.Exists = False Then
+ Throw New FileNotFoundException("Cannot import non-existing file.", FilePath)
+ End If
+
+ Using oStream As New FileStream(FilePath, FileMode.Open)
+ Dim oContents As Byte() = {}
+ Dim oBytesRead = Await oStream.ReadAsync(oContents, 0, oStream.Length)
+ Dim oData As New DocumentImportRequest() With {
+ .FileName = oFileInfo.Name,
+ .Contents = oContents,
+ .DocumentType = DocumentType,
+ .ObjectStoreId = ObjectStoreId,
+ .RetentionDays = RetentionDays
+ }
+
+ Dim oResponse = Await _channel.ImportFileAsync(oData)
+
+ Return oResponse.ObjectId
+ End Using
+ Catch ex As Exception
+ _logger.Error(ex)
+ Throw ex
+ End Try
+ End Function
+
+ Public Async Function GetFileByObjectIdAsync(ObjectId As Long) As Task(Of StreamedFile)
+ Try
+ Dim oData As New DocumentStreamRequest() With {.ObjectId = ObjectId}
+ Dim oResponse As DocumentStreamResponse = Await _channel.GetFileByObjectIdAsync(oData)
+ Dim oMemoryStream As New MemoryStream()
+ oResponse.FileContents.CopyTo(oMemoryStream)
+ oMemoryStream.Position = 0
+
+ Return New StreamedFile() With {
+ .Stream = oMemoryStream,
+ .FileName = oResponse.FileName
+ }
+ Catch ex As Exception
+ _logger.Error(ex)
+ Throw ex
+ End Try
+ End Function
+
+ Public Async Function ListFilesForUserAsync() As Task(Of FileList)
+ Try
+ Dim oResponse As DocumentListResponse = Await _channel.ListFilesForUserAsync(New ListFilesForUserRequest())
+ Return New FileList() With {
+ .Datatable = oResponse.Datatable
+ }
+ Catch ex As Exception
+ _logger.Error(ex)
+ Throw ex
+ End Try
+ End Function
+
+ '''
+ ''' Aborts the channel and creates a new connection
+ '''
+ Private Sub Reconnect()
+ _logger.Warn("Connection faulted. Trying to reconnect..")
+
+ Try
+ _channel.Abort()
+ _channel = GetChannel()
+ _channel.Open()
+ Catch ex As Exception
+ _logger.Error(ex)
+ End Try
+ End Sub
+
+ '''
+ ''' Creates a channel and adds a Faulted-Handler
+ '''
+ ''' A channel object
+ Private Function GetChannel() As IEDMIServiceChannel
+ Try
+ _logger.Debug("Creating channel..")
+ Dim oChannel = _channelFactory.CreateChannel()
+
+ AddHandler oChannel.Faulted, AddressOf Reconnect
+
+ Return oChannel
+ Catch ex As Exception
+ _logger.Error(ex)
+ Throw ex
+ End Try
+ End Function
+End Class
diff --git a/Modules.EDMIAPI/Client/Channel.vb b/Modules.EDMIAPI/Client/Channel.vb
new file mode 100644
index 00000000..041ae8d0
--- /dev/null
+++ b/Modules.EDMIAPI/Client/Channel.vb
@@ -0,0 +1,38 @@
+Imports System.ServiceModel
+Imports System.Xml
+
+
+Public Class Channel
+ ' Infos about MaxBufferSize and MaxBufferPoolSize
+ ' https://social.msdn.microsoft.com/Forums/vstudio/en-US/d6e234d3-942f-4e9d-8470-32618d3f3212/maxbufferpoolsize-vs-maxbuffersize?forum=wcf
+
+ Public Const MAX_RECEIVED_MESSAGE_SIZE = 2147483647 ' 1GB
+ Public Const MAX_BUFFER_SIZE = 2147483647 ' 10MB
+ Public Const MAX_BUFFER_POOL_SIZE = 2147483647 ' 40MB
+
+ Public Const MAX_CONNECTIONS = 500
+ Public Const MAX_ARRAY_LENGTH = 2147483647
+ Public Const MAX_STRING_CONTENT_LENGTH = 2147483647
+
+ Public Shared Function GetBinding(Optional AuthenticationMode As TcpClientCredentialType = TcpClientCredentialType.Windows) As NetTcpBinding
+ Return New NetTcpBinding() With {
+ .MaxReceivedMessageSize = MAX_RECEIVED_MESSAGE_SIZE,
+ .MaxBufferSize = MAX_BUFFER_SIZE,
+ .MaxBufferPoolSize = MAX_BUFFER_POOL_SIZE,
+ .MaxConnections = MAX_CONNECTIONS,
+ .TransferMode = TransferMode.Streamed,
+ .Security = New NetTcpSecurity() With {
+ .Mode = SecurityMode.Transport,
+ .Transport = New TcpTransportSecurity() With {
+ .ClientCredentialType = AuthenticationMode
+ }
+ },
+ .ReaderQuotas = New XmlDictionaryReaderQuotas() With {
+ .MaxArrayLength = MAX_ARRAY_LENGTH,
+ .MaxStringContentLength = MAX_STRING_CONTENT_LENGTH
+ }
+ }
+ End Function
+End Class
+
+
diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Modules.EDMI.API.EDMIServiceReference.DocumentResult.datasource b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Modules.EDMI.API.EDMIServiceReference.DocumentImportResponse.datasource
similarity index 56%
rename from Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Modules.EDMI.API.EDMIServiceReference.DocumentResult.datasource
rename to Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Modules.EDMI.API.EDMIServiceReference.DocumentImportResponse.datasource
index 4bf7be0e..0cb66122 100644
--- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Modules.EDMI.API.EDMIServiceReference.DocumentResult.datasource
+++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Modules.EDMI.API.EDMIServiceReference.DocumentImportResponse.datasource
@@ -5,6 +5,6 @@
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
-
- DigitalData.Modules.EDMI.API.EDMIServiceReference.DocumentResult, Connected Services.EDMIServiceReference.Reference.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
+
+ DigitalData.Modules.EDMI.API.EDMIServiceReference.DocumentImportResponse, Connected Services.EDMIServiceReference.Reference.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
\ No newline at end of file
diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.Messages.xsd b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.Messages.xsd
deleted file mode 100644
index 00e7f568..00000000
--- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.Messages.xsd
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.wsdl b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.wsdl
index 886341bc..79b1af83 100644
--- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.wsdl
+++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.wsdl
@@ -9,7 +9,6 @@
-
@@ -84,11 +83,11 @@
-
-
+
+
-
-
+
+
@@ -99,11 +98,9 @@
-
-
-
-
-
+
+
+
@@ -161,8 +158,8 @@
-
-
+
+
@@ -170,7 +167,7 @@
-
+
diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.xsd b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.xsd
index cffaf1e9..4650e6f9 100644
--- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.xsd
+++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.xsd
@@ -3,7 +3,6 @@
-
@@ -169,21 +168,21 @@
-
+
-
-
+
+
-
+
-
+
@@ -197,27 +196,35 @@
-
+
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -227,7 +234,7 @@
-
+
diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService1.xsd b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService1.xsd
index 0c04d9a3..1158774c 100644
--- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService1.xsd
+++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService1.xsd
@@ -61,25 +61,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.svcmap b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.svcmap
index 43899f29..0dd586d8 100644
--- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.svcmap
+++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.svcmap
@@ -31,7 +31,6 @@
-
diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.vb b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.vb
index 9f35c7e1..1c5b2359 100644
--- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.vb
+++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.vb
@@ -23,7 +23,6 @@ Namespace EDMIServiceReference
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.ScalarResult)), _
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.NonQueryResult)), _
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.DocumentResultOld)), _
- System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.DocumentResult)), _
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.IndexResult)), _
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.TableResult))> _
Partial Public Class BaseResult
@@ -93,13 +92,9 @@ Namespace EDMIServiceReference
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.BaseResult)), _
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.NonQueryResult)), _
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.DocumentResultOld)), _
- System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.DocumentResult)), _
- System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.DocumentResult.DocumentObject)), _
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.IndexResult)), _
System.Runtime.Serialization.KnownTypeAttribute(GetType(System.DBNull)), _
- System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.DocumentObject)), _
- System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.DocumentListResponse)), _
- System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.BaseResponse))> _
+ System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.DocumentObject))> _
Partial Public Class ScalarResult
Inherits EDMIServiceReference.BaseResult
@@ -181,121 +176,6 @@ Namespace EDMIServiceReference
End Property
End Class
- _
- Partial Public Class DocumentResult
- Inherits EDMIServiceReference.BaseResult
-
- Private ContentsField() As Byte
-
- Private DocumentField As EDMIServiceReference.DocumentResult.DocumentObject
-
- Private HasContentsField As Boolean
-
- _
- Public Property Contents() As Byte()
- Get
- Return Me.ContentsField
- End Get
- Set
- If (Object.ReferenceEquals(Me.ContentsField, value) <> true) Then
- Me.ContentsField = value
- Me.RaisePropertyChanged("Contents")
- End If
- End Set
- End Property
-
- _
- Public Property Document() As EDMIServiceReference.DocumentResult.DocumentObject
- Get
- Return Me.DocumentField
- End Get
- Set
- If (Object.ReferenceEquals(Me.DocumentField, value) <> true) Then
- Me.DocumentField = value
- Me.RaisePropertyChanged("Document")
- End If
- End Set
- End Property
-
- _
- Public Property HasContents() As Boolean
- Get
- Return Me.HasContentsField
- End Get
- Set
- If (Me.HasContentsField.Equals(value) <> true) Then
- Me.HasContentsField = value
- Me.RaisePropertyChanged("HasContents")
- End If
- End Set
- End Property
-
- _
- Partial Public Class DocumentObject
- Inherits Object
- Implements System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged
-
- _
- Private extensionDataField As System.Runtime.Serialization.ExtensionDataObject
-
- _
- Private FileIdField As String
-
- _
- Private FileNameField As String
-
- Public Property ExtensionData() As System.Runtime.Serialization.ExtensionDataObject Implements System.Runtime.Serialization.IExtensibleDataObject.ExtensionData
- Get
- Return Me.extensionDataField
- End Get
- Set
- Me.extensionDataField = value
- End Set
- End Property
-
- _
- Public Property FileId() As String
- Get
- Return Me.FileIdField
- End Get
- Set
- If (Object.ReferenceEquals(Me.FileIdField, value) <> true) Then
- Me.FileIdField = value
- Me.RaisePropertyChanged("FileId")
- End If
- End Set
- End Property
-
- _
- Public Property FileName() As String
- Get
- Return Me.FileNameField
- End Get
- Set
- If (Object.ReferenceEquals(Me.FileNameField, value) <> true) Then
- Me.FileNameField = value
- Me.RaisePropertyChanged("FileName")
- End If
- End Set
- End Property
-
- Public Event PropertyChanged As System.ComponentModel.PropertyChangedEventHandler Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
-
- Protected Sub RaisePropertyChanged(ByVal propertyName As String)
- Dim propertyChanged As System.ComponentModel.PropertyChangedEventHandler = Me.PropertyChangedEvent
- If (Not (propertyChanged) Is Nothing) Then
- propertyChanged(Me, New System.ComponentModel.PropertyChangedEventArgs(propertyName))
- End If
- End Sub
- End Class
- End Class
-
_
- Partial Public Class DocumentListResponse
- Inherits EDMIServiceReference.BaseResponse
-
- _
- Private DatatableField As System.Data.DataTable
-
- _
- Public Property Datatable() As System.Data.DataTable
- Get
- Return Me.DatatableField
- End Get
- Set
- If (Object.ReferenceEquals(Me.DatatableField, value) <> true) Then
- Me.DatatableField = value
- Me.RaisePropertyChanged("Datatable")
- End If
- End Set
- End Property
- End Class
-
- _
- Partial Public Class BaseResponse
- Inherits Object
- Implements System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged
-
- _
- Private extensionDataField As System.Runtime.Serialization.ExtensionDataObject
-
- _
- Private ErrorMessageField As String
-
- _
- Private OKField As Boolean
-
- _
- Public Property ExtensionData() As System.Runtime.Serialization.ExtensionDataObject Implements System.Runtime.Serialization.IExtensibleDataObject.ExtensionData
- Get
- Return Me.extensionDataField
- End Get
- Set
- Me.extensionDataField = value
- End Set
- End Property
-
- _
- Public Property ErrorMessage() As String
- Get
- Return Me.ErrorMessageField
- End Get
- Set
- If (Object.ReferenceEquals(Me.ErrorMessageField, value) <> true) Then
- Me.ErrorMessageField = value
- Me.RaisePropertyChanged("ErrorMessage")
- End If
- End Set
- End Property
-
- _
- Public Property OK() As Boolean
- Get
- Return Me.OKField
- End Get
- Set
- If (Me.OKField.Equals(value) <> true) Then
- Me.OKField = value
- Me.RaisePropertyChanged("OK")
- End If
- End Set
- End Property
-
- Public Event PropertyChanged As System.ComponentModel.PropertyChangedEventHandler Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
-
- Protected Sub RaisePropertyChanged(ByVal propertyName As String)
- Dim propertyChanged As System.ComponentModel.PropertyChangedEventHandler = Me.PropertyChangedEvent
- If (Not (propertyChanged) Is Nothing) Then
- propertyChanged(Me, New System.ComponentModel.PropertyChangedEventArgs(propertyName))
- End If
- End Sub
- End Class
-
_
Public Interface IEDMIService
@@ -593,11 +383,12 @@ Namespace EDMIServiceReference
"onse")> _
Function GetDocumentByContainerIdAsync(ByVal ContainerId As String) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentResultOld)
+ 'CODEGEN: Der Nachrichtenvertrag wird generiert, da der Wrappername (DocumentImportRequest) von Nachricht "DocumentImportRequest" nicht mit dem Standardwert (ImportFile) übereinstimmt.
_
- Function ImportFile(ByVal FileName As String, ByVal Contents() As Byte, ByVal ObjectStoreId As Long, ByVal DocumentType As String, ByVal RetentionDays As Long) As EDMIServiceReference.DocumentResult
+ Function ImportFile(ByVal request As EDMIServiceReference.DocumentImportRequest) As EDMIServiceReference.DocumentImportResponse
_
- Function ImportFileAsync(ByVal FileName As String, ByVal Contents() As Byte, ByVal ObjectStoreId As Long, ByVal DocumentType As String, ByVal RetentionDays As Long) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentResult)
+ Function ImportFileAsync(ByVal request As EDMIServiceReference.DocumentImportRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentImportResponse)
'CODEGEN: Der Nachrichtenvertrag wird generiert, da der Wrappername (DocumentStreamRequest) von Nachricht "DocumentStreamRequest" nicht mit dem Standardwert (GetFileByObjectId) übereinstimmt.
_
@@ -606,11 +397,12 @@ Namespace EDMIServiceReference
_
Function GetFileByObjectIdAsync(ByVal request As EDMIServiceReference.DocumentStreamRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentStreamResponse)
+ 'CODEGEN: Der Nachrichtenvertrag wird generiert, da der Vorgang ListFilesForUser weder in RPC noch in einem Dokument eingeschlossen ist.
_
- Function ListFilesForUser() As EDMIServiceReference.DocumentListResponse
+ Function ListFilesForUser(ByVal request As EDMIServiceReference.ListFilesForUserRequest) As EDMIServiceReference.DocumentListResponse
_
- Function ListFilesForUserAsync() As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentListResponse)
+ Function ListFilesForUserAsync(ByVal request As EDMIServiceReference.ListFilesForUserRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentListResponse)
_
Function NewFileIndex(ByVal DocObject As EDMIServiceReference.DocumentObject, ByVal Syskey As String, ByVal LanguageCode As String, ByVal Value As String) As EDMIServiceReference.IndexResult
@@ -619,6 +411,60 @@ Namespace EDMIServiceReference
Function NewFileIndexAsync(ByVal DocObject As EDMIServiceReference.DocumentObject, ByVal Syskey As String, ByVal LanguageCode As String, ByVal Value As String) As System.Threading.Tasks.Task(Of EDMIServiceReference.IndexResult)
End Interface
+ _
+ Partial Public Class DocumentImportRequest
+
+ _
+ Public Contents() As Byte
+
+ _
+ Public DocumentType As String
+
+ _
+ Public FileName As String
+
+ _
+ Public ObjectStoreId As Long
+
+ _
+ Public RetentionDays As Long
+
+ Public Sub New()
+ MyBase.New
+ End Sub
+
+ Public Sub New(ByVal Contents() As Byte, ByVal DocumentType As String, ByVal FileName As String, ByVal ObjectStoreId As Long, ByVal RetentionDays As Long)
+ MyBase.New
+ Me.Contents = Contents
+ Me.DocumentType = DocumentType
+ Me.FileName = FileName
+ Me.ObjectStoreId = ObjectStoreId
+ Me.RetentionDays = RetentionDays
+ End Sub
+ End Class
+
+ _
+ Partial Public Class DocumentImportResponse
+
+ _
+ Public ObjectId As Long
+
+ Public Sub New()
+ MyBase.New
+ End Sub
+
+ Public Sub New(ByVal ObjectId As Long)
+ MyBase.New
+ Me.ObjectId = ObjectId
+ End Sub
+ End Class
+
_
+ Partial Public Class ListFilesForUserRequest
+
+ Public Sub New()
+ MyBase.New
+ End Sub
+ End Class
+
+ _
+ Partial Public Class DocumentListResponse
+
+ _
+ Public Datatable As System.Data.DataTable
+
+ Public Sub New()
+ MyBase.New
+ End Sub
+
+ Public Sub New(ByVal Datatable As System.Data.DataTable)
+ MyBase.New
+ Me.Datatable = Datatable
+ End Sub
+ End Class
+
_
Public Interface IEDMIServiceChannel
Inherits EDMIServiceReference.IEDMIService, System.ServiceModel.IClientChannel
@@ -788,12 +664,35 @@ Namespace EDMIServiceReference
Return MyBase.Channel.GetDocumentByContainerIdAsync(ContainerId)
End Function
- Public Function ImportFile(ByVal FileName As String, ByVal Contents() As Byte, ByVal ObjectStoreId As Long, ByVal DocumentType As String, ByVal RetentionDays As Long) As EDMIServiceReference.DocumentResult Implements EDMIServiceReference.IEDMIService.ImportFile
- Return MyBase.Channel.ImportFile(FileName, Contents, ObjectStoreId, DocumentType, RetentionDays)
+ _
+ Function EDMIServiceReference_IEDMIService_ImportFile(ByVal request As EDMIServiceReference.DocumentImportRequest) As EDMIServiceReference.DocumentImportResponse Implements EDMIServiceReference.IEDMIService.ImportFile
+ Return MyBase.Channel.ImportFile(request)
End Function
- Public Function ImportFileAsync(ByVal FileName As String, ByVal Contents() As Byte, ByVal ObjectStoreId As Long, ByVal DocumentType As String, ByVal RetentionDays As Long) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentResult) Implements EDMIServiceReference.IEDMIService.ImportFileAsync
- Return MyBase.Channel.ImportFileAsync(FileName, Contents, ObjectStoreId, DocumentType, RetentionDays)
+ Public Function ImportFile(ByVal Contents() As Byte, ByVal DocumentType As String, ByVal FileName As String, ByVal ObjectStoreId As Long, ByVal RetentionDays As Long) As Long
+ Dim inValue As EDMIServiceReference.DocumentImportRequest = New EDMIServiceReference.DocumentImportRequest()
+ inValue.Contents = Contents
+ inValue.DocumentType = DocumentType
+ inValue.FileName = FileName
+ inValue.ObjectStoreId = ObjectStoreId
+ inValue.RetentionDays = RetentionDays
+ Dim retVal As EDMIServiceReference.DocumentImportResponse = CType(Me,EDMIServiceReference.IEDMIService).ImportFile(inValue)
+ Return retVal.ObjectId
+ End Function
+
+ _
+ Function EDMIServiceReference_IEDMIService_ImportFileAsync(ByVal request As EDMIServiceReference.DocumentImportRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentImportResponse) Implements EDMIServiceReference.IEDMIService.ImportFileAsync
+ Return MyBase.Channel.ImportFileAsync(request)
+ End Function
+
+ Public Function ImportFileAsync(ByVal Contents() As Byte, ByVal DocumentType As String, ByVal FileName As String, ByVal ObjectStoreId As Long, ByVal RetentionDays As Long) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentImportResponse)
+ Dim inValue As EDMIServiceReference.DocumentImportRequest = New EDMIServiceReference.DocumentImportRequest()
+ inValue.Contents = Contents
+ inValue.DocumentType = DocumentType
+ inValue.FileName = FileName
+ inValue.ObjectStoreId = ObjectStoreId
+ inValue.RetentionDays = RetentionDays
+ Return CType(Me,EDMIServiceReference.IEDMIService).ImportFileAsync(inValue)
End Function
_
@@ -820,12 +719,25 @@ Namespace EDMIServiceReference
Return CType(Me,EDMIServiceReference.IEDMIService).GetFileByObjectIdAsync(inValue)
End Function
- Public Function ListFilesForUser() As EDMIServiceReference.DocumentListResponse Implements EDMIServiceReference.IEDMIService.ListFilesForUser
- Return MyBase.Channel.ListFilesForUser
+ _
+ Function EDMIServiceReference_IEDMIService_ListFilesForUser(ByVal request As EDMIServiceReference.ListFilesForUserRequest) As EDMIServiceReference.DocumentListResponse Implements EDMIServiceReference.IEDMIService.ListFilesForUser
+ Return MyBase.Channel.ListFilesForUser(request)
End Function
- Public Function ListFilesForUserAsync() As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentListResponse) Implements EDMIServiceReference.IEDMIService.ListFilesForUserAsync
- Return MyBase.Channel.ListFilesForUserAsync
+ Public Function ListFilesForUser() As System.Data.DataTable
+ Dim inValue As EDMIServiceReference.ListFilesForUserRequest = New EDMIServiceReference.ListFilesForUserRequest()
+ Dim retVal As EDMIServiceReference.DocumentListResponse = CType(Me,EDMIServiceReference.IEDMIService).ListFilesForUser(inValue)
+ Return retVal.Datatable
+ End Function
+
+ _
+ Function EDMIServiceReference_IEDMIService_ListFilesForUserAsync(ByVal request As EDMIServiceReference.ListFilesForUserRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentListResponse) Implements EDMIServiceReference.IEDMIService.ListFilesForUserAsync
+ Return MyBase.Channel.ListFilesForUserAsync(request)
+ End Function
+
+ Public Function ListFilesForUserAsync() As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentListResponse)
+ Dim inValue As EDMIServiceReference.ListFilesForUserRequest = New EDMIServiceReference.ListFilesForUserRequest()
+ Return CType(Me,EDMIServiceReference.IEDMIService).ListFilesForUserAsync(inValue)
End Function
Public Function NewFileIndex(ByVal DocObject As EDMIServiceReference.DocumentObject, ByVal Syskey As String, ByVal LanguageCode As String, ByVal Value As String) As EDMIServiceReference.IndexResult Implements EDMIServiceReference.IEDMIService.NewFileIndex
diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/service.wsdl b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/service.wsdl
index b8d866c0..392381ce 100644
--- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/service.wsdl
+++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/service.wsdl
@@ -151,10 +151,10 @@
-
+
-
+
@@ -173,7 +173,7 @@
-
+
diff --git a/Modules.EDMIAPI/Constants.vb b/Modules.EDMIAPI/Constants.vb
deleted file mode 100644
index 74d153b2..00000000
--- a/Modules.EDMIAPI/Constants.vb
+++ /dev/null
@@ -1,12 +0,0 @@
-Public Class Constants
- ' Infos about MaxBufferSize and MaxBufferPoolSize
- ' https://social.msdn.microsoft.com/Forums/vstudio/en-US/d6e234d3-942f-4e9d-8470-32618d3f3212/maxbufferpoolsize-vs-maxbuffersize?forum=wcf
-
- Public Const MAX_RECEIVED_MESSAGE_SIZE = 2147483647 ' 1GB
- Public Const MAX_BUFFER_SIZE = 2147483647 ' 10MB
- Public Const MAX_BUFFER_POOL_SIZE = 2147483647 ' 40MB
-
- Public Const MAX_CONNECTIONS = 500
- Public Const MAX_ARRAY_LENGTH = 2147483647
- Public Const MAX_STRING_CONTENT_LENGTH = 2147483647
-End Class
diff --git a/Modules.EDMIAPI/Document.vb b/Modules.EDMIAPI/Document.vb
deleted file mode 100644
index 9ca378d1..00000000
--- a/Modules.EDMIAPI/Document.vb
+++ /dev/null
@@ -1,200 +0,0 @@
-Imports DigitalData.Modules.Logging
-Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
-Imports System.ServiceModel
-Imports System.IO
-
-Public Class Document
- Private _logger As Logger
- Private _logConfig As LogConfig
- Private _channelFactory As ChannelFactory(Of IEDMIServiceChannel)
- Private _channel As IEDMIServiceChannel
-
- '''
- ''' Creates a new EDMIAPI object
- '''
- ''' LogConfig object
- ''' The full service url to connect to
- Public Sub New(LogConfig As LogConfig, ServiceAdress As String)
- _logger = LogConfig.GetLogger()
- _logConfig = LogConfig
-
- Try
- Dim oBinding = Channel.GetBinding()
- Dim oAddress = New EndpointAddress(ServiceAdress)
- Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress)
-
- _channelFactory = oFactory
- Catch ex As Exception
- _logger.Error(ex)
- End Try
- End Sub
-
- '''
- ''' Connect to the service
- '''
- ''' True if connection was successful, false otherwise
- Public Function Connect() As Boolean
- Try
- _channel = GetChannel()
-
- _logger.Debug("Opening channel..")
- _channel.Open()
-
- _logger.Info("Connection to Service established!")
- Return True
- Catch ex As Exception
- _logger.Error(ex)
- Return False
- End Try
- End Function
-
- '''
- ''' Imports a file by filename
- '''
- ''' The filename to import
- ''' A document object
- Public Async Function ImportFileAsync(FilePath As String, Optional [ReadOnly] As Boolean = False, Optional RetentionDays As Integer = 0) As Task(Of DocumentResult)
- Try
- Using oStream As New FileStream(FilePath, FileMode.Open)
- Dim oContents As Byte() = {}
- Dim oBytesRead = Await oStream.ReadAsync(oContents, 0, oStream.Length)
- Dim oResult = Await _channel.ImportFileAsync(FilePath, oContents, 1, "WichtigesDokument", RetentionDays)
-
- Return oResult
- End Using
- Catch ex As Exception
- _logger.Error(ex)
- Throw ex
- End Try
- End Function
-
- '''
- ''' Imports a file by filename
- '''
- ''' The filename to import
- ''' A document object
- Public Function ImportFile(FilePath As String) As DocumentResult
- Try
- Dim oContents As Byte() = File.ReadAllBytes(FilePath)
- Dim oInfo As New FileInfo(FilePath)
- Dim oDocObject = _channel.ImportFile(FilePath, oContents, 1, "WichtigesDokument", 0)
- Return oDocObject
- Catch ex As Exception
- _logger.Error(ex)
- Throw ex
- End Try
- End Function
-
- ''''
- '''' Imports a file by filename
- ''''
- '''' The filename to import
- '''' A document object
- 'Public Function ImportFile(FilePath As String) As DocumentResult
- ' Try
- ' Dim oContents As Byte() = File.ReadAllBytes(FilePath)
- ' Dim oInfo As New FileInfo(FilePath)
- ' Dim oName As String = oInfo.Name
- ' Dim oExtension As String = oInfo.Extension.Substring(1)
-
- ' Dim oDocObject = _channel.NewFile(oName, oContents)
- ' Return oDocObject
- ' Catch ex As Exception
- ' _logger.Error(ex)
- ' Throw ex
- ' End Try
- 'End Function
-
- ''''
- '''' Imports a file by filename
- ''''
- '''' The filename to import
- '''' A document object
- 'Public Async Function ImportFileAsync(FilePath As String) As Task(Of DocumentResult)
- ' Try
- ' Dim oContents As Byte() = File.ReadAllBytes(FilePath)
- ' Dim oInfo As New FileInfo(FilePath)
- ' Dim oName As String = oInfo.Name
- ' Dim oExtension As String = oInfo.Extension.Substring(1)
-
- ' Dim oDocObject = Await _channel.NewFileAsync(oName, oContents)
- ' Return oDocObject
- ' Catch ex As Exception
- ' _logger.Error(ex)
- ' Throw ex
- ' End Try
- 'End Function
-
- 'Public Async Function NewFileIndexAsync(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As Task(Of IndexResult)
- ' Try
- ' Dim oResult As IndexResult = Await _channel.NewFileIndexAsync(DocObject, Syskey, LanguageCode, Value)
-
- ' Return oResult
- ' Catch ex As Exception
- ' _logger.Error(ex)
- ' Throw ex
- ' End Try
- 'End Function
-
- 'Public Function NewFileIndex(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As IndexResult
- ' Try
- ' Dim oResult As IndexResult = _channel.NewFileIndex(DocObject, Syskey, LanguageCode, Value)
-
- ' Return oResult
- ' Catch ex As Exception
- ' _logger.Error(ex)
- ' Throw ex
- ' End Try
- 'End Function
-
- 'Public Function GetDocumentByDocumentId(DocumentId As Int64) As DocumentResult
- ' Try
- ' Return _channel.GetDocumentByDocumentId(DocumentId)
- ' Catch ex As Exception
- ' _logger.Error(ex)
- ' Throw ex
- ' End Try
- 'End Function
-
- 'Public Function GetDocumentByContainerId(ContainerId As String) As DocumentResult
- ' Try
- ' Return _channel.GetDocumentByContainerId(ContainerId)
- ' Catch ex As Exception
- ' _logger.Error(ex)
- ' Throw ex
- ' End Try
- 'End Function
-
- '''
- ''' Aborts the channel and creates a new connection
- '''
- Private Sub Reconnect()
- _logger.Warn("Connection faulted. Trying to reconnect..")
-
- Try
- _channel.Abort()
- _channel = GetChannel()
- _channel.Open()
- Catch ex As Exception
- _logger.Error(ex)
- End Try
- End Sub
-
- '''
- ''' Creates a channel and adds a Faulted-Handler
- '''
- ''' A channel object
- Private Function GetChannel() As IEDMIServiceChannel
- Try
- _logger.Debug("Creating channel..")
- Dim oChannel = _channelFactory.CreateChannel()
-
- AddHandler oChannel.Faulted, AddressOf Reconnect
-
- Return oChannel
- Catch ex As Exception
- _logger.Error(ex)
- Throw ex
- End Try
- End Function
-End Class
diff --git a/Modules.EDMIAPI/EDMI.API.vbproj b/Modules.EDMIAPI/EDMI.API.vbproj
index a9808632..6880d2de 100644
--- a/Modules.EDMIAPI/EDMI.API.vbproj
+++ b/Modules.EDMIAPI/EDMI.API.vbproj
@@ -72,14 +72,13 @@
-
+
True
True
Reference.svcmap
-
-
+
True
@@ -106,10 +105,10 @@
-
+
Reference.svcmap
-
+
Reference.svcmap
@@ -133,9 +132,6 @@
Designer
-
- Designer
-
Designer
@@ -160,6 +156,7 @@
MyApplicationCodeGenerator
Application.Designer.vb
+
SettingsSingleFileGenerator
My
diff --git a/Modules.EDMIAPI/My Project/DataSources/System.Data.DataTable.datasource b/Modules.EDMIAPI/My Project/DataSources/System.Data.DataTable.datasource
new file mode 100644
index 00000000..a23fb0d1
--- /dev/null
+++ b/Modules.EDMIAPI/My Project/DataSources/System.Data.DataTable.datasource
@@ -0,0 +1,10 @@
+
+
+
+ System.Data.DataTable, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/Service.EDMIService/EDMIService.vb b/Service.EDMIService/EDMIService.vb
index afb67df3..5c5ea456 100644
--- a/Service.EDMIService/EDMIService.vb
+++ b/Service.EDMIService/EDMIService.vb
@@ -33,6 +33,8 @@ Public Class EDMIService
_username = oUsername
_logger = LogConfig.GetLogger()
_logger.Debug("New Request by User [{0}]", _username)
+
+
End Sub
Public Function StripDomainFromUsername(UserName As String)
@@ -313,16 +315,14 @@ Public Class EDMIService
'''
''' Imports a file according to ObjectStoreId
'''
- '''
- '''
'''
- Public Function ImportFile(FileName As String, Contents() As Byte, ObjectStoreId As Int64, DocumentType As String, Optional RetentionDays As Int64 = Nothing) As DocumentResult Implements IEDMIService.ImportFile
+ Public Function ImportFile(Data As Messages.DocumentImportRequest) As Messages.DocumentImportResponse Implements IEDMIService.ImportFile
Dim oObjectStore = GlobalState.ObjectStores.
- Where(Function(s) s.Id = ObjectStoreId).
+ Where(Function(s) s.Id = Data.ObjectStoreId).
FirstOrDefault()
If oObjectStore Is Nothing Then
- Return New DocumentResult($"Object Store with Id [{ObjectStoreId}] does not exist!")
+ Throw New FaultException($"Object Store with Id [{Data.ObjectStoreId}] does not exist!")
End If
Dim EDMIPath = New EDMI.File.Path(LogConfig, oObjectStore.Path)
@@ -335,24 +335,23 @@ Public Class EDMIService
' and return ObjectStore Path from ObjectStoreId + RelativePath
' VWIDB_OBJECTSTORE
- Dim oRelativePath As String = EDMIPath.GetRelativePath(DocumentType, FileName)
- Dim oAbsolutePath As String = EDMIPath.GetFullPath(DocumentType, FileName)
- Dim oDirectoryPath = EDMIPath.GetFullPath(DocumentType)
- Dim oDocument = New DocumentResult.DocumentObject With {.FileName = FileName}
+ Dim oRelativePath As String = EDMIPath.GetRelativePath(Data.DocumentType, Data.FileName)
+ Dim oAbsolutePath As String = EDMIPath.GetFullPath(Data.DocumentType, Data.FileName)
+ Dim oDirectoryPath = EDMIPath.GetFullPath(Data.DocumentType)
Try
Directory.CreateDirectory(oDirectoryPath)
Catch ex As Exception
_logger.Error(ex)
- Return New DocumentResult(ex.Message)
+ Throw New FaultException(ex.Message)
End Try
Try
Dim oVersionedFileName As String = Filesystem.GetVersionedFilename(oAbsolutePath)
- _logger.Info("ImportFile: Saving file [{0}] to path [{1}]", FileName, oVersionedFileName)
+ _logger.Info("ImportFile: Saving file [{0}] to path [{1}]", Data.FileName, oVersionedFileName)
Using oStream = New FileStream(oVersionedFileName, FileMode.CreateNew)
- oStream.Write(Contents, 0, Contents.Length)
+ oStream.Write(Data.Contents, 0, Data.Contents.Length)
oStream.Flush(True)
oStream.Close()
End Using
@@ -367,12 +366,10 @@ Public Class EDMIService
Dim oObjectId = MSSQL.GetScalarValue(oCommand, "@IDB_OBJ_ID")
- oDocument.FileId = oObjectId
-
- Return New DocumentResult(oDocument)
+ Return New Messages.DocumentImportResponse() With {.ObjectId = oObjectId}
Catch ex As Exception
_logger.Error(ex)
- Return New DocumentResult(ex.Message)
+ Throw New FaultException(ex.Message)
End Try
End Function
@@ -427,7 +424,7 @@ Public Class EDMIService
Public Function ListFilesForUser() As Messages.DocumentListResponse Implements IEDMIService.ListFilesForUser
Try
- Dim oSQL = $"SELECT * FROM VWIDB_DOC_DATA WHERE ADDED_WHO = UPPER('{_username}')"
+ Dim oSQL = $"SELECT * FROM VWIDB_DOC_DATA"
Dim oDatatable As DataTable = MSSQL.GetDatatable(oSQL)
oDatatable.TableName = "DocumentList"
diff --git a/Service.EDMIService/IEDMIService.vb b/Service.EDMIService/IEDMIService.vb
index 9df8a652..f862a87e 100644
--- a/Service.EDMIService/IEDMIService.vb
+++ b/Service.EDMIService/IEDMIService.vb
@@ -49,7 +49,8 @@ Interface IEDMIService
#Region "Document (New)"
- Function ImportFile(FileName As String, Contents As Byte(), ObjectStoreId As Int64, DocumentType As String, Optional RetentionDays As Int64 = Nothing) As DocumentResult
+ Function ImportFile(Data As Messages.DocumentImportRequest) As Messages.DocumentImportResponse
+ 'Function ImportFile(FileName As String, Contents As Byte(), ObjectStoreId As Int64, DocumentType As String, Optional RetentionDays As Int64 = Nothing) As Messages.DocumentImportResponse
Function GetFileByObjectId(Data As Messages.DocumentStreamRequest) As Messages.DocumentStreamResponse
diff --git a/Service.EDMIService/Messages.vb b/Service.EDMIService/Messages.vb
index 4ce640fa..90e3406b 100644
--- a/Service.EDMIService/Messages.vb
+++ b/Service.EDMIService/Messages.vb
@@ -3,29 +3,30 @@ Imports System.Runtime.Serialization
Imports System.ServiceModel
Namespace Messages
-
-
-
- Public MustInherit Class BaseResponse
-
- Public Property OK As Boolean
-
- Public Property ErrorMessage As String
+
+ Public Class DocumentImportRequest
+
+ Public Contents() As Byte
+
+ Public ObjectStoreId As Long
+
+ Public FileName As String
+
+ Public DocumentType As String
+
+ Public RetentionDays As Long = 0
+ End Class
- Public Sub New()
- OK = True
- End Sub
-
- Public Sub New(ErrorMessage As String)
- OK = False
- Me.ErrorMessage = ErrorMessage
- End Sub
+
+ Public Class DocumentImportResponse
+
+ Public ObjectId As Long
End Class
Public Class DocumentStreamRequest
- Public ObjectId As Int64
+ Public ObjectId As Long
End Class
@@ -37,9 +38,10 @@ Namespace Messages
Public FileContents As Stream
End Class
+
+
Public Class DocumentListResponse
- Inherits BaseResponse
-
+
Public Datatable As DataTable
End Class