EDMI: Method NewFileAsync Improvements

This commit is contained in:
Jonathan Jenne 2021-06-28 16:40:21 +02:00
parent 5d296873be
commit 36b86ed9d1
10 changed files with 198 additions and 203 deletions

View File

@ -1194,6 +1194,8 @@ Public Class frmGlobix_Index
NI_TITLE = "Error Globix-Import" NI_TITLE = "Error Globix-Import"
NI_MESSAGE = "The import was not successful - Check LogFile" NI_MESSAGE = "The import was not successful - Check LogFile"
End If End If
MsgBox(NI_MESSAGE, MsgBoxStyle.Critical, NI_TITLE)
End If End If
'False oder True zurückgeben 'False oder True zurückgeben

View File

@ -36,7 +36,7 @@ Public Class frmtest
Using oMemoryStream As New MemoryStream Using oMemoryStream As New MemoryStream
oStream.CopyTo(oMemoryStream) oStream.CopyTo(oMemoryStream)
Dim oContents As Byte() = oMemoryStream.ToArray() Dim oContents As Byte() = oMemoryStream.ToArray()
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, "WORK", txtIDBFOPath.Text)
End Using End Using
End Using End Using
@ -103,26 +103,25 @@ Public Class frmtest
txtFile2Import.Text = OpenFileDialog1.FileName txtFile2Import.Text = OpenFileDialog1.FileName
Using oStream As New FileStream(txtFile2Import.Text, FileMode.Open, FileAccess.Read)
Using oMemoryStream As New MemoryStream
oStream.CopyTo(oMemoryStream)
Dim oContents As Byte() = oMemoryStream.ToArray()
oResult = Await My.Application.Service.Client.ImportFileAsync(
txtFile2Import.Text,
Environment.UserName,
Date.Now,
"WORK",
1,
"DEFAULT",
New Client.ImportFileOptions With {
.KeepExtension = True
}
)
MsgBox($"File saved to: [{oResult}]") oResult = Await My.Application.Service.Client.NewFileAsync(
'oResult = Await My.Application.Service.Client.ImportFileObjectAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, 1, txtIDBFOPath.Text) txtFile2Import.Text,
End Using Environment.UserName,
End Using Date.Now,
"WORK",
"DEFAULT",
New Client.ImportFileOptions With {
.KeepExtension = True
}
)
MsgBox($"File saved to: [{oResult}]")
'oResult = Await My.Application.Service.Client.ImportFileObjectAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, 1, txtIDBFOPath.Text)
End Sub
Private Sub frmtest_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub End Sub
End Class End Class

View File

@ -78,20 +78,38 @@ Public Class Client
End Try End Try
End Function End Function
''' <summary>
''' Import options for NewFileAsync
''' </summary>
Public Class ImportFileOptions Public Class ImportFileOptions
Public KeepExtension As Boolean Public KeepExtension As Boolean
End Class End Class
''' <summary> ''' <summary>
''' Imports a file by filename ''' TODO: Platzhalter
''' </summary> ''' </summary>
''' <returns>A document object</returns> ''' <returns></returns>
Public Async Function ImportFileAsync(pFilePath As String, pWho As String, pWhen As Date, pObjectStoreType As String, pObjectStoreId As Long, pBusinessEntity As String, ImportOptions As ImportFileOptions) As Task(Of String) Public Async Function NewObjectAsync() As Task
'pObjectId As Long, pStoreType As String, pDate As String, pExtension As String, pKeepExtension As String End Function
Dim oKindType = "DOC"
''' <summary>
''' Imports a file from a filepath, creating a IDB ObjectId and Filesystem Object
''' </summary>
''' <param name="pFilePath">Local filepath to a file.</param>
''' <param name="pWho">Windows username of the user responsible for the import.</param>
''' <param name="pWhen">Date when the file was imported. Can be in the past.</param>
''' <param name="pObjectStoreType">Type of ObjectStore. Can be WORK or ARCHIVE.</param>
''' <param name="pBusinessEntity">Business entity that the new file object should belong to.</param>
''' <param name="ImportOptions">Other file import options</param>
''' <returns>The ObjectId of the newly generated filesystem object</returns>
''' <exception cref="FileNotFoundException">When local filepath was not found</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)
Const oKindType = "DOC"
Try Try
If File.Exists(pFilePath) = False Then If File.Exists(pFilePath) = False Then
Throw New ApplicationException("ImportFileAsync: Path does not exist") Throw New FileNotFoundException("ImportFileAsync: Path does not exist")
End If End If
Dim oFileInfo As New FileInfo(pFilePath) Dim oFileInfo As New FileInfo(pFilePath)
@ -125,10 +143,10 @@ Public Class Client
Dim oContents = oMemoryStream.ToArray() Dim oContents = oMemoryStream.ToArray()
Dim oFileImportResponse = Await _channel.ImportFileIntoFileObjectAsync(New ImportFileIntoFileObjectRequest With { Dim oFileImportResponse = Await _channel.ImportFileIntoFileObjectAsync(New ImportFileIntoFileObjectRequest With {
.pIDBFilePath = oFilePathResponse.FileObjectPath, .FilePath = oFilePathResponse.FileObjectPath,
.pIDB_OBJ_ID = oObjectIdResponse.ObjectId, .ObjectId = oObjectIdResponse.ObjectId,
.pObjectStoreID = pObjectStoreId, .ObjectStoreType = pObjectStoreType,
.pWho = pWho, .Who = pWho,
.Contents = oContents .Contents = oContents
}) })
@ -138,39 +156,12 @@ Public Class Client
End Using End Using
End Using End Using
Return oFilePathResponse.FileObjectPath Return oObjectIdResponse.ObjectId
Catch ex As Exception Catch ex As Exception
_logger.Error(ex) _logger.Error(ex)
Return Nothing Return Nothing
End Try End Try
End Function End Function
'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(oStream.Length) 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 Function CreateObjectId(pKindType As String, pWho As String, pBusinessEntity As String) As Long Public Function CreateObjectId(pKindType As String, pWho As String, pBusinessEntity As String) As Long
Try Try
@ -209,14 +200,14 @@ Public Class Client
End Try End Try
End Function End Function
Public Async Function ImportFileObjectAsync(pContent As Byte(), pWho As String, pObjectId As Long, pObjectStoreID As Short, pFileObjectPath As String) As Task(Of Boolean) Public Async Function ImportFileObjectAsync(pContent As Byte(), pWho As String, pObjectId As Long, pObjectStoreType As String, pFileObjectPath As String) As Task(Of Boolean)
Try Try
Dim oData As New ImportFileIntoFileObjectRequest() With { Dim oData As New ImportFileIntoFileObjectRequest() With {
.Contents = pContent, .Contents = pContent,
.pWho = pWho, .Who = pWho,
.pIDBFilePath = pFileObjectPath, .FilePath = pFileObjectPath,
.pIDB_OBJ_ID = pObjectId, .ObjectId = pObjectId,
.pObjectStoreID = pObjectStoreID .ObjectStoreType = pObjectStoreType
} }
Dim oResponse = Await _channel.ImportFileIntoFileObjectAsync(oData) Dim oResponse = Await _channel.ImportFileIntoFileObjectAsync(oData)

View File

@ -264,10 +264,10 @@
<xs:complexType> <xs:complexType>
<xs:sequence> <xs:sequence>
<xs:element minOccurs="0" name="Contents" nillable="true" type="xs:base64Binary" /> <xs:element minOccurs="0" name="Contents" nillable="true" type="xs:base64Binary" />
<xs:element minOccurs="0" name="pIDBFilePath" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="FilePath" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="pIDB_OBJ_ID" type="xs:long" /> <xs:element minOccurs="0" name="ObjectId" type="xs:long" />
<xs:element minOccurs="0" name="pObjectStoreID" type="xs:int" /> <xs:element minOccurs="0" name="ObjectStoreType" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="pWho" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="Who" nillable="true" type="xs:string" />
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>

View File

@ -756,39 +756,39 @@ Namespace EDMIServiceReference
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=0)> _ <System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=0)> _
Public Contents() As Byte Public Contents() As Byte
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=1)> _ <System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=1)>
Public pIDBFilePath As String Public FilePath As String
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=2)> _ <System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=2)>
Public pIDB_OBJ_ID As Long Public ObjectId As Long
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=3)> _ <System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=3)>
Public pObjectStoreID As Integer Public ObjectStoreType As String
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=4)> _ <System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=4)>
Public pWho As String Public Who As String
Public Sub New() Public Sub New()
MyBase.New MyBase.New
End Sub End Sub
Public Sub New(ByVal Contents() As Byte, ByVal pIDBFilePath As String, ByVal pIDB_OBJ_ID As Long, ByVal pObjectStoreID As Integer, ByVal pWho As String) Public Sub New(ByVal Contents() As Byte, ByVal FilePath As String, ByVal ObjectId As Long, ByVal ObjectStoreType As String, ByVal Who As String)
MyBase.New MyBase.New
Me.Contents = Contents Me.Contents = Contents
Me.pIDBFilePath = pIDBFilePath Me.FilePath = FilePath
Me.pIDB_OBJ_ID = pIDB_OBJ_ID Me.ObjectId = ObjectId
Me.pObjectStoreID = pObjectStoreID Me.ObjectStoreType = ObjectStoreType
Me.pWho = pWho Me.Who = Who
End Sub End Sub
End Class End Class
<System.Diagnostics.DebuggerStepThroughAttribute(), _ <System.Diagnostics.DebuggerStepThroughAttribute(),
System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0"), _ System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0"),
System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced), _ System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced),
System.ServiceModel.MessageContractAttribute(WrapperName:="ImportFileIntoFileObjectResponse", WrapperNamespace:="http://DigitalData.Services.EDMIService", IsWrapped:=true)> _ System.ServiceModel.MessageContractAttribute(WrapperName:="ImportFileIntoFileObjectResponse", WrapperNamespace:="http://DigitalData.Services.EDMIService", IsWrapped:=True)>
Partial Public Class ImportFileIntoFileObjectResponse Partial Public Class ImportFileIntoFileObjectResponse
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=0)> _ <System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=0)>
Public Result As Boolean Public Result As Boolean
Public Sub New() Public Sub New()
@ -801,13 +801,13 @@ Namespace EDMIServiceReference
End Sub End Sub
End Class End Class
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")> _ <System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")>
Public Interface IEDMIServiceChannel Public Interface IEDMIServiceChannel
Inherits EDMIServiceReference.IEDMIService, System.ServiceModel.IClientChannel Inherits EDMIServiceReference.IEDMIService, System.ServiceModel.IClientChannel
End Interface End Interface
<System.Diagnostics.DebuggerStepThroughAttribute(), _ <System.Diagnostics.DebuggerStepThroughAttribute(),
System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")> _ System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")>
Partial Public Class EDMIServiceClient Partial Public Class EDMIServiceClient
Inherits System.ServiceModel.ClientBase(Of EDMIServiceReference.IEDMIService) Inherits System.ServiceModel.ClientBase(Of EDMIServiceReference.IEDMIService)
Implements EDMIServiceReference.IEDMIService Implements EDMIServiceReference.IEDMIService
@ -920,7 +920,7 @@ Namespace EDMIServiceReference
Return MyBase.Channel.ExecuteNonQuery_MSSQL_ECMAsync(SQL) Return MyBase.Channel.ExecuteNonQuery_MSSQL_ECMAsync(SQL)
End Function End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
Function EDMIServiceReference_IEDMIService_ImportFile(ByVal request As EDMIServiceReference.DocumentImportRequest) As EDMIServiceReference.DocumentImportResponse Implements EDMIServiceReference.IEDMIService.ImportFile Function EDMIServiceReference_IEDMIService_ImportFile(ByVal request As EDMIServiceReference.DocumentImportRequest) As EDMIServiceReference.DocumentImportResponse Implements EDMIServiceReference.IEDMIService.ImportFile
Return MyBase.Channel.ImportFile(request) Return MyBase.Channel.ImportFile(request)
End Function End Function
@ -932,11 +932,11 @@ Namespace EDMIServiceReference
inValue.FileName = FileName inValue.FileName = FileName
inValue.ObjectStoreId = ObjectStoreId inValue.ObjectStoreId = ObjectStoreId
inValue.RetentionDays = RetentionDays inValue.RetentionDays = RetentionDays
Dim retVal As EDMIServiceReference.DocumentImportResponse = CType(Me,EDMIServiceReference.IEDMIService).ImportFile(inValue) Dim retVal As EDMIServiceReference.DocumentImportResponse = CType(Me, EDMIServiceReference.IEDMIService).ImportFile(inValue)
Return retVal.ObjectId Return retVal.ObjectId
End Function End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
Function EDMIServiceReference_IEDMIService_ImportFileAsync(ByVal request As EDMIServiceReference.DocumentImportRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentImportResponse) Implements EDMIServiceReference.IEDMIService.ImportFileAsync 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) Return MyBase.Channel.ImportFileAsync(request)
End Function End Function
@ -948,10 +948,10 @@ Namespace EDMIServiceReference
inValue.FileName = FileName inValue.FileName = FileName
inValue.ObjectStoreId = ObjectStoreId inValue.ObjectStoreId = ObjectStoreId
inValue.RetentionDays = RetentionDays inValue.RetentionDays = RetentionDays
Return CType(Me,EDMIServiceReference.IEDMIService).ImportFileAsync(inValue) Return CType(Me, EDMIServiceReference.IEDMIService).ImportFileAsync(inValue)
End Function End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
Function EDMIServiceReference_IEDMIService_GetFileByObjectId(ByVal request As EDMIServiceReference.DocumentStreamRequest) As EDMIServiceReference.DocumentStreamResponse Implements EDMIServiceReference.IEDMIService.GetFileByObjectId Function EDMIServiceReference_IEDMIService_GetFileByObjectId(ByVal request As EDMIServiceReference.DocumentStreamRequest) As EDMIServiceReference.DocumentStreamResponse Implements EDMIServiceReference.IEDMIService.GetFileByObjectId
Return MyBase.Channel.GetFileByObjectId(request) Return MyBase.Channel.GetFileByObjectId(request)
End Function End Function
@ -959,12 +959,12 @@ Namespace EDMIServiceReference
Public Function GetFileByObjectId(ByVal ObjectId As Long, <System.Runtime.InteropServices.OutAttribute()> ByRef FileContents As System.IO.Stream) As String Public Function GetFileByObjectId(ByVal ObjectId As Long, <System.Runtime.InteropServices.OutAttribute()> ByRef FileContents As System.IO.Stream) As String
Dim inValue As EDMIServiceReference.DocumentStreamRequest = New EDMIServiceReference.DocumentStreamRequest() Dim inValue As EDMIServiceReference.DocumentStreamRequest = New EDMIServiceReference.DocumentStreamRequest()
inValue.ObjectId = ObjectId inValue.ObjectId = ObjectId
Dim retVal As EDMIServiceReference.DocumentStreamResponse = CType(Me,EDMIServiceReference.IEDMIService).GetFileByObjectId(inValue) Dim retVal As EDMIServiceReference.DocumentStreamResponse = CType(Me, EDMIServiceReference.IEDMIService).GetFileByObjectId(inValue)
FileContents = retVal.FileContents FileContents = retVal.FileContents
Return retVal.FileName Return retVal.FileName
End Function End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
Function EDMIServiceReference_IEDMIService_GetFileByObjectIdAsync(ByVal request As EDMIServiceReference.DocumentStreamRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentStreamResponse) Implements EDMIServiceReference.IEDMIService.GetFileByObjectIdAsync Function EDMIServiceReference_IEDMIService_GetFileByObjectIdAsync(ByVal request As EDMIServiceReference.DocumentStreamRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentStreamResponse) Implements EDMIServiceReference.IEDMIService.GetFileByObjectIdAsync
Return MyBase.Channel.GetFileByObjectIdAsync(request) Return MyBase.Channel.GetFileByObjectIdAsync(request)
End Function End Function
@ -972,10 +972,10 @@ Namespace EDMIServiceReference
Public Function GetFileByObjectIdAsync(ByVal ObjectId As Long) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentStreamResponse) Public Function GetFileByObjectIdAsync(ByVal ObjectId As Long) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentStreamResponse)
Dim inValue As EDMIServiceReference.DocumentStreamRequest = New EDMIServiceReference.DocumentStreamRequest() Dim inValue As EDMIServiceReference.DocumentStreamRequest = New EDMIServiceReference.DocumentStreamRequest()
inValue.ObjectId = ObjectId inValue.ObjectId = ObjectId
Return CType(Me,EDMIServiceReference.IEDMIService).GetFileByObjectIdAsync(inValue) Return CType(Me, EDMIServiceReference.IEDMIService).GetFileByObjectIdAsync(inValue)
End Function End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
Function EDMIServiceReference_IEDMIService_GetFileInfoByObjectId(ByVal request As EDMIServiceReference.DocumentInfoRequest) As EDMIServiceReference.DocumentInfoResponse Implements EDMIServiceReference.IEDMIService.GetFileInfoByObjectId Function EDMIServiceReference_IEDMIService_GetFileInfoByObjectId(ByVal request As EDMIServiceReference.DocumentInfoRequest) As EDMIServiceReference.DocumentInfoResponse Implements EDMIServiceReference.IEDMIService.GetFileInfoByObjectId
Return MyBase.Channel.GetFileInfoByObjectId(request) Return MyBase.Channel.GetFileInfoByObjectId(request)
End Function End Function
@ -984,7 +984,7 @@ Namespace EDMIServiceReference
Dim inValue As EDMIServiceReference.DocumentInfoRequest = New EDMIServiceReference.DocumentInfoRequest() Dim inValue As EDMIServiceReference.DocumentInfoRequest = New EDMIServiceReference.DocumentInfoRequest()
inValue.ObjectId = ObjectId inValue.ObjectId = ObjectId
inValue.UserId = UserId inValue.UserId = UserId
Dim retVal As EDMIServiceReference.DocumentInfoResponse = CType(Me,EDMIServiceReference.IEDMIService).GetFileInfoByObjectId(inValue) Dim retVal As EDMIServiceReference.DocumentInfoResponse = CType(Me, EDMIServiceReference.IEDMIService).GetFileInfoByObjectId(inValue)
FullPath = retVal.FullPath FullPath = retVal.FullPath
Return retVal.FileRight Return retVal.FileRight
End Function End Function
@ -993,28 +993,28 @@ Namespace EDMIServiceReference
Return MyBase.Channel.GetFileInfoByObjectIdAsync(request) Return MyBase.Channel.GetFileInfoByObjectIdAsync(request)
End Function End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
Function EDMIServiceReference_IEDMIService_ListFilesForUser(ByVal request As EDMIServiceReference.ListFilesForUserRequest) As EDMIServiceReference.DocumentListResponse Implements EDMIServiceReference.IEDMIService.ListFilesForUser Function EDMIServiceReference_IEDMIService_ListFilesForUser(ByVal request As EDMIServiceReference.ListFilesForUserRequest) As EDMIServiceReference.DocumentListResponse Implements EDMIServiceReference.IEDMIService.ListFilesForUser
Return MyBase.Channel.ListFilesForUser(request) Return MyBase.Channel.ListFilesForUser(request)
End Function End Function
Public Function ListFilesForUser() As System.Data.DataTable Public Function ListFilesForUser() As System.Data.DataTable
Dim inValue As EDMIServiceReference.ListFilesForUserRequest = New EDMIServiceReference.ListFilesForUserRequest() Dim inValue As EDMIServiceReference.ListFilesForUserRequest = New EDMIServiceReference.ListFilesForUserRequest()
Dim retVal As EDMIServiceReference.DocumentListResponse = CType(Me,EDMIServiceReference.IEDMIService).ListFilesForUser(inValue) Dim retVal As EDMIServiceReference.DocumentListResponse = CType(Me, EDMIServiceReference.IEDMIService).ListFilesForUser(inValue)
Return retVal.Datatable Return retVal.Datatable
End Function End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
Function EDMIServiceReference_IEDMIService_ListFilesForUserAsync(ByVal request As EDMIServiceReference.ListFilesForUserRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentListResponse) Implements EDMIServiceReference.IEDMIService.ListFilesForUserAsync 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) Return MyBase.Channel.ListFilesForUserAsync(request)
End Function End Function
Public Function ListFilesForUserAsync() As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentListResponse) Public Function ListFilesForUserAsync() As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentListResponse)
Dim inValue As EDMIServiceReference.ListFilesForUserRequest = New EDMIServiceReference.ListFilesForUserRequest() Dim inValue As EDMIServiceReference.ListFilesForUserRequest = New EDMIServiceReference.ListFilesForUserRequest()
Return CType(Me,EDMIServiceReference.IEDMIService).ListFilesForUserAsync(inValue) Return CType(Me, EDMIServiceReference.IEDMIService).ListFilesForUserAsync(inValue)
End Function End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
Function EDMIServiceReference_IEDMIService_NewObjectId(ByVal request As EDMIServiceReference.NewObjectIdRequest) As EDMIServiceReference.NewObjectIdResponse Implements EDMIServiceReference.IEDMIService.NewObjectId Function EDMIServiceReference_IEDMIService_NewObjectId(ByVal request As EDMIServiceReference.NewObjectIdRequest) As EDMIServiceReference.NewObjectIdResponse Implements EDMIServiceReference.IEDMIService.NewObjectId
Return MyBase.Channel.NewObjectId(request) Return MyBase.Channel.NewObjectId(request)
End Function End Function
@ -1024,11 +1024,11 @@ Namespace EDMIServiceReference
inValue.BusinessEntity = BusinessEntity inValue.BusinessEntity = BusinessEntity
inValue.KindType = KindType inValue.KindType = KindType
inValue.Who = Who inValue.Who = Who
Dim retVal As EDMIServiceReference.NewObjectIdResponse = CType(Me,EDMIServiceReference.IEDMIService).NewObjectId(inValue) Dim retVal As EDMIServiceReference.NewObjectIdResponse = CType(Me, EDMIServiceReference.IEDMIService).NewObjectId(inValue)
Return retVal.ObjectId Return retVal.ObjectId
End Function End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
Function EDMIServiceReference_IEDMIService_NewObjectIdAsync(ByVal request As EDMIServiceReference.NewObjectIdRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.NewObjectIdResponse) Implements EDMIServiceReference.IEDMIService.NewObjectIdAsync Function EDMIServiceReference_IEDMIService_NewObjectIdAsync(ByVal request As EDMIServiceReference.NewObjectIdRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.NewObjectIdResponse) Implements EDMIServiceReference.IEDMIService.NewObjectIdAsync
Return MyBase.Channel.NewObjectIdAsync(request) Return MyBase.Channel.NewObjectIdAsync(request)
End Function End Function
@ -1038,10 +1038,10 @@ Namespace EDMIServiceReference
inValue.BusinessEntity = BusinessEntity inValue.BusinessEntity = BusinessEntity
inValue.KindType = KindType inValue.KindType = KindType
inValue.Who = Who inValue.Who = Who
Return CType(Me,EDMIServiceReference.IEDMIService).NewObjectIdAsync(inValue) Return CType(Me, EDMIServiceReference.IEDMIService).NewObjectIdAsync(inValue)
End Function End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
Function EDMIServiceReference_IEDMIService_NewFileObject(ByVal request As EDMIServiceReference.NewFileObjectRequest) As EDMIServiceReference.NewFileObjectResponse Implements EDMIServiceReference.IEDMIService.NewFileObject Function EDMIServiceReference_IEDMIService_NewFileObject(ByVal request As EDMIServiceReference.NewFileObjectRequest) As EDMIServiceReference.NewFileObjectResponse Implements EDMIServiceReference.IEDMIService.NewFileObject
Return MyBase.Channel.NewFileObject(request) Return MyBase.Channel.NewFileObject(request)
End Function End Function
@ -1053,11 +1053,11 @@ Namespace EDMIServiceReference
inValue.KeepExtension = KeepExtension inValue.KeepExtension = KeepExtension
inValue.ObjectId = ObjectId inValue.ObjectId = ObjectId
inValue.StoreType = StoreType inValue.StoreType = StoreType
Dim retVal As EDMIServiceReference.NewFileObjectResponse = CType(Me,EDMIServiceReference.IEDMIService).NewFileObject(inValue) Dim retVal As EDMIServiceReference.NewFileObjectResponse = CType(Me, EDMIServiceReference.IEDMIService).NewFileObject(inValue)
Return retVal.FileObjectPath Return retVal.FileObjectPath
End Function End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
Function EDMIServiceReference_IEDMIService_NewFileObjectAsync(ByVal request As EDMIServiceReference.NewFileObjectRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.NewFileObjectResponse) Implements EDMIServiceReference.IEDMIService.NewFileObjectAsync Function EDMIServiceReference_IEDMIService_NewFileObjectAsync(ByVal request As EDMIServiceReference.NewFileObjectRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.NewFileObjectResponse) Implements EDMIServiceReference.IEDMIService.NewFileObjectAsync
Return MyBase.Channel.NewFileObjectAsync(request) Return MyBase.Channel.NewFileObjectAsync(request)
End Function End Function
@ -1069,37 +1069,37 @@ Namespace EDMIServiceReference
inValue.KeepExtension = KeepExtension inValue.KeepExtension = KeepExtension
inValue.ObjectId = ObjectId inValue.ObjectId = ObjectId
inValue.StoreType = StoreType inValue.StoreType = StoreType
Return CType(Me,EDMIServiceReference.IEDMIService).NewFileObjectAsync(inValue) Return CType(Me, EDMIServiceReference.IEDMIService).NewFileObjectAsync(inValue)
End Function End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
Function EDMIServiceReference_IEDMIService_ImportFileIntoFileObject(ByVal request As EDMIServiceReference.ImportFileIntoFileObjectRequest) As EDMIServiceReference.ImportFileIntoFileObjectResponse Implements EDMIServiceReference.IEDMIService.ImportFileIntoFileObject Function EDMIServiceReference_IEDMIService_ImportFileIntoFileObject(ByVal request As EDMIServiceReference.ImportFileIntoFileObjectRequest) As EDMIServiceReference.ImportFileIntoFileObjectResponse Implements EDMIServiceReference.IEDMIService.ImportFileIntoFileObject
Return MyBase.Channel.ImportFileIntoFileObject(request) Return MyBase.Channel.ImportFileIntoFileObject(request)
End Function End Function
Public Function ImportFileIntoFileObject(ByVal Contents() As Byte, ByVal pIDBFilePath As String, ByVal pIDB_OBJ_ID As Long, ByVal pObjectStoreID As Integer, ByVal pWho As String) As Boolean Public Function ImportFileIntoFileObject(ByVal Contents() As Byte, ByVal FilePath As String, ByVal ObjectId As Long, ByVal ObjectStoreType As String, ByVal Who As String) As Boolean
Dim inValue As EDMIServiceReference.ImportFileIntoFileObjectRequest = New EDMIServiceReference.ImportFileIntoFileObjectRequest() Dim inValue As EDMIServiceReference.ImportFileIntoFileObjectRequest = New EDMIServiceReference.ImportFileIntoFileObjectRequest()
inValue.Contents = Contents inValue.Contents = Contents
inValue.pIDBFilePath = pIDBFilePath inValue.FilePath = FilePath
inValue.pIDB_OBJ_ID = pIDB_OBJ_ID inValue.ObjectId = ObjectId
inValue.pObjectStoreID = pObjectStoreID inValue.ObjectStoreType = ObjectStoreType
inValue.pWho = pWho inValue.Who = Who
Dim retVal As EDMIServiceReference.ImportFileIntoFileObjectResponse = CType(Me,EDMIServiceReference.IEDMIService).ImportFileIntoFileObject(inValue) Dim retVal As EDMIServiceReference.ImportFileIntoFileObjectResponse = CType(Me, EDMIServiceReference.IEDMIService).ImportFileIntoFileObject(inValue)
Return retVal.Result Return retVal.Result
End Function End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
Function EDMIServiceReference_IEDMIService_ImportFileIntoFileObjectAsync(ByVal request As EDMIServiceReference.ImportFileIntoFileObjectRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.ImportFileIntoFileObjectResponse) Implements EDMIServiceReference.IEDMIService.ImportFileIntoFileObjectAsync Function EDMIServiceReference_IEDMIService_ImportFileIntoFileObjectAsync(ByVal request As EDMIServiceReference.ImportFileIntoFileObjectRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.ImportFileIntoFileObjectResponse) Implements EDMIServiceReference.IEDMIService.ImportFileIntoFileObjectAsync
Return MyBase.Channel.ImportFileIntoFileObjectAsync(request) Return MyBase.Channel.ImportFileIntoFileObjectAsync(request)
End Function End Function
Public Function ImportFileIntoFileObjectAsync(ByVal Contents() As Byte, ByVal pIDBFilePath As String, ByVal pIDB_OBJ_ID As Long, ByVal pObjectStoreID As Integer, ByVal pWho As String) As System.Threading.Tasks.Task(Of EDMIServiceReference.ImportFileIntoFileObjectResponse) Public Function ImportFileIntoFileObjectAsync(ByVal Contents() As Byte, ByVal FilePath As String, ByVal ObjectId As Long, ByVal ObjectStoreType As String, ByVal Who As String) As System.Threading.Tasks.Task(Of EDMIServiceReference.ImportFileIntoFileObjectResponse)
Dim inValue As EDMIServiceReference.ImportFileIntoFileObjectRequest = New EDMIServiceReference.ImportFileIntoFileObjectRequest() Dim inValue As EDMIServiceReference.ImportFileIntoFileObjectRequest = New EDMIServiceReference.ImportFileIntoFileObjectRequest()
inValue.Contents = Contents inValue.Contents = Contents
inValue.pIDBFilePath = pIDBFilePath inValue.FilePath = FilePath
inValue.pIDB_OBJ_ID = pIDB_OBJ_ID inValue.ObjectId = ObjectId
inValue.pObjectStoreID = pObjectStoreID inValue.ObjectStoreType = ObjectStoreType
inValue.pWho = pWho inValue.Who = Who
Return CType(Me,EDMIServiceReference.IEDMIService).ImportFileIntoFileObjectAsync(inValue) Return CType(Me,EDMIServiceReference.IEDMIService).ImportFileIntoFileObjectAsync(inValue)
End Function End Function
End Class End Class

View File

@ -580,12 +580,17 @@ Public Class EDMIService
End Function End Function
Public Function ImportFileIntoFileObject(Data As ImportFileIntoFileObjectRequest) As ImportFileIntoFileObjectResponse Implements IEDMIService.ImportFileIntoFileObject Public Function ImportFileIntoFileObject(Data As ImportFileIntoFileObjectRequest) As ImportFileIntoFileObjectResponse Implements IEDMIService.ImportFileIntoFileObject
Dim oObjectStore = GlobalState.ObjectStores.First()
Dim oEDMIPath = New EDMI.File.Path(LogConfig, oObjectStore.Path)
Try Try
Using oStream = New FileStream(Data.pIDBFilePath, FileMode.Create, FileAccess.Write) Dim oObjectStore = GlobalState.ObjectStores.
_Logger.Info("ImportFile: Saving file to path [{0}]", Data.pIDBFilePath) Where(Function(o) o.Title = Data.ObjectStoreType).
FirstOrDefault()
If oObjectStore Is Nothing Then
Throw New KeyNotFoundException($"ObjectStore [{Data.ObjectStoreType}] was not found.")
End If
Using oStream = New FileStream(Data.FilePath, FileMode.Create, FileAccess.Write)
_Logger.Info("ImportFile: Saving file to path [{0}]", Data.FilePath)
_Logger.Info("ImportFile: Content Length: {0}", Data.Contents.Length) _Logger.Info("ImportFile: Content Length: {0}", Data.Contents.Length)
oStream.Write(Data.Contents, 0, Data.Contents.Length) oStream.Write(Data.Contents, 0, Data.Contents.Length)
@ -594,7 +599,7 @@ Public Class EDMIService
End Using End Using
' insert into db ' insert into db
Dim oSQL As String = $"EXEC PRIDB_NEW_IDBFO '{Data.pIDBFilePath}','{Data.pWho}','{Data.pIDB_OBJ_ID}',{Data.pObjectStoreID}" Dim oSQL As String = $"EXEC PRIDB_NEW_IDBFO '{Data.FilePath}','{Data.Who}','{Data.ObjectId}',{oObjectStore.Id}"
Dim oResult As Boolean = MSSQL_IDB.ExecuteNonQuery(oSQL) Dim oResult As Boolean = MSSQL_IDB.ExecuteNonQuery(oSQL)
Return New ImportFileIntoFileObjectResponse() With {.Result = oResult} Return New ImportFileIntoFileObjectResponse() With {.Result = oResult}

View File

@ -32,13 +32,13 @@ Namespace Messages
<MessageBodyMember> <MessageBodyMember>
Public Contents() As Byte Public Contents() As Byte
<MessageBodyMember> <MessageBodyMember>
Public pWho As String Public Who As String
<MessageBodyMember> <MessageBodyMember>
Public pIDBFilePath As String Public FilePath As String
<MessageBodyMember> <MessageBodyMember>
Public pIDB_OBJ_ID As Long Public ObjectId As Long
<MessageBodyMember> <MessageBodyMember>
Public pObjectStoreID As Integer Public ObjectStoreType As String
End Class End Class
<MessageContract> <MessageContract>

View File

@ -18,7 +18,7 @@ Public Class DatatableJob
Dim oLogConfig As LogConfig = oJobData.Item("LogConfig") Dim oLogConfig As LogConfig = oJobData.Item("LogConfig")
Dim oCronJobId As Integer = oJobData.Item("CronJobId") Dim oCronJobId As Integer = oJobData.Item("CronJobId")
Dim oCronJobTitle As String = oJobData.Item("CronJobTitle") Dim oCronJobTitle As String = oJobData.Item("CronJobTitle")
Dim oLogger As Logger = oLogConfig.GetLogger() Dim oLogger As Logger = oLogConfig.GetLoggerFor("Scheduler")
Dim oResult As New JobResult() Dim oResult As New JobResult()

View File

@ -21,7 +21,7 @@ Public Class JobListener
MyBase.New() MyBase.New()
_LogConfig = LogConfig _LogConfig = LogConfig
_Logger = LogConfig.GetLogger() _Logger = LogConfig.GetLoggerFor("Scheduler")
_MSSQL = MSSQL _MSSQL = MSSQL
Dataset = ResultDataSet Dataset = ResultDataSet
End Sub End Sub

View File

@ -108,8 +108,6 @@ Public Class Scheduler
End Sub End Sub
Public Async Function GetCronJobs() As Task(Of DataTable) Public Async Function GetCronJobs() As Task(Of DataTable)
Try Try
Dim oSQL As String = "SELECT * FROM TBAPPSERV_CRON_JOB WHERE ACTIVE = 1" Dim oSQL As String = "SELECT * FROM TBAPPSERV_CRON_JOB WHERE ACTIVE = 1"