EDMI: final changes to Client

This commit is contained in:
Jonathan Jenne 2021-06-29 11:22:19 +02:00
parent 54c96b0b1f
commit 5658c233ee
6 changed files with 19 additions and 12 deletions

View File

@ -95,17 +95,13 @@ Public Class frmtest
End Sub End Sub
Private Async Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click Private Async Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
Dim oResult As Object
If OpenFileDialog1.ShowDialog() <> DialogResult.OK Then If OpenFileDialog1.ShowDialog() <> DialogResult.OK Then
Exit Sub Exit Sub
End If End If
txtFile2Import.Text = OpenFileDialog1.FileName txtFile2Import.Text = OpenFileDialog1.FileName
Dim oResult As FileMeta = Await My.Application.Service.Client.NewFileAsync(
oResult = Await My.Application.Service.Client.NewFileAsync(
txtFile2Import.Text, txtFile2Import.Text,
Environment.UserName, Environment.UserName,
Date.Now, Date.Now,
@ -116,7 +112,7 @@ Public Class frmtest
} }
) )
MsgBox($"File saved to: [{oResult}]") MsgBox($"File saved to: [{oResult.FilePath}]")
'oResult = Await My.Application.Service.Client.ImportFileObjectAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, 1, txtIDBFOPath.Text) 'oResult = Await My.Application.Service.Client.ImportFileObjectAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, 1, txtIDBFOPath.Text)
End Sub End Sub

View File

@ -104,7 +104,7 @@ Public Class Client
''' <returns>The ObjectId of the newly generated filesystem object</returns> ''' <returns>The ObjectId of the newly generated filesystem object</returns>
''' <exception cref="FileNotFoundException">When local filepath was not found</exception> ''' <exception cref="FileNotFoundException">When local filepath was not found</exception>
''' <exception cref="ApplicationException">When there was a error in the Service</exception> ''' <exception cref="ApplicationException">When there was a error in the Service</exception>
Public Async Function NewFileAsync(pFilePath As String, pWho As String, pWhen As Date, pObjectStoreType As String, pBusinessEntity As String, ImportOptions As ImportFileOptions) As Task(Of Long) Public Async Function NewFileAsync(pFilePath As String, pWho As String, pWhen As Date, pObjectStoreType As String, pBusinessEntity As String, ImportOptions As ImportFileOptions) As Task(Of FileMeta)
Const oKindType = "DOC" Const oKindType = "DOC"
Try Try
@ -156,7 +156,10 @@ Public Class Client
End Using End Using
End Using End Using
Return oObjectIdResponse.ObjectId Return New FileMeta With {
.ObjectId = oObjectIdResponse.ObjectId,
.FilePath = oFilePathResponse.FileObjectPath
}
Catch ex As Exception Catch ex As Exception
_logger.Error(ex) _logger.Error(ex)
Return Nothing Return Nothing

View File

@ -0,0 +1,4 @@
Public Class FileMeta
Public FilePath As String
Public ObjectId As String
End Class

View File

@ -81,6 +81,7 @@
</Compile> </Compile>
<Compile Include="Client.vb" /> <Compile Include="Client.vb" />
<Compile Include="DataWithFallback.vb" /> <Compile Include="DataWithFallback.vb" />
<Compile Include="Client\FileMeta.vb" />
<Compile Include="My Project\AssemblyInfo.vb" /> <Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb"> <Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>

View File

@ -581,10 +581,7 @@ Public Class EDMIService
Public Function ImportFileIntoFileObject(Data As ImportFileIntoFileObjectRequest) As ImportFileIntoFileObjectResponse Implements IEDMIService.ImportFileIntoFileObject Public Function ImportFileIntoFileObject(Data As ImportFileIntoFileObjectRequest) As ImportFileIntoFileObjectResponse Implements IEDMIService.ImportFileIntoFileObject
Try Try
Dim oObjectStore = GlobalState.ObjectStores. Dim oObjectStore = GlobalState.GetObjectStore(Data.ObjectStoreType)
Where(Function(o) o.Title = Data.ObjectStoreType).
FirstOrDefault()
If oObjectStore Is Nothing Then If oObjectStore Is Nothing Then
Throw New KeyNotFoundException($"ObjectStore [{Data.ObjectStoreType}] was not found.") Throw New KeyNotFoundException($"ObjectStore [{Data.ObjectStoreType}] was not found.")
End If End If

View File

@ -43,6 +43,12 @@ Public Class GlobalState
End Try End Try
End Sub End Sub
Public Function GetObjectStore(Name As String) As ObjectStore
Return ObjectStores.
Where(Function(o) o.Title.ToUpper = Name.ToUpper).
FirstOrDefault()
End Function
Class ObjectStore Class ObjectStore
Public Id As Long Public Id As Long
Public Title As String Public Title As String