EDMI: WIP for Client
This commit is contained in:
parent
8e8374fc88
commit
c9dafd4bde
@ -144,11 +144,11 @@ Public Class ClassIDBData
|
|||||||
oOldAttributeResult = GetVariableValue(pAttributeName, oIDBTyp)
|
oOldAttributeResult = GetVariableValue(pAttributeName, oIDBTyp)
|
||||||
oTypeOldResult = oOldAttributeResult.GetType.ToString
|
oTypeOldResult = oOldAttributeResult.GetType.ToString
|
||||||
If oTypeOldResult = "System.Data.DataTable" Then
|
If oTypeOldResult = "System.Data.DataTable" Then
|
||||||
Dim myOldValues As DataTable = oOldAttributeResult
|
Dim oOldValues As DataTable = oOldAttributeResult
|
||||||
If myOldValues.Rows.Count > 1 Then
|
If oOldValues.Rows.Count > 1 Then
|
||||||
|
|
||||||
'now Checking whether the old row still remains in Vector? If not it will be deleted as it cannot be replaced in multivalues
|
'now Checking whether the old row still remains in Vector? If not it will be deleted as it cannot be replaced in multivalues
|
||||||
For Each oOldValueRow As DataRow In myOldValues.Rows
|
For Each oOldValueRow As DataRow In oOldValues.Rows
|
||||||
Dim oExists As Boolean = False
|
Dim oExists As Boolean = False
|
||||||
For Each oNewValueRow As DataRow In oDTMyNewValues.Rows
|
For Each oNewValueRow As DataRow In oDTMyNewValues.Rows
|
||||||
Dim oInfo1 = $"Checking oldValue[{oOldValueRow.Item(0)}] vs NewValue [{oNewValueRow.Item(1)}]"
|
Dim oInfo1 = $"Checking oldValue[{oOldValueRow.Item(0)}] vs NewValue [{oNewValueRow.Item(1)}]"
|
||||||
|
|||||||
@ -45,12 +45,12 @@ Public Class ClassInit
|
|||||||
|
|
||||||
' === Init Schritte definieren
|
' === Init Schritte definieren
|
||||||
_Loader.AddStep("Initializing Database (1/2)", AddressOf InitializeDatabase, True)
|
_Loader.AddStep("Initializing Database (1/2)", AddressOf InitializeDatabase, True)
|
||||||
_Loader.AddStep("Initializing Service", AddressOf InitializeService, True)
|
_Loader.AddStep("Initializing EDMI Service", AddressOf InitializeService, True)
|
||||||
_Loader.AddStep("Initializing Database (2/2)", AddressOf InitializeDatabaseWithFallback, True)
|
_Loader.AddStep("Initializing Database (2/2)", AddressOf InitializeDatabaseWithFallback, True)
|
||||||
_Loader.AddStep("Initializing User..", AddressOf InitializeUser, True)
|
_Loader.AddStep("Initializing User", AddressOf InitializeUser, True)
|
||||||
_Loader.AddStep("Initializing Language..", AddressOf InitializeLanguage, False)
|
_Loader.AddStep("Initializing Language", AddressOf InitializeLanguage, False)
|
||||||
_Loader.AddStep("Loading 3rd-party licenses..", AddressOf Initialize3rdParty, False)
|
_Loader.AddStep("Initializing 3rd-party licenses", AddressOf Initialize3rdParty, False)
|
||||||
_Loader.AddStep("Loading Basic Configs..", AddressOf InitBasicData, False)
|
_Loader.AddStep("Initializing Basic Config", AddressOf InitBasicData, False)
|
||||||
' === Init Schritte definieren
|
' === Init Schritte definieren
|
||||||
|
|
||||||
AddHandler _Loader.ProgressChanged, AddressOf ProgressChanged
|
AddHandler _Loader.ProgressChanged, AddressOf ProgressChanged
|
||||||
@ -156,8 +156,7 @@ Public Class ClassInit
|
|||||||
Private Sub Initialize3rdParty(MyApplication As My.MyApplication)
|
Private Sub Initialize3rdParty(MyApplication As My.MyApplication)
|
||||||
Try
|
Try
|
||||||
Dim oSql = "Select LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE'"
|
Dim oSql = "Select LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE'"
|
||||||
Dim oDatatable As DataTable = _DataASorDB.GetDatatable("DD_ECM", oSql, "TBDD_3RD_PARTY_MODULES", "", "")
|
Dim oDatatable As DataTable = My.DatabaseECM.GetDatatable(oSql)
|
||||||
|
|
||||||
|
|
||||||
If oDatatable.Rows.Count = 0 Then
|
If oDatatable.Rows.Count = 0 Then
|
||||||
Throw New InitException("Konfiguration konnte nicht geladen werden!")
|
Throw New InitException("Konfiguration konnte nicht geladen werden!")
|
||||||
|
|||||||
@ -1,15 +1,16 @@
|
|||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.EDMI.API
|
||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
Namespace ClipboardWatcher
|
Namespace ClipboardWatcher
|
||||||
Public Class ClassProfileLoader
|
Public Class ClassProfileLoader
|
||||||
Private ReadOnly LogConfig As LogConfig
|
Private ReadOnly LogConfig As LogConfig
|
||||||
Private ReadOnly Logger As Logger
|
Private ReadOnly Logger As Logger
|
||||||
Private Database As ClassDataASorDB
|
Private ReadOnly Database As DatabaseWithFallback
|
||||||
|
|
||||||
Public Sub New(LogConfig As LogConfig, AppServerOrDB As ClassDataASorDB)
|
Public Sub New(LogConfig As LogConfig, Database As DatabaseWithFallback)
|
||||||
Me.LogConfig = LogConfig
|
Me.LogConfig = LogConfig
|
||||||
Me.Logger = LogConfig.GetLogger()
|
Me.Logger = LogConfig.GetLogger()
|
||||||
Me.Database = AppServerOrDB
|
Me.Database = Database
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Function LoadProfiles() As Boolean
|
Public Function LoadProfiles() As Boolean
|
||||||
@ -22,10 +23,10 @@ Namespace ClipboardWatcher
|
|||||||
Dim oWindowSQL As String = $"SELECT DISTINCT T.* FROM VWCW_PROFILE_REL_WINDOW T, VWCW_USER_PROFILE T1 WHERE T.PROFILE_ID = T1.GUID AND ({oWhereClause})"
|
Dim oWindowSQL As String = $"SELECT DISTINCT T.* FROM VWCW_PROFILE_REL_WINDOW T, VWCW_USER_PROFILE T1 WHERE T.PROFILE_ID = T1.GUID AND ({oWhereClause})"
|
||||||
Dim oControlSQL As String = $"SELECT DISTINCT T.* FROM VWCW_PROFILE_REL_CONTROL T, VWCW_USER_PROFILE T1 WHERE T.PROFILE_ID = T1.GUID AND ({oWhereClause})"
|
Dim oControlSQL As String = $"SELECT DISTINCT T.* FROM VWCW_PROFILE_REL_CONTROL T, VWCW_USER_PROFILE T1 WHERE T.PROFILE_ID = T1.GUID AND ({oWhereClause})"
|
||||||
|
|
||||||
Dim oUserProfiles = Database.GetDatatable("DD_ECM", oProfileSQL, "VWCW_USER_PROFILE", "", "", "DB")
|
Dim oUserProfiles = Database.GetDatatable("VWCW_USER_PROFILE", oProfileSQL, Constants.DatabaseType.ECM)
|
||||||
Dim oProfileProcesses = Database.GetDatatable("DD_ECM", oProcessSQL, "TBCW_PROFILE_PROCESS", "", "", "DB")
|
Dim oProfileProcesses = Database.GetDatatable("VWCW_PROFILE_REL_WINDOW", oProcessSQL, Constants.DatabaseType.ECM)
|
||||||
Dim oProfileWindows = Database.GetDatatable("DD_ECM", oWindowSQL, "VWCW_PROFILE_REL_WINDOW", "", "", "DB")
|
Dim oProfileWindows = Database.GetDatatable("VWCW_PROFILE_REL_WINDOW", oWindowSQL, Constants.DatabaseType.ECM)
|
||||||
Dim oProfileControls = Database.GetDatatable("DD_ECM", oControlSQL, "VWCW_PROFILE_REL_CONTROL", "", "", "DB")
|
Dim oProfileControls = Database.GetDatatable("VWCW_PROFILE_REL_CONTROL", oControlSQL, Constants.DatabaseType.ECM)
|
||||||
|
|
||||||
My.Application.ClipboardWatcher.UserProfiles = oUserProfiles
|
My.Application.ClipboardWatcher.UserProfiles = oUserProfiles
|
||||||
My.Application.ClipboardWatcher.ProfileProcesses = oProfileProcesses
|
My.Application.ClipboardWatcher.ProfileProcesses = oProfileProcesses
|
||||||
|
|||||||
@ -247,7 +247,7 @@ Public Class frmFlowForm
|
|||||||
|
|
||||||
AddHandler HotkeyClass.HotKeyPressed, AddressOf HotkeyClass_HotKeyPressed
|
AddHandler HotkeyClass.HotKeyPressed, AddressOf HotkeyClass_HotKeyPressed
|
||||||
|
|
||||||
ProfileLoader = New ClassProfileLoader(My.LogConfig, AppServerOrDB)
|
ProfileLoader = New ClassProfileLoader(My.LogConfig, My.Database)
|
||||||
ProfileLoader.LoadProfiles()
|
ProfileLoader.LoadProfiles()
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
ShowErrorMessage(ex)
|
ShowErrorMessage(ex)
|
||||||
|
|||||||
@ -101,7 +101,7 @@ Public Class frmtest
|
|||||||
DateTimePicker1.Value,
|
DateTimePicker1.Value,
|
||||||
cmbObjectStoreType.Text,
|
cmbObjectStoreType.Text,
|
||||||
"DEFAULT",
|
"DEFAULT",
|
||||||
New Client.ImportFileOptions With {
|
New Client.NewFileOptions With {
|
||||||
.KeepExtension = True
|
.KeepExtension = True
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
Imports DigitalData.Modules.Logging
|
Imports System.IO
|
||||||
|
Imports System.ServiceModel
|
||||||
|
Imports DigitalData.Modules.EDMI.API.Constants
|
||||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||||
Imports DigitalData.Modules.EDMI.API.Rights
|
Imports DigitalData.Modules.EDMI.API.Rights
|
||||||
Imports System.ServiceModel
|
Imports DigitalData.Modules.Language.Utils
|
||||||
Imports System.IO
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
Public Class Client
|
Public Class Client
|
||||||
Private Const INVALID_OBEJCT_ID As Long = 0
|
Private Const INVALID_OBEJCT_ID As Long = 0
|
||||||
@ -105,12 +107,7 @@ Public Class Client
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
''' <summary>
|
|
||||||
''' Import options for NewFileAsync. Contains default values for all options
|
|
||||||
''' </summary>
|
|
||||||
Public Class ImportFileOptions
|
|
||||||
Public KeepExtension As Boolean = True
|
|
||||||
End Class
|
|
||||||
|
|
||||||
''' <summary>
|
''' <summary>
|
||||||
''' TODO: Creates a new object
|
''' TODO: Creates a new object
|
||||||
@ -120,6 +117,15 @@ Public Class Client
|
|||||||
Throw New NotImplementedException()
|
Throw New NotImplementedException()
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Import options for NewFileAsync. Contains default values for all options
|
||||||
|
''' </summary>
|
||||||
|
Public Class NewFileOptions
|
||||||
|
Public KeepExtension As Boolean = True
|
||||||
|
Public Username As String = String.Empty
|
||||||
|
Public Language As String = String.Empty
|
||||||
|
End Class
|
||||||
|
|
||||||
''' <summary>
|
''' <summary>
|
||||||
''' Imports a file from a filepath, creating a IDB ObjectId and Filesystem Object
|
''' Imports a file from a filepath, creating a IDB ObjectId and Filesystem Object
|
||||||
''' </summary>
|
''' </summary>
|
||||||
@ -132,8 +138,12 @@ Public Class Client
|
|||||||
''' <exception cref="FileNotFoundException">When local filepath was not found</exception>
|
''' <exception cref="FileNotFoundException">When local filepath was not found</exception>
|
||||||
''' <exception cref="ApplicationException">When there was a error in the Service</exception>
|
''' <exception cref="ApplicationException">When there was a error in the Service</exception>
|
||||||
''' <returns>The ObjectId of the newly generated filesystem object</returns>
|
''' <returns>The ObjectId of the newly generated filesystem object</returns>
|
||||||
Public Async Function NewFileAsync(pFilePath As String, pAddedWho As String, pAddedWhen As Date, pObjectStoreType As String, pBusinessEntity As String, pImportOptions As ImportFileOptions) As Task(Of Long)
|
Public Async Function NewFileAsync(pFilePath As String, pAddedWho As String, pAddedWhen As Date, pObjectStoreType As String, pBusinessEntity As String, Optional pImportOptions As NewFileOptions = Nothing) As Task(Of Long)
|
||||||
Try
|
Try
|
||||||
|
If pImportOptions Is Nothing Then
|
||||||
|
pImportOptions = New NewFileOptions()
|
||||||
|
End If
|
||||||
|
|
||||||
If File.Exists(pFilePath) = False Then
|
If File.Exists(pFilePath) = False Then
|
||||||
Throw New FileNotFoundException("ImportFileAsync: Path does not exist")
|
Throw New FileNotFoundException("ImportFileAsync: Path does not exist")
|
||||||
End If
|
End If
|
||||||
@ -189,90 +199,288 @@ Public Class Client
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function CreateObjectId(pKindType As String, pWho As String, pBusinessEntity As String) As Long
|
Public Class SetVariableValueOptions
|
||||||
Try
|
Public CheckDeleted As Boolean = False
|
||||||
Dim oResponse = _channel.NewObjectId(New NewObjectIdRequest With {
|
Public Username As String = String.Empty
|
||||||
.KindType = pKindType,
|
Public Language As String = String.Empty
|
||||||
.BusinessEntity = pBusinessEntity,
|
End Class
|
||||||
.Who = pWho
|
|
||||||
})
|
|
||||||
Return oResponse.ObjectId
|
|
||||||
Catch ex As Exception
|
|
||||||
_logger.Error(ex)
|
|
||||||
Throw ex
|
|
||||||
End Try
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Function CreateFileStoreObject(pObjectId As Long, pStoreType As String, pDate As String, pExtension As String, pKeepExtension As String) As String
|
''' <summary>
|
||||||
|
''' Sets a value to an attribute
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="pAttributeName"></param>
|
||||||
|
''' <param name="pAttributeType"></param>
|
||||||
|
''' <param name="pValue"></param>
|
||||||
|
''' <param name="pOptions"></param>
|
||||||
|
''' <returns></returns>
|
||||||
|
Public Function SetVariableValue(pObjectId As Long, pAttributeName As String, pAttributeType As AttributeType, pValue As Object, Optional pOptions As SetVariableValueOptions = Nothing) As Boolean
|
||||||
Try
|
Try
|
||||||
' Remove dot in Extension
|
If pOptions Is Nothing Then
|
||||||
If pExtension.StartsWith(".") Then
|
pOptions = New SetVariableValueOptions()
|
||||||
pExtension = pExtension.Substring(1)
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim oArgs As New NewFileObjectRequest With {
|
Dim oLanguage = NotNull(pOptions.Language, GetUserLanguage())
|
||||||
.ObjectId = pObjectId,
|
Dim oUsername = NotNull(pOptions.Username, Environment.UserName)
|
||||||
.StoreType = pStoreType,
|
|
||||||
.DateImported = pDate,
|
|
||||||
.Extension = pExtension,
|
|
||||||
.KeepExtension = pKeepExtension
|
|
||||||
}
|
|
||||||
Dim oResponse = _channel.NewFileObject(oArgs)
|
|
||||||
Return oResponse.FileObjectPath
|
|
||||||
Catch ex As Exception
|
|
||||||
_logger.Error(ex)
|
|
||||||
Throw ex
|
|
||||||
End Try
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Async Function ImportFileObjectAsync(pContent As Byte(), pWho As String, pObjectId As Long, pObjectStoreType As String, pFileObjectPath As String) As Task(Of Boolean)
|
Dim oType = pValue.GetType.Name
|
||||||
Try
|
|
||||||
Dim oData As New ImportFileIntoFileObjectRequest() With {
|
If oType = GetType(DataTable).Name Then
|
||||||
.Contents = pContent,
|
Dim oDTMyNewValues As DataTable = pValue
|
||||||
.Who = pWho,
|
Dim oOldAttributeResult As Object
|
||||||
.FilePath = pFileObjectPath,
|
Dim oTypeOldResult As Object
|
||||||
.ObjectId = pObjectId,
|
|
||||||
.ObjectStoreType = pObjectStoreType
|
If pOptions.CheckDeleted = True Then
|
||||||
}
|
oOldAttributeResult = GetVariableValue(pAttributeName, pAttributeType)
|
||||||
|
oTypeOldResult = oOldAttributeResult.GetType.Name
|
||||||
|
If oTypeOldResult = GetType(DataTable).Name Then
|
||||||
|
Dim oOldValues As DataTable = oOldAttributeResult
|
||||||
|
If oOldValues.Rows.Count > 1 Then
|
||||||
|
|
||||||
|
'now Checking whether the old row still remains in Vector? If not it will be deleted as it cannot be replaced in multivalues
|
||||||
|
For Each oOldValueRow As DataRow In oOldValues.Rows
|
||||||
|
Dim oExists As Boolean = False
|
||||||
|
For Each oNewValueRow As DataRow In oDTMyNewValues.Rows
|
||||||
|
Dim oInfo = $"Checking oldValue[{oOldValueRow.Item(0)}] vs NewValue [{oNewValueRow.Item(1)}]"
|
||||||
|
If oNewValueRow.Item(1).ToString.ToUpper = oOldValueRow.Item(0).ToString.ToUpper Then
|
||||||
|
oExists = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
If oExists = False Then
|
||||||
|
Dim oInfo = $"Value [{oOldValueRow.Item(0)}] no longer existing in Vector-Attribute [{pAttributeName}] - will be deleted!"
|
||||||
|
_logger.Debug(oInfo)
|
||||||
|
SetVariableValue(pObjectId, My.Application.Globix.CURRENT_PROFILE_LOG_INDEX, AttributeType.Varchar, oInfo)
|
||||||
|
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oOldValueRow.Item(0))
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
If oDTMyNewValues.Rows.Count > 1 Then
|
||||||
|
Dim oExists As Boolean = False
|
||||||
|
For Each oNewValueRow As DataRow In oDTMyNewValues.Rows
|
||||||
|
Dim oInfo1 = $"Checking oldValue[{oOldAttributeResult}] vs NewValue [{oNewValueRow.Item(1)}]"
|
||||||
|
If oNewValueRow.Item(1).ToString.ToUpper = oOldAttributeResult.ToString.ToUpper Then
|
||||||
|
oExists = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
If oExists = False Then
|
||||||
|
Dim oInfo = $"Value [{oOldAttributeResult}] no longer existing in Vector-Attribute [{pAttributeName}] - will be deleted!"
|
||||||
|
_logger.Debug(oInfo)
|
||||||
|
SetVariableValue(pObjectId, My.Application.Globix.CURRENT_PROFILE_LOG_INDEX, AttributeType.Varchar, oInfo)
|
||||||
|
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oOldAttributeResult)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Dim oInfo = $"Value [{oOldAttributeResult}] of Attribute [{pAttributeName}] obviously was updated during runtime - will be deleted!"
|
||||||
|
_logger.Debug(oInfo)
|
||||||
|
SetVariableValue(pObjectId, My.Application.Globix.CURRENT_PROFILE_LOG_INDEX, AttributeType.Varchar, oInfo)
|
||||||
|
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oOldAttributeResult)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
For Each oNewValueRow As DataRow In oDTMyNewValues.Rows
|
||||||
|
Dim oSuccess As Boolean = False
|
||||||
|
Dim oSQL = $"DECLARE @NEW_OBJ_MD_ID BIGINT
|
||||||
|
EXEC PRIDB_NEW_OBJ_DATA({pObjectId}, '{pAttributeName}', '{oUsername}', '{oNewValueRow.Item(1)}', '{oLanguage}', 0, @OMD_ID = @NEW_OBJ_MD_ID OUTPUT)"
|
||||||
|
|
||||||
|
Dim oResult = _channel.ExecuteNonQuery_MSSQL_IDB(oSQL)
|
||||||
|
|
||||||
|
If Not oResult.OK Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return True
|
||||||
|
Else
|
||||||
|
Dim oSql = $"DECLARE @NEW_OBJ_MD_ID BIGINT
|
||||||
|
EXEC PRIDB_NEW_OBJ_DATA({pObjectId}, '{pAttributeName}', '{oUsername}', '{pValue}', '{oLanguage}', 0, @OMD_ID = @NEW_OBJ_MD_ID OUTPUT)"
|
||||||
|
|
||||||
|
Dim oResult = _channel.ExecuteNonQuery_MSSQL_IDB(oSql)
|
||||||
|
|
||||||
|
Return oResult.OK
|
||||||
|
End If
|
||||||
|
|
||||||
Dim oResponse = Await _channel.ImportFileIntoFileObjectAsync(oData)
|
|
||||||
Return oResponse.Result
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Error(ex)
|
_logger.Error(ex)
|
||||||
Return False
|
Return False
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Async Function GetFileByObjectIdAsync(ObjectId As Long) As Task(Of StreamedFile)
|
Public Class GetVariableValueOptions
|
||||||
Try
|
Public FromIDB As Boolean = False
|
||||||
Dim oData As New DocumentStreamRequest() With {.ObjectId = ObjectId}
|
Public Username As String = String.Empty
|
||||||
Dim oResponse As DocumentStreamResponse = Await _channel.GetFileByObjectIdAsync(oData)
|
Public Language As String = String.Empty
|
||||||
Dim oMemoryStream As New MemoryStream()
|
End Class
|
||||||
oResponse.FileContents.CopyTo(oMemoryStream)
|
|
||||||
oMemoryStream.Position = 0
|
|
||||||
|
|
||||||
Return New StreamedFile() With {
|
Public Function GetVariableValue(pObjectId As Long, pAttributeName As String, pAttributeType As AttributeType, Optional pOptions As GetVariableValueOptions = Nothing) As Object
|
||||||
.Stream = oMemoryStream,
|
If pOptions Is Nothing Then
|
||||||
.FileName = oResponse.FileName
|
pOptions = New GetVariableValueOptions()
|
||||||
}
|
End If
|
||||||
|
|
||||||
|
Dim oLanguage = NotNull(pOptions.Language, GetUserLanguage())
|
||||||
|
Dim oUsername = NotNull(pOptions.Username, Environment.UserName)
|
||||||
|
|
||||||
|
Try
|
||||||
|
Dim oSingleAttribute As Boolean
|
||||||
|
Select Case pAttributeType
|
||||||
|
Case AttributeType.VectorInteger
|
||||||
|
oSingleAttribute = False
|
||||||
|
Case AttributeType.VectorString
|
||||||
|
oSingleAttribute = False
|
||||||
|
Case Else
|
||||||
|
oSingleAttribute = True
|
||||||
|
End Select
|
||||||
|
|
||||||
|
Dim oAttributeValue As Object = Nothing
|
||||||
|
|
||||||
|
If Not IsNothing(My.Tables.DTIDB_DOC_DATA) Then
|
||||||
|
If oSingleAttribute = True And My.Tables.DTIDB_DOC_DATA.Rows.Count = 1 And pOptions.FromIDB = False Then
|
||||||
|
Try
|
||||||
|
If pAttributeName = "IDBCreatedWhen" Then
|
||||||
|
pAttributeName = "ADDED_WHEN"
|
||||||
|
ElseIf pAttributeName = "IDBCreatedWho" Then
|
||||||
|
pAttributeName = "ADDED_WHO"
|
||||||
|
ElseIf pAttributeName = "IDBChangedWhen" Then
|
||||||
|
pAttributeName = "CHANGED_WHEN"
|
||||||
|
ElseIf pAttributeName = "IDBChangedWho" Then
|
||||||
|
pAttributeName = "CHANGED_WHO"
|
||||||
|
End If
|
||||||
|
|
||||||
|
oAttributeValue = My.Tables.DTIDB_DOC_DATA.Rows(0).Item(pAttributeName)
|
||||||
|
Catch ex As Exception
|
||||||
|
_logger.Debug($"Error getting Attribute from IDB_DT_DOC_DATA: {ex.Message}")
|
||||||
|
End Try
|
||||||
|
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not IsNothing(oAttributeValue) Then
|
||||||
|
Return oAttributeValue
|
||||||
|
Else
|
||||||
|
_logger.Debug($"oAttributeValue for Attribute [{pAttributeName}] is so far nothing..Now trying FNIDB_PM_GET_VARIABLE_VALUE ")
|
||||||
|
End If
|
||||||
|
Dim oFNSQL = $"SELECT * FROM [dbo].[FNIDB_PM_GET_VARIABLE_VALUE] ({pObjectId},'{pAttributeName}','{oLanguage}',CONVERT(BIT,'0'))"
|
||||||
|
Dim oDatatable As TableResult = _channel.ReturnDatatable_MSSQL_IDB(oFNSQL)
|
||||||
|
|
||||||
|
If oDatatable.OK = False Then
|
||||||
|
_logger.Warn(oDatatable.ErrorMessage)
|
||||||
|
Return Nothing
|
||||||
|
End If
|
||||||
|
|
||||||
|
If oDatatable.Table.Rows.Count = 1 Then
|
||||||
|
oAttributeValue = oDatatable.Table.Rows.Item(0).Item(0)
|
||||||
|
End If
|
||||||
|
Return oAttributeValue
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Error(ex)
|
_logger.Error(ex)
|
||||||
Throw ex
|
Return Nothing
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Async Function ListFilesForUserAsync() As Task(Of FileList)
|
Private Function DeleteTermObjectFromMetadata(pObjectId As Long, pAttributeName As String, pTerm2Delete As String, Optional pUsername As String = "", Optional pLanguage As String = "") As Boolean
|
||||||
Try
|
Try
|
||||||
Dim oResponse As DocumentListResponse = Await _channel.ListFilesForUserAsync(New ListFilesForUserRequest())
|
Dim oLanguage = NotNull(pLanguage, GetUserLanguage())
|
||||||
Return New FileList() With {
|
Dim oUsername = NotNull(pUsername, Environment.UserName)
|
||||||
.Datatable = oResponse.Datatable
|
|
||||||
}
|
Dim oIdIsForeign As Integer = 1
|
||||||
|
Dim oDELSQL = $"EXEC PRIDB_DELETE_TERM_OBJECT_METADATA {pObjectId},'{pAttributeName}','{pTerm2Delete}','{oUsername}','{oLanguage}',{oIdIsForeign}"
|
||||||
|
Dim oResult = _channel.ExecuteNonQuery_MSSQL_IDB(oDELSQL)
|
||||||
|
|
||||||
|
Return oResult.OK
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Error(ex)
|
_logger.Error(ex)
|
||||||
Throw ex
|
Return False
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
'Public Function CreateObjectId(pKindType As String, pWho As String, pBusinessEntity As String) As Long
|
||||||
|
' Try
|
||||||
|
' Dim oResponse = _channel.NewObjectId(New NewObjectIdRequest With {
|
||||||
|
' .KindType = pKindType,
|
||||||
|
' .BusinessEntity = pBusinessEntity,
|
||||||
|
' .Who = pWho
|
||||||
|
' })
|
||||||
|
' Return oResponse.ObjectId
|
||||||
|
' Catch ex As Exception
|
||||||
|
' _logger.Error(ex)
|
||||||
|
' Throw ex
|
||||||
|
' End Try
|
||||||
|
'End Function
|
||||||
|
|
||||||
|
'Public Function CreateFileStoreObject(pObjectId As Long, pStoreType As String, pDate As String, pExtension As String, pKeepExtension As String) As String
|
||||||
|
' Try
|
||||||
|
' ' Remove dot in Extension
|
||||||
|
' If pExtension.StartsWith(".") Then
|
||||||
|
' pExtension = pExtension.Substring(1)
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' Dim oArgs As New NewFileObjectRequest With {
|
||||||
|
' .ObjectId = pObjectId,
|
||||||
|
' .StoreType = pStoreType,
|
||||||
|
' .DateImported = pDate,
|
||||||
|
' .Extension = pExtension,
|
||||||
|
' .KeepExtension = pKeepExtension
|
||||||
|
' }
|
||||||
|
' Dim oResponse = _channel.NewFileObject(oArgs)
|
||||||
|
' Return oResponse.FileObjectPath
|
||||||
|
' Catch ex As Exception
|
||||||
|
' _logger.Error(ex)
|
||||||
|
' Throw ex
|
||||||
|
' End Try
|
||||||
|
'End Function
|
||||||
|
|
||||||
|
'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,
|
||||||
|
' .Who = pWho,
|
||||||
|
' .FilePath = pFileObjectPath,
|
||||||
|
' .ObjectId = pObjectId,
|
||||||
|
' .ObjectStoreType = pObjectStoreType
|
||||||
|
' }
|
||||||
|
|
||||||
|
' Dim oResponse = Await _channel.ImportFileIntoFileObjectAsync(oData)
|
||||||
|
' Return oResponse.Result
|
||||||
|
' Catch ex As Exception
|
||||||
|
' _logger.Error(ex)
|
||||||
|
' Return False
|
||||||
|
' End Try
|
||||||
|
'End Function
|
||||||
|
|
||||||
|
'Public Async Function GetFileByObjectIdAsync(ObjectId As Long) As Task(Of StreamedFile)
|
||||||
|
' Try
|
||||||
|
' Dim oData As New DocumentStreamRequest() With {.ObjectId = ObjectId}
|
||||||
|
' Dim oResponse As DocumentStreamResponse = Await _channel.GetFileByObjectIdAsync(oData)
|
||||||
|
' Dim oMemoryStream As New MemoryStream()
|
||||||
|
' oResponse.FileContents.CopyTo(oMemoryStream)
|
||||||
|
' oMemoryStream.Position = 0
|
||||||
|
|
||||||
|
' Return New StreamedFile() With {
|
||||||
|
' .Stream = oMemoryStream,
|
||||||
|
' .FileName = oResponse.FileName
|
||||||
|
' }
|
||||||
|
' Catch ex As Exception
|
||||||
|
' _logger.Error(ex)
|
||||||
|
' Throw ex
|
||||||
|
' End Try
|
||||||
|
'End Function
|
||||||
|
|
||||||
|
'Public Async Function ListFilesForUserAsync() As Task(Of FileList)
|
||||||
|
' Try
|
||||||
|
' Dim oResponse As DocumentListResponse = Await _channel.ListFilesForUserAsync(New ListFilesForUserRequest())
|
||||||
|
' Return New FileList() With {
|
||||||
|
' .Datatable = oResponse.Datatable
|
||||||
|
' }
|
||||||
|
' Catch ex As Exception
|
||||||
|
' _logger.Error(ex)
|
||||||
|
' Throw ex
|
||||||
|
' End Try
|
||||||
|
'End Function
|
||||||
|
|
||||||
Public Function GetDatatableFromIDB(SQL As String) As TableResult
|
Public Function GetDatatableFromIDB(SQL As String) As TableResult
|
||||||
Try
|
Try
|
||||||
Dim oResponse = _channel.ReturnDatatable_MSSQL_IDB(SQL)
|
Dim oResponse = _channel.ReturnDatatable_MSSQL_IDB(SQL)
|
||||||
@ -324,23 +532,20 @@ Public Class Client
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Async Function GetDatatableByNameAsync(DatatableName As String, Optional FilterExpression As String = "", Optional SortByColumn As String = "") As Task(Of TableResult)
|
|
||||||
Try
|
|
||||||
Dim oResponse = Await _channel.ReturnDatatableFromCacheAsync(DatatableName, FilterExpression, SortByColumn)
|
|
||||||
Return oResponse
|
|
||||||
Catch ex As Exception
|
|
||||||
_logger.Error(ex)
|
|
||||||
Throw ex
|
|
||||||
End Try
|
|
||||||
End Function
|
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Return infos about a file object
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="UserId"></param>
|
||||||
|
''' <param name="ObjectId"></param>
|
||||||
|
''' <returns></returns>
|
||||||
Public Function GetDocumentInfo(UserId As Long, ObjectId As Long) As DocumentInfo
|
Public Function GetDocumentInfo(UserId As Long, ObjectId As Long) As DocumentInfo
|
||||||
Try
|
Try
|
||||||
Dim oParams = New DocumentInfoRequest With {
|
Dim oResponse As DocumentInfoResponse = _channel.GetFileInfoByObjectId(New DocumentInfoRequest With {
|
||||||
.ObjectId = ObjectId,
|
.ObjectId = ObjectId,
|
||||||
.UserId = UserId
|
.UserId = UserId
|
||||||
}
|
})
|
||||||
Dim oResponse As DocumentInfoResponse = _channel.GetFileInfoByObjectId(oParams)
|
|
||||||
|
|
||||||
Return New DocumentInfo With {
|
Return New DocumentInfo With {
|
||||||
.AccessRight = oResponse.FileRight,
|
.AccessRight = oResponse.FileRight,
|
||||||
@ -413,5 +618,8 @@ Public Class Client
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Function GetUserLanguage() As String
|
||||||
|
Return Threading.Thread.CurrentThread.CurrentUICulture.Name
|
||||||
|
End Function
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@ -3,4 +3,16 @@
|
|||||||
ECM
|
ECM
|
||||||
IDB
|
IDB
|
||||||
End Enum
|
End Enum
|
||||||
|
|
||||||
|
Public Enum AttributeType
|
||||||
|
Varchar = 1
|
||||||
|
BigInteger = 2
|
||||||
|
Float = 3
|
||||||
|
[Decimal] = 4
|
||||||
|
[Date] = 5
|
||||||
|
[DateTime] = 6
|
||||||
|
Bit = 7
|
||||||
|
VectorString = 8
|
||||||
|
VectorInteger = 9
|
||||||
|
End Enum
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user