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_MESSAGE = "The import was not successful - Check LogFile"
End If
MsgBox(NI_MESSAGE, MsgBoxStyle.Critical, NI_TITLE)
End If
'False oder True zurückgeben

View File

@ -36,7 +36,7 @@ Public Class frmtest
Using oMemoryStream As New MemoryStream
oStream.CopyTo(oMemoryStream)
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
@ -103,17 +103,13 @@ Public Class frmtest
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(
oResult = Await My.Application.Service.Client.NewFileAsync(
txtFile2Import.Text,
Environment.UserName,
Date.Now,
"WORK",
1,
"DEFAULT",
New Client.ImportFileOptions With {
.KeepExtension = True
@ -122,7 +118,10 @@ Public Class frmtest
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 Using
End Using
End Sub
Private Sub frmtest_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
End Class

View File

@ -78,20 +78,38 @@ Public Class Client
End Try
End Function
''' <summary>
''' Import options for NewFileAsync
''' </summary>
Public Class ImportFileOptions
Public KeepExtension As Boolean
End Class
''' <summary>
''' Imports a file by filename
''' TODO: Platzhalter
''' </summary>
''' <returns>A document object</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)
'pObjectId As Long, pStoreType As String, pDate As String, pExtension As String, pKeepExtension As String
Dim oKindType = "DOC"
''' <returns></returns>
Public Async Function NewObjectAsync() As Task
End Function
''' <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
If File.Exists(pFilePath) = False Then
Throw New ApplicationException("ImportFileAsync: Path does not exist")
Throw New FileNotFoundException("ImportFileAsync: Path does not exist")
End If
Dim oFileInfo As New FileInfo(pFilePath)
@ -125,10 +143,10 @@ Public Class Client
Dim oContents = oMemoryStream.ToArray()
Dim oFileImportResponse = Await _channel.ImportFileIntoFileObjectAsync(New ImportFileIntoFileObjectRequest With {
.pIDBFilePath = oFilePathResponse.FileObjectPath,
.pIDB_OBJ_ID = oObjectIdResponse.ObjectId,
.pObjectStoreID = pObjectStoreId,
.pWho = pWho,
.FilePath = oFilePathResponse.FileObjectPath,
.ObjectId = oObjectIdResponse.ObjectId,
.ObjectStoreType = pObjectStoreType,
.Who = pWho,
.Contents = oContents
})
@ -138,39 +156,12 @@ Public Class Client
End Using
End Using
Return oFilePathResponse.FileObjectPath
Return oObjectIdResponse.ObjectId
Catch ex As Exception
_logger.Error(ex)
Return Nothing
End Try
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
Try
@ -209,14 +200,14 @@ Public Class Client
End Try
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
Dim oData As New ImportFileIntoFileObjectRequest() With {
.Contents = pContent,
.pWho = pWho,
.pIDBFilePath = pFileObjectPath,
.pIDB_OBJ_ID = pObjectId,
.pObjectStoreID = pObjectStoreID
.Who = pWho,
.FilePath = pFileObjectPath,
.ObjectId = pObjectId,
.ObjectStoreType = pObjectStoreType
}
Dim oResponse = Await _channel.ImportFileIntoFileObjectAsync(oData)

View File

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

View File

@ -756,39 +756,39 @@ Namespace EDMIServiceReference
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=0)> _
Public Contents() As Byte
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=1)> _
Public pIDBFilePath As String
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=1)>
Public FilePath As String
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=2)> _
Public pIDB_OBJ_ID As Long
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=2)>
Public ObjectId As Long
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=3)> _
Public pObjectStoreID As Integer
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=3)>
Public ObjectStoreType As String
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=4)> _
Public pWho As String
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=4)>
Public Who As String
Public Sub New()
MyBase.New
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
Me.Contents = Contents
Me.pIDBFilePath = pIDBFilePath
Me.pIDB_OBJ_ID = pIDB_OBJ_ID
Me.pObjectStoreID = pObjectStoreID
Me.pWho = pWho
Me.FilePath = FilePath
Me.ObjectId = ObjectId
Me.ObjectStoreType = ObjectStoreType
Me.Who = Who
End Sub
End Class
<System.Diagnostics.DebuggerStepThroughAttribute(), _
System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0"), _
System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced), _
System.ServiceModel.MessageContractAttribute(WrapperName:="ImportFileIntoFileObjectResponse", WrapperNamespace:="http://DigitalData.Services.EDMIService", IsWrapped:=true)> _
<System.Diagnostics.DebuggerStepThroughAttribute(),
System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0"),
System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced),
System.ServiceModel.MessageContractAttribute(WrapperName:="ImportFileIntoFileObjectResponse", WrapperNamespace:="http://DigitalData.Services.EDMIService", IsWrapped:=True)>
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 Sub New()
@ -801,13 +801,13 @@ Namespace EDMIServiceReference
End Sub
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
Inherits EDMIServiceReference.IEDMIService, System.ServiceModel.IClientChannel
End Interface
<System.Diagnostics.DebuggerStepThroughAttribute(), _
System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")> _
<System.Diagnostics.DebuggerStepThroughAttribute(),
System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")>
Partial Public Class EDMIServiceClient
Inherits System.ServiceModel.ClientBase(Of EDMIServiceReference.IEDMIService)
Implements EDMIServiceReference.IEDMIService
@ -920,7 +920,7 @@ Namespace EDMIServiceReference
Return MyBase.Channel.ExecuteNonQuery_MSSQL_ECMAsync(SQL)
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
Return MyBase.Channel.ImportFile(request)
End Function
@ -936,7 +936,7 @@ Namespace EDMIServiceReference
Return retVal.ObjectId
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
Return MyBase.Channel.ImportFileAsync(request)
End Function
@ -951,7 +951,7 @@ Namespace EDMIServiceReference
Return CType(Me, EDMIServiceReference.IEDMIService).ImportFileAsync(inValue)
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
Return MyBase.Channel.GetFileByObjectId(request)
End Function
@ -964,7 +964,7 @@ Namespace EDMIServiceReference
Return retVal.FileName
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
Return MyBase.Channel.GetFileByObjectIdAsync(request)
End Function
@ -975,7 +975,7 @@ Namespace EDMIServiceReference
Return CType(Me, EDMIServiceReference.IEDMIService).GetFileByObjectIdAsync(inValue)
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
Return MyBase.Channel.GetFileInfoByObjectId(request)
End Function
@ -993,7 +993,7 @@ Namespace EDMIServiceReference
Return MyBase.Channel.GetFileInfoByObjectIdAsync(request)
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
Return MyBase.Channel.ListFilesForUser(request)
End Function
@ -1004,7 +1004,7 @@ Namespace EDMIServiceReference
Return retVal.Datatable
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
Return MyBase.Channel.ListFilesForUserAsync(request)
End Function
@ -1014,7 +1014,7 @@ Namespace EDMIServiceReference
Return CType(Me, EDMIServiceReference.IEDMIService).ListFilesForUserAsync(inValue)
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
Return MyBase.Channel.NewObjectId(request)
End Function
@ -1028,7 +1028,7 @@ Namespace EDMIServiceReference
Return retVal.ObjectId
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
Return MyBase.Channel.NewObjectIdAsync(request)
End Function
@ -1041,7 +1041,7 @@ Namespace EDMIServiceReference
Return CType(Me, EDMIServiceReference.IEDMIService).NewObjectIdAsync(inValue)
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
Return MyBase.Channel.NewFileObject(request)
End Function
@ -1057,7 +1057,7 @@ Namespace EDMIServiceReference
Return retVal.FileObjectPath
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
Return MyBase.Channel.NewFileObjectAsync(request)
End Function
@ -1072,34 +1072,34 @@ Namespace EDMIServiceReference
Return CType(Me, EDMIServiceReference.IEDMIService).NewFileObjectAsync(inValue)
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
Return MyBase.Channel.ImportFileIntoFileObject(request)
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()
inValue.Contents = Contents
inValue.pIDBFilePath = pIDBFilePath
inValue.pIDB_OBJ_ID = pIDB_OBJ_ID
inValue.pObjectStoreID = pObjectStoreID
inValue.pWho = pWho
inValue.FilePath = FilePath
inValue.ObjectId = ObjectId
inValue.ObjectStoreType = ObjectStoreType
inValue.Who = Who
Dim retVal As EDMIServiceReference.ImportFileIntoFileObjectResponse = CType(Me, EDMIServiceReference.IEDMIService).ImportFileIntoFileObject(inValue)
Return retVal.Result
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
Return MyBase.Channel.ImportFileIntoFileObjectAsync(request)
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()
inValue.Contents = Contents
inValue.pIDBFilePath = pIDBFilePath
inValue.pIDB_OBJ_ID = pIDB_OBJ_ID
inValue.pObjectStoreID = pObjectStoreID
inValue.pWho = pWho
inValue.FilePath = FilePath
inValue.ObjectId = ObjectId
inValue.ObjectStoreType = ObjectStoreType
inValue.Who = Who
Return CType(Me,EDMIServiceReference.IEDMIService).ImportFileIntoFileObjectAsync(inValue)
End Function
End Class

View File

@ -580,12 +580,17 @@ Public Class EDMIService
End Function
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
Using oStream = New FileStream(Data.pIDBFilePath, FileMode.Create, FileAccess.Write)
_Logger.Info("ImportFile: Saving file to path [{0}]", Data.pIDBFilePath)
Dim oObjectStore = GlobalState.ObjectStores.
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)
oStream.Write(Data.Contents, 0, Data.Contents.Length)
@ -594,7 +599,7 @@ Public Class EDMIService
End Using
' 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)
Return New ImportFileIntoFileObjectResponse() With {.Result = oResult}

View File

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

View File

@ -18,7 +18,7 @@ Public Class DatatableJob
Dim oLogConfig As LogConfig = oJobData.Item("LogConfig")
Dim oCronJobId As Integer = oJobData.Item("CronJobId")
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()

View File

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

View File

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