EDMI.API: add parameter to load file contents for GetFileObject

This commit is contained in:
Jonathan Jenne 2021-12-17 16:41:05 +01:00
parent 1b6a69b24f
commit 97fd37de0c
4 changed files with 35 additions and 9 deletions

View File

@ -61,6 +61,7 @@ Public Class Client
''' <param name="IPAddress">The IP address to connect to</param> ''' <param name="IPAddress">The IP address to connect to</param>
''' <param name="PortNumber">The Port number to use for the connection</param> ''' <param name="PortNumber">The Port number to use for the connection</param>
Public Sub New(LogConfig As LogConfig, IPAddress As String, PortNumber As Integer) Public Sub New(LogConfig As LogConfig, IPAddress As String, PortNumber As Integer)
_LogConfig = LogConfig
_logger = LogConfig.GetLogger() _logger = LogConfig.GetLogger()
_FileEx = New Filesystem.File(LogConfig) _FileEx = New Filesystem.File(LogConfig)
@ -247,10 +248,10 @@ Public Class Client
End Try End Try
End Function End Function
Public Function GetFileObject(pObjectId As Long) As FileObject Public Function GetFileObject(pObjectId As Long, pLoadFileContents As Boolean) As FileObject
Try Try
Dim oGetFileObject As New Modules.Zooflow.GetFileObject(_LogConfig, Me) Dim oGetFileObject As New Modules.Zooflow.GetFileObject(_LogConfig, _channel)
Dim oFileObject = oGetFileObject.Run(pObjectId) Dim oFileObject = oGetFileObject.Run(pObjectId, pLoadFileContents)
Return oFileObject Return oFileObject
Catch ex As Exception Catch ex As Exception
_logger.Error(ex) _logger.Error(ex)
@ -258,10 +259,10 @@ Public Class Client
End Try End Try
End Function End Function
Public Async Function GetFileObjectAsync(pObjectId As Long) As Task(Of FileObject) Public Async Function GetFileObjectAsync(pObjectId As Long, pLoadFileContents As Boolean) As Task(Of FileObject)
Try Try
Dim oGetFileObject As New Modules.Zooflow.GetFileObject(_LogConfig, Me) Dim oGetFileObject As New Modules.Zooflow.GetFileObject(_LogConfig, Me)
Dim oFileObject = Await oGetFileObject.RunAsync(pObjectId) Dim oFileObject = Await oGetFileObject.RunAsync(pObjectId, pLoadFileContents)
Return oFileObject Return oFileObject
Catch ex As Exception Catch ex As Exception
_logger.Error(ex) _logger.Error(ex)
@ -734,6 +735,7 @@ Public Class Client
End Class End Class
Public Class DocumentInfo Public Class DocumentInfo
Public Id As Long
Public FullPath As String Public FullPath As String
Public AccessRight As AccessRight Public AccessRight As AccessRight
End Class End Class

View File

@ -22,6 +22,7 @@
<xs:sequence> <xs:sequence>
<xs:element name="_AccessRights" nillable="true" type="xs:string" /> <xs:element name="_AccessRights" nillable="true" type="xs:string" />
<xs:element name="_FileContents" nillable="true" type="xs:base64Binary" /> <xs:element name="_FileContents" nillable="true" type="xs:base64Binary" />
<xs:element name="_FileExtension" nillable="true" type="xs:string" />
<xs:element name="_FileHash" nillable="true" type="xs:string" /> <xs:element name="_FileHash" nillable="true" type="xs:string" />
<xs:element name="_FileSize" type="xs:long" /> <xs:element name="_FileSize" type="xs:long" />
<xs:element name="_ObjectId" type="xs:long" /> <xs:element name="_ObjectId" type="xs:long" />

View File

@ -1307,6 +1307,8 @@ Namespace EDMIServiceReference
Private _FileContentsField() As Byte Private _FileContentsField() As Byte
Private _FileExtensionField As String
Private _FileHashField As String Private _FileHashField As String
Private _FileSizeField As Long Private _FileSizeField As Long
@ -1349,6 +1351,19 @@ Namespace EDMIServiceReference
End Set End Set
End Property End Property
<System.Runtime.Serialization.DataMemberAttribute(IsRequired:=true)> _
Public Property _FileExtension() As String
Get
Return Me._FileExtensionField
End Get
Set
If (Object.ReferenceEquals(Me._FileExtensionField, value) <> true) Then
Me._FileExtensionField = value
Me.RaisePropertyChanged("_FileExtension")
End If
End Set
End Property
<System.Runtime.Serialization.DataMemberAttribute(IsRequired:=true)> _ <System.Runtime.Serialization.DataMemberAttribute(IsRequired:=true)> _
Public Property _FileHash() As String Public Property _FileHash() As String
Get Get

View File

@ -13,9 +13,13 @@ Namespace Modules.Zooflow
Channel = pChannel Channel = pChannel
End Sub End Sub
Public Async Function RunAsync(pObjectId As Long) As Task(Of FileObject) Public Async Function RunAsync(pObjectId As Long, pLoadFileContents As Boolean) As Task(Of FileObject)
Try Try
Dim oResult = Await Channel.GetFileObjectAsync(New GetFileObjectRequest With {.ObjectId = pObjectId}) Dim oParams = New GetFileObjectRequest With {
.ObjectId = pObjectId,
.LoadFileContents = pLoadFileContents
}
Dim oResult = Await Channel.GetFileObjectAsync(oParams)
If oResult.OK Then If oResult.OK Then
Return oResult.FileObject Return oResult.FileObject
Else Else
@ -27,9 +31,13 @@ Namespace Modules.Zooflow
End Try End Try
End Function End Function
Public Function Run(pObjectId As Long) As FileObject Public Function Run(pObjectId As Long, pLoadFileContents As Boolean) As FileObject
Try Try
Dim oResult = Channel.GetFileObject(New GetFileObjectRequest With {.ObjectId = pObjectId}) Dim oParams = New GetFileObjectRequest With {
.ObjectId = pObjectId,
.LoadFileContents = pLoadFileContents
}
Dim oResult = Channel.GetFileObject(oParams)
If oResult.OK Then If oResult.OK Then
Return oResult.FileObject Return oResult.FileObject
Else Else