EDMI: Bring Service and Client up to date

This commit is contained in:
Jonathan Jenne
2021-06-30 14:49:38 +02:00
parent a2374ce427
commit 6963505fe9
5 changed files with 114 additions and 108 deletions

View File

@@ -445,65 +445,6 @@ Public Class EDMIService
Return Nothing
End Try
End Function
Private Function GetFullPathForObjectId(ObjectId As Long) As String
Try
If Not GlobalState.TableStore.Tables.Contains(TBIDB_DOC_INFO) Then
_Logger.Warn("GetFullPathForObjectId: Document info table does not exist!")
Return String.Empty
End If
Dim oTable As DataTable = GlobalState.TableStore.Tables.Item(TBIDB_DOC_INFO)
Dim oRows As List(Of DataRow) = oTable.Select($"IDB_OBJ_ID = {ObjectId}").ToList()
Dim oFullPath As String
If oRows.Count = 0 Then
_Logger.Warn("GetFullPathForObjectId: Full path does not exist for object [{0}]", ObjectId)
oFullPath = String.Empty
Else
Dim oRow As DataRow = oRows.First()
oFullPath = oRow.Item("FULL_PATH")
End If
Return oFullPath
Catch ex As Exception
_Logger.Warn("GetFullPathForObjectId: Unexpected Error while getting full path for object [{0}].", ObjectId)
_Logger.Error(ex)
Return String.Empty
End Try
End Function
Private Function GetAccessRightForObjectId(UserId As Long, ObjectId As Long) As AccessRight
Try
If Not GlobalState.TableStore.Tables.Contains(TBIDB_ACCESSRIGHT) Then
_Logger.Warn("GetAccessRightForObjectId: Access right table does not exist!")
Return AccessRight.VIEW_ONLY
End If
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
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
Else
If oRows.Count > 1 Then
_Logger.Warn("GetAccessRightForObjectId: More than one access right assignment found for user [{0}] on object [{1}]", UserId, ObjectId)
End If
Dim oRow As DataRow = oRows.First()
Dim oRightAsInt = oRow.Item("ACCESSRIGHT")
oRight = Utils.ToEnum(Of AccessRight)(oRightAsInt)
End If
Return oRight
Catch ex As Exception
_Logger.Warn("GetAccessRightForObjectId: Unexpected Error while getting access right for object [{0}].", ObjectId)
_Logger.Error(ex)
Return AccessRight.VIEW_ONLY
End Try
End Function
Public Function NewObjectId(Data As NewObjectIdRequest) As NewObjectIdResponse Implements IEDMIService.NewObjectId
Try
@@ -613,6 +554,7 @@ Public Class EDMIService
End Function
#End Region
#Region "=== Private ==="
Private Function GetFileObjectFileName(IDB_OBJ_ID As Long, pExtension As String, pKeepExtension As Boolean) As String
If Not pExtension.StartsWith("."c) Then
pExtension &= "."c
@@ -652,4 +594,67 @@ Public Class EDMIService
Return New FaultException(Of UnexpectedErrorFault)(oFault, New FaultReason(oFault.InnerException.Message))
End Function
Private Function GetFullPathForObjectId(ObjectId As Long) As String
Try
If Not GlobalState.TableStore.Tables.Contains(TBIDB_DOC_INFO) Then
_Logger.Warn("GetFullPathForObjectId: Document info table does not exist!")
Return String.Empty
End If
Dim oTable As DataTable = GlobalState.TableStore.Tables.Item(TBIDB_DOC_INFO)
Dim oRows As List(Of DataRow) = oTable.Select($"IDB_OBJ_ID = {ObjectId}").ToList()
Dim oFullPath As String
If oRows.Count = 0 Then
_Logger.Warn("GetFullPathForObjectId: Full path does not exist for object [{0}]", ObjectId)
oFullPath = String.Empty
Else
Dim oRow As DataRow = oRows.First()
oFullPath = oRow.Item("FULL_PATH")
End If
Return oFullPath
Catch ex As Exception
_Logger.Warn("GetFullPathForObjectId: Unexpected Error while getting full path for object [{0}].", ObjectId)
_Logger.Error(ex)
Return String.Empty
End Try
End Function
Private Function GetAccessRightForObjectId(UserId As Long, ObjectId As Long) As AccessRight
Try
If Not GlobalState.TableStore.Tables.Contains(TBIDB_ACCESSRIGHT) Then
_Logger.Warn("GetAccessRightForObjectId: Access right table does not exist!")
Return AccessRight.VIEW_ONLY
End If
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
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
Else
If oRows.Count > 1 Then
_Logger.Warn("GetAccessRightForObjectId: More than one access right assignment found for user [{0}] on object [{1}]", UserId, ObjectId)
End If
Dim oRow As DataRow = oRows.First()
Dim oRightAsInt = oRow.Item("ACCESSRIGHT")
oRight = Utils.ToEnum(Of AccessRight)(oRightAsInt)
End If
Return oRight
Catch ex As Exception
_Logger.Warn("GetAccessRightForObjectId: Unexpected Error while getting access right for object [{0}].", ObjectId)
_Logger.Error(ex)
Return AccessRight.VIEW_ONLY
End Try
End Function
#End Region
End Class