Get DocumentObject from DocId or ContainerId
This commit is contained in:
parent
bbd761c0ad
commit
ec616ac9b8
64
EDMI_ClientSuite/frmFileTest.Designer.vb
generated
64
EDMI_ClientSuite/frmFileTest.Designer.vb
generated
@ -23,7 +23,11 @@ Partial Class frmFileTest
|
||||
<System.Diagnostics.DebuggerStepThrough()>
|
||||
Private Sub InitializeComponent()
|
||||
Me.Button1 = New System.Windows.Forms.Button()
|
||||
Me.ListBox1 = New System.Windows.Forms.ListBox()
|
||||
Me.listboxLog = New System.Windows.Forms.ListBox()
|
||||
Me.btnDocByDocId = New System.Windows.Forms.Button()
|
||||
Me.TextBox1 = New System.Windows.Forms.TextBox()
|
||||
Me.btnDocByContainerId = New System.Windows.Forms.Button()
|
||||
Me.TextBox2 = New System.Windows.Forms.TextBox()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'Button1
|
||||
@ -35,27 +39,69 @@ Partial Class frmFileTest
|
||||
Me.Button1.Text = "Upload file"
|
||||
Me.Button1.UseVisualStyleBackColor = True
|
||||
'
|
||||
'ListBox1
|
||||
'listboxLog
|
||||
'
|
||||
Me.ListBox1.FormattingEnabled = True
|
||||
Me.ListBox1.Location = New System.Drawing.Point(12, 45)
|
||||
Me.ListBox1.Name = "ListBox1"
|
||||
Me.ListBox1.Size = New System.Drawing.Size(256, 95)
|
||||
Me.ListBox1.TabIndex = 1
|
||||
Me.listboxLog.Dock = System.Windows.Forms.DockStyle.Bottom
|
||||
Me.listboxLog.FormattingEnabled = True
|
||||
Me.listboxLog.Location = New System.Drawing.Point(0, 225)
|
||||
Me.listboxLog.Name = "listboxLog"
|
||||
Me.listboxLog.Size = New System.Drawing.Size(800, 225)
|
||||
Me.listboxLog.TabIndex = 1
|
||||
'
|
||||
'btnDocByDocId
|
||||
'
|
||||
Me.btnDocByDocId.Location = New System.Drawing.Point(655, 12)
|
||||
Me.btnDocByDocId.Name = "btnDocByDocId"
|
||||
Me.btnDocByDocId.Size = New System.Drawing.Size(133, 32)
|
||||
Me.btnDocByDocId.TabIndex = 2
|
||||
Me.btnDocByDocId.Text = "GetDocByDocId"
|
||||
Me.btnDocByDocId.UseVisualStyleBackColor = True
|
||||
'
|
||||
'TextBox1
|
||||
'
|
||||
Me.TextBox1.Location = New System.Drawing.Point(425, 24)
|
||||
Me.TextBox1.Name = "TextBox1"
|
||||
Me.TextBox1.Size = New System.Drawing.Size(224, 20)
|
||||
Me.TextBox1.TabIndex = 3
|
||||
'
|
||||
'btnDocByContainerId
|
||||
'
|
||||
Me.btnDocByContainerId.Location = New System.Drawing.Point(655, 50)
|
||||
Me.btnDocByContainerId.Name = "btnDocByContainerId"
|
||||
Me.btnDocByContainerId.Size = New System.Drawing.Size(133, 32)
|
||||
Me.btnDocByContainerId.TabIndex = 4
|
||||
Me.btnDocByContainerId.Text = "GetDocByContainerId"
|
||||
Me.btnDocByContainerId.UseVisualStyleBackColor = True
|
||||
'
|
||||
'TextBox2
|
||||
'
|
||||
Me.TextBox2.Location = New System.Drawing.Point(425, 62)
|
||||
Me.TextBox2.Name = "TextBox2"
|
||||
Me.TextBox2.Size = New System.Drawing.Size(224, 20)
|
||||
Me.TextBox2.TabIndex = 3
|
||||
'
|
||||
'frmFileTest
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(800, 450)
|
||||
Me.Controls.Add(Me.ListBox1)
|
||||
Me.Controls.Add(Me.btnDocByContainerId)
|
||||
Me.Controls.Add(Me.TextBox2)
|
||||
Me.Controls.Add(Me.TextBox1)
|
||||
Me.Controls.Add(Me.btnDocByDocId)
|
||||
Me.Controls.Add(Me.listboxLog)
|
||||
Me.Controls.Add(Me.Button1)
|
||||
Me.Name = "frmFileTest"
|
||||
Me.Text = "frmFileTest"
|
||||
Me.ResumeLayout(False)
|
||||
Me.PerformLayout()
|
||||
|
||||
End Sub
|
||||
|
||||
Friend WithEvents Button1 As Button
|
||||
Friend WithEvents ListBox1 As ListBox
|
||||
Friend WithEvents listboxLog As ListBox
|
||||
Friend WithEvents btnDocByDocId As Button
|
||||
Friend WithEvents TextBox1 As TextBox
|
||||
Friend WithEvents btnDocByContainerId As Button
|
||||
Friend WithEvents TextBox2 As TextBox
|
||||
End Class
|
||||
|
||||
@ -17,24 +17,72 @@ Public Class frmFileTest
|
||||
|
||||
Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
Dim oDialog = New OpenFileDialog()
|
||||
Dim oResult = oDialog.ShowDialog()
|
||||
Dim oDialogResult = oDialog.ShowDialog()
|
||||
|
||||
If oResult <> DialogResult.OK Then
|
||||
If oDialogResult <> DialogResult.OK Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim oDocObject = Await _fileOp.ImportFileAsync(oDialog.FileName)
|
||||
Dim oResult = Await _fileOp.ImportFileAsync(oDialog.FileName)
|
||||
|
||||
If oDocObject.OK = False Then
|
||||
MsgBox(oDocObject.ErrorMessage)
|
||||
If oResult.OK = False Then
|
||||
MsgBox(oResult.ErrorMessage)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
ListBox1.Items.Add(oDocObject)
|
||||
listboxLog.Items.Add($"Document uploaded!")
|
||||
listboxLog.Items.Add($"DocId: {oResult.Document._DocumentId}")
|
||||
listboxLog.Items.Add($"ContainerId: {oResult.Document._ContainerId}")
|
||||
listboxLog.Items.Add($"Filename: {oResult.Document._FileName}")
|
||||
listboxLog.Items.Add($"----------------------------------------------------------")
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub btnDocByDocId_Click(sender As Object, e As EventArgs) Handles btnDocByDocId.Click
|
||||
Try
|
||||
Dim oDocId As Int64 = Int64.Parse(TextBox1.Text)
|
||||
Dim oResult = _fileOp.GetDocumentByDocumentId(oDocId)
|
||||
|
||||
If Not oResult.OK Then
|
||||
MsgBox(oResult.ErrorMessage)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oDocObject = oResult.Document
|
||||
|
||||
listboxLog.Items.Add($"Document fetched!")
|
||||
listboxLog.Items.Add($"DocId: {oDocObject._DocumentId}")
|
||||
listboxLog.Items.Add($"ContainerId: {oDocObject._ContainerId}")
|
||||
listboxLog.Items.Add($"Filename: {oDocObject._FileName}")
|
||||
listboxLog.Items.Add($"----------------------------------------------------------")
|
||||
Catch ex As Exception
|
||||
_ErrorHandler.ShowErrorMessage(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub btnDocByContainerId_Click(sender As Object, e As EventArgs) Handles btnDocByContainerId.Click
|
||||
Try
|
||||
Dim oContainerId As Int64 = Int64.Parse(TextBox2.Text)
|
||||
Dim oResult = _fileOp.GetDocumentByContainerId(oContainerId)
|
||||
|
||||
If Not oResult.OK Then
|
||||
MsgBox(oResult.ErrorMessage)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oDocObject = oResult.Document
|
||||
|
||||
listboxLog.Items.Add($"Document fetched!")
|
||||
listboxLog.Items.Add($"DocId: {oDocObject._DocumentId}")
|
||||
listboxLog.Items.Add($"ContainerId: {oDocObject._ContainerId}")
|
||||
listboxLog.Items.Add($"Filename: {oDocObject._FileName}")
|
||||
listboxLog.Items.Add($"----------------------------------------------------------")
|
||||
Catch ex As Exception
|
||||
_ErrorHandler.ShowErrorMessage(ex)
|
||||
End Try
|
||||
End Sub
|
||||
End Class
|
||||
@ -1,3 +1,22 @@
|
||||
Public Class Channel
|
||||
Imports System.ServiceModel
|
||||
|
||||
Public Class Channel
|
||||
Public Shared Function GetBinding() 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,
|
||||
.Security = New NetTcpSecurity() With {
|
||||
.Mode = SecurityMode.Transport,
|
||||
.Transport = New TcpTransportSecurity() With {
|
||||
.ClientCredentialType = TcpClientCredentialType.Windows
|
||||
}
|
||||
},
|
||||
.ReaderQuotas = New Xml.XmlDictionaryReaderQuotas() With {
|
||||
.MaxArrayLength = Constants.MAX_ARRAY_LENGTH,
|
||||
.MaxStringContentLength = Constants.MAX_STRING_CONTENT_LENGTH
|
||||
}
|
||||
}
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@ -70,6 +70,18 @@
|
||||
<wsdl:message name="IEDMService_DeleteFile_OutputMessage">
|
||||
<wsdl:part name="parameters" element="tns:DeleteFileResponse" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="IEDMService_GetDocumentByDocumentId_InputMessage">
|
||||
<wsdl:part name="parameters" element="tns:GetDocumentByDocumentId" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="IEDMService_GetDocumentByDocumentId_OutputMessage">
|
||||
<wsdl:part name="parameters" element="tns:GetDocumentByDocumentIdResponse" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="IEDMService_GetDocumentByContainerId_InputMessage">
|
||||
<wsdl:part name="parameters" element="tns:GetDocumentByContainerId" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="IEDMService_GetDocumentByContainerId_OutputMessage">
|
||||
<wsdl:part name="parameters" element="tns:GetDocumentByContainerIdResponse" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="IEDMService_NewFileIndex_InputMessage">
|
||||
<wsdl:part name="parameters" element="tns:NewFileIndex" />
|
||||
</wsdl:message>
|
||||
@ -117,6 +129,14 @@
|
||||
<wsdl:input wsaw:Action="http://DigitalData.Services.EDMService/IEDMService/DeleteFile" message="tns:IEDMService_DeleteFile_InputMessage" />
|
||||
<wsdl:output wsaw:Action="http://DigitalData.Services.EDMService/IEDMService/DeleteFileResponse" message="tns:IEDMService_DeleteFile_OutputMessage" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetDocumentByDocumentId">
|
||||
<wsdl:input wsaw:Action="http://DigitalData.Services.EDMService/IEDMService/GetDocumentByDocumentId" message="tns:IEDMService_GetDocumentByDocumentId_InputMessage" />
|
||||
<wsdl:output wsaw:Action="http://DigitalData.Services.EDMService/IEDMService/GetDocumentByDocumentIdResponse" message="tns:IEDMService_GetDocumentByDocumentId_OutputMessage" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetDocumentByContainerId">
|
||||
<wsdl:input wsaw:Action="http://DigitalData.Services.EDMService/IEDMService/GetDocumentByContainerId" message="tns:IEDMService_GetDocumentByContainerId_InputMessage" />
|
||||
<wsdl:output wsaw:Action="http://DigitalData.Services.EDMService/IEDMService/GetDocumentByContainerIdResponse" message="tns:IEDMService_GetDocumentByContainerId_OutputMessage" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="NewFileIndex">
|
||||
<wsdl:input wsaw:Action="http://DigitalData.Services.EDMService/IEDMService/NewFileIndex" message="tns:IEDMService_NewFileIndex_InputMessage" />
|
||||
<wsdl:output wsaw:Action="http://DigitalData.Services.EDMService/IEDMService/NewFileIndexResponse" message="tns:IEDMService_NewFileIndex_OutputMessage" />
|
||||
|
||||
@ -139,10 +139,38 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="GetDocumentByDocumentId">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" name="DocumentId" type="xs:long" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="GetDocumentByDocumentIdResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q10="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMService" minOccurs="0" name="GetDocumentByDocumentIdResult" nillable="true" type="q10:DocumentResult" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="GetDocumentByContainerId">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" name="ContainerId" nillable="true" type="xs:string" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="GetDocumentByContainerIdResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q11="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMService" minOccurs="0" name="GetDocumentByContainerIdResult" nillable="true" type="q11:DocumentResult" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="NewFileIndex">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q10="http://schemas.datacontract.org/2004/07/DigitalData.Modules.Filesystem" minOccurs="0" name="DocObject" nillable="true" type="q10:DocumentObject" />
|
||||
<xs:element xmlns:q12="http://schemas.datacontract.org/2004/07/DigitalData.Modules.Filesystem" minOccurs="0" name="DocObject" nillable="true" type="q12:DocumentObject" />
|
||||
<xs:element minOccurs="0" name="Syskey" nillable="true" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="LanguageCode" nillable="true" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="Value" nillable="true" type="xs:string" />
|
||||
@ -152,7 +180,7 @@
|
||||
<xs:element name="NewFileIndexResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q11="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMService" minOccurs="0" name="NewFileIndexResult" nillable="true" type="q11:IndexResult" />
|
||||
<xs:element xmlns:q13="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMService" minOccurs="0" name="NewFileIndexResult" nillable="true" type="q13:IndexResult" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
@ -363,6 +363,22 @@ Namespace EDMIServiceReference
|
||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMService/IEDMService/DeleteFile", ReplyAction:="http://DigitalData.Services.EDMService/IEDMService/DeleteFileResponse")> _
|
||||
Function DeleteFileAsync(ByVal DocObject As EDMIServiceReference.DocumentObject) As System.Threading.Tasks.Task(Of Boolean)
|
||||
|
||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMService/IEDMService/GetDocumentByDocumentId", ReplyAction:="http://DigitalData.Services.EDMService/IEDMService/GetDocumentByDocumentIdRespons"& _
|
||||
"e")> _
|
||||
Function GetDocumentByDocumentId(ByVal DocumentId As Long) As EDMIServiceReference.DocumentResult
|
||||
|
||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMService/IEDMService/GetDocumentByDocumentId", ReplyAction:="http://DigitalData.Services.EDMService/IEDMService/GetDocumentByDocumentIdRespons"& _
|
||||
"e")> _
|
||||
Function GetDocumentByDocumentIdAsync(ByVal DocumentId As Long) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentResult)
|
||||
|
||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMService/IEDMService/GetDocumentByContainerId", ReplyAction:="http://DigitalData.Services.EDMService/IEDMService/GetDocumentByContainerIdRespon"& _
|
||||
"se")> _
|
||||
Function GetDocumentByContainerId(ByVal ContainerId As String) As EDMIServiceReference.DocumentResult
|
||||
|
||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMService/IEDMService/GetDocumentByContainerId", ReplyAction:="http://DigitalData.Services.EDMService/IEDMService/GetDocumentByContainerIdRespon"& _
|
||||
"se")> _
|
||||
Function GetDocumentByContainerIdAsync(ByVal ContainerId As String) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentResult)
|
||||
|
||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMService/IEDMService/NewFileIndex", ReplyAction:="http://DigitalData.Services.EDMService/IEDMService/NewFileIndexResponse")> _
|
||||
Function NewFileIndex(ByVal DocObject As EDMIServiceReference.DocumentObject, ByVal Syskey As String, ByVal LanguageCode As String, ByVal Value As String) As EDMIServiceReference.IndexResult
|
||||
|
||||
@ -481,6 +497,22 @@ Namespace EDMIServiceReference
|
||||
Return MyBase.Channel.DeleteFileAsync(DocObject)
|
||||
End Function
|
||||
|
||||
Public Function GetDocumentByDocumentId(ByVal DocumentId As Long) As EDMIServiceReference.DocumentResult Implements EDMIServiceReference.IEDMService.GetDocumentByDocumentId
|
||||
Return MyBase.Channel.GetDocumentByDocumentId(DocumentId)
|
||||
End Function
|
||||
|
||||
Public Function GetDocumentByDocumentIdAsync(ByVal DocumentId As Long) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentResult) Implements EDMIServiceReference.IEDMService.GetDocumentByDocumentIdAsync
|
||||
Return MyBase.Channel.GetDocumentByDocumentIdAsync(DocumentId)
|
||||
End Function
|
||||
|
||||
Public Function GetDocumentByContainerId(ByVal ContainerId As String) As EDMIServiceReference.DocumentResult Implements EDMIServiceReference.IEDMService.GetDocumentByContainerId
|
||||
Return MyBase.Channel.GetDocumentByContainerId(ContainerId)
|
||||
End Function
|
||||
|
||||
Public Function GetDocumentByContainerIdAsync(ByVal ContainerId As String) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentResult) Implements EDMIServiceReference.IEDMService.GetDocumentByContainerIdAsync
|
||||
Return MyBase.Channel.GetDocumentByContainerIdAsync(ContainerId)
|
||||
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.IEDMService.NewFileIndex
|
||||
Return MyBase.Channel.NewFileIndex(DocObject, Syskey, LanguageCode, Value)
|
||||
End Function
|
||||
|
||||
@ -129,6 +129,24 @@
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetDocumentByDocumentId">
|
||||
<soap12:operation soapAction="http://DigitalData.Services.EDMService/IEDMService/GetDocumentByDocumentId" style="document" />
|
||||
<wsdl:input>
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetDocumentByContainerId">
|
||||
<soap12:operation soapAction="http://DigitalData.Services.EDMService/IEDMService/GetDocumentByContainerId" style="document" />
|
||||
<wsdl:input>
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="NewFileIndex">
|
||||
<soap12:operation soapAction="http://DigitalData.Services.EDMService/IEDMService/NewFileIndex" style="document" />
|
||||
<wsdl:input>
|
||||
|
||||
8
EDMI_FILE_OPs/Constants.vb
Normal file
8
EDMI_FILE_OPs/Constants.vb
Normal file
@ -0,0 +1,8 @@
|
||||
Public Class Constants
|
||||
Public Const MAX_RECEIVED_MESSAGE_SIZE = 2147483647
|
||||
Public Const MAX_BUFFER_SIZE = 2147483647
|
||||
Public Const MAX_BUFFER_POOL_SIZE = 2147483647
|
||||
Public Const MAX_CONNECTIONS = 10000
|
||||
Public Const MAX_ARRAY_LENGTH = 2147483647
|
||||
Public Const MAX_STRING_CONTENT_LENGTH = 2147483647
|
||||
End Class
|
||||
@ -8,22 +8,14 @@ Public Class Document
|
||||
Private _logConfig As LogConfig
|
||||
Private _channelFactory As ChannelFactory(Of IEDMServiceChannel)
|
||||
Private _channel As IEDMServiceChannel
|
||||
Public Sub New(LogConfig As LogConfig, EDMI_ServiceAdress As String)
|
||||
Public Sub New(LogConfig As LogConfig, ServiceAdress As String)
|
||||
_logger = LogConfig.GetLogger()
|
||||
_logConfig = LogConfig
|
||||
|
||||
Try
|
||||
Dim binding As New NetTcpBinding()
|
||||
binding.Security.Mode = SecurityMode.Transport
|
||||
binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows
|
||||
binding.MaxReceivedMessageSize = 2147483647
|
||||
binding.MaxBufferSize = 2147483647
|
||||
binding.MaxBufferPoolSize = 2147483647
|
||||
binding.MaxConnections = 10000
|
||||
binding.ReaderQuotas.MaxArrayLength = 2147483647
|
||||
binding.ReaderQuotas.MaxStringContentLength = 2147483647
|
||||
Dim endpointAddress = New EndpointAddress(EDMI_ServiceAdress)
|
||||
_channelFactory = New ChannelFactory(Of IEDMServiceChannel)(binding, endpointAddress)
|
||||
Dim oBinding = Channel.GetBinding()
|
||||
Dim oAddress = New EndpointAddress(ServiceAdress)
|
||||
_channelFactory = New ChannelFactory(Of IEDMServiceChannel)(oBinding, oAddress)
|
||||
Connect2NetService()
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
@ -110,6 +102,24 @@ Public Class Document
|
||||
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
|
||||
|
||||
'Public Async Function New_EDMI_File(oFILENAME As String, oUserName As String) As Task(Of String)
|
||||
' Try
|
||||
' Dim oFileGUID As DocumentResult = Await CreateDocument(oFILENAME)
|
||||
|
||||
@ -78,6 +78,7 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Constants.vb" />
|
||||
<Compile Include="Document.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
|
||||
@ -3,6 +3,7 @@ Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
Imports System.IO
|
||||
Imports DigitalData.Services.EDMService
|
||||
|
||||
<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)>
|
||||
Public Class EDMService
|
||||
@ -236,10 +237,56 @@ Public Class EDMService
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "Utils"
|
||||
Public Function GetDocumentByDocumentId(DocumentId As Long) As DocumentResult Implements IEDMService.GetDocumentByDocumentId
|
||||
Try
|
||||
Dim oSQL = $"SELECT GUID, CONTAINER_ID, ORIGINAL_FILENAME FROM TBICM_DOCUMENT WHERE GUID = {DocumentId}"
|
||||
Dim oTable = Database.GetDatatable(oSQL)
|
||||
|
||||
If oTable.Rows.Count = 0 Then
|
||||
Return New DocumentResult("Document not found")
|
||||
End If
|
||||
|
||||
Dim oRow As DataRow = oTable.Rows.Item(0)
|
||||
Dim oDocument As New DocumentObject(
|
||||
oRow.Item("CONTAINER_ID"),
|
||||
oRow.Item("GUID"),
|
||||
oRow.Item("ORIGINAL_FILENAME")
|
||||
)
|
||||
|
||||
Return New DocumentResult(oDocument)
|
||||
Catch ex As Exception
|
||||
Return New DocumentResult(ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetDocumentByContainerId(ContainerId As String) As DocumentResult Implements IEDMService.GetDocumentByContainerId
|
||||
Try
|
||||
Dim oSQL = $"SELECT GUID, CONTAINER_ID, ORIGINAL_FILENAME FROM TBICM_DOCUMENT WHERE CONTAINER_ID = '{ContainerId}'"
|
||||
Dim oTable = Database.GetDatatable(oSQL)
|
||||
|
||||
If oTable.Rows.Count = 0 Then
|
||||
Return New DocumentResult("Document not found")
|
||||
End If
|
||||
|
||||
Dim oRow As DataRow = oTable.Rows.Item(0)
|
||||
Dim oDocument As New DocumentObject(
|
||||
oRow.Item("CONTAINER_ID"),
|
||||
oRow.Item("GUID"),
|
||||
oRow.Item("ORIGINAL_FILENAME")
|
||||
)
|
||||
|
||||
Return New DocumentResult(oDocument)
|
||||
Catch ex As Exception
|
||||
Return New DocumentResult(ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
#Region "Index"
|
||||
Public Function NewFileIndex(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As IndexResult Implements IEDMService.NewFileIndex
|
||||
Try
|
||||
Dim oSQL = $"SELECT FNICM_NEW_OBJECT_VALUE({DocObject.DocumentId},'{Syskey}','{LanguageCode}','{Value}','{_username}') FROM RDB$DATABASE;"
|
||||
Dim oSQL = $"SELECT FNICM_NEW_DOC_VALUE({DocObject.DocumentId},'{Syskey}','{LanguageCode}','{Value}','{_username}') FROM RDB$DATABASE;"
|
||||
Dim oIndexId As Int64 = Database.GetScalarValue(oSQL)
|
||||
|
||||
Return New IndexResult(oIndexId)
|
||||
|
||||
@ -40,6 +40,14 @@ Interface IEDMService
|
||||
Function DeleteFile(DocObject As DocumentObject) As Boolean
|
||||
#End Region
|
||||
|
||||
#Region "Utils"
|
||||
<OperationContract>
|
||||
Function GetDocumentByDocumentId(DocumentId As Int64) As DocumentResult
|
||||
|
||||
<OperationContract>
|
||||
Function GetDocumentByContainerId(ContainerId As String) As DocumentResult
|
||||
#End Region
|
||||
|
||||
#Region "Index"
|
||||
<OperationContract>
|
||||
Function NewFileIndex(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As IndexResult
|
||||
|
||||
@ -10,7 +10,7 @@ Public Class BaseResult
|
||||
Public Property ErrorMessage As String
|
||||
|
||||
Public Sub New()
|
||||
Me.OK = OK
|
||||
OK = True
|
||||
End Sub
|
||||
|
||||
Public Sub New(ErrorMessage As String)
|
||||
|
||||
@ -36,8 +36,8 @@ Public Class WindowsService
|
||||
|
||||
_logger = _logConfig.GetLogger()
|
||||
|
||||
_logger.Info("Service {0} is starting", SERVICE_DISPLAY_NAME)
|
||||
_logger.Info("Connecting to database")
|
||||
_logger.Info("Service {0} is starting...", SERVICE_DISPLAY_NAME)
|
||||
_logger.Debug("Connecting to database...")
|
||||
|
||||
_db = New Firebird(
|
||||
_logConfig,
|
||||
@ -47,20 +47,20 @@ Public Class WindowsService
|
||||
AppConfig.FirebirdPassword
|
||||
)
|
||||
|
||||
_logger.Info("Successfully connected to database!")
|
||||
_logger.Info("Database connection established.")
|
||||
|
||||
EDMService.Database = _db
|
||||
EDMService.LogConfig = _logConfig
|
||||
EDMService.AppConfig = _config
|
||||
|
||||
_logger.Info("Starting the WCF Service")
|
||||
_logger.Debug("Starting WCF ServiceHost...")
|
||||
|
||||
_serviceHost = New ServiceHost(GetType(EDMService))
|
||||
_serviceHost.Open()
|
||||
|
||||
_logger.Info("Successfully started the WCF Service!")
|
||||
_logger.Info("WCF ServiceHost started.")
|
||||
|
||||
_logger.Info("Service {0} successfully started!", SERVICE_DISPLAY_NAME)
|
||||
_logger.Info("Service {0} successfully started.", SERVICE_DISPLAY_NAME)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex, "Failed to start the service host!")
|
||||
End Try
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user