diff --git a/Modules.EDMIAPI/Connected Services/IDBServiceReference/DigitalData.Services.IDBService.xsd b/Modules.EDMIAPI/Connected Services/IDBServiceReference/DigitalData.Services.IDBService.xsd index 209cb9e7..6dfd78af 100644 --- a/Modules.EDMIAPI/Connected Services/IDBServiceReference/DigitalData.Services.IDBService.xsd +++ b/Modules.EDMIAPI/Connected Services/IDBServiceReference/DigitalData.Services.IDBService.xsd @@ -145,6 +145,8 @@ + + diff --git a/Modules.EDMIAPI/Connected Services/IDBServiceReference/Reference.vb b/Modules.EDMIAPI/Connected Services/IDBServiceReference/Reference.vb index 8692d353..6e9cdd65 100644 --- a/Modules.EDMIAPI/Connected Services/IDBServiceReference/Reference.vb +++ b/Modules.EDMIAPI/Connected Services/IDBServiceReference/Reference.vb @@ -468,10 +468,10 @@ Namespace IDBServiceReference Function DeleteFileAsync(ByVal DocObject As IDBServiceReference.DocumentObject) As System.Threading.Tasks.Task(Of Boolean) _ - Function ImportFile(ByVal FileInfo As System.IO.FileInfo, ByVal Contents() As Byte) As IDBServiceReference.DocumentResult2 + Function ImportFile(ByVal FileInfo As System.IO.FileInfo, ByVal Contents() As Byte, ByVal [ReadOnly] As Boolean, ByVal RetentionTime As Integer) As IDBServiceReference.DocumentResult2 _ - Function ImportFileAsync(ByVal FileInfo As System.IO.FileInfo, ByVal Contents() As Byte) As System.Threading.Tasks.Task(Of IDBServiceReference.DocumentResult2) + Function ImportFileAsync(ByVal FileInfo As System.IO.FileInfo, ByVal Contents() As Byte, ByVal [ReadOnly] As Boolean, ByVal RetentionTime As Integer) As System.Threading.Tasks.Task(Of IDBServiceReference.DocumentResult2) _ @@ -607,12 +607,12 @@ Namespace IDBServiceReference Return MyBase.Channel.DeleteFileAsync(DocObject) End Function - Public Function ImportFile(ByVal FileInfo As System.IO.FileInfo, ByVal Contents() As Byte) As IDBServiceReference.DocumentResult2 Implements IDBServiceReference.IIDBService.ImportFile - Return MyBase.Channel.ImportFile(FileInfo, Contents) + Public Function ImportFile(ByVal FileInfo As System.IO.FileInfo, ByVal Contents() As Byte, ByVal [ReadOnly] As Boolean, ByVal RetentionTime As Integer) As IDBServiceReference.DocumentResult2 Implements IDBServiceReference.IIDBService.ImportFile + Return MyBase.Channel.ImportFile(FileInfo, Contents, [ReadOnly], RetentionTime) End Function - Public Function ImportFileAsync(ByVal FileInfo As System.IO.FileInfo, ByVal Contents() As Byte) As System.Threading.Tasks.Task(Of IDBServiceReference.DocumentResult2) Implements IDBServiceReference.IIDBService.ImportFileAsync - Return MyBase.Channel.ImportFileAsync(FileInfo, Contents) + Public Function ImportFileAsync(ByVal FileInfo As System.IO.FileInfo, ByVal Contents() As Byte, ByVal [ReadOnly] As Boolean, ByVal RetentionTime As Integer) As System.Threading.Tasks.Task(Of IDBServiceReference.DocumentResult2) Implements IDBServiceReference.IIDBService.ImportFileAsync + Return MyBase.Channel.ImportFileAsync(FileInfo, Contents, [ReadOnly], RetentionTime) End Function Public Function GetDocumentByDocumentId(ByVal DocumentId As Long) As IDBServiceReference.DocumentResult Implements IDBServiceReference.IIDBService.GetDocumentByDocumentId diff --git a/Modules.EDMIAPI/Document.vb b/Modules.EDMIAPI/Document.vb index c506e664..d4926c21 100644 --- a/Modules.EDMIAPI/Document.vb +++ b/Modules.EDMIAPI/Document.vb @@ -73,14 +73,14 @@ Public Class Document ''' ''' The filename to import ''' A document object - Public Async Function ImportFile2(FilePath As String) As Task(Of DocumentResult2) + Public Async Function ImportFile2(FilePath As String, Optional [ReadOnly] As Boolean = False, Optional RetentionPeriod As Integer = -1) As Task(Of DocumentResult2) Try Dim oContents As Byte() = File.ReadAllBytes(FilePath) Dim oInfo As New FileInfo(FilePath) Dim oName As String = oInfo.Name Dim oExtension As String = oInfo.Extension.Substring(1) - Dim oResult = Await _channel.ImportFileAsync(oInfo, oContents) + Dim oResult = Await _channel.ImportFileAsync(oInfo, oContents, [ReadOnly], RetentionPeriod) Return oResult Catch ex As Exception _logger.Error(ex) diff --git a/SERVICES/DDEDM_NetworkService/IDBService.vb b/SERVICES/DDEDM_NetworkService/IDBService.vb index 5f313fca..15fae81c 100644 --- a/SERVICES/DDEDM_NetworkService/IDBService.vb +++ b/SERVICES/DDEDM_NetworkService/IDBService.vb @@ -237,7 +237,7 @@ Public Class IDBService #End Region #Region "Document" - Public Function ImportFile(FileInfo As FileInfo, Contents() As Byte) As DocumentResult2 Implements IIDBService.ImportFile + Public Function ImportFile(FileInfo As FileInfo, Contents() As Byte, [Readonly] As Boolean, RetentionPeriod As Integer) As DocumentResult2 Implements IIDBService.ImportFile Dim oFilePath = Path.Combine(AppConfig.ContainerPath, FileInfo.Name) Dim oDocument = New DocumentResult2.DocumentObject() With {.FileName = FileInfo.Name} @@ -251,11 +251,15 @@ Public Class IDBService Dim oAttributes = IO.File.GetAttributes(oFilePath) Or FileAttributes.ReadOnly - _logger.Info("Setting LastAccessTime") - IO.File.SetLastAccessTime(oFilePath, Date.Now.AddYears(30)) + If RetentionPeriod Then + _logger.Info("Setting LastAccessTime") + IO.File.SetLastAccessTime(oFilePath, Date.Now.AddYears(30)) + End If - _logger.Info("Setting ReadOnly Attribute") - IO.File.SetAttributes(oFilePath, oAttributes) + If [Readonly] Then + _logger.Info("Setting ReadOnly Attribute") + IO.File.SetAttributes(oFilePath, oAttributes) + End If Return New DocumentResult2(oDocument) Catch ex As Exception diff --git a/SERVICES/DDEDM_NetworkService/IIDBService.vb b/SERVICES/DDEDM_NetworkService/IIDBService.vb index f072a38d..512549d3 100644 --- a/SERVICES/DDEDM_NetworkService/IIDBService.vb +++ b/SERVICES/DDEDM_NetworkService/IIDBService.vb @@ -43,7 +43,7 @@ Interface IIDBService #Region "Document (New)" - Function ImportFile(FileInfo As FileInfo, Contents As Byte()) As DocumentResult2 + Function ImportFile(FileInfo As FileInfo, Contents As Byte(), [ReadOnly] As Boolean, RetentionTime As Integer) As DocumentResult2 #End Region #Region "Utils"