EDMIService: Update client and fix wrnog extension at import
This commit is contained in:
parent
977fff6999
commit
cb00685085
@ -11,25 +11,27 @@ Public Class Client
|
||||
|
||||
Private Const KIND_TYPE_DOC = "DOC"
|
||||
|
||||
Private ReadOnly _LogConfig As LogConfig
|
||||
Private ReadOnly _logger As Logger
|
||||
Private ReadOnly _channelFactory As ChannelFactory(Of IEDMIServiceChannel)
|
||||
Private ReadOnly _IPAddressServer As String
|
||||
Private ReadOnly _PortServer As Integer
|
||||
|
||||
Private _dummy_table_attributes As DataTable
|
||||
Private _channel As IEDMIServiceChannel
|
||||
Private _FileEx As Filesystem.File
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' Creates a new EDMI Client object
|
||||
''' </summary>
|
||||
''' <param name="LogConfig">LogConfig object</param>
|
||||
''' <param name="ServiceAdress">The IP address/hostname and port, separated by semicolon or colon, ex localhost:9000</param>
|
||||
Public Sub New(LogConfig As LogConfig, ServiceAdress As String)
|
||||
_logger = LogConfig.GetLogger()
|
||||
_FileEx = New Filesystem.File(LogConfig)
|
||||
''' <param name="pLogConfig">LogConfig object</param>
|
||||
''' <param name="pServiceAdress">The IP address/hostname and port, separated by semicolon or colon, ex. 1.2.3.4:9000</param>
|
||||
Public Sub New(pLogConfig As LogConfig, pServiceAdress As String)
|
||||
_LogConfig = pLogConfig
|
||||
_logger = pLogConfig.GetLogger()
|
||||
_FileEx = New Filesystem.File(pLogConfig)
|
||||
|
||||
Dim oServiceAddress As String = ServiceAdress
|
||||
Dim oServiceAddress As String = pServiceAdress
|
||||
Dim oAddressArray() As String
|
||||
|
||||
If oServiceAddress.Contains(";") Then
|
||||
@ -40,8 +42,10 @@ Public Class Client
|
||||
|
||||
Try
|
||||
_IPAddressServer = oAddressArray(0)
|
||||
_PortServer = oAddressArray(1)
|
||||
|
||||
Dim oBinding = Channel.GetBinding()
|
||||
Dim oAddress = New EndpointAddress($"net.tcp://{oAddressArray(0)}:{oAddressArray(1)}/DigitalData/Services/Main")
|
||||
Dim oAddress = New EndpointAddress($"net.tcp://{_IPAddressServer}:{_PortServer}/DigitalData/Services/Main")
|
||||
Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress)
|
||||
|
||||
_channelFactory = oFactory
|
||||
@ -243,6 +247,29 @@ Public Class Client
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetFileObject(pObjectId As Long) As FileObject
|
||||
Try
|
||||
Dim oGetFileObject As New Modules.Zooflow.GetFileObject(_LogConfig, Me)
|
||||
Dim oFileObject = oGetFileObject.Run(pObjectId)
|
||||
Return oFileObject
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Async Function GetFileObjectAsync(pObjectId As Long) As Task(Of FileObject)
|
||||
Try
|
||||
Dim oGetFileObject As New Modules.Zooflow.GetFileObject(_LogConfig, Me)
|
||||
Dim oFileObject = Await oGetFileObject.RunAsync(pObjectId)
|
||||
Return oFileObject
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' Sets a value to an attribute
|
||||
''' </summary>
|
||||
@ -466,7 +493,6 @@ Public Class Client
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
Private Function GetAttributesForObject(pObjectId As Long, pLanguage As String) As List(Of ObjectAttribute)
|
||||
Dim oAttributes As New List(Of ObjectAttribute)
|
||||
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is automatically generated by Visual Studio .Net. It is
|
||||
used to store generic object data source configuration information.
|
||||
Renaming the file extension or editing the content of this file may
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="GetFileObjectResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>DigitalData.Modules.EDMI.API.EDMIServiceReference.GetFileObjectResponse, Connected Services.EDMIServiceReference.Reference.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
||||
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:tns="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.GetFileObject" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.GetFileObject" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Messages" />
|
||||
<xs:complexType name="GetFileObjectRequest">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" name="LoadFileContents" type="xs:boolean" />
|
||||
<xs:element minOccurs="0" name="ObjectId" type="xs:long" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="GetFileObjectRequest" nillable="true" type="tns:GetFileObjectRequest" />
|
||||
<xs:complexType name="GetFileObjectResponse">
|
||||
<xs:complexContent mixed="false">
|
||||
<xs:extension xmlns:q1="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Messages" base="q1:BaseResponse">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" name="FileObject" nillable="true" type="tns:FileObject" />
|
||||
</xs:sequence>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
<xs:element name="GetFileObjectResponse" nillable="true" type="tns:GetFileObjectResponse" />
|
||||
<xs:complexType name="FileObject">
|
||||
<xs:sequence>
|
||||
<xs:element name="_AccessRights" nillable="true" type="xs:string" />
|
||||
<xs:element name="_FileContents" nillable="true" type="xs:base64Binary" />
|
||||
<xs:element name="_FileHash" nillable="true" type="xs:string" />
|
||||
<xs:element name="_FileSize" type="xs:long" />
|
||||
<xs:element name="_ObjectId" type="xs:long" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="FileObject" nillable="true" type="tns:FileObject" />
|
||||
</xs:schema>
|
||||
@ -15,6 +15,7 @@
|
||||
<xsd:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.SetAttributeValue" />
|
||||
<xsd:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.GlobalIndexer.ImportFile" />
|
||||
<xsd:import namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
|
||||
<xsd:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.GetFileObject" />
|
||||
<xsd:import namespace="http://schemas.microsoft.com/Message" />
|
||||
<xsd:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Modules.EDMI.API" />
|
||||
</xsd:schema>
|
||||
@ -136,6 +137,12 @@
|
||||
<wsdl:message name="IEDMIService_ImportFile_OutputMessage">
|
||||
<wsdl:part name="parameters" element="tns:ImportFileResponse" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="IEDMIService_GetFileObject_InputMessage">
|
||||
<wsdl:part name="parameters" element="tns:GetFileObject" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="IEDMIService_GetFileObject_OutputMessage">
|
||||
<wsdl:part name="parameters" element="tns:GetFileObjectResponse" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="DocumentStreamRequest">
|
||||
<wsdl:part name="parameters" element="tns:DocumentStreamRequest" />
|
||||
</wsdl:message>
|
||||
@ -244,6 +251,10 @@
|
||||
<wsdl:input wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/ImportFile" message="tns:IEDMIService_ImportFile_InputMessage" />
|
||||
<wsdl:output wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/ImportFileResponse" message="tns:IEDMIService_ImportFile_OutputMessage" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetFileObject">
|
||||
<wsdl:input wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/GetFileObject" message="tns:IEDMIService_GetFileObject_InputMessage" />
|
||||
<wsdl:output wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/GetFileObjectResponse" message="tns:IEDMIService_GetFileObject_OutputMessage" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetFileByObjectId">
|
||||
<wsdl:input wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/GetFileByObjectId" name="DocumentStreamRequest" message="tns:DocumentStreamRequest" />
|
||||
<wsdl:output wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/GetFileByObjectIdResponse" name="DocumentStreamResponse" message="tns:DocumentStreamResponse" />
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.NewFile" />
|
||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.SetAttributeValue" />
|
||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.GlobalIndexer.ImportFile" />
|
||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.GetFileObject" />
|
||||
<xs:import namespace="http://schemas.microsoft.com/Message" />
|
||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Modules.EDMI.API" />
|
||||
<xs:element name="Heartbeat">
|
||||
@ -202,6 +203,20 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="GetFileObject">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q17="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.GetFileObject" minOccurs="0" name="Data" nillable="true" type="q17:GetFileObjectRequest" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="GetFileObjectResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q18="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.GetFileObject" minOccurs="0" name="GetFileObjectResult" nillable="true" type="q18:GetFileObjectResponse" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="DocumentStreamRequest">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
@ -212,7 +227,7 @@
|
||||
<xs:element name="DocumentStreamResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q17="http://schemas.microsoft.com/Message" name="FileContents" type="q17:StreamBody" />
|
||||
<xs:element xmlns:q19="http://schemas.microsoft.com/Message" name="FileContents" type="q19:StreamBody" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
@ -228,7 +243,7 @@
|
||||
<xs:element name="DocumentInfoResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q18="http://schemas.datacontract.org/2004/07/DigitalData.Modules.EDMI.API" minOccurs="0" name="FileRight" type="q18:Rights.AccessRight" />
|
||||
<xs:element xmlns:q20="http://schemas.datacontract.org/2004/07/DigitalData.Modules.EDMI.API" minOccurs="0" name="FileRight" type="q20:Rights.AccessRight" />
|
||||
<xs:element minOccurs="0" name="FullPath" nillable="true" type="xs:string" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
<MetadataFile FileName="DigitalData.Services.EDMIService.Methods.SetAttributeValue.xsd" MetadataType="Schema" ID="a34a2b84-4efd-4be1-83ee-bcb340176a49" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
||||
<MetadataFile FileName="DigitalData.Services.EDMIService.Methods.GlobalIndexer.ImportFile.xsd" MetadataType="Schema" ID="4c9227ac-82b3-4aff-bcb3-eab453dc69c5" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
||||
<MetadataFile FileName="Arrays.xsd" MetadataType="Schema" ID="74eac9b3-9049-499b-bf42-5e443530645c" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
||||
<MetadataFile FileName="DigitalData.Services.EDMIService.Methods.GetFileObject.xsd" MetadataType="Schema" ID="39eb9e73-dc51-4849-bb13-09c4d0753ad3" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
||||
<MetadataFile FileName="Message.xsd" MetadataType="Schema" ID="2589e82f-d68f-4843-b153-a80edf895f82" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
||||
<MetadataFile FileName="DigitalData.Modules.EDMI.API.xsd" MetadataType="Schema" ID="4eca5a54-795a-4e5b-a3b1-10c24930efec" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
||||
</Metadata>
|
||||
|
||||
@ -26,6 +26,7 @@ Namespace EDMIServiceReference
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.NewFileResponse)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.SetAttributeValueResponse)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.ImportFileResponse)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.GetFileObjectResponse)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.TableResult))> _
|
||||
Partial Public Class BaseResponse
|
||||
Inherits Object
|
||||
@ -129,6 +130,9 @@ Namespace EDMIServiceReference
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.ImportFileRequest)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.ImportFileResponse)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(String())), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.GetFileObjectRequest)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.GetFileObjectResponse)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.FileObject)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.RightsAccessRight))> _
|
||||
Partial Public Class ScalarResult
|
||||
Inherits EDMIServiceReference.BaseResponse
|
||||
@ -234,6 +238,31 @@ Namespace EDMIServiceReference
|
||||
End Property
|
||||
End Class
|
||||
|
||||
<System.Diagnostics.DebuggerStepThroughAttribute(), _
|
||||
System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0"), _
|
||||
System.Runtime.Serialization.DataContractAttribute(Name:="GetFileObjectResponse", [Namespace]:="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods."& _
|
||||
"GetFileObject"), _
|
||||
System.SerializableAttribute()> _
|
||||
Partial Public Class GetFileObjectResponse
|
||||
Inherits EDMIServiceReference.BaseResponse
|
||||
|
||||
<System.Runtime.Serialization.OptionalFieldAttribute()> _
|
||||
Private FileObjectField As EDMIServiceReference.FileObject
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute()> _
|
||||
Public Property FileObject() As EDMIServiceReference.FileObject
|
||||
Get
|
||||
Return Me.FileObjectField
|
||||
End Get
|
||||
Set
|
||||
If (Object.ReferenceEquals(Me.FileObjectField, value) <> true) Then
|
||||
Me.FileObjectField = value
|
||||
Me.RaisePropertyChanged("FileObject")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
End Class
|
||||
|
||||
<System.Diagnostics.DebuggerStepThroughAttribute(), _
|
||||
System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0"), _
|
||||
System.Runtime.Serialization.DataContractAttribute(Name:="TableResult", [Namespace]:="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Messages"& _
|
||||
@ -1198,6 +1227,177 @@ Namespace EDMIServiceReference
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
<System.Diagnostics.DebuggerStepThroughAttribute(), _
|
||||
System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0"), _
|
||||
System.Runtime.Serialization.DataContractAttribute(Name:="GetFileObjectRequest", [Namespace]:="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods."& _
|
||||
"GetFileObject"), _
|
||||
System.SerializableAttribute()> _
|
||||
Partial Public Class GetFileObjectRequest
|
||||
Inherits Object
|
||||
Implements System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged
|
||||
|
||||
<System.NonSerializedAttribute()> _
|
||||
Private extensionDataField As System.Runtime.Serialization.ExtensionDataObject
|
||||
|
||||
<System.Runtime.Serialization.OptionalFieldAttribute()> _
|
||||
Private LoadFileContentsField As Boolean
|
||||
|
||||
<System.Runtime.Serialization.OptionalFieldAttribute()> _
|
||||
Private ObjectIdField As Long
|
||||
|
||||
<Global.System.ComponentModel.BrowsableAttribute(false)> _
|
||||
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
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute()> _
|
||||
Public Property LoadFileContents() As Boolean
|
||||
Get
|
||||
Return Me.LoadFileContentsField
|
||||
End Get
|
||||
Set
|
||||
If (Me.LoadFileContentsField.Equals(value) <> true) Then
|
||||
Me.LoadFileContentsField = value
|
||||
Me.RaisePropertyChanged("LoadFileContents")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute()> _
|
||||
Public Property ObjectId() As Long
|
||||
Get
|
||||
Return Me.ObjectIdField
|
||||
End Get
|
||||
Set
|
||||
If (Me.ObjectIdField.Equals(value) <> true) Then
|
||||
Me.ObjectIdField = value
|
||||
Me.RaisePropertyChanged("ObjectId")
|
||||
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
|
||||
|
||||
<System.Diagnostics.DebuggerStepThroughAttribute(), _
|
||||
System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0"), _
|
||||
System.Runtime.Serialization.DataContractAttribute(Name:="FileObject", [Namespace]:="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods."& _
|
||||
"GetFileObject"), _
|
||||
System.SerializableAttribute()> _
|
||||
Partial Public Class FileObject
|
||||
Inherits Object
|
||||
Implements System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged
|
||||
|
||||
<System.NonSerializedAttribute()> _
|
||||
Private extensionDataField As System.Runtime.Serialization.ExtensionDataObject
|
||||
|
||||
Private _AccessRightsField As String
|
||||
|
||||
Private _FileContentsField() As Byte
|
||||
|
||||
Private _FileHashField As String
|
||||
|
||||
Private _FileSizeField As Long
|
||||
|
||||
Private _ObjectIdField As Long
|
||||
|
||||
<Global.System.ComponentModel.BrowsableAttribute(false)> _
|
||||
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
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute(IsRequired:=true)> _
|
||||
Public Property _AccessRights() As String
|
||||
Get
|
||||
Return Me._AccessRightsField
|
||||
End Get
|
||||
Set
|
||||
If (Object.ReferenceEquals(Me._AccessRightsField, value) <> true) Then
|
||||
Me._AccessRightsField = value
|
||||
Me.RaisePropertyChanged("_AccessRights")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute(IsRequired:=true)> _
|
||||
Public Property _FileContents() As Byte()
|
||||
Get
|
||||
Return Me._FileContentsField
|
||||
End Get
|
||||
Set
|
||||
If (Object.ReferenceEquals(Me._FileContentsField, value) <> true) Then
|
||||
Me._FileContentsField = value
|
||||
Me.RaisePropertyChanged("_FileContents")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute(IsRequired:=true)> _
|
||||
Public Property _FileHash() As String
|
||||
Get
|
||||
Return Me._FileHashField
|
||||
End Get
|
||||
Set
|
||||
If (Object.ReferenceEquals(Me._FileHashField, value) <> true) Then
|
||||
Me._FileHashField = value
|
||||
Me.RaisePropertyChanged("_FileHash")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute(IsRequired:=true)> _
|
||||
Public Property _FileSize() As Long
|
||||
Get
|
||||
Return Me._FileSizeField
|
||||
End Get
|
||||
Set
|
||||
If (Me._FileSizeField.Equals(value) <> true) Then
|
||||
Me._FileSizeField = value
|
||||
Me.RaisePropertyChanged("_FileSize")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute(IsRequired:=true)> _
|
||||
Public Property _ObjectId() As Long
|
||||
Get
|
||||
Return Me._ObjectIdField
|
||||
End Get
|
||||
Set
|
||||
If (Me._ObjectIdField.Equals(value) <> true) Then
|
||||
Me._ObjectIdField = value
|
||||
Me.RaisePropertyChanged("_ObjectId")
|
||||
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
|
||||
|
||||
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0"), _
|
||||
System.Runtime.Serialization.DataContractAttribute(Name:="Rights.AccessRight", [Namespace]:="http://schemas.datacontract.org/2004/07/DigitalData.Modules.EDMI.API")> _
|
||||
Public Enum RightsAccessRight As Integer
|
||||
@ -1353,6 +1553,12 @@ Namespace EDMIServiceReference
|
||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/ImportFile", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/ImportFileResponse")> _
|
||||
Function ImportFileAsync(ByVal Data As EDMIServiceReference.ImportFileRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.ImportFileResponse)
|
||||
|
||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/GetFileObject", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/GetFileObjectResponse")> _
|
||||
Function GetFileObject(ByVal Data As EDMIServiceReference.GetFileObjectRequest) As EDMIServiceReference.GetFileObjectResponse
|
||||
|
||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/GetFileObject", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/GetFileObjectResponse")> _
|
||||
Function GetFileObjectAsync(ByVal Data As EDMIServiceReference.GetFileObjectRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.GetFileObjectResponse)
|
||||
|
||||
'CODEGEN: Der Nachrichtenvertrag wird generiert, da der Wrappername (DocumentStreamRequest) von Nachricht "DocumentStreamRequest" nicht mit dem Standardwert (GetFileByObjectId) übereinstimmt.
|
||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/GetFileByObjectId", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/GetFileByObjectIdResponse"), _
|
||||
System.ServiceModel.FaultContractAttribute(GetType(EDMIServiceReference.ObjectDoesNotExistFault), Action:="http://DigitalData.Services.EDMIService/IEDMIService/GetFileByObjectIdObjectDoesN"& _
|
||||
@ -1702,6 +1908,14 @@ Namespace EDMIServiceReference
|
||||
Return MyBase.Channel.ImportFileAsync(Data)
|
||||
End Function
|
||||
|
||||
Public Function GetFileObject(ByVal Data As EDMIServiceReference.GetFileObjectRequest) As EDMIServiceReference.GetFileObjectResponse Implements EDMIServiceReference.IEDMIService.GetFileObject
|
||||
Return MyBase.Channel.GetFileObject(Data)
|
||||
End Function
|
||||
|
||||
Public Function GetFileObjectAsync(ByVal Data As EDMIServiceReference.GetFileObjectRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.GetFileObjectResponse) Implements EDMIServiceReference.IEDMIService.GetFileObjectAsync
|
||||
Return MyBase.Channel.GetFileObjectAsync(Data)
|
||||
End Function
|
||||
|
||||
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Function EDMIServiceReference_IEDMIService_GetFileByObjectId(ByVal request As EDMIServiceReference.DocumentStreamRequest) As EDMIServiceReference.DocumentStreamResponse Implements EDMIServiceReference.IEDMIService.GetFileByObjectId
|
||||
Return MyBase.Channel.GetFileByObjectId(request)
|
||||
|
||||
@ -200,6 +200,15 @@
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetFileObject">
|
||||
<soap12:operation soapAction="http://DigitalData.Services.EDMIService/IEDMIService/GetFileObject" style="document" />
|
||||
<wsdl:input>
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetFileByObjectId">
|
||||
<soap12:operation soapAction="http://DigitalData.Services.EDMIService/IEDMIService/GetFileByObjectId" style="document" />
|
||||
<wsdl:input name="DocumentStreamRequest">
|
||||
|
||||
@ -76,6 +76,7 @@
|
||||
<Compile Include="Client\Options.vb" />
|
||||
<Compile Include="Client\Rights.vb" />
|
||||
<Compile Include="Client\Channel.vb" />
|
||||
<Compile Include="Modules\ZooFlow\GetFileObject.vb" />
|
||||
<Compile Include="Connected Services\EDMIServiceReference\Reference.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
@ -122,6 +123,9 @@
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMI.API.EDMIServiceReference.DocumentStreamResponse.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMI.API.EDMIServiceReference.GetFileObjectResponse.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMI.API.EDMIServiceReference.ImportFileResponse.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
@ -158,6 +162,9 @@
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Services.EDMIService.Messages.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Services.EDMIService.Methods.GetFileObject.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Services.EDMIService.Methods.GlobalIndexer.ImportFile.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
|
||||
44
Modules.EDMIAPI/Modules/ZooFlow/GetFileObject.vb
Normal file
44
Modules.EDMIAPI/Modules/ZooFlow/GetFileObject.vb
Normal file
@ -0,0 +1,44 @@
|
||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Namespace Modules.Zooflow
|
||||
Public Class GetFileObject
|
||||
Private ReadOnly LogConfig As LogConfig
|
||||
Private ReadOnly Logger As Logger
|
||||
Private ReadOnly Channel As IEDMIServiceChannel
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pChannel As IEDMIServiceChannel)
|
||||
LogConfig = pLogConfig
|
||||
Logger = pLogConfig.GetLogger()
|
||||
Channel = pChannel
|
||||
End Sub
|
||||
|
||||
Public Async Function RunAsync(pObjectId As Long) As Task(Of FileObject)
|
||||
Try
|
||||
Dim oResult = Await Channel.GetFileObjectAsync(New GetFileObjectRequest With {.ObjectId = pObjectId})
|
||||
If oResult.OK Then
|
||||
Return oResult.FileObject
|
||||
Else
|
||||
Return Nothing
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Run(pObjectId As Long) As FileObject
|
||||
Try
|
||||
Dim oResult = Channel.GetFileObject(New GetFileObjectRequest With {.ObjectId = pObjectId})
|
||||
If oResult.OK Then
|
||||
Return oResult.FileObject
|
||||
Else
|
||||
Return Nothing
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
End Namespace
|
||||
@ -1,10 +1,20 @@
|
||||
Namespace Methods.GetFileObject
|
||||
Imports System.Runtime.Serialization
|
||||
|
||||
Namespace Methods.GetFileObject
|
||||
<Serializable>
|
||||
Public Class FileObject
|
||||
<DataMember>
|
||||
Public Property ObjectId As Long
|
||||
<DataMember>
|
||||
Public Property AccessRights As String
|
||||
<DataMember>
|
||||
Public Property FileExtension As String
|
||||
<DataMember>
|
||||
Public Property FileHash As String
|
||||
<DataMember>
|
||||
Public Property FileSize As Long
|
||||
<DataMember>
|
||||
Public Property FileContents As Byte()
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@ -1,6 +1,7 @@
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Language
|
||||
Imports System.IO
|
||||
|
||||
Namespace Methods.GetFileObject
|
||||
Public Class GetFileObjectMethod
|
||||
@ -16,7 +17,6 @@ Namespace Methods.GetFileObject
|
||||
LogAndThrow("ObjectId does not exist!")
|
||||
End If
|
||||
|
||||
|
||||
Dim oSQL = $"SELECT * FROM VWIDB_FILE_OBJECT WHERE IDB_OBJ_ID = {pData.ObjectId}"
|
||||
Dim oTable = Database.GetDatatable(oSQL)
|
||||
|
||||
@ -25,20 +25,64 @@ Namespace Methods.GetFileObject
|
||||
End If
|
||||
|
||||
Dim oRow As DataRow = oTable.First()
|
||||
Dim oFileHash As String = oRow.ItemEx("FILE_HASH", "")
|
||||
Dim oFileSize As Long = oRow.ItemEx(Of Long)("FILE_SIZE", 0)
|
||||
|
||||
Dim oFileObject As New FileObject With {
|
||||
.ObjectId = pData.ObjectId,
|
||||
.FileHash = oRow.ItemEx("FILE_HASH", ""),
|
||||
.FileSize = oRow.ItemEx(Of Long)("FILE_SIZE", 0)
|
||||
.FileHash = oFileHash,
|
||||
.FileSize = oFileSize
|
||||
}
|
||||
|
||||
If pData.LoadFileContents = True Then
|
||||
Dim oFilePath = oRow.ItemEx("RELPATH", "")
|
||||
Dim oFileName = oRow.ItemEx("Filename", "")
|
||||
Dim oFullFileName = Path.Combine(oFilePath, oFileName)
|
||||
|
||||
If File.Exists(oFullFileName) = False Then
|
||||
Throw New FileNotFoundException("FileObject not Found!", oFullFileName)
|
||||
End If
|
||||
|
||||
Dim oContents As Byte() = LoadFileContents(oFullFileName)
|
||||
|
||||
If oContents Is Nothing Then
|
||||
Throw New FileNotFoundException("FileObject not Found!", oFullFileName)
|
||||
End If
|
||||
|
||||
oFileObject.FileContents = oContents
|
||||
|
||||
End If
|
||||
|
||||
Return New GetFileObjectResponse(oFileObject)
|
||||
|
||||
Catch ex As FileNotFoundException
|
||||
Logger.Error(ex)
|
||||
Return New GetFileObjectResponse(ex, ex.FileName)
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return New GetFileObjectResponse(ex)
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function LoadFileContents(pFilePath As String) As Byte()
|
||||
Try
|
||||
Using oFileStream As New FileStream(pFilePath, FileMode.Open, FileAccess.Read)
|
||||
Using oMemoryStream As New MemoryStream()
|
||||
oFileStream.CopyTo(oMemoryStream)
|
||||
Dim oContents = oMemoryStream.ToArray()
|
||||
|
||||
Return oContents
|
||||
End Using
|
||||
End Using
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@ -6,6 +6,8 @@ Namespace Methods.GetFileObject
|
||||
Public Class GetFileObjectRequest
|
||||
<DataMember>
|
||||
Public Property ObjectId As Long
|
||||
<DataMember>
|
||||
Public Property LoadFileContents As Boolean = False
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
|
||||
@ -83,12 +83,12 @@ Public Class NewFileMethod
|
||||
Dim oFileObjectInfo As IO.FileInfo = New IO.FileInfo(oFilePath)
|
||||
|
||||
Dim oFileObjectSize As Long = pData.File.FileContents.Length
|
||||
Dim oFileObjectExtension As String = oFileObjectInfo.Extension.Substring(1)
|
||||
Dim oFileObjectName As String = oFileObjectInfo.Name
|
||||
Dim oOriginalExtension As String = pData.File.FileInfoRaw.Extension.Substring(1)
|
||||
|
||||
Logger.Debug("File Information for [{0}]:", oFileObjectName)
|
||||
Logger.Debug("Size: [{0}]", oFileObjectSize)
|
||||
Logger.Debug("Extension: [{0}]", oFileObjectExtension)
|
||||
Logger.Debug("Original Extension: [{0}]", oOriginalExtension)
|
||||
Logger.Debug("Checksum: [{0}]", pData.File.FileChecksum)
|
||||
|
||||
Try
|
||||
@ -110,7 +110,7 @@ Public Class NewFileMethod
|
||||
Dim oSQL As String = $"EXEC PRIDB_NEW_IDBFO
|
||||
'{oFinalPath}',
|
||||
'{oFileObjectName}',
|
||||
'{oFileObjectExtension}',
|
||||
'{oOriginalExtension}',
|
||||
{oFileObjectSize},
|
||||
'{pData.File.FileChecksum}' ,
|
||||
'{pData.User.UserName}',
|
||||
@ -218,6 +218,7 @@ Public Class NewFileMethod
|
||||
End Function
|
||||
|
||||
Private Function GetFileObjectFileName(IDB_OBJ_ID As Long, pFilename As String, pKeepFilename As Boolean) As String
|
||||
' TODO: save actual extensions
|
||||
If pKeepFilename Then
|
||||
Return pFilename
|
||||
Else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user