This commit is contained in:
SchreiberM 2021-09-13 16:42:26 +02:00
commit aa86bce5d0
10 changed files with 104 additions and 31 deletions

View File

@ -241,7 +241,7 @@ Public Class frmDocumentResultList
Private Function LoadFile_IDB(GridRow As DataRow) As DocumentResultInfo
Try
Dim oObjectId = GridRow.Item(COLUMN_DOCID)
_Logger.Debug($"Getting Information for oObjectId: {oObjectId}")
_Logger.Debug("Loading Information for ObjectId: [{0}]", oObjectId)
' This needs to be Sync bc otherwise the PopupMenuShowing event will fire before this method loaded the Document Info
Dim oDocumentInfo As DocumentInfo = _IDBClient.GetDocumentInfo(_Environment.User.UserId, oObjectId)
@ -249,34 +249,47 @@ Public Class frmDocumentResultList
.AccessRight = oDocumentInfo.AccessRight,
.FullPath = oDocumentInfo.FullPath
}
_Logger.Debug("Successfully loaded Information for ObjectId: [{0}]", oObjectId)
_Logger.Debug("Loading file [{0}]", oResultDocumentInfo.FullPath)
If File.Exists(oResultDocumentInfo.FullPath) Then
oResultDocumentInfo = LoadFile_AsByteArray(oResultDocumentInfo)
_OpenDocuments.Add(oResultDocumentInfo)
_CurrentDocument = oResultDocumentInfo
Else
_Logger.Warn("File [{0}] does not exist.", oResultDocumentInfo.FullPath)
End If
_Logger.Debug($"Got Info for oObjectId: {oObjectId}!")
_Logger.Debug("Successfully loaded File [{0}]", oResultDocumentInfo.FullPath)
Return oResultDocumentInfo
Catch ex As Exception
_Logger.Error(ex)
Return Nothing
End Try
End Function
Private Function LoadFile_AsByteArray(DocumentInfo As DocumentResultInfo) As DocumentResultInfo
Try
_Logger.Debug("Loading File [{0}]", DocumentInfo.FullPath)
Dim oFullPath As String = DocumentInfo.FullPath
Dim oPathExists = From oFile In _OpenDocuments
Where oFile.FullPath = oFullPath And oFile.Contents IsNot Nothing
Select oFile
Dim oExistsInCache = oPathExists.Count() > 0
Dim oSizeChanged = False
Dim oWriteTimeChanged = False
_Logger.Debug("File exists in Cache: [{0}]", oExistsInCache)
' Get Information about the file on the filesystem
Dim oFileInfo As New FileInfo(oFullPath)
If oExistsInCache Then
_Logger.Debug("Loading file from cache.")
Dim oCachedItem = oPathExists.First()
If oCachedItem.Contents Is Nothing Then
@ -284,37 +297,29 @@ Public Class frmDocumentResultList
Else
oSizeChanged = Not (oFileInfo.Length = oCachedItem.Contents.Length)
End If
_Logger.Debug("Filesize changed: [{0}]", oSizeChanged)
If oCachedItem.LastWriteTime = Nothing Then
oWriteTimeChanged = False
Else
oWriteTimeChanged = Not oFileInfo.LastWriteTime.Equals(oCachedItem.LastWriteTime)
End If
_Logger.Debug("Write-time changed: [{0}]", oWriteTimeChanged)
If oSizeChanged Or oWriteTimeChanged Then
Using oStream = File.OpenRead(DocumentInfo.FullPath)
Using oMemoryStream = New MemoryStream()
oStream.CopyTo(oMemoryStream)
DocumentInfo.Contents = oMemoryStream.ToArray()
DocumentInfo.LastWriteTime = oFileInfo.LastWriteTime
End Using
End Using
_Logger.Debug("Size or Write-time changed, loading from disk.")
Return DocumentInfo
Return LoadFile_FromDisk(DocumentInfo, oFileInfo)
Else
_Logger.Debug("Loading from cache")
Return oCachedItem
End If
Else
Using oStream = File.OpenRead(DocumentInfo.FullPath)
Using oMemoryStream = New MemoryStream()
oStream.CopyTo(oMemoryStream)
DocumentInfo.Contents = oMemoryStream.ToArray()
DocumentInfo.LastWriteTime = oFileInfo.LastWriteTime
End Using
End Using
_Logger.Debug("File exists in cache, loading from disk.")
Return DocumentInfo
Return LoadFile_FromDisk(DocumentInfo, oFileInfo)
End If
Catch ex As Exception
@ -323,6 +328,22 @@ Public Class frmDocumentResultList
End Try
End Function
Private Function LoadFile_FromDisk(pDocumentInfo As DocumentResultInfo, pFileInfo As FileInfo) As DocumentResultInfo
Using oStream = File.OpenRead(pDocumentInfo.FullPath)
_Logger.Debug("File opened.")
Using oMemoryStream = New MemoryStream()
_Logger.Debug("Copying file contents to memory stream.")
oStream.CopyTo(oMemoryStream)
pDocumentInfo.Contents = oMemoryStream.ToArray()
pDocumentInfo.LastWriteTime = pFileInfo.LastWriteTime
_Logger.Debug("Successfully copied file contents to memory stream.")
End Using
End Using
Return pDocumentInfo
End Function
Public Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean Implements IResultForm.RefreshResults
_IsLoading = True
Try

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.8.0.0")>
<Assembly: AssemblyFileVersion("1.8.0.0")>
<Assembly: AssemblyVersion("1.8.1.0")>
<Assembly: AssemblyFileVersion("1.8.1.0")>

View File

@ -170,6 +170,10 @@ Public Class frmObjectPropertyDialog
Dim oAttributes = Await GetAttributesForBusinessEntity(oEntityId)
If oAttributes.Count = 0 Then
MsgBox($"Es konnten keine Attribute für das Objekt '{_ObjectId}' geladen werden!", MsgBoxStyle.Critical, Text)
End If
For Each oAttribute As Attribute In oAttributes
Dim oControl = _Controls.GetControlForAttribute(oAttribute, True)
Dim oItem As LayoutControlItem = AttributeLayout.AddItem()
@ -230,4 +234,8 @@ Public Class frmObjectPropertyDialog
Return False
End Try
End Function
Private Sub TabFormControl1_Click(sender As Object, e As EventArgs) Handles TabFormControl1.Click
End Sub
End Class

View File

@ -858,27 +858,42 @@ Public Class frmFlowForm
oState.CurrentClipboardContents = ClipboardContents
If oState.MonitoringActive = False Then
Logger.Info("Clipboard Watcher is not active!")
Dim oMessage As String = "Clipboard Watcher is not active!"
Logger.Info(oMessage)
MsgBox(oMessage, MsgBoxStyle.Critical, Text)
Exit Sub
End If
If oState.UserProfiles Is Nothing Then
Logger.Warn("User Profiles is empty!")
Dim oMessage As String = "User Profiles are empty!"
Logger.Info(oMessage)
MsgBox(oMessage, MsgBoxStyle.Critical, Text)
Exit Sub
End If
If oState.ProfileProcesses Is Nothing OrElse oState.ProfileProcesses.Rows.Count = 0 Then
Logger.Warn("Profile Processes is empty!")
Dim oMessage As String = "Profile Processes are empty!"
Logger.Info(oMessage)
MsgBox(oMessage, MsgBoxStyle.Critical, Text)
Exit Sub
End If
If oState.ProfileWindows Is Nothing OrElse oState.ProfileWindows.Rows.Count = 0 Then
Logger.Warn("Profile Processes is empty!")
Dim oMessage As String = "Profile Processes are empty!"
Logger.Info(oMessage)
MsgBox(oMessage, MsgBoxStyle.Critical, Text)
Exit Sub
End If
If oState.ProfileProcesses Is Nothing OrElse oState.ProfileProcesses.Rows.Count = 0 Then
Logger.Warn("Profile Processes is empty!")
Dim oMessage As String = "Profile Processes are empty!"
Logger.Info(oMessage)
MsgBox(oMessage, MsgBoxStyle.Critical, Text)
Exit Sub
End If
@ -894,7 +909,7 @@ Public Class frmFlowForm
oState.MatchTreeView)
Catch ex As Exception
Logger.Error(ex)
MsgBox("Fehler beim Laden der Profile. Möglicherweise liegt ein Konfigurationsfehler vor. Mehr Informationen im Log.", MsgBoxStyle.Critical, Text)
MsgBox("Fehler beim Laden der Profile. Möglicherweise liegt ein Konfigurationsfehler vor. Fehlermeldung: " & ex.Message, MsgBoxStyle.Critical, Text)
End Try
Try

View File

@ -23,10 +23,18 @@ Public Class DatabaseWithFallback
Dim oResult As DataTable = Nothing
If ForceFallback = False Then
Dim oTableResult As TableResult = _Client.GetDatatableByName(DataTable, FilterExpression, SortByColumn)
Dim oTableResult As TableResult
Try
oTableResult = _Client.GetDatatableByName(DataTable, FilterExpression, SortByColumn)
Catch ex As Exception
_Logger.Error(ex)
oTableResult = Nothing
End Try
If oTableResult Is Nothing OrElse oTableResult.OK = False Then
_Logger.Warn("Datatable [{0}] could not be fetched from AppServer Cache. Falling back to direct Database Access.")
Return GetDatatableFromDatabase(FallbackSQL, FallbackType)
End If
Return oTableResult.Table

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.2.1.0")>
<Assembly: AssemblyFileVersion("1.2.1.0")>
<Assembly: AssemblyVersion("1.2.2.0")>
<Assembly: AssemblyFileVersion("1.2.2.0")>

View File

@ -658,10 +658,14 @@ Public Class EDMIService
Return AccessRight.VIEW_ONLY
End If
_Logger.Debug("Getting AccessRights for ObjectId [{0}]", ObjectId)
Dim oTable As DataTable = GlobalState.TableStore.Tables.Item(TBIDB_ACCESSRIGHT)
Dim oRows As List(Of DataRow) = oTable.Select($"IDB_OBJ_ID = {ObjectId} AND USR_ID = {UserId}").ToList()
Dim oRight As AccessRight
_Logger.Debug("Successfully got AccessRights for ObjectId [{0}]", ObjectId)
_Logger.Debug("Parsing AccessRights for ObjectId [{0}]", ObjectId)
If oRows.Count = 0 Then
_Logger.Warn("GetAccessRightForObjectId: Access right assignment does not exist for user [{0}] on object [{1}]", UserId, ObjectId)
Return AccessRight.VIEW_ONLY
@ -676,6 +680,9 @@ Public Class EDMIService
oRight = Utils.ToEnum(Of AccessRight)(oRightAsInt)
End If
_Logger.Debug("Successfully parsed AccessRights for ObjectId [{0}]", ObjectId)
_Logger.Debug("AccessRight for ObjectId [{0}] is [{1}]", ObjectId, oRight.ToString)
Return oRight
Catch ex As Exception
_Logger.Warn("GetAccessRightForObjectId: Unexpected Error while getting access right for object [{0}].", ObjectId)

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.1.1.0")>
<Assembly: AssemblyFileVersion("2.1.1.0")>
<Assembly: AssemblyVersion("2.2.0.0")>
<Assembly: AssemblyFileVersion("2.2.0.0")>

View File

@ -36,6 +36,7 @@ Public Class DatatableJob
Dim oConnectionId As Integer = NotNull(oRow.Item("CON_ID"), String.Empty)
Dim oTitle As String = NotNull(oRow.Item("TITLE"), String.Empty)
Dim oSQL As String = NotNull(oRow.Item("COMMAND"), String.Empty)
Dim oIndexColumns As String = NotNull(oRow.Item("INDEX_COLUMNS"), String.Empty)
Try
oLogger.Debug("Running Command-Job [{0}]", oTitle)
@ -46,10 +47,22 @@ Public Class DatatableJob
Dim oTable = oMSSQL.GetDatatableWithConnection(oSQL, oConnectionString, COMMAND_SQL_TIMEOUT)
oTable.TableName = oDatatableName
Dim oView As DataView = Nothing
' This creates an Index for the columns specified in INDEX_COLUMNS to speed up calls to 'Table.Select'!
If oIndexColumns <> String.Empty Then
oLogger.Debug("Adding indexes for Table: [{0}]", oIndexColumns)
oView = New DataView(oTable) With {
.Sort = oIndexColumns
}
End If
oLogger.Debug("Result Datatable [{0}] contains [{1}] rows", oTable.TableName, oTable.Rows.Count)
Dim oResultTable = New JobResult.ResultTable() With {
.Table = oTable,
.View = oView,
.DetailRow = oRow
}

View File

@ -3,6 +3,7 @@
Public Class ResultTable
Public Table As DataTable
Public View As DataView
Public ChildTable As DataTable
Public TableRelationColumn As String
Public ChildRelationColumn As String