EDMIService: Add GetFileObject Method
This commit is contained in:
parent
fc9720326e
commit
ff60623130
@ -77,6 +77,12 @@ Public Class EDMIService
|
||||
Return oImportFile.Run(pData)
|
||||
End Function
|
||||
|
||||
Public Function GetFileObject(pData As GetFileObject.GetFileObjectRequest) As GetFileObject.GetFileObjectResponse Implements IEDMIService.GetFileObject
|
||||
_Logger.Debug("Start of Method [GetFileObject]")
|
||||
Dim oGetFileObject As New GetFileObject.GetFileObjectMethod(LogConfig, MSSQL_IDB, GlobalState)
|
||||
Return oGetFileObject.Run(pData)
|
||||
End Function
|
||||
|
||||
#Region "=== Heartbeat ==="
|
||||
Public Function Heartbeat() As Boolean Implements IEDMIService.Heartbeat
|
||||
Return True
|
||||
|
||||
@ -138,6 +138,10 @@
|
||||
<Compile Include="Methods\GetDatatableFromCache\GetDatatableFromCacheMethod.vb" />
|
||||
<Compile Include="Methods\GetDatatableFromCache\GetDatatableFromCacheRequest.vb" />
|
||||
<Compile Include="Methods\GetDatatableFromCache\GetDatatableFromCacheResponse.vb" />
|
||||
<Compile Include="Methods\GetFileObject\FileObject.vb" />
|
||||
<Compile Include="Methods\GetFileObject\GetFileObjectRequest.vb" />
|
||||
<Compile Include="Methods\GetFileObject\GetFileObjectResponse.vb" />
|
||||
<Compile Include="Methods\GetFileObject\GetFileObjectMethod.vb" />
|
||||
<Compile Include="Methods\GlobalIndexer\AutomaticIndex.vb" />
|
||||
<Compile Include="Methods\GlobalIndexer\BaseIndex.vb" />
|
||||
<Compile Include="Methods\GlobalIndexer\ImportFile\Steps\AutomaticIndexing.vb" />
|
||||
|
||||
@ -72,6 +72,8 @@ Interface IEDMIService
|
||||
<OperationContract>
|
||||
Function ImportFile(Data As GlobalIndexer.ImportFile.ImportFileRequest) As GlobalIndexer.ImportFile.ImportFileResponse
|
||||
|
||||
<OperationContract>
|
||||
Function GetFileObject(Data As GetFileObject.GetFileObjectRequest) As GetFileObject.GetFileObjectResponse
|
||||
#End Region
|
||||
|
||||
#Region "Document (Old)"
|
||||
|
||||
10
Service.EDMIService/Methods/GetFileObject/FileObject.vb
Normal file
10
Service.EDMIService/Methods/GetFileObject/FileObject.vb
Normal file
@ -0,0 +1,10 @@
|
||||
Namespace Methods.GetFileObject
|
||||
<Serializable>
|
||||
Public Class FileObject
|
||||
Public Property ObjectId As Long
|
||||
Public Property AccessRights As String
|
||||
Public Property FileHash As String
|
||||
Public Property FileSize As Long
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@ -0,0 +1,44 @@
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Language
|
||||
|
||||
Namespace Methods.GetFileObject
|
||||
Public Class GetFileObjectMethod
|
||||
Inherits BaseMethod
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pGlobalState As GlobalState)
|
||||
MyBase.New(pLogConfig, pMSSQLServer, pGlobalState)
|
||||
End Sub
|
||||
|
||||
Public Function Run(pData As GetFileObjectRequest) As GetFileObjectResponse
|
||||
Try
|
||||
If Helpers.TestObjectIdExists(pData.ObjectId) = False Then
|
||||
LogAndThrow("ObjectId does not exist!")
|
||||
End If
|
||||
|
||||
|
||||
Dim oSQL = $"SELECT * FROM VWIDB_FILE_OBJECT WHERE IDB_OBJ_ID = {pData.ObjectId}"
|
||||
Dim oTable = Database.GetDatatable(oSQL)
|
||||
|
||||
If oTable Is Nothing OrElse oTable.Rows.Count = 0 Then
|
||||
LogAndThrow("Error while getting FileObject data!")
|
||||
End If
|
||||
|
||||
Dim oRow As DataRow = oTable.First()
|
||||
Dim oFileObject As New FileObject With {
|
||||
.ObjectId = pData.ObjectId,
|
||||
.FileHash = oRow.ItemEx("FILE_HASH", ""),
|
||||
.FileSize = oRow.ItemEx(Of Long)("FILE_SIZE", 0)
|
||||
}
|
||||
|
||||
Return New GetFileObjectResponse(oFileObject)
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return New GetFileObjectResponse(ex)
|
||||
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@ -0,0 +1,12 @@
|
||||
Imports System.Runtime.Serialization
|
||||
|
||||
Namespace Methods.GetFileObject
|
||||
<Serializable>
|
||||
<DataContract>
|
||||
Public Class GetFileObjectRequest
|
||||
<DataMember>
|
||||
Public Property ObjectId As Long
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
Imports System.Runtime.Serialization
|
||||
|
||||
Namespace Methods.GetFileObject
|
||||
<Serializable>
|
||||
<DataContract>
|
||||
Public Class GetFileObjectResponse
|
||||
Inherits Messages.BaseResponse
|
||||
|
||||
<DataMember>
|
||||
Public Property FileObject As FileObject
|
||||
|
||||
Public Sub New(pFileObject As FileObject)
|
||||
MyBase.New()
|
||||
FileObject = pFileObject
|
||||
End Sub
|
||||
|
||||
Public Sub New(pException As Exception, Optional pDetails As String = "")
|
||||
MyBase.New(pException, pDetails)
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
Loading…
x
Reference in New Issue
Block a user