EDMIService: Use EDMI.File functions, add DatastorePath
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
Imports DigitalData.Services.EDMIService
|
||||
Imports DigitalData.Modules
|
||||
Imports System.IO
|
||||
|
||||
<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)>
|
||||
@@ -12,6 +12,8 @@ Public Class EDMIService
|
||||
Public Shared LogConfig As LogConfig
|
||||
Public Shared Database As Firebird
|
||||
Public Shared AppConfig As AppConfig
|
||||
Public Shared EDMIPath As EDMI.File.Path
|
||||
Public Shared EDMIArchive As EDMI.File.Archive
|
||||
|
||||
Private ReadOnly _logger As Logger
|
||||
|
||||
@@ -19,6 +21,7 @@ Public Class EDMIService
|
||||
Private _debug As Boolean = False
|
||||
Private _username As String
|
||||
|
||||
|
||||
Public Sub New()
|
||||
Dim oOperationContext As OperationContext = OperationContext.Current
|
||||
Dim oInstanceContext As InstanceContext = oOperationContext.InstanceContext
|
||||
@@ -294,7 +297,8 @@ Public Class EDMIService
|
||||
|
||||
#Region "Document"
|
||||
Public Function ImportFile(FileInfo As FileInfo, Contents() As Byte, [Readonly] As Boolean, RetentionPeriod As Integer) As DocumentResult2 Implements IEDMIService.ImportFile
|
||||
Dim oFilePath = Path.Combine(AppConfig.ContainerPath, FileInfo.Name)
|
||||
Dim oDocumentType As String = "DummyDocumentType"
|
||||
Dim oFilePath = Path.Combine(EDMIPath.GetActivePath(oDocumentType), FileInfo.Name)
|
||||
Dim oDocument = New DocumentResult2.DocumentObject() With {.FileName = FileInfo.Name}
|
||||
|
||||
Try
|
||||
@@ -305,17 +309,7 @@ Public Class EDMIService
|
||||
oStream.Close()
|
||||
End Using
|
||||
|
||||
Dim oAttributes = IO.File.GetAttributes(oFilePath) Or FileAttributes.ReadOnly
|
||||
|
||||
If RetentionPeriod Then
|
||||
_logger.Info("Setting LastAccessTime")
|
||||
IO.File.SetLastAccessTime(oFilePath, Date.Now.AddYears(30))
|
||||
End If
|
||||
|
||||
If [Readonly] Then
|
||||
_logger.Info("Setting ReadOnly Attribute")
|
||||
IO.File.SetAttributes(oFilePath, oAttributes)
|
||||
End If
|
||||
EDMIArchive.SetRetention(oFilePath, RetentionPeriod, [Readonly])
|
||||
|
||||
Return New DocumentResult2(oDocument)
|
||||
Catch ex As Exception
|
||||
|
||||
Reference in New Issue
Block a user