EDMI: First version of Updating files by replacing them!
This commit is contained in:
parent
ab10268c99
commit
17bbaac7a0
@ -21,6 +21,11 @@ Namespace DocumentResultList
|
||||
''' </summary>
|
||||
Private ReadOnly OpenFiles As New List(Of OpenFile)
|
||||
|
||||
''' <summary>
|
||||
''' List of files that changed and are processed by the client, ie. updated
|
||||
''' </summary>
|
||||
Private ReadOnly ProcessedFiles As New List(Of OpenFile)
|
||||
|
||||
Public Event FileChanged As EventHandler(Of FileChangedArgs)
|
||||
|
||||
Public Class OpenFile
|
||||
@ -39,15 +44,15 @@ Namespace DocumentResultList
|
||||
FileEx = New Modules.Filesystem.File(pLogConfig)
|
||||
End Sub
|
||||
|
||||
Public Function OpenDocument(pDocument As Document) As Boolean
|
||||
Public Async Function OpenDocument(pDocument As Document) As Task(Of Boolean)
|
||||
Dim oResult As Tuple(Of Process, String) = Nothing
|
||||
|
||||
If pDocument.FullPath IsNot Nothing OrElse pDocument.FullPath.Trim <> String.Empty Then
|
||||
If pDocument.FullPath IsNot Nothing AndAlso pDocument.FullPath.Trim <> String.Empty Then
|
||||
' TODO: DONT put into openfiles
|
||||
oResult = OpenFileFromPath(pDocument)
|
||||
|
||||
ElseIf pDocument.Extension IsNot Nothing AndAlso pDocument.Contents IsNot Nothing Then
|
||||
oResult = OpenFileFromByteArray(pDocument)
|
||||
oResult = Await OpenFileFromByteArray(pDocument)
|
||||
|
||||
End If
|
||||
|
||||
@ -67,14 +72,21 @@ Namespace DocumentResultList
|
||||
.ProcessId = oProcess.Id
|
||||
})
|
||||
|
||||
|
||||
If FileOpenTimer.Enabled = False Then
|
||||
FileOpenTimer.Interval = 10000
|
||||
FileOpenTimer.Start()
|
||||
End If
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Sub FileSaved(pOpenFile As OpenFile)
|
||||
pOpenFile.CurrentlyProcessing = False
|
||||
OpenFiles.Remove(pOpenFile)
|
||||
ProcessedFiles.Remove(pOpenFile)
|
||||
End Sub
|
||||
|
||||
Private Function OpenFileFromByteArray(pDocument As Document) As Tuple(Of Process, String)
|
||||
Private Async Function OpenFileFromByteArray(pDocument As Document) As Task(Of Tuple(Of Process, String))
|
||||
Try
|
||||
Dim oTempPath = Path.Combine(Path.GetTempPath(), Constants.TEMP_PATH_SUBFOLDER)
|
||||
Dim oDirectory = Directory.CreateDirectory(oTempPath)
|
||||
@ -82,8 +94,8 @@ Namespace DocumentResultList
|
||||
Dim oFilePath = Path.Combine(oTempPath, oFileName)
|
||||
|
||||
Using oMemoryStream As New MemoryStream(pDocument.Contents)
|
||||
Using oStreamWriter As New StreamWriter(oFilePath, append:=False, Encoding.UTF8)
|
||||
oMemoryStream.CopyTo(oMemoryStream)
|
||||
Using oFileStream As New FileStream(oFilePath, FileMode.Create, FileAccess.Write)
|
||||
Await oMemoryStream.CopyToAsync(oFileStream)
|
||||
End Using
|
||||
End Using
|
||||
|
||||
@ -119,14 +131,20 @@ Namespace DocumentResultList
|
||||
Private Sub FileOpenTimer_Elapsed() Handles FileOpenTimer.Elapsed
|
||||
Try
|
||||
For Each oOpenFile In OpenFiles
|
||||
|
||||
' All files that are currently processe/updated on the outside,
|
||||
' will not be checked again.
|
||||
If oOpenFile.CurrentlyProcessing = False Then
|
||||
Dim oFileIsProcessed = ProcessedFiles.Contains(oOpenFile)
|
||||
Debug.WriteLine($"File is processed: [{oFileIsProcessed}]")
|
||||
|
||||
If oFileIsProcessed = True Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
' Check if the file is currently in use, and skip if it is.
|
||||
Dim oIsLocked = FileEx.TestFileIsLocked(oOpenFile.FilePath)
|
||||
Debug.WriteLine($"File is locked: [{oIsLocked}]")
|
||||
|
||||
If oIsLocked Then
|
||||
Continue For
|
||||
End If
|
||||
@ -134,53 +152,37 @@ Namespace DocumentResultList
|
||||
' If this point is reached, we assume the file was closed again after opening it.
|
||||
' ------
|
||||
|
||||
Debug.WriteLine($"File Closed")
|
||||
|
||||
' Compute the current hash of the file and compare it with the one
|
||||
' in the database.
|
||||
Dim oOldHash = oOpenFile.Document.FileHash
|
||||
Dim oNewHash = FileEx.GetChecksum(oOpenFile.FilePath)
|
||||
|
||||
Debug.WriteLine($"Old Hash: [{oOldHash}]")
|
||||
Debug.WriteLine($"New Hash: [{oNewHash}]")
|
||||
|
||||
' If the the file did not change, remove it from the watch list
|
||||
If oNewHash.Equals(oOldHash) Then
|
||||
ProcessedFiles.Remove(oOpenFile)
|
||||
OpenFiles.Remove(oOpenFile)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
' If this point is reached, we assume the file changed.
|
||||
' ------
|
||||
|
||||
Debug.WriteLine($"File Changed")
|
||||
|
||||
' The File changed, so mark the file as being processed/updated
|
||||
' and notify any listeners of the FileChanged event
|
||||
oOpenFile.CurrentlyProcessing = True
|
||||
' and notify any listeners of the FileChanged event
|
||||
ProcessedFiles.Add(oOpenFile)
|
||||
|
||||
RaiseEvent FileChanged(Me, New FileChangedArgs() With {.File = oOpenFile})
|
||||
Next
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
|
||||
'Try
|
||||
' Dim oIds = Process.GetProcesses().
|
||||
' Select(Function(process) process.Id).
|
||||
' ToList()
|
||||
|
||||
' Dim oNewFileOpenList As New Dictionary(Of Integer, Document)
|
||||
' For Each oOpenFile In OpenFiles
|
||||
' If oIds.Contains(oOpenFile.Key) Then
|
||||
' oNewFileOpenList.Add(oOpenFile.Key, oOpenFile.Value)
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' If oNewFileOpenList.Count < OpenFiles.Count Then
|
||||
' Dim oClosedFiles = OpenFiles.
|
||||
' Except(oNewFileOpenList).
|
||||
' ToList()
|
||||
|
||||
' If oClosedFiles.Count = 1 Then
|
||||
' Dim oOpenFile = oClosedFiles.First()
|
||||
' RaiseEvent ProcessEnded(Me, oOpenFile.Value)
|
||||
' End If
|
||||
|
||||
' OpenFiles = oNewFileOpenList
|
||||
' End If
|
||||
'Catch ex As Exception
|
||||
' Logger.Error(ex)
|
||||
'End Try
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
@ -229,19 +229,28 @@ Public Class frmDocumentResultList
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Show_CriticalError(ex.Message)
|
||||
Show_CriticalError(ex)
|
||||
Finally
|
||||
Cursor = Cursors.Default
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Sub Watcher_FileChanged(sender As Object, e As DocumentResultList.Watcher.FileChangedArgs) Handles Watcher.FileChanged
|
||||
Public Async Sub Watcher_FileChanged(sender As Object, e As DocumentResultList.Watcher.FileChangedArgs) Handles Watcher.FileChanged
|
||||
Try
|
||||
Await _IDBClient.UpdateFileAsync(e.File.Document.Id, e.File.FilePath, New Options.UpdateFileOptions With {
|
||||
.CreateNewFileVersion = False,
|
||||
.Language = Environment.User.Language,
|
||||
.Username = Environment.User.UserName
|
||||
})
|
||||
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
|
||||
Logger.Error(ex)
|
||||
Show_CriticalError(ex)
|
||||
Finally
|
||||
e.File.CurrentlyProcessing = False
|
||||
' Signal to the watcher that the file is no longer in use
|
||||
Watcher.FileSaved(e.File)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
@ -565,11 +574,12 @@ Public Class frmDocumentResultList
|
||||
Close()
|
||||
End Sub
|
||||
|
||||
Private Sub GridControl_DoubleClick(sender As Object, e As EventArgs) Handles GridControl1.DoubleClick, GridControl2.DoubleClick, GridControl3.DoubleClick
|
||||
Private Async Sub GridControl_DoubleClick(sender As Object, e As EventArgs) Handles GridControl1.DoubleClick, GridControl2.DoubleClick, GridControl3.DoubleClick
|
||||
If _CurrentDocument IsNot Nothing AndAlso _CurrentDocument.AccessRight > Rights.AccessRight.VIEW_ONLY Then
|
||||
Process.Start(New ProcessStartInfo With {
|
||||
.FileName = _CurrentDocument.FullPath
|
||||
})
|
||||
'Process.Start(New ProcessStartInfo With {
|
||||
' .FileName = _CurrentDocument.FullPath
|
||||
'})
|
||||
Await Watcher.OpenDocument(_CurrentDocument)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@ -578,6 +588,11 @@ Public Class frmDocumentResultList
|
||||
labelCriticalError.Caption = Message
|
||||
End Sub
|
||||
|
||||
Public Sub Show_CriticalError(pException As Exception)
|
||||
labelCriticalError.Visibility = BarItemVisibility.Always
|
||||
labelCriticalError.Caption = pException.Message
|
||||
End Sub
|
||||
|
||||
Public Sub Show_Warning(Message As String)
|
||||
labelWarning.Visibility = BarItemVisibility.Always
|
||||
labelWarning.Caption = Message
|
||||
@ -701,15 +716,17 @@ Public Class frmDocumentResultList
|
||||
oPropertyDialog.Show()
|
||||
End Sub
|
||||
|
||||
Private Sub MenuItemFileOpen_ItemClick(sender As Object, e As ItemClickEventArgs) Handles MenuItemFileOpen.ItemClick
|
||||
Private Async Sub MenuItemFileOpen_ItemClick(sender As Object, e As ItemClickEventArgs) Handles MenuItemFileOpen.ItemClick
|
||||
If TestPathExists(OPEN_FILE) = False Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Try
|
||||
Process.Start(New ProcessStartInfo With {
|
||||
.FileName = _CurrentDocument.FullPath
|
||||
})
|
||||
Await Watcher.OpenDocument(_CurrentDocument)
|
||||
|
||||
'Process.Start(New ProcessStartInfo With {
|
||||
' .FileName = _CurrentDocument.FullPath
|
||||
'})
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
Imports DigitalData.Modules.EDMI.API
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Logging.LogConfig
|
||||
Imports Microsoft.VisualBasic.ApplicationServices
|
||||
|
||||
Namespace My
|
||||
' Für MyApplication sind folgende Ereignisse verfügbar:
|
||||
@ -18,6 +19,8 @@ Namespace My
|
||||
Private CommonAppDataPath As String = Windows.Forms.Application.CommonAppDataPath
|
||||
Private StartupPath As String = Windows.Forms.Application.StartupPath
|
||||
|
||||
|
||||
|
||||
Public Sub App_Startup() Handles Me.Startup
|
||||
Dim oLogConfig As New LogConfig(LogPath:=PathType.AppData, CompanyName:="Digital Data", ProductName:="ZooFlow", FileKeepRangeInDays:=30) With {.Debug = True}
|
||||
|
||||
@ -68,6 +71,13 @@ Namespace My
|
||||
|
||||
Public Sub App_Shutdown(sender As Object, e As EventArgs) Handles Me.Shutdown
|
||||
_Logger.Debug("Shutting down Client Suite..")
|
||||
Application.Sidebar.UnregisterSidebar()
|
||||
End Sub
|
||||
|
||||
Private Sub MyApplication_UnhandledException(sender As Object, e As UnhandledExceptionEventArgs) Handles Me.UnhandledException
|
||||
Application.Sidebar.UnregisterSidebar()
|
||||
_Logger.Warn("Unhandled exception occurred: [{0}]", e.Exception.Message)
|
||||
_Logger.Error(e.Exception)
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
End Namespace
|
||||
@ -55,6 +55,7 @@ Namespace My
|
||||
Public Property IDB_ConnectionString As String
|
||||
Public Property Globix As New Globix.State
|
||||
Public Property Search As New Search.State
|
||||
Public Property Sidebar As Sidebar
|
||||
|
||||
Public CommandLineFunction As String
|
||||
Public CommandLineArguments As New Dictionary(Of String, String)
|
||||
|
||||
94
GUIs.ZooFlow/Sidebar.vb
Normal file
94
GUIs.ZooFlow/Sidebar.vb
Normal file
@ -0,0 +1,94 @@
|
||||
Public Class Sidebar
|
||||
#Region "Sidebar Declarations"
|
||||
Private Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As IntPtr, ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
|
||||
Public Declare Auto Function MoveWindow Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal X As Int32, ByVal Y As Int32, ByVal nWidth As Int32, ByVal nHeight As Int32, ByVal bRepaint As Boolean) As Boolean
|
||||
Declare Function SHAppBarMessage Lib "shell32.dll" Alias "SHAppBarMessage" (ByVal dwMessage As Integer, ByRef pData As APPBARDATA) As Integer
|
||||
Declare Function SetWindowPos Lib "user32.dll" (ByVal hwnd As Integer, ByVal hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal cX As Integer, ByVal cY As Integer, ByVal wFlags As Integer) As Integer
|
||||
|
||||
Structure APPBARDATA
|
||||
Dim cbSize As Integer
|
||||
Dim hwnd As Integer
|
||||
Dim uCallbackMessage As [Delegate]
|
||||
Dim uEdge As Integer
|
||||
Dim rc As RECT
|
||||
Dim lParam As Integer ' message specific
|
||||
End Structure
|
||||
|
||||
Structure RECT
|
||||
Dim Left As Integer
|
||||
Dim Top As Integer
|
||||
Dim Right As Integer
|
||||
Dim Bottom As Integer
|
||||
End Structure
|
||||
|
||||
Const ABE_LEFT As Integer = 0
|
||||
Const ABE_TOP As Integer = &H1
|
||||
Const ABE_RIGHT As Integer = 2
|
||||
Const ABE_BOTTOM As Integer = 3
|
||||
|
||||
Const ABM_NEW As Integer = 0
|
||||
Const ABM_REMOVE As Integer = 1
|
||||
Const ABM_QUERYPOS As Integer = 2
|
||||
Const ABM_SETPOS As Integer = &H3
|
||||
Const ABM_GETSTATE As Integer = 4
|
||||
Const ABM_GETTASKBARPOS As Integer = 5
|
||||
Const ABM_ACTIVATE As Integer = 6
|
||||
Const ABM_GETAUTOHIDEBAR As Integer = 7
|
||||
Const ABM_SETAUTOHIDEBAR As Integer = 8
|
||||
Const ABM_WINDOWPOSCHANGED As Integer = 9
|
||||
|
||||
Const ABS_AUTOHIDE As Integer = 1
|
||||
Const ABS_ALWAYSONTOP As Integer = 2
|
||||
|
||||
Const HWND_NOTTOPMOST As Integer = -2
|
||||
Const HWND_TOPMOST As Integer = -1
|
||||
Const HWND_TOP As Integer = 0
|
||||
Const SHOWNORMAL As Integer = 5
|
||||
|
||||
Const SWP_NOSIZE As Integer = &H1
|
||||
Const SWP_NOMOVE As Short = &H2
|
||||
Const SWP_NOZORDER As Integer = 4
|
||||
Const SWP_NOACTIVATE As Integer = &H10
|
||||
Const SWP_DRAWFRAME As Integer = &H20
|
||||
Const SWP_SHOWWINDOW As Integer = &H40
|
||||
#End Region
|
||||
|
||||
Private Sidebar As APPBARDATA
|
||||
Private Handle As IntPtr
|
||||
|
||||
Public Sub New(pHandle As IntPtr)
|
||||
Handle = pHandle
|
||||
End Sub
|
||||
|
||||
Public Sub RegisterSidebar(pScreenName As String)
|
||||
Sidebar.hwnd = Handle.ToInt32
|
||||
Sidebar.cbSize = Len(Sidebar)
|
||||
|
||||
Dim oSelectedScreen = System.Windows.Forms.Screen.PrimaryScreen
|
||||
|
||||
' TODO: Make Sidebar Screen configurable
|
||||
'If pScreenName <> "" Then
|
||||
' Dim oScreens = System.Windows.Forms.Screen.AllScreens
|
||||
' For Each oScreen In oScreens
|
||||
' If oScreen.DeviceName = pScreenName Then
|
||||
' oSelectedScreen = oScreen
|
||||
' End If
|
||||
' Next
|
||||
'End If
|
||||
|
||||
With Sidebar
|
||||
.uEdge = ABE_RIGHT
|
||||
.rc.Top = oSelectedScreen.WorkingArea.Top '0
|
||||
.rc.Right = oSelectedScreen.WorkingArea.Right ' right
|
||||
.rc.Left = oSelectedScreen.WorkingArea.Right - 200 ' width of our appbar
|
||||
.rc.Bottom = oSelectedScreen.WorkingArea.Height ' bottom
|
||||
SHAppBarMessage(ABM_NEW, Sidebar)
|
||||
SetWindowPos(Sidebar.hwnd, HWND_TOP, .rc.Left, .rc.Top, .rc.Right - .rc.Left, .rc.Bottom, SWP_SHOWWINDOW Or SWP_NOACTIVATE)
|
||||
SHAppBarMessage(ABM_SETPOS, Sidebar)
|
||||
End With
|
||||
End Sub
|
||||
|
||||
Public Sub UnregisterSidebar()
|
||||
SHAppBarMessage(ABM_REMOVE, Sidebar)
|
||||
End Sub
|
||||
End Class
|
||||
@ -98,6 +98,9 @@
|
||||
<Reference Include="DigitalData.Controls.SnapPanel">
|
||||
<HintPath>..\Controls.SnapPanel\obj\Debug\DigitalData.Controls.SnapPanel.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Base">
|
||||
<HintPath>..\Modules.Base\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Independentsoft.Msg">
|
||||
<HintPath>P:\Visual Studio Projekte\Bibliotheken\MSG .NET\Bin\22_11_19\Independentsoft.Msg.dll</HintPath>
|
||||
</Reference>
|
||||
@ -405,6 +408,7 @@
|
||||
<Compile Include="Search\SearchFilter.vb" />
|
||||
<Compile Include="Search\SearchToken.vb" />
|
||||
<Compile Include="Search\State.vb" />
|
||||
<Compile Include="Sidebar.vb" />
|
||||
<EmbeddedResource Include="Administration\frmAdmin_ClipboardWatcher.resx">
|
||||
<DependentUpon>frmAdmin_ClipboardWatcher.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
@ -13,59 +13,7 @@ Imports DigitalData.Modules.Messaging
|
||||
Imports DigitalData.Modules.Windows
|
||||
|
||||
Public Class frmFlowForm
|
||||
#Region "Sidebar Declarations"
|
||||
Private Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As IntPtr, ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
|
||||
Public Declare Auto Function MoveWindow Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal X As Int32, ByVal Y As Int32, ByVal nWidth As Int32, ByVal nHeight As Int32, ByVal bRepaint As Boolean) As Boolean
|
||||
Declare Function SHAppBarMessage Lib "shell32.dll" Alias "SHAppBarMessage" (ByVal dwMessage As Integer, ByRef pData As APPBARDATA) As Integer
|
||||
Declare Function SetWindowPos Lib "user32.dll" (ByVal hwnd As Integer, ByVal hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal cX As Integer, ByVal cY As Integer, ByVal wFlags As Integer) As Integer
|
||||
|
||||
Structure APPBARDATA
|
||||
Dim cbSize As Integer
|
||||
Dim hwnd As Integer
|
||||
Dim uCallbackMessage As [Delegate]
|
||||
Dim uEdge As Integer
|
||||
Dim rc As RECT
|
||||
Dim lParam As Integer ' message specific
|
||||
End Structure
|
||||
|
||||
Structure RECT
|
||||
Dim Left As Integer
|
||||
Dim Top As Integer
|
||||
Dim Right As Integer
|
||||
Dim Bottom As Integer
|
||||
End Structure
|
||||
|
||||
Const ABE_LEFT As Integer = 0
|
||||
Const ABE_TOP As Integer = &H1
|
||||
Const ABE_RIGHT As Integer = 2
|
||||
Const ABE_BOTTOM As Integer = 3
|
||||
|
||||
Const ABM_NEW As Integer = 0
|
||||
Const ABM_REMOVE As Integer = 1
|
||||
Const ABM_QUERYPOS As Integer = 2
|
||||
Const ABM_SETPOS As Integer = &H3
|
||||
Const ABM_GETSTATE As Integer = 4
|
||||
Const ABM_GETTASKBARPOS As Integer = 5
|
||||
Const ABM_ACTIVATE As Integer = 6
|
||||
Const ABM_GETAUTOHIDEBAR As Integer = 7
|
||||
Const ABM_SETAUTOHIDEBAR As Integer = 8
|
||||
Const ABM_WINDOWPOSCHANGED As Integer = 9
|
||||
|
||||
Const ABS_AUTOHIDE As Integer = 1
|
||||
Const ABS_ALWAYSONTOP As Integer = 2
|
||||
|
||||
Const HWND_NOTTOPMOST As Integer = -2
|
||||
Const HWND_TOPMOST As Integer = -1
|
||||
Const HWND_TOP As Integer = 0
|
||||
Const SHOWNORMAL As Integer = 5
|
||||
|
||||
Const SWP_NOSIZE As Integer = &H1
|
||||
Const SWP_NOMOVE As Short = &H2
|
||||
Const SWP_NOZORDER As Integer = 4
|
||||
Const SWP_NOACTIVATE As Integer = &H10
|
||||
Const SWP_DRAWFRAME As Integer = &H20
|
||||
Const SWP_SHOWWINDOW As Integer = &H40
|
||||
#End Region
|
||||
|
||||
' Constants
|
||||
Private Const OPACITY_INITIAL = 0
|
||||
@ -101,7 +49,7 @@ Public Class frmFlowForm
|
||||
Private ESCHitCount As Integer = 0
|
||||
Private IndexForm As frmGlobix_Index
|
||||
Private AdminForm As frmAdmin_Start
|
||||
Private Sidebar As APPBARDATA
|
||||
|
||||
|
||||
' Events
|
||||
Public Event ClipboardChanged As EventHandler(Of IDataObject)
|
||||
@ -128,8 +76,8 @@ Public Class frmFlowForm
|
||||
Init.InitializeApplication()
|
||||
|
||||
' Register Form as Sidebar
|
||||
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
|
||||
RegisterSidebar(My.UIConfig.SidebarScreen)
|
||||
My.Application.Sidebar = New Sidebar(Handle)
|
||||
My.Application.Sidebar.RegisterSidebar(My.UIConfig.SidebarScreen)
|
||||
End Sub
|
||||
|
||||
Private Sub Init_Completed(sender As Object, e As EventArgs)
|
||||
@ -938,42 +886,6 @@ Public Class frmFlowForm
|
||||
frmSearchNeu.Show()
|
||||
End Sub
|
||||
|
||||
Private Sub frmFlowForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||||
UnregisterSidebar()
|
||||
End Sub
|
||||
|
||||
Private Sub RegisterSidebar(pScreenName As String)
|
||||
Sidebar.hwnd = Me.Handle.ToInt32
|
||||
Sidebar.cbSize = Len(Sidebar)
|
||||
|
||||
Dim oSelectedScreen = System.Windows.Forms.Screen.PrimaryScreen
|
||||
|
||||
' TODO: Make Sidebar Screen configurable
|
||||
'If pScreenName <> "" Then
|
||||
' Dim oScreens = System.Windows.Forms.Screen.AllScreens
|
||||
' For Each oScreen In oScreens
|
||||
' If oScreen.DeviceName = pScreenName Then
|
||||
' oSelectedScreen = oScreen
|
||||
' End If
|
||||
' Next
|
||||
'End If
|
||||
|
||||
With Sidebar
|
||||
.uEdge = ABE_RIGHT
|
||||
.rc.Top = oSelectedScreen.WorkingArea.Top '0
|
||||
.rc.Right = oSelectedScreen.WorkingArea.Right ' right
|
||||
.rc.Left = oSelectedScreen.WorkingArea.Right - 200 ' width of our appbar
|
||||
.rc.Bottom = oSelectedScreen.WorkingArea.Height ' bottom
|
||||
SHAppBarMessage(ABM_NEW, Sidebar)
|
||||
SetWindowPos(Sidebar.hwnd, HWND_TOP, .rc.Left, .rc.Top, .rc.Right - .rc.Left, .rc.Bottom, SWP_SHOWWINDOW Or SWP_NOACTIVATE)
|
||||
SHAppBarMessage(ABM_SETPOS, Sidebar)
|
||||
End With
|
||||
End Sub
|
||||
|
||||
Private Sub UnregisterSidebar()
|
||||
SHAppBarMessage(ABM_REMOVE, Sidebar)
|
||||
End Sub
|
||||
|
||||
Private Sub BasisKonfigurationToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles BasisKonfigurationToolStripMenuItem.Click
|
||||
frmConfigBasic.ShowDialog()
|
||||
End Sub
|
||||
|
||||
@ -1,10 +1,5 @@
|
||||
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.EDMI.API
|
||||
Imports System.IO
|
||||
Imports System.Text
|
||||
Imports DigitalData.Modules.EDMI.API.Client
|
||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||
Imports DigitalData.Modules.Base.IDB.FileStore
|
||||
|
||||
Public Class frmtest
|
||||
|
||||
@ -27,7 +22,7 @@ Public Class frmtest
|
||||
"DEFAULT"
|
||||
)
|
||||
|
||||
If oObjectId <> INVALID_OBEJCT_ID Then
|
||||
If oObjectId <> FILE_STORE_INVALID_OBEJCT_ID Then
|
||||
MsgBox("File Imported!", MsgBoxStyle.Information, Text)
|
||||
Else
|
||||
MsgBox("File was not imported. Check the server logs!")
|
||||
@ -35,7 +30,6 @@ Public Class frmtest
|
||||
txtIDB_OBJ_ID.Text = oObjectId
|
||||
End Sub
|
||||
|
||||
|
||||
Private Async Sub btnImportFile_Click_(sender As Object, e As EventArgs) Handles btnImportFile.Click
|
||||
Dim oResponse As ImportFileResponse = Await My.Application.Service.Client.Globix_ImportFileAsync(
|
||||
txtFile2Import.Text,
|
||||
|
||||
@ -66,8 +66,8 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BaseClass.vb" />
|
||||
<Compile Include="Database\Enums.vb" />
|
||||
<Compile Include="IDB\Database.vb" />
|
||||
<Compile Include="IDB\FileStore.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
''' <summary>
|
||||
''' BaseClass that sets up a Logger.
|
||||
''' </summary>
|
||||
Public Class BaseClass
|
||||
Protected LogConfig As LogConfig
|
||||
Protected Logger As Logger
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
Namespace Database
|
||||
Module Enums
|
||||
Public Enum NamedDatabase
|
||||
ECM
|
||||
IDB
|
||||
End Enum
|
||||
End Module
|
||||
End Namespace
|
||||
@ -1,15 +1,18 @@
|
||||
|
||||
Namespace IDB
|
||||
''' <summary>
|
||||
''' This module is intended for often used constants and datastructures
|
||||
''' Therefor it is important that this module does not have any dependencies on other modules!!
|
||||
''' </summary>
|
||||
Module Constants
|
||||
Public Class Database
|
||||
Public Const OBJECT_STATE_FILE_ADDED = "File added"
|
||||
Public Const OBJECT_STATE_FILE_VERSIONED = "File versioned"
|
||||
Public Const OBJECT_STATE_FILE_CHANGED = "File changed"
|
||||
Public Const OBJECT_STATE_FILE_DELETED = "File deleted"
|
||||
Public Const OBJECT_STATE_METADATA_CHANGED = "Metadata changed"
|
||||
Public Const OBJECT_STATE_ATTRIBUTEVALUE_DELETED = "Attributevalue deleted"
|
||||
End Module
|
||||
|
||||
Public Enum NamedDatabase
|
||||
ECM
|
||||
IDB
|
||||
End Enum
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
|
||||
|
||||
6
Modules.Base/Base/IDB/FileStore.vb
Normal file
6
Modules.Base/Base/IDB/FileStore.vb
Normal file
@ -0,0 +1,6 @@
|
||||
Namespace IDB
|
||||
Public Class FileStore
|
||||
Public Const FILE_STORE_INVALID_OBEJCT_ID = 0
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@ -196,6 +196,16 @@ Public Class Client
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Async Function UpdateFileAsync(pObjectId As Long, pFilePath As String, Optional pImportOptions As Options.UpdateFileOptions = Nothing) As Task(Of Long)
|
||||
Try
|
||||
Dim oUpdateFile As New Modules.IDB.UpdateFile(LogConfig, Channel)
|
||||
Return Await oUpdateFile.RunAsync(pFilePath, pObjectId, pImportOptions)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Async Function Globix_ImportFileAsync(
|
||||
pFilePath As String,
|
||||
pProfileId As Integer,
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is automatically generated by Visual Studio .Net. It is
|
||||
used to store generic object data source configuration information.
|
||||
Renaming the file extension or editing the content of this file may
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="UpdateFileResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>DigitalData.Modules.EDMI.API.EDMIServiceReference.UpdateFileResponse, Connected Services.EDMIServiceReference.Reference.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
||||
@ -24,6 +24,7 @@
|
||||
<xs:element name="_FileContents" nillable="true" type="xs:base64Binary" />
|
||||
<xs:element name="_FileExtension" nillable="true" type="xs:string" />
|
||||
<xs:element name="_FileHash" nillable="true" type="xs:string" />
|
||||
<xs:element name="_FilePath" nillable="true" type="xs:string" />
|
||||
<xs:element name="_FileSize" type="xs:long" />
|
||||
<xs:element name="_ObjectId" type="xs:long" />
|
||||
</xs:sequence>
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:tns="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.UpdateFile" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.UpdateFile" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB" />
|
||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Modules.ZooFlow.State" />
|
||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Messages" />
|
||||
<xs:complexType name="UpdateFileRequest">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" name="CreateNewVersion" type="xs:boolean" />
|
||||
<xs:element xmlns:q1="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB" minOccurs="0" name="File" nillable="true" type="q1:FileProperties" />
|
||||
<xs:element minOccurs="0" name="ObjectId" type="xs:long" />
|
||||
<xs:element xmlns:q2="http://schemas.datacontract.org/2004/07/DigitalData.Modules.ZooFlow.State" minOccurs="0" name="User" nillable="true" type="q2:UserState" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="UpdateFileRequest" nillable="true" type="tns:UpdateFileRequest" />
|
||||
<xs:complexType name="UpdateFileResponse">
|
||||
<xs:complexContent mixed="false">
|
||||
<xs:extension xmlns:q3="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Messages" base="q3:BaseResponse">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" name="ObjectId" type="xs:long" />
|
||||
</xs:sequence>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
<xs:element name="UpdateFileResponse" nillable="true" type="tns:UpdateFileResponse" />
|
||||
</xs:schema>
|
||||
@ -19,6 +19,7 @@
|
||||
<xsd:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB" />
|
||||
<xsd:import namespace="http://schemas.datacontract.org/2004/07/System.IO" />
|
||||
<xsd:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Modules.ZooFlow.State" />
|
||||
<xsd:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.UpdateFile" />
|
||||
<xsd:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.SetAttributeValue" />
|
||||
<xsd:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.GlobalIndexer.ImportFile" />
|
||||
<xsd:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.GetFileObject" />
|
||||
@ -161,6 +162,12 @@
|
||||
<wsdl:message name="IEDMIService_NewFile_OutputMessage">
|
||||
<wsdl:part name="parameters" element="tns:NewFileResponse" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="IEDMIService_UpdateFile_InputMessage">
|
||||
<wsdl:part name="parameters" element="tns:UpdateFile" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="IEDMIService_UpdateFile_OutputMessage">
|
||||
<wsdl:part name="parameters" element="tns:UpdateFileResponse" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="IEDMIService_SetAttributeValue_InputMessage">
|
||||
<wsdl:part name="parameters" element="tns:SetAttributeValue" />
|
||||
</wsdl:message>
|
||||
@ -299,6 +306,10 @@
|
||||
<wsdl:input wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/NewFile" message="tns:IEDMIService_NewFile_InputMessage" />
|
||||
<wsdl:output wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/NewFileResponse" message="tns:IEDMIService_NewFile_OutputMessage" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="UpdateFile">
|
||||
<wsdl:input wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/UpdateFile" message="tns:IEDMIService_UpdateFile_InputMessage" />
|
||||
<wsdl:output wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/UpdateFileResponse" message="tns:IEDMIService_UpdateFile_OutputMessage" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="SetAttributeValue">
|
||||
<wsdl:input wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/SetAttributeValue" message="tns:IEDMIService_SetAttributeValue_InputMessage" />
|
||||
<wsdl:output wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/SetAttributeValueResponse" message="tns:IEDMIService_SetAttributeValue_OutputMessage" />
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.Database.GetScalarValue" />
|
||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.Database.ExecuteNonQuery" />
|
||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.NewFile" />
|
||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.UpdateFile" />
|
||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.SetAttributeValue" />
|
||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.GlobalIndexer.ImportFile" />
|
||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.GetFileObject" />
|
||||
@ -246,45 +247,59 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="UpdateFile">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q21="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.UpdateFile" minOccurs="0" name="Data" nillable="true" type="q21:UpdateFileRequest" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="UpdateFileResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q22="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.UpdateFile" minOccurs="0" name="UpdateFileResult" nillable="true" type="q22:UpdateFileResponse" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="SetAttributeValue">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q21="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.SetAttributeValue" minOccurs="0" name="Data" nillable="true" type="q21:SetAttributeValueRequest" />
|
||||
<xs:element xmlns:q23="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.SetAttributeValue" minOccurs="0" name="Data" nillable="true" type="q23:SetAttributeValueRequest" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="SetAttributeValueResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q22="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.SetAttributeValue" minOccurs="0" name="SetAttributeValueResult" nillable="true" type="q22:SetAttributeValueResponse" />
|
||||
<xs:element xmlns:q24="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.SetAttributeValue" minOccurs="0" name="SetAttributeValueResult" nillable="true" type="q24:SetAttributeValueResponse" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="ImportFile">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q23="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.GlobalIndexer.ImportFile" minOccurs="0" name="Data" nillable="true" type="q23:ImportFileRequest" />
|
||||
<xs:element xmlns:q25="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.GlobalIndexer.ImportFile" minOccurs="0" name="Data" nillable="true" type="q25:ImportFileRequest" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="ImportFileResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q24="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.GlobalIndexer.ImportFile" minOccurs="0" name="ImportFileResult" nillable="true" type="q24:ImportFileResponse" />
|
||||
<xs:element xmlns:q26="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.GlobalIndexer.ImportFile" minOccurs="0" name="ImportFileResult" nillable="true" type="q26:ImportFileResponse" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="GetFileObject">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q25="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.GetFileObject" minOccurs="0" name="Data" nillable="true" type="q25:GetFileObjectRequest" />
|
||||
<xs:element xmlns:q27="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.GetFileObject" minOccurs="0" name="Data" nillable="true" type="q27:GetFileObjectRequest" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="GetFileObjectResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q26="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.GetFileObject" minOccurs="0" name="GetFileObjectResult" nillable="true" type="q26:GetFileObjectResponse" />
|
||||
<xs:element xmlns:q28="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods.IDB.GetFileObject" minOccurs="0" name="GetFileObjectResult" nillable="true" type="q28:GetFileObjectResponse" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
@ -298,7 +313,7 @@
|
||||
<xs:element name="DocumentStreamResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q27="http://schemas.microsoft.com/Message" name="FileContents" type="q27:StreamBody" />
|
||||
<xs:element xmlns:q29="http://schemas.microsoft.com/Message" name="FileContents" type="q29:StreamBody" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
@ -314,7 +329,7 @@
|
||||
<xs:element name="DocumentInfoResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q28="http://schemas.datacontract.org/2004/07/DigitalData.Modules.EDMI.API" minOccurs="0" name="FileRight" type="q28:Rights.AccessRight" />
|
||||
<xs:element xmlns:q30="http://schemas.datacontract.org/2004/07/DigitalData.Modules.EDMI.API" minOccurs="0" name="FileRight" type="q30:Rights.AccessRight" />
|
||||
<xs:element minOccurs="0" name="FullPath" nillable="true" type="xs:string" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
@ -41,6 +41,7 @@
|
||||
<MetadataFile FileName="DigitalData.Services.EDMIService.Methods.IDB.xsd" MetadataType="Schema" ID="ff8eee6b-9a48-4ecf-9a99-ec43f65d1e5d" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
||||
<MetadataFile FileName="System.IO.xsd" MetadataType="Schema" ID="88cf8e31-2b3d-4d1a-9172-e7b0ea930e93" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
||||
<MetadataFile FileName="DigitalData.Modules.ZooFlow.State.xsd" MetadataType="Schema" ID="c9ca2958-d16e-444e-ac34-40fc3c6a86cb" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
||||
<MetadataFile FileName="DigitalData.Services.EDMIService.Methods.IDB.UpdateFile.xsd" MetadataType="Schema" ID="ee905b55-bae0-4ecb-8e57-f7477bd1a4bc" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
||||
<MetadataFile FileName="DigitalData.Services.EDMIService.Methods.IDB.SetAttributeValue.xsd" MetadataType="Schema" ID="09473ff2-6558-47e2-89ed-7c8bce746a4c" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
||||
<MetadataFile FileName="DigitalData.Services.EDMIService.Methods.GlobalIndexer.ImportFile.xsd" MetadataType="Schema" ID="4c9227ac-82b3-4aff-bcb3-eab453dc69c5" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
||||
<MetadataFile FileName="DigitalData.Services.EDMIService.Methods.IDB.GetFileObject.xsd" MetadataType="Schema" ID="df5739a1-d592-43d7-9307-fa8e5580635c" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
||||
|
||||
@ -28,6 +28,7 @@ Namespace EDMIServiceReference
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.GetScalarValueResponse)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.ExecuteNonQueryResponse)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.NewFileResponse)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.UpdateFileResponse)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.SetAttributeValueResponse)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.ImportFileResponse)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.GetFileObjectResponse)), _
|
||||
@ -165,6 +166,8 @@ Namespace EDMIServiceReference
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(System.IO.FileInfo)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(System.IO.FileSystemInfo)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.UserState)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.UpdateFileRequest)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.UpdateFileResponse)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.SetAttributeValueRequest)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.SetAttributeValueResponse)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.ImportFileRequest)), _
|
||||
@ -260,6 +263,8 @@ Namespace EDMIServiceReference
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(System.IO.FileInfo)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(System.IO.FileSystemInfo)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.UserState)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.UpdateFileRequest)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.UpdateFileResponse)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.SetAttributeValueRequest)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.SetAttributeValueResponse)), _
|
||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.ImportFileRequest)), _
|
||||
@ -338,6 +343,31 @@ Namespace EDMIServiceReference
|
||||
End Property
|
||||
End Class
|
||||
|
||||
<System.Diagnostics.DebuggerStepThroughAttribute(), _
|
||||
System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0"), _
|
||||
System.Runtime.Serialization.DataContractAttribute(Name:="UpdateFileResponse", [Namespace]:="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods."& _
|
||||
"IDB.UpdateFile"), _
|
||||
System.SerializableAttribute()> _
|
||||
Partial Public Class UpdateFileResponse
|
||||
Inherits EDMIServiceReference.BaseResponse
|
||||
|
||||
<System.Runtime.Serialization.OptionalFieldAttribute()> _
|
||||
Private ObjectIdField As Long
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute()> _
|
||||
Public Property ObjectId() As Long
|
||||
Get
|
||||
Return Me.ObjectIdField
|
||||
End Get
|
||||
Set
|
||||
If (Me.ObjectIdField.Equals(value) <> true) Then
|
||||
Me.ObjectIdField = value
|
||||
Me.RaisePropertyChanged("ObjectId")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
End Class
|
||||
|
||||
<System.Diagnostics.DebuggerStepThroughAttribute(), _
|
||||
System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0"), _
|
||||
System.Runtime.Serialization.DataContractAttribute(Name:="SetAttributeValueResponse", [Namespace]:="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods."& _
|
||||
@ -1488,6 +1518,102 @@ Namespace EDMIServiceReference
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
<System.Diagnostics.DebuggerStepThroughAttribute(), _
|
||||
System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0"), _
|
||||
System.Runtime.Serialization.DataContractAttribute(Name:="UpdateFileRequest", [Namespace]:="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods."& _
|
||||
"IDB.UpdateFile"), _
|
||||
System.SerializableAttribute()> _
|
||||
Partial Public Class UpdateFileRequest
|
||||
Inherits Object
|
||||
Implements System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged
|
||||
|
||||
<System.NonSerializedAttribute()> _
|
||||
Private extensionDataField As System.Runtime.Serialization.ExtensionDataObject
|
||||
|
||||
<System.Runtime.Serialization.OptionalFieldAttribute()> _
|
||||
Private CreateNewVersionField As Boolean
|
||||
|
||||
<System.Runtime.Serialization.OptionalFieldAttribute()> _
|
||||
Private FileField As EDMIServiceReference.FileProperties
|
||||
|
||||
<System.Runtime.Serialization.OptionalFieldAttribute()> _
|
||||
Private ObjectIdField As Long
|
||||
|
||||
<System.Runtime.Serialization.OptionalFieldAttribute()> _
|
||||
Private UserField As EDMIServiceReference.UserState
|
||||
|
||||
<Global.System.ComponentModel.BrowsableAttribute(false)> _
|
||||
Public Property ExtensionData() As System.Runtime.Serialization.ExtensionDataObject Implements System.Runtime.Serialization.IExtensibleDataObject.ExtensionData
|
||||
Get
|
||||
Return Me.extensionDataField
|
||||
End Get
|
||||
Set
|
||||
Me.extensionDataField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute()> _
|
||||
Public Property CreateNewVersion() As Boolean
|
||||
Get
|
||||
Return Me.CreateNewVersionField
|
||||
End Get
|
||||
Set
|
||||
If (Me.CreateNewVersionField.Equals(value) <> true) Then
|
||||
Me.CreateNewVersionField = value
|
||||
Me.RaisePropertyChanged("CreateNewVersion")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute()> _
|
||||
Public Property File() As EDMIServiceReference.FileProperties
|
||||
Get
|
||||
Return Me.FileField
|
||||
End Get
|
||||
Set
|
||||
If (Object.ReferenceEquals(Me.FileField, value) <> true) Then
|
||||
Me.FileField = value
|
||||
Me.RaisePropertyChanged("File")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute()> _
|
||||
Public Property ObjectId() As Long
|
||||
Get
|
||||
Return Me.ObjectIdField
|
||||
End Get
|
||||
Set
|
||||
If (Me.ObjectIdField.Equals(value) <> true) Then
|
||||
Me.ObjectIdField = value
|
||||
Me.RaisePropertyChanged("ObjectId")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute()> _
|
||||
Public Property User() As EDMIServiceReference.UserState
|
||||
Get
|
||||
Return Me.UserField
|
||||
End Get
|
||||
Set
|
||||
If (Object.ReferenceEquals(Me.UserField, value) <> true) Then
|
||||
Me.UserField = value
|
||||
Me.RaisePropertyChanged("User")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Event PropertyChanged As System.ComponentModel.PropertyChangedEventHandler Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
|
||||
|
||||
Protected Sub RaisePropertyChanged(ByVal propertyName As String)
|
||||
Dim propertyChanged As System.ComponentModel.PropertyChangedEventHandler = Me.PropertyChangedEvent
|
||||
If (Not (propertyChanged) Is Nothing) Then
|
||||
propertyChanged(Me, New System.ComponentModel.PropertyChangedEventArgs(propertyName))
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
<System.Diagnostics.DebuggerStepThroughAttribute(), _
|
||||
System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0"), _
|
||||
System.Runtime.Serialization.DataContractAttribute(Name:="SetAttributeValueRequest", [Namespace]:="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Methods."& _
|
||||
@ -1828,6 +1954,8 @@ Namespace EDMIServiceReference
|
||||
|
||||
Private _FileHashField As String
|
||||
|
||||
Private _FilePathField As String
|
||||
|
||||
Private _FileSizeField As Long
|
||||
|
||||
Private _ObjectIdField As Long
|
||||
@ -1894,6 +2022,19 @@ Namespace EDMIServiceReference
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute(IsRequired:=true)> _
|
||||
Public Property _FilePath() As String
|
||||
Get
|
||||
Return Me._FilePathField
|
||||
End Get
|
||||
Set
|
||||
If (Object.ReferenceEquals(Me._FilePathField, value) <> true) Then
|
||||
Me._FilePathField = value
|
||||
Me.RaisePropertyChanged("_FilePath")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute(IsRequired:=true)> _
|
||||
Public Property _FileSize() As Long
|
||||
Get
|
||||
@ -2103,6 +2244,12 @@ Namespace EDMIServiceReference
|
||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/NewFile", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/NewFileResponse")> _
|
||||
Function NewFileAsync(ByVal Data As EDMIServiceReference.NewFileRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.NewFileResponse)
|
||||
|
||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/UpdateFile", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/UpdateFileResponse")> _
|
||||
Function UpdateFile(ByVal Data As EDMIServiceReference.UpdateFileRequest) As EDMIServiceReference.UpdateFileResponse
|
||||
|
||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/UpdateFile", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/UpdateFileResponse")> _
|
||||
Function UpdateFileAsync(ByVal Data As EDMIServiceReference.UpdateFileRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.UpdateFileResponse)
|
||||
|
||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/SetAttributeValue", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/SetAttributeValueResponse")> _
|
||||
Function SetAttributeValue(ByVal Data As EDMIServiceReference.SetAttributeValueRequest) As EDMIServiceReference.SetAttributeValueResponse
|
||||
|
||||
@ -2494,6 +2641,14 @@ Namespace EDMIServiceReference
|
||||
Return MyBase.Channel.NewFileAsync(Data)
|
||||
End Function
|
||||
|
||||
Public Function UpdateFile(ByVal Data As EDMIServiceReference.UpdateFileRequest) As EDMIServiceReference.UpdateFileResponse Implements EDMIServiceReference.IEDMIService.UpdateFile
|
||||
Return MyBase.Channel.UpdateFile(Data)
|
||||
End Function
|
||||
|
||||
Public Function UpdateFileAsync(ByVal Data As EDMIServiceReference.UpdateFileRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.UpdateFileResponse) Implements EDMIServiceReference.IEDMIService.UpdateFileAsync
|
||||
Return MyBase.Channel.UpdateFileAsync(Data)
|
||||
End Function
|
||||
|
||||
Public Function SetAttributeValue(ByVal Data As EDMIServiceReference.SetAttributeValueRequest) As EDMIServiceReference.SetAttributeValueResponse Implements EDMIServiceReference.IEDMIService.SetAttributeValue
|
||||
Return MyBase.Channel.SetAttributeValue(Data)
|
||||
End Function
|
||||
|
||||
@ -227,6 +227,15 @@
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="UpdateFile">
|
||||
<soap12:operation soapAction="http://DigitalData.Services.EDMIService/IEDMIService/UpdateFile" style="document" />
|
||||
<wsdl:input>
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="SetAttributeValue">
|
||||
<soap12:operation soapAction="http://DigitalData.Services.EDMIService/IEDMIService/SetAttributeValue" style="document" />
|
||||
<wsdl:input>
|
||||
|
||||
@ -167,6 +167,9 @@
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMI.API.EDMIServiceReference.TestObjectIdExistsResponse.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMI.API.EDMIServiceReference.UpdateFileResponse.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMI.API.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
@ -206,6 +209,9 @@
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Services.EDMIService.Methods.IDB.SetAttributeValue.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Services.EDMIService.Methods.IDB.UpdateFile.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Services.EDMIService.Methods.IDB.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
|
||||
@ -10,29 +10,43 @@ Namespace Modules.IDB
|
||||
MyBase.New(pLogConfig, pChannel)
|
||||
End Sub
|
||||
|
||||
Public Async Function RunAsync(pFilePath As String, pObjectId As Long, Optional pOptions As UpdateFileOptions = Nothing) As Task
|
||||
' Set default options
|
||||
If pOptions Is Nothing Then
|
||||
pOptions = New UpdateFileOptions()
|
||||
End If
|
||||
Public Async Function RunAsync(pFilePath As String, pObjectId As Long, Optional pOptions As UpdateFileOptions = Nothing) As Task(Of Long)
|
||||
Try
|
||||
' Set default options
|
||||
If pOptions Is Nothing Then
|
||||
pOptions = New UpdateFileOptions()
|
||||
End If
|
||||
|
||||
' Check if file exists
|
||||
If IO.File.Exists(pFilePath) = False Then
|
||||
Throw New IO.FileNotFoundException("Path does not exist")
|
||||
End If
|
||||
' Check if file exists
|
||||
If IO.File.Exists(pFilePath) = False Then
|
||||
Throw New IO.FileNotFoundException("Path does not exist")
|
||||
End If
|
||||
|
||||
' Importing the file now
|
||||
Dim oFileProperties = Helpers.GetFileProperties(pFilePath, Date.Now)
|
||||
'Dim oFileImportResponse = Await Channel.(New NewFileRequest With {
|
||||
' .BusinessEntity = pBusinessEntity,
|
||||
' .File = oFileProperties,
|
||||
' .KindType = pObjectKind,
|
||||
' .StoreName = pObjectStoreName,
|
||||
' .User = New UserState With {
|
||||
' .Language = pOptions.Language,
|
||||
' .UserName = pOptions.Username
|
||||
' }
|
||||
'})
|
||||
' Importing the file now
|
||||
Dim oFileProperties = Helpers.GetFileProperties(pFilePath, Date.Now)
|
||||
|
||||
|
||||
Dim oUpdateFileResponse = Await Channel.UpdateFileAsync(New UpdateFileRequest With {
|
||||
.File = oFileProperties,
|
||||
.ObjectId = pObjectId,
|
||||
.CreateNewVersion = pOptions.CreateNewFileVersion,
|
||||
.User = New UserState With {
|
||||
.Language = pOptions.Language,
|
||||
.UserName = pOptions.Username
|
||||
}
|
||||
})
|
||||
|
||||
If oUpdateFileResponse.OK = False Then
|
||||
Throw New ApplicationException("Could not Import File Contents!")
|
||||
End If
|
||||
|
||||
Return oUpdateFileResponse.ObjectId
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Constants.INVALID_OBEJCT_ID
|
||||
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
|
||||
@ -352,11 +352,13 @@ Public Class File
|
||||
''' </remarks>
|
||||
Public Function TestFileIsLocked(pFilePath As String) As Boolean
|
||||
Try
|
||||
Using stream As FileStream = IO.File.Open(FileMode.Open, FileAccess.Read, FileShare.None)
|
||||
Using stream As FileStream = IO.File.Open(pFilePath, FileMode.Open, FileAccess.Read, FileShare.None)
|
||||
stream.Close()
|
||||
End Using
|
||||
Catch ex As Exception When ((ex.HResult And &HFFFF) = 32)
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Return True
|
||||
End Try
|
||||
|
||||
Return False
|
||||
@ -409,4 +411,13 @@ Public Class File
|
||||
Return $"{pBaseString}-{pSuffix}.{pExtension}"
|
||||
End Function
|
||||
|
||||
Public Function GetFilenameWithPrefix(pFilePath As String, pPrefix As String)
|
||||
Dim oFileInfo = New IO.FileInfo(pFilePath)
|
||||
Return GetFilenameWithSuffix(IO.Path.GetFileNameWithoutExtension(pFilePath), pPrefix, oFileInfo.Extension.Substring(1))
|
||||
End Function
|
||||
|
||||
Public Function GetFilenameWithPrefix(pBaseString As String, pPrefix As String, pExtension As String)
|
||||
Return $"{pPrefix}-{pBaseString}.{pExtension}"
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
@ -72,35 +72,35 @@ Namespace IDB
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetAttributesForObject(pObjectId As Long, pLanguage As String) As List(Of ObjectAttribute)
|
||||
Dim oAttributes As New List(Of ObjectAttribute)
|
||||
'Public Function GetAttributesForObject(pObjectId As Long, pLanguage As String) As List(Of ObjectAttribute)
|
||||
' Dim oAttributes As New List(Of ObjectAttribute)
|
||||
|
||||
Try
|
||||
Dim oTable As DataTable = Database.GetDatatable($"EXEC [PRIDB_GET_VALUE_DT] {pObjectId}, '{pLanguage}'")
|
||||
If oTable Is Nothing OrElse oTable.Rows.Count = 0 Then
|
||||
Return Nothing
|
||||
End If
|
||||
' Try
|
||||
' Dim oTable As DataTable = Database.GetDatatable($"EXEC [PRIDB_GET_VALUE_DT] {pObjectId}, '{pLanguage}'")
|
||||
' If oTable Is Nothing OrElse oTable.Rows.Count = 0 Then
|
||||
' Return Nothing
|
||||
' End If
|
||||
|
||||
For Each oRow As DataRow In oTable.Rows
|
||||
Dim oAttribute As New ObjectAttribute With {
|
||||
.Id = oRow.Item("AttributeId"),
|
||||
.Title = oRow.Item("AttributeTitle"),
|
||||
.Type = oRow.Item("AttributeType"),
|
||||
.ValueBigInt = Utils.NotNull(oRow.Item("ValueBigInt"), Nothing),
|
||||
.ValueDate = Utils.NotNull(oRow.Item("ValueDate"), Nothing),
|
||||
.ValueDecimal = Utils.NotNull(oRow.Item("ValueDecimal"), Nothing),
|
||||
.ValueText = Utils.NotNull(oRow.Item("ValueText"), Nothing)
|
||||
}
|
||||
' For Each oRow As DataRow In oTable.Rows
|
||||
' Dim oAttribute As New ObjectAttribute With {
|
||||
' .Id = oRow.Item("AttributeId"),
|
||||
' .Title = oRow.Item("AttributeTitle"),
|
||||
' .Type = oRow.Item("AttributeType"),
|
||||
' .ValueBigInt = Utils.NotNull(oRow.Item("ValueBigInt"), Nothing),
|
||||
' .ValueDate = Utils.NotNull(oRow.Item("ValueDate"), Nothing),
|
||||
' .ValueDecimal = Utils.NotNull(oRow.Item("ValueDecimal"), Nothing),
|
||||
' .ValueText = Utils.NotNull(oRow.Item("ValueText"), Nothing)
|
||||
' }
|
||||
|
||||
oAttributes.Add(oAttribute)
|
||||
Next
|
||||
' oAttributes.Add(oAttribute)
|
||||
' Next
|
||||
|
||||
Return oAttributes
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
' Return oAttributes
|
||||
' Catch ex As Exception
|
||||
' Logger.Error(ex)
|
||||
' Return Nothing
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
Public Function SetAttributeValue(pConnection As SqlConnection, pTransaction As SqlTransaction, pObjectId As Long, pAttributeName As String, pValue As String, pLanguage As String, pWho As String) As Boolean
|
||||
Dim oSql = $"
|
||||
|
||||
@ -15,6 +15,9 @@ Namespace Methods.IDB.GetFileObject
|
||||
Public Property FileSize As Long
|
||||
<DataMember>
|
||||
Public Property FileContents As Byte()
|
||||
|
||||
' Internal Properties, these will not be given to the client
|
||||
Public Property FilePath As String
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@ -28,19 +28,19 @@ Namespace Methods.IDB.GetFileObject
|
||||
Dim oFileHash As String = oRow.ItemEx("FILE_HASH", "")
|
||||
Dim oFileSize As Long = oRow.ItemEx(Of Long)("FILE_SIZE", 0)
|
||||
Dim oFileExtension As String = oRow.ItemEx(Of String)("EXTENSION")
|
||||
Dim oFilePath = oRow.ItemEx("RELPATH", "")
|
||||
Dim oFileName = oRow.ItemEx("Filename", "")
|
||||
Dim oFullFileName = Path.Combine(oFilePath, oFileName)
|
||||
|
||||
Dim oFileObject As New FileObject With {
|
||||
.ObjectId = pData.ObjectId,
|
||||
.FileHash = oFileHash,
|
||||
.FileSize = oFileSize,
|
||||
.FileExtension = oFileExtension
|
||||
.FileExtension = oFileExtension,
|
||||
.FilePath = oFullFileName
|
||||
}
|
||||
|
||||
If pData.LoadFileContents = True Then
|
||||
Dim oFilePath = oRow.ItemEx("RELPATH", "")
|
||||
Dim oFileName = oRow.ItemEx("Filename", "")
|
||||
Dim oFullFileName = Path.Combine(oFilePath, oFileName)
|
||||
|
||||
If File.Exists(oFullFileName) = False Then
|
||||
Throw New FileNotFoundException("FileObject not Found!", oFullFileName)
|
||||
End If
|
||||
|
||||
@ -125,10 +125,10 @@ Namespace Methods.IDB.NewFile
|
||||
'TODO: File dates in try catch
|
||||
|
||||
Dim oSystemAttributes As New Dictionary(Of String, Object) From {
|
||||
{"OriginFileName", pData.File.FileName},
|
||||
{"OriginCreationDatetime", pData.File.FileCreatedAt},
|
||||
{"OriginChangedDatetime", pData.File.FileChangedAt}
|
||||
}
|
||||
{"OriginFileName", pData.File.FileName},
|
||||
{"OriginCreationDatetime", pData.File.FileCreatedAt},
|
||||
{"OriginChangedDatetime", pData.File.FileChangedAt}
|
||||
}
|
||||
|
||||
For Each oAttribute As KeyValuePair(Of String, Object) In oSystemAttributes
|
||||
Try
|
||||
|
||||
@ -21,25 +21,56 @@ Namespace Methods.IDB.UpdateFile
|
||||
|
||||
Public Function Run(pData As UpdateFileRequest) As UpdateFileResponse
|
||||
|
||||
' TODO: Update file object
|
||||
If Helpers.TestObjectIdExists(pData.ObjectId) = False Then
|
||||
LogAndThrow("ObjectId does not exist!")
|
||||
End If
|
||||
Try
|
||||
' TODO: Update file object
|
||||
If Helpers.TestObjectIdExists(pData.ObjectId) = False Then
|
||||
LogAndThrow("ObjectId does not exist!")
|
||||
End If
|
||||
|
||||
'TODO: Create a view that collects all information about an idb object
|
||||
'TODO: Create a view that collects all information about an idb object
|
||||
|
||||
If pData.CreateNewVersion = False Then
|
||||
If pData.CreateNewVersion = False Then
|
||||
Dim oGetFileObject As New GetFileObject.GetFileObjectMethod(LogConfig, DatabaseIDB, DatabaseECM, GlobalState)
|
||||
Dim oArgs = New GetFileObject.GetFileObjectRequest With {
|
||||
.ObjectId = pData.ObjectId,
|
||||
.LoadFileContents = False
|
||||
}
|
||||
Dim oFileObjectResponse As GetFileObject.GetFileObjectResponse = oGetFileObject.Run(oArgs)
|
||||
|
||||
If oFileObjectResponse.OK = False Then
|
||||
LogAndThrow(oFileObjectResponse.ErrorMessage)
|
||||
End If
|
||||
|
||||
Dim oFileObjectSize As Long = pData.File.FileContents.Length
|
||||
Dim oFileObject As GetFileObject.FileObject = oFileObjectResponse.FileObject
|
||||
Dim oFilePath As String = oFileObject.FilePath
|
||||
|
||||
Try
|
||||
Using oStream = New IO.FileStream(oFilePath, IO.FileMode.Create, IO.FileAccess.Write)
|
||||
Logger.Info("Saving file to path [{0}]", oFilePath)
|
||||
oStream.Write(pData.File.FileContents, 0, oFileObjectSize)
|
||||
oStream.Flush(True)
|
||||
oStream.Close()
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
LogAndThrow(ex, $"Could not write file [{oFilePath}] to disk!")
|
||||
End Try
|
||||
|
||||
Return New UpdateFileResponse(pData.ObjectId)
|
||||
|
||||
Else
|
||||
Throw New ApplicationException("Not implemented!!")
|
||||
|
||||
|
||||
Else
|
||||
End If
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Return New UpdateFileResponse(ex)
|
||||
|
||||
End Try
|
||||
|
||||
|
||||
|
||||
|
||||
Return New UpdateFileResponse(pData.ObjectId)
|
||||
|
||||
'Dim oFilePath As String = Nothing
|
||||
'
|
||||
'Dim oExistingObjectId = TestFileChecksumExists(pData.File.FileChecksum)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user