MS FlowSearch EDMIService ObjectAdd

This commit is contained in:
2021-03-11 09:37:24 +01:00
parent 9346eb9534
commit c681bfb674
18 changed files with 484 additions and 55 deletions

View File

@@ -551,6 +551,49 @@ Public Class EDMIService
Return ""
End Try
End Function
Public Function NewIDB_Object(pKindType As String, pWho As String, pBusinessEntity As String) As String Implements IEDMIService.New_IDB_OBJECT
Try
Dim oSQL As String = $"DECLARE @NEW_IDB_OBJ_ID BIGINT
EXEC PRIDB_NEW_OBJECT '{pKindType}','{pWho}','{pBusinessEntity}',0, @IDB_OBJ_ID = @NEW_IDB_OBJ_ID OUTPUT;
SELECT @NEW_IDB_OBJ_ID"
Dim oObjectId = MSSQL_IDB.GetScalarValue(oSQL)
Return oObjectId
Catch ex As Exception
_Logger.Error(ex)
Return 0
End Try
End Function
Public Function ImportFileIDBFO(Data As DocumentImportIDBFORequest) As DocumentImportIDBFOResponse Implements IEDMIService.ImportNewIDBFO
Dim oObjectStore = GlobalState.ObjectStores.First()
Dim EDMIPath = New EDMI.File.Path(LogConfig, oObjectStore.Path)
Try
_Logger.Info("ImportFile: Saving file to path [{0}]", Data.pIDBFilePath)
Using oStream = New FileStream(Data.pIDBFilePath, FileMode.CreateNew)
oStream.Write(Data.Contents, 0, Data.Contents.Length)
oStream.Flush(True)
oStream.Close()
End Using
' insert into db
Dim oSQL As String = $"EXEC PRIDB_NEW_IDBFO '{Data.pIDBFilePath},'{Data.pWho}','{Data.pIDB_OBJ_ID}',{Data.pObjectStoreID}"
Dim oResult As Boolean = MSSQL_IDB.ExecuteNonQuery(oSQL)
Return New DocumentImportIDBFOResponse() With {.Result = oResult}
Catch ex As FaultException
_Logger.Error(ex)
Throw ex
Catch ex As Exception
_Logger.Error(ex)
Dim oDetails As New UnexpectedErrorFault(ex)
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
End Try
End Function
Private Function GetDigitalDataFileObject(IDB_OBJ_ID As Long) As String
Return $"{IDB_OBJ_ID}.ddfo"
End Function