EDMIService: Use EDMI.File functions, add DatastorePath

This commit is contained in:
Jonathan Jenne
2020-04-06 16:04:01 +02:00
parent 0e13de63fb
commit eb527a7abb
10 changed files with 50 additions and 31 deletions

View File

@@ -14,8 +14,8 @@ Public Class Archive
''' Sets a retention-period for a give file path by setting the file attributes LastAccessTime and ReadOnly
''' </summary>
''' <param name="FilePath"></param>
''' <param name="RetentionTimeInDays"></param>
''' <param name="[ReadOnly]"></param>
''' <param name="RetentionTimeInDays">If greater than 0, sets this plus the current date as LastAccessTime</param>
''' <param name="[ReadOnly]">If true, sets ReadOnly Attribute</param>
Public Sub SetRetention(FilePath As String, RetentionTimeInDays As Integer, [ReadOnly] As Boolean)
Try
If RetentionTimeInDays > 0 Then

View File

@@ -4,25 +4,27 @@ Imports System.IO
Public Class Path
Private ReadOnly _LogConfig As LogConfig
Private ReadOnly _Logger As Logger
Private ReadOnly _BasePath As String
Public Const BASE_PATH_ACTIVE As String = "Active"
Public Const BASE_PATH_ARCHIVE As String = "Archive"
Public Const BASE_PATH_EDMI As String = "EDMI"
Public Const PATH_ACTIVE As String = "Active"
Public Const PATH_ARCHIVE As String = "Archive"
Public Const PATH_EDMI As String = "EDMI"
Public Sub New(LogConfig As LogConfig)
Public Sub New(LogConfig As LogConfig, DatastoreBasePath As String)
_LogConfig = LogConfig
_Logger = LogConfig.GetLogger()
_BasePath = DatastoreBasePath
End Sub
Public Function GetActivePath(DocumentType As String)
Dim oPathParts As New List(Of String) From {BASE_PATH_EDMI, BASE_PATH_ACTIVE, DocumentType}
Dim oPathParts As New List(Of String) From {_BasePath, PATH_EDMI, PATH_ACTIVE, DocumentType}
oPathParts.AddRange(GetDatePath())
Return IO.Path.Combine(oPathParts.ToArray())
End Function
Public Function GetArchivePath(DocumentType As String)
Dim oPathParts As New List(Of String) From {BASE_PATH_EDMI, BASE_PATH_ARCHIVE, DocumentType}
Dim oPathParts As New List(Of String) From {_BasePath, PATH_EDMI, PATH_ARCHIVE, DocumentType}
oPathParts.AddRange(GetDatePath())
Return IO.Path.Combine(oPathParts.ToArray())