5 Commits

Author SHA1 Message Date
Jonathan Jenne
d79340d54f ZooFlow: small tweaks 2021-06-30 14:51:11 +02:00
Jonathan Jenne
6963505fe9 EDMI: Bring Service and Client up to date 2021-06-30 14:49:38 +02:00
Jonathan Jenne
a2374ce427 Config: Version 1.1.2 2021-06-30 14:49:11 +02:00
Jonathan Jenne
ed78d93def Config: Fix error when computerconfig dir does not exist 2021-06-30 14:48:37 +02:00
Jonathan Jenne
321c8fe498 ZooFlow: Improve frmTest 2021-06-30 14:48:13 +02:00
10 changed files with 276 additions and 269 deletions

View File

@@ -1131,7 +1131,6 @@ Public Class frmGlobix_Index
CreateFolderForIndex(String.Empty)
End If
Dim oIDBImportResult As Boolean = False
'Variable Folder
If DropType = "|DROPFROMFSYSTEM|" Or DropType = "|OUTLOOK_ATTACHMENT|" Or DropType = "|ATTMNTEXTRACTED|" Or DropType = "|FW_SIMPLEINDEXER|" Then
@@ -1227,9 +1226,9 @@ Public Class frmGlobix_Index
Return True
End If
End If
Else
Return False
End If
Catch ex As Exception
_Logger.Error(ex)
Return False

View File

@@ -22,17 +22,9 @@ Partial Class frmtest
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.txtFilestoreType = New System.Windows.Forms.TextBox()
Me.Button1 = New System.Windows.Forms.Button()
Me.txtIDBFOPath = New System.Windows.Forms.TextBox()
Me.txtDate = New System.Windows.Forms.TextBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.Button2 = New System.Windows.Forms.Button()
Me.txtIDB_OBJ_ID = New System.Windows.Forms.TextBox()
Me.Button3 = New System.Windows.Forms.Button()
Me.txtFile2Import = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.Button4 = New System.Windows.Forms.Button()
Me.Button5 = New System.Windows.Forms.Button()
Me.CheckBoxKeepExtension = New System.Windows.Forms.CheckBox()
@@ -40,103 +32,45 @@ Partial Class frmtest
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
Me.Button7 = New System.Windows.Forms.Button()
Me.Button8 = New System.Windows.Forms.Button()
Me.Label4 = New System.Windows.Forms.Label()
Me.Label5 = New System.Windows.Forms.Label()
Me.cmbObjectStoreType = New System.Windows.Forms.ComboBox()
Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker()
Me.Label6 = New System.Windows.Forms.Label()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'txtFilestoreType
'
Me.txtFilestoreType.Location = New System.Drawing.Point(16, 62)
Me.txtFilestoreType.Name = "txtFilestoreType"
Me.txtFilestoreType.Size = New System.Drawing.Size(100, 20)
Me.txtFilestoreType.TabIndex = 2
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(152, 58)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(137, 23)
Me.Button1.TabIndex = 3
Me.Button1.Text = "2. GetFileName"
Me.Button1.UseVisualStyleBackColor = True
'
'txtIDBFOPath
'
Me.txtIDBFOPath.Location = New System.Drawing.Point(152, 87)
Me.txtIDBFOPath.Name = "txtIDBFOPath"
Me.txtIDBFOPath.ReadOnly = True
Me.txtIDBFOPath.Size = New System.Drawing.Size(495, 20)
Me.txtIDBFOPath.TabIndex = 4
'
'txtDate
'
Me.txtDate.Location = New System.Drawing.Point(16, 101)
Me.txtDate.Name = "txtDate"
Me.txtDate.Size = New System.Drawing.Size(100, 20)
Me.txtDate.TabIndex = 5
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(16, 43)
Me.Label2.Location = New System.Drawing.Point(9, 66)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(72, 13)
Me.Label2.TabIndex = 6
Me.Label2.Text = "FileStoreType"
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(16, 85)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(30, 13)
Me.Label3.TabIndex = 7
Me.Label3.Text = "Date"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(12, 12)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(277, 23)
Me.Button2.TabIndex = 8
Me.Button2.Text = "1. Get IDB_OBJ_ID"
Me.Button2.UseVisualStyleBackColor = True
'
'txtIDB_OBJ_ID
'
Me.txtIDB_OBJ_ID.DataBindings.Add(New System.Windows.Forms.Binding("Text", Global.DigitalData.GUIs.ZooFlow.Settings.Default, "IDBOBJID", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged))
Me.txtIDB_OBJ_ID.Location = New System.Drawing.Point(295, 14)
Me.txtIDB_OBJ_ID.Location = New System.Drawing.Point(137, 38)
Me.txtIDB_OBJ_ID.Name = "txtIDB_OBJ_ID"
Me.txtIDB_OBJ_ID.Size = New System.Drawing.Size(100, 20)
Me.txtIDB_OBJ_ID.TabIndex = 9
Me.txtIDB_OBJ_ID.Text = Global.DigitalData.GUIs.ZooFlow.Settings.Default.IDBOBJID
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(16, 188)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(175, 23)
Me.Button3.TabIndex = 10
Me.Button3.Text = "3. Import/StreamFile"
Me.Button3.UseVisualStyleBackColor = True
'
'txtFile2Import
'
Me.txtFile2Import.Location = New System.Drawing.Point(16, 162)
Me.txtFile2Import.Location = New System.Drawing.Point(137, 12)
Me.txtFile2Import.Name = "txtFile2Import"
Me.txtFile2Import.Size = New System.Drawing.Size(551, 20)
Me.txtFile2Import.Size = New System.Drawing.Size(426, 20)
Me.txtFile2Import.TabIndex = 11
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(16, 143)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(58, 13)
Me.Label1.TabIndex = 12
Me.Label1.Text = "File2Import"
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(16, 234)
Me.Button4.Location = New System.Drawing.Point(16, 345)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(286, 23)
Me.Button4.TabIndex = 13
@@ -145,7 +79,7 @@ Partial Class frmtest
'
'Button5
'
Me.Button5.Location = New System.Drawing.Point(16, 263)
Me.Button5.Location = New System.Drawing.Point(16, 374)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(286, 23)
Me.Button5.TabIndex = 14
@@ -155,7 +89,9 @@ Partial Class frmtest
'CheckBoxKeepExtension
'
Me.CheckBoxKeepExtension.AutoSize = True
Me.CheckBoxKeepExtension.Location = New System.Drawing.Point(307, 62)
Me.CheckBoxKeepExtension.Checked = True
Me.CheckBoxKeepExtension.CheckState = System.Windows.Forms.CheckState.Checked
Me.CheckBoxKeepExtension.Location = New System.Drawing.Point(16, 19)
Me.CheckBoxKeepExtension.Name = "CheckBoxKeepExtension"
Me.CheckBoxKeepExtension.Size = New System.Drawing.Size(100, 17)
Me.CheckBoxKeepExtension.TabIndex = 15
@@ -164,7 +100,7 @@ Partial Class frmtest
'
'Button6
'
Me.Button6.Location = New System.Drawing.Point(572, 160)
Me.Button6.Location = New System.Drawing.Point(569, 9)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(75, 23)
Me.Button6.TabIndex = 16
@@ -177,7 +113,7 @@ Partial Class frmtest
'
'Button7
'
Me.Button7.Location = New System.Drawing.Point(16, 292)
Me.Button7.Location = New System.Drawing.Point(16, 403)
Me.Button7.Name = "Button7"
Me.Button7.Size = New System.Drawing.Size(286, 23)
Me.Button7.TabIndex = 14
@@ -186,52 +122,115 @@ Partial Class frmtest
'
'Button8
'
Me.Button8.Location = New System.Drawing.Point(666, 14)
Me.Button8.Location = New System.Drawing.Point(12, 142)
Me.Button8.Name = "Button8"
Me.Button8.Size = New System.Drawing.Size(187, 23)
Me.Button8.TabIndex = 17
Me.Button8.Text = "1B. All-In-One"
Me.Button8.Text = "Import File"
Me.Button8.UseVisualStyleBackColor = True
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(9, 14)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(48, 13)
Me.Label4.TabIndex = 18
Me.Label4.Text = "File Path"
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(9, 41)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(47, 13)
Me.Label5.TabIndex = 18
Me.Label5.Text = "ObjectId"
'
'cmbObjectStoreType
'
Me.cmbObjectStoreType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cmbObjectStoreType.FormattingEnabled = True
Me.cmbObjectStoreType.Items.AddRange(New Object() {"Work", "Archive"})
Me.cmbObjectStoreType.Location = New System.Drawing.Point(137, 63)
Me.cmbObjectStoreType.Name = "cmbObjectStoreType"
Me.cmbObjectStoreType.Size = New System.Drawing.Size(121, 21)
Me.cmbObjectStoreType.TabIndex = 19
'
'DateTimePicker1
'
Me.DateTimePicker1.Location = New System.Drawing.Point(137, 90)
Me.DateTimePicker1.Name = "DateTimePicker1"
Me.DateTimePicker1.Size = New System.Drawing.Size(200, 20)
Me.DateTimePicker1.TabIndex = 20
'
'Label6
'
Me.Label6.AutoSize = True
Me.Label6.Location = New System.Drawing.Point(9, 96)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(30, 13)
Me.Label6.TabIndex = 6
Me.Label6.Text = "Date"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(137, 183)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(426, 20)
Me.TextBox1.TabIndex = 21
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(9, 186)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(98, 13)
Me.Label1.TabIndex = 18
Me.Label1.Text = "File Path (Imported)"
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.CheckBoxKeepExtension)
Me.GroupBox1.Location = New System.Drawing.Point(653, 12)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(200, 100)
Me.GroupBox1.TabIndex = 22
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Import Options"
'
'frmtest
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(865, 450)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.DateTimePicker1)
Me.Controls.Add(Me.cmbObjectStoreType)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Button8)
Me.Controls.Add(Me.Button6)
Me.Controls.Add(Me.CheckBoxKeepExtension)
Me.Controls.Add(Me.Button7)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtFile2Import)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.txtIDB_OBJ_ID)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.txtDate)
Me.Controls.Add(Me.txtIDBFOPath)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.txtFilestoreType)
Me.Name = "frmtest"
Me.Text = "frmtest"
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox1.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents txtFilestoreType As TextBox
Friend WithEvents Button1 As Button
Friend WithEvents txtIDBFOPath As TextBox
Friend WithEvents txtDate As TextBox
Friend WithEvents Label2 As Label
Friend WithEvents Label3 As Label
Friend WithEvents Button2 As Button
Friend WithEvents txtIDB_OBJ_ID As TextBox
Friend WithEvents Button3 As Button
Friend WithEvents txtFile2Import As TextBox
Friend WithEvents Label1 As Label
Friend WithEvents Button4 As Button
Friend WithEvents Button5 As Button
Friend WithEvents CheckBoxKeepExtension As CheckBox
@@ -239,4 +238,12 @@ Partial Class frmtest
Friend WithEvents OpenFileDialog1 As OpenFileDialog
Friend WithEvents Button7 As Button
Friend WithEvents Button8 As Button
Friend WithEvents Label4 As Label
Friend WithEvents Label5 As Label
Friend WithEvents cmbObjectStoreType As ComboBox
Friend WithEvents DateTimePicker1 As DateTimePicker
Friend WithEvents Label6 As Label
Friend WithEvents TextBox1 As TextBox
Friend WithEvents Label1 As Label
Friend WithEvents GroupBox1 As GroupBox
End Class

View File

@@ -5,56 +5,56 @@ Imports System.IO
Imports System.Text
Public Class frmtest
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
My.Settings.Save()
Dim oString As String
Dim oextension = ""
Dim oKeepExtension As Boolean = False
If CheckBoxKeepExtension.Checked Then
If txtFile2Import.Text <> String.Empty Then
oextension = Path.GetExtension(txtFile2Import.Text)
oKeepExtension = True
End If
'Private Sub Button1_Click(sender As Object, e As EventArgs)
' My.Settings.Save()
' Dim oString As String
' Dim oextension = ""
' Dim oKeepExtension As Boolean = False
' If CheckBoxKeepExtension.Checked Then
' If txtFile2Import.Text <> String.Empty Then
' oextension = Path.GetExtension(txtFile2Import.Text)
' oKeepExtension = True
' End If
End If
oString = My.Application.Service.Client.CreateFileStoreObject(txtIDB_OBJ_ID.Text, txtFilestoreType.Text, txtDate.Text, oextension, oKeepExtension)
txtIDBFOPath.Text = oString
' End If
' oString = My.Application.Service.Client.CreateFileStoreObject(txtIDB_OBJ_ID.Text, txtFilestoreType.Text, txtDate.Text, oextension, oKeepExtension)
' txtIDBFOPath.Text = oString
End Sub
'End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim oString As String
oString = My.Application.Service.Client.CreateObjectId("DOC", My.Application.User.UserName, "")
txtIDB_OBJ_ID.Text = oString
End Sub
'Private Sub Button2_Click(sender As Object, e As EventArgs)
' Dim oString As String
' oString = My.Application.Service.Client.CreateObjectId("DOC", My.Application.User.UserName, "")
' txtIDB_OBJ_ID.Text = oString
'End Sub
Private Async Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Try
Dim oResult As Boolean = False
'Private Async Sub Button3_Click(sender As Object, e As EventArgs)
' Try
' Dim oResult As Boolean = False
Using oStream As New FileStream(txtFile2Import.Text, FileMode.Open, FileAccess.Read)
Using oMemoryStream As New MemoryStream
oStream.CopyTo(oMemoryStream)
Dim oContents As Byte() = oMemoryStream.ToArray()
oResult = Await My.Application.Service.Client.ImportFileObjectAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, "WORK", txtIDBFOPath.Text)
End Using
End Using
' Using oStream As New FileStream(txtFile2Import.Text, FileMode.Open, FileAccess.Read)
' Using oMemoryStream As New MemoryStream
' oStream.CopyTo(oMemoryStream)
' Dim oContents As Byte() = oMemoryStream.ToArray()
' oResult = Await My.Application.Service.Client.ImportFileObjectAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, "WORK", txtIDBFOPath.Text)
' End Using
' End Using
If oResult = False Then
MsgBox("Oh no error", MsgBoxStyle.Critical)
Else
MsgBox("#Nailedit")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
' If oResult = False Then
' MsgBox("Oh no error", MsgBoxStyle.Critical)
' Else
' MsgBox("#Nailedit")
' End If
' Catch ex As Exception
' MsgBox(ex.Message)
' End Try
'End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Try
Dim oextension = Path.GetExtension(txtFile2Import.Text)
Dim oFile = $"E:\file{oextension}"
Using oInputStream As New FileStream(txtIDBFOPath.Text, FileMode.Open)
Using oInputStream As New FileStream(TextBox1.Text, FileMode.Open)
Using oFileStream As New FileStream(oFile, FileMode.Create, FileAccess.Write)
oInputStream.CopyTo(oFileStream)
End Using
@@ -91,33 +91,26 @@ Public Class frmtest
Dim oExt = Path.GetExtension(txtFile2Import.Text)
Dim oFile = $"E:\file{oExt}"
File.Copy(txtIDBFOPath.Text, oFile)
File.Copy(TextBox1.Text, oFile)
End Sub
Private Async Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
If OpenFileDialog1.ShowDialog() <> DialogResult.OK Then
Exit Sub
End If
txtFile2Import.Text = OpenFileDialog1.FileName
Dim oResult As FileMeta = Await My.Application.Service.Client.NewFileAsync(
Dim oResult As Long = Await My.Application.Service.Client.NewFileAsync(
txtFile2Import.Text,
Environment.UserName,
Date.Now,
"WORK",
DateTimePicker1.Value,
cmbObjectStoreType.Text,
"DEFAULT",
New Client.ImportFileOptions With {
.KeepExtension = True
}
)
MsgBox($"File saved to: [{oResult.FilePath}]")
'oResult = Await My.Application.Service.Client.ImportFileObjectAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, 1, txtIDBFOPath.Text)
txtIDB_OBJ_ID.Text = oResult
MsgBox("File Imported!")
End Sub
Private Sub frmtest_Load(sender As Object, e As EventArgs) Handles MyBase.Load
cmbObjectStoreType.SelectedIndex = 0
End Sub
End Class

View File

@@ -116,6 +116,8 @@ Public Class ConfigManager(Of T)
If ComputerConfigPath <> String.Empty Then
If IO.File.Exists(ComputerConfigPath) Then
_ComputerDirectory = _File.CreateDirectory(ComputerConfigPath, False)
Else
_ComputerDirectory = ComputerConfigPath
End If
_ComputerConfigPath = Path.Combine(_ComputerDirectory, COMPUTER_CONFIG_NAME)
End If

View File

@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.1.1.0")>
<Assembly: AssemblyFileVersion("1.1.1.0")>
<Assembly: AssemblyVersion("1.1.2.0")>
<Assembly: AssemblyFileVersion("1.1.2.0")>

View File

@@ -5,9 +5,12 @@ Imports System.ServiceModel
Imports System.IO
Public Class Client
Private Const INVALID_OBEJCT_ID As Long = 0
Private Const KIND_TYPE_DOC = "DOC"
Private ReadOnly _logger As Logger
Private ReadOnly _channelFactory As ChannelFactory(Of IEDMIServiceChannel)
Private _IPAddressServer As String
Private ReadOnly _IPAddressServer As String
Private _channel As IEDMIServiceChannel
Public Class StreamedFile
@@ -25,10 +28,10 @@ Public Class Client
End Class
''' <summary>
''' Creates a new EDMIAPI object
''' Creates a new EDMI Client object
''' </summary>
''' <param name="LogConfig">LogConfig object</param>
''' <param name="ServiceAdress">The full service url to connect to</param>
''' <param name="ServiceAdress">The full service url to connect to, for example: net.tcp://1.1.1.1:1111/some/path</param>
Public Sub New(LogConfig As LogConfig, ServiceAdress As String)
_logger = LogConfig.GetLogger()
@@ -43,6 +46,12 @@ Public Class Client
End Try
End Sub
''' <summary>
''' Creates a new EDMI Client object
''' </summary>
''' <param name="LogConfig">LogConfig object</param>
''' <param name="IPAddress">The IP address to connect to</param>
''' <param name="PortNumber">The Port number to use for the connection</param>
Public Sub New(LogConfig As LogConfig, IPAddress As String, PortNumber As Integer)
_logger = LogConfig.GetLogger()
@@ -79,34 +88,33 @@ Public Class Client
End Function
''' <summary>
''' Import options for NewFileAsync
''' Import options for NewFileAsync. Contains default values for all options
''' </summary>
Public Class ImportFileOptions
Public KeepExtension As Boolean
Public KeepExtension As Boolean = True
End Class
''' <summary>
''' TODO: Platzhalter
''' TODO: Creates a new object
''' </summary>
''' <returns></returns>
Public Async Function NewObjectAsync() As Task
Throw New NotImplementedException()
End Function
''' <summary>
''' Imports a file from a filepath, creating a IDB ObjectId and Filesystem Object
''' </summary>
''' <param name="pFilePath">Local filepath to a file.</param>
''' <param name="pWho">Windows username of the user responsible for the import.</param>
''' <param name="pWhen">Date when the file was imported. Can be in the past.</param>
''' <param name="pAddedWho">Windows username of the user responsible for the import.</param>
''' <param name="pAddedWhen">Date when the file was imported. Can be in the past.</param>
''' <param name="pObjectStoreType">Type of ObjectStore. Can be WORK or ARCHIVE.</param>
''' <param name="pBusinessEntity">Business entity that the new file object should belong to.</param>
''' <param name="ImportOptions">Other file import options</param>
''' <returns>The ObjectId of the newly generated filesystem object</returns>
''' <param name="pImportOptions">Other file import options</param>
''' <exception cref="FileNotFoundException">When local filepath was not found</exception>
''' <exception cref="ApplicationException">When there was a error in the Service</exception>
Public Async Function NewFileAsync(pFilePath As String, pWho As String, pWhen As Date, pObjectStoreType As String, pBusinessEntity As String, ImportOptions As ImportFileOptions) As Task(Of FileMeta)
Const oKindType = "DOC"
''' <returns>The ObjectId of the newly generated filesystem object</returns>
Public Async Function NewFileAsync(pFilePath As String, pAddedWho As String, pAddedWhen As Date, pObjectStoreType As String, pBusinessEntity As String, pImportOptions As ImportFileOptions) As Task(Of Long)
Try
If File.Exists(pFilePath) = False Then
Throw New FileNotFoundException("ImportFileAsync: Path does not exist")
@@ -117,8 +125,8 @@ Public Class Client
Dim oObjectIdResponse = Await _channel.NewObjectIdAsync(New NewObjectIdRequest With {
.BusinessEntity = pBusinessEntity,
.KindType = oKindType,
.Who = pWho
.KindType = KIND_TYPE_DOC,
.Who = pAddedWho
})
If oObjectIdResponse.ObjectId = Nothing OrElse oObjectIdResponse.ObjectId = 0 Then
@@ -126,9 +134,9 @@ Public Class Client
End If
Dim oFilePathResponse = Await _channel.NewFileObjectAsync(New NewFileObjectRequest With {
.DateImported = pWhen,
.DateImported = pAddedWhen,
.Extension = oExtension,
.KeepExtension = ImportOptions.KeepExtension,
.KeepExtension = pImportOptions.KeepExtension,
.ObjectId = oObjectIdResponse.ObjectId,
.StoreType = pObjectStoreType
})
@@ -146,7 +154,7 @@ Public Class Client
.FilePath = oFilePathResponse.FileObjectPath,
.ObjectId = oObjectIdResponse.ObjectId,
.ObjectStoreType = pObjectStoreType,
.Who = pWho,
.Who = pAddedWho,
.Contents = oContents
})
@@ -156,24 +164,20 @@ Public Class Client
End Using
End Using
Return New FileMeta With {
.ObjectId = oObjectIdResponse.ObjectId,
.FilePath = oFilePathResponse.FileObjectPath
}
Return oObjectIdResponse.ObjectId
Catch ex As Exception
_logger.Error(ex)
Return Nothing
Return INVALID_OBEJCT_ID
End Try
End Function
Public Function CreateObjectId(pKindType As String, pWho As String, pBusinessEntity As String) As Long
Try
Dim oArgs As New NewObjectIdRequest With {
Dim oResponse = _channel.NewObjectId(New NewObjectIdRequest With {
.KindType = pKindType,
.BusinessEntity = pBusinessEntity,
.Who = pWho
}
Dim oResponse = _channel.NewObjectId(oArgs)
})
Return oResponse.ObjectId
Catch ex As Exception
_logger.Error(ex)

View File

@@ -1,4 +0,0 @@
Public Class FileMeta
Public FilePath As String
Public ObjectId As String
End Class

View File

@@ -65,27 +65,29 @@ Public Class DataWithFallback
End Function
Public Function GetUserData(UserName As String, ModuleCode As String, Client As Integer) As UserData
Dim oSQL = $"SELECT * FROM FNDD_CHECK_USER_MODULE('{UserName}','{ModuleCode}',{Client})"
Dim oTable As DataTable = GetDatatable("TBDD_USER_MODULE", $"USERNAME = '{UserName.ToLower}' AND MODULE_SHORT = '{ModuleCode}'", "", oSQL, DatabaseType.ECM)
'Dim oSQL = $"SELECT * FROM FNDD_CHECK_USER_MODULE('{UserName}','{ModuleCode}',{Client})"
'Dim oTable As DataTable = GetDatatable("TBDD_USER_MODULE", $"USERNAME = '{UserName.ToLower}' AND MODULE_SHORT = '{ModuleCode}'", "", oSQL, DatabaseType.ECM)
If oTable Is Nothing Then
Return Nothing
End If
'If oTable Is Nothing Then
' Return Nothing
'End If
If oTable.Rows.Count = 0 Then
Return Nothing
End If
'If oTable.Rows.Count = 0 Then
' Return Nothing
'End If
Dim oRow As DataRow = oTable.Rows.Item(0)
Dim oUserData As New UserData With {
.Id = NotNull(oRow, "USER_ID", -1),
.Surname = NotNull(oRow, "USER_SURNAME", String.Empty),
.Prename = NotNull(oRow, "USER_PRENAME", String.Empty),
.Shortname = NotNull(oRow, "USER_SHORTNAME", String.Empty),
.Email = NotNull(oRow, "USER_EMAIL", String.Empty),
.Language = NotNull(oRow, "USER_LANGUAGE", "de-DE"),
.DateFormat = NotNull(oRow, "USER_DATE_FORMAT", "dd.MM.yyyy")
}
'Dim oRow As DataRow = oTable.Rows.Item(0)
'Dim oUserData As New UserData With {
' .Id = NotNull(oRow, "USER_ID", -1),
' .Surname = NotNull(oRow, "USER_SURNAME", String.Empty),
' .Prename = NotNull(oRow, "USER_PRENAME", String.Empty),
' .Shortname = NotNull(oRow, "USER_SHORTNAME", String.Empty),
' .Email = NotNull(oRow, "USER_EMAIL", String.Empty),
' .Language = NotNull(oRow, "USER_LANGUAGE", "de-DE"),
' .DateFormat = NotNull(oRow, "USER_DATE_FORMAT", "dd.MM.yyyy")
'}
Throw New NotImplementedException()
End Function
End Class

View File

@@ -81,7 +81,6 @@
</Compile>
<Compile Include="Client.vb" />
<Compile Include="DataWithFallback.vb" />
<Compile Include="Client\FileMeta.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>

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