EDMIService: Automatic indexing, more consolidation of globix logic
This commit is contained in:
@@ -160,7 +160,9 @@ Public Class Client
|
||||
},
|
||||
.KindType = pObjectKind,
|
||||
.StoreName = pObjectStoreName,
|
||||
.Who = pImportOptions.Username
|
||||
.User = New UserState With {
|
||||
.UserName = pImportOptions.Username
|
||||
}
|
||||
})
|
||||
|
||||
If oFileImportResponse.OK = False Then
|
||||
@@ -176,58 +178,61 @@ Public Class Client
|
||||
End Try
|
||||
End Function
|
||||
|
||||
'Public Function ImportFileAsync(pFilePath As String, pObjectStoreName As String, pObjectKind As String, pBusinessEntity As String, Optional pImportOptions As NewFileOptions = Nothing)
|
||||
' Try
|
||||
' ' Set default options
|
||||
' If pImportOptions Is Nothing Then
|
||||
' pImportOptions = New NewFileOptions()
|
||||
' End If
|
||||
Public Async Function ImportFileAsync(pFilePath As String, pObjectStoreName As String, pObjectKind As String, pBusinessEntity As String, Optional pImportOptions As NewFileOptions = Nothing) As Task(Of Long)
|
||||
Try
|
||||
' Set default options
|
||||
If pImportOptions Is Nothing Then
|
||||
pImportOptions = New NewFileOptions()
|
||||
End If
|
||||
|
||||
' ' Check if file exists
|
||||
' If File.Exists(pFilePath) = False Then
|
||||
' Throw New FileNotFoundException("Path does not exist")
|
||||
' End If
|
||||
' Check if file exists
|
||||
If File.Exists(pFilePath) = False Then
|
||||
Throw New FileNotFoundException("Path does not exist")
|
||||
End If
|
||||
|
||||
' Dim oFileInfo As New FileInfo(pFilePath)
|
||||
' Dim oExtension As String = oFileInfo.Extension
|
||||
Dim oFileInfo As New FileInfo(pFilePath)
|
||||
Dim oExtension As String = oFileInfo.Extension
|
||||
|
||||
' Dim oFileName As String = oFileInfo.Name
|
||||
' Dim oFileCreatedAt As Date = oFileInfo?.CreationTime
|
||||
' Dim oFileModifiedAt As Date = oFileInfo?.LastWriteTime
|
||||
' Dim oFileHash As String = _FileEx.GetChecksum(oFileInfo.FullName)
|
||||
Dim oFileName As String = oFileInfo.Name
|
||||
Dim oFileCreatedAt As Date = oFileInfo?.CreationTime
|
||||
Dim oFileModifiedAt As Date = oFileInfo?.LastWriteTime
|
||||
Dim oFileHash As String = _FileEx.GetChecksum(oFileInfo.FullName)
|
||||
|
||||
' ' Importing the file now
|
||||
' Using oFileStream As New FileStream(pFilePath, FileMode.Open, FileAccess.Read)
|
||||
' Using oMemoryStream As New MemoryStream()
|
||||
' oFileStream.CopyTo(oMemoryStream)
|
||||
' Dim oContents = oMemoryStream.ToArray()
|
||||
' Importing the file now
|
||||
Using oFileStream As New FileStream(pFilePath, FileMode.Open, FileAccess.Read)
|
||||
Using oMemoryStream As New MemoryStream()
|
||||
oFileStream.CopyTo(oMemoryStream)
|
||||
Dim oContents = oMemoryStream.ToArray()
|
||||
|
||||
' Dim oFileImportResponse = Await _channel.NewFIleAsync (New NewFileRequest With {
|
||||
' .BusinessEntity = pBusinessEntity,
|
||||
' .File = New FileProperties With {
|
||||
' .FileName = oFileInfo.Name,
|
||||
' .FileCreatedAt = oFileCreatedAt,
|
||||
' .FileChangedAt = oFileModifiedAt,
|
||||
' .FileContents = oContents,
|
||||
' .FileImportedAt = pImportOptions.DateImported,
|
||||
' .FileChecksum = oFileHash
|
||||
' },
|
||||
' .KindType = pObjectKind,
|
||||
' .StoreName = pObjectStoreName,
|
||||
' .Who = pImportOptions.Username
|
||||
' })
|
||||
' If oFileImportResponse.OK = False Then
|
||||
' Throw New ApplicationException("Could not Import File Contents!")
|
||||
' End If
|
||||
Dim oFileImportResponse = Await _channel.ImportFileAsync(New ImportFileRequest With {
|
||||
.BusinessEntity = pBusinessEntity,
|
||||
.File = New FileProperties With {
|
||||
.FileName = oFileInfo.Name,
|
||||
.FileCreatedAt = oFileCreatedAt,
|
||||
.FileChangedAt = oFileModifiedAt,
|
||||
.FileContents = oContents,
|
||||
.FileImportedAt = pImportOptions.DateImported,
|
||||
.FileChecksum = oFileHash,
|
||||
.FileInfoRaw = oFileInfo
|
||||
},
|
||||
.KindType = pObjectKind,
|
||||
.StoreName = pObjectStoreName,
|
||||
.User = New UserState With {
|
||||
.UserName = pImportOptions.Username
|
||||
}
|
||||
})
|
||||
If oFileImportResponse.OK = False Then
|
||||
Throw New ApplicationException("Could not Import File Contents!")
|
||||
End If
|
||||
|
||||
' Return oFileImportResponse.ObjectId
|
||||
' End Using
|
||||
' End Using
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' Return INVALID_OBEJCT_ID
|
||||
' End Try
|
||||
'End Function
|
||||
Return oFileImportResponse.ObjectId
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return INVALID_OBEJCT_ID
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Sets a value to an attribute
|
||||
|
||||
Reference in New Issue
Block a user