diff --git a/Modules.Windream/Windream.vb b/Modules.Windream/Windream.vb
index a327fc2e..4b99baa6 100644
--- a/Modules.Windream/Windream.vb
+++ b/Modules.Windream/Windream.vb
@@ -11,19 +11,15 @@ Public Class Windream
Inherits Constants
#Region "+++++ Variables +++++"
Private Shared Logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger
- Public CurrentSession = Nothing
Private CurrentController As WMOSearchController
- Private Shared CurrentWMConnect ' der Typ darf nicht festgelegt werden (warum auch immer... geht sonst nicht)
- Public CurrentWMServer As String
Private WMDriveLetter As String = "W"
- ' New
Private ServerBrowser As IServerBrowser
- Private Session As IWMSession6
- Private Connect As IWMConnect2
+ Private CurrentSession As IWMSession6
+ Private CurrentConnect As IWMConnect2
- Private CurrentServer As String
+ Private CurrentWMServer As String
Private CurrentObjecttypes As WMObjects
Private ReconnectSession As Boolean
@@ -56,7 +52,7 @@ Public Class Windream
Dim objectTypes As WMObjects
Try
- objectTypes = Session.GetWMObjectTypes(WMEntityDocument)
+ objectTypes = CurrentSession.GetWMObjectTypes(WMEntityDocument)
Return objectTypes
Catch ex As Exception
Logger.Error(ex)
@@ -89,7 +85,7 @@ Public Class Windream
Try
' Create Connect Object for Session
- Connect = New WMConnect With {
+ CurrentConnect = New WMConnect With {
.ModuleId = 9
}
Catch ex As Exception
@@ -98,14 +94,14 @@ Public Class Windream
End Try
Try
- Session = New WMSession()
+ CurrentSession = New WMSession()
Catch ex As Exception
Logger.Error(ex, "Could not create WMConnect")
Return False
End Try
Try
- Connect.LoginSession(Session)
+ CurrentConnect.LoginSession(CurrentSession)
LoggedInSession = True
Catch ex As Exception
Logger.Error(ex, "Could not login session")
@@ -114,13 +110,13 @@ Public Class Windream
Try
' Standardmässig hinterlegen dass abgelegte Dateien keine Indexmaske öffnet
- Session.SwitchEvents(WMCOMEventWMSessionNeedIndex, False)
+ CurrentSession.SwitchEvents(WMCOMEventWMSessionNeedIndex, False)
Catch ex As Exception
Logger.Error(ex, "Could not SwitchEvents")
Return False
End Try
- If Not Session.aLoggedin Then
+ If Not CurrentSession.aLoggedin Then
Logger.Warn("Session created but user {0} could not be logged in", Environment.UserName)
Return False
End If
@@ -137,8 +133,10 @@ Public Class Windream
'''
Public Function NewFolder(ByVal folderpath As String)
Try
+ If CurrentSession.aLoggedin Then
+ Return False
+ End If
folderpath = NormalizePath(folderpath)
-
Dim folders() As String = folderpath.Split("\")
For Each folder As String In folders
Dim WMObject As WINDREAMLib.WMObject
@@ -361,6 +359,9 @@ Public Class Windream
'''
Public Function NewObjecttypeForFolder(folderpath As String, folderObjecttype As String) As Boolean
Try
+ If CurrentSession.aLoggedin Then
+ Return False
+ End If
Dim result As Boolean = False
Dim WMFolder As WINDREAMLib.WMObject
folderpath = NormalizePath(folderpath)
@@ -418,6 +419,9 @@ Public Class Windream
'''
Public Function NewVersion(ByVal WMPath As String, ByVal Comment As String)
Try
+ If CurrentSession.aLoggedin Then
+ Return False
+ End If
WMPath = NormalizePath(WMPath)
Dim WMObject As WINDREAMLib.WMObject '= CreateObject("WINDREAMLib.WMObject") 'New WINDREAMLib.WMObject
@@ -444,6 +448,9 @@ Public Class Windream
Public Function GetChoiceLists() As DataTable
Dim dtresult As New DataTable
dtresult.Columns.Add("RESULT", GetType(String))
+ If CurrentSession.aLoggedin Then
+ Return dtresult
+ End If
Try
Dim oChoiceLists As WMObjects
Dim oChoiceList As IWMObject2
@@ -474,6 +481,9 @@ Public Class Windream
'''
Public Function GetIndicesByObjecttype(ByVal ObjecttypeName As String) As String()
Try
+ If CurrentSession.aLoggedin Then
+ Return Nothing
+ End If
Dim oObjectType As WMObject
Dim oIndexAttributes As WMObjectRelation
Dim oIndexAttribute As WMObject
@@ -513,51 +523,51 @@ Public Class Windream
Return Nothing
End Try
End Function
- '''
- ''' Returns all items of a choicelist
- '''
- ''' name of choicelist
- ''' items as String-Array
- '''
- Public Function GetChoicelistItems(ByVal NameChoicelist As String) As DataTable
- Dim dtresult As New DataTable
- dtresult.Columns.Add("RESULT", GetType(String))
- Try
- 'Dim oAttribute = Me.oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname)
- 'Dim vType = oAttribute.getVariableValue("vItems")
- 'Return vType
- Dim oChoiceList = CurrentSession.GetWMObjectByName(WMEntityChoiceList, NameChoicelist)
- If Err.Number = 0 And TypeName(oChoiceList) <> "Nothing" Then
- Dim Values = oChoiceList
- Values = oChoiceList.GetVariableValue("vItems")
- Dim anz As Integer = 0
+ ''''
+ '''' Returns all items of a choicelist
+ ''''
+ '''' name of choicelist
+ '''' items as String-Array
+ ''''
+ 'Public Function GetChoicelistItems(ByVal NameChoicelist As String) As DataTable
+ ' Dim dtresult As New DataTable
+ ' dtresult.Columns.Add("RESULT", GetType(String))
+ ' Try
+ ' 'Dim oAttribute = Me.oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname)
+ ' 'Dim vType = oAttribute.getVariableValue("vItems")
+ ' 'Return vType
+ ' Dim oChoiceList = CurrentSession.GetWMObjectByName(WMEntityChoiceList, NameChoicelist)
+ ' If Err.Number = 0 And TypeName(oChoiceList) <> "Nothing" Then
+ ' Dim oValues = oChoiceList
+ ' oValues = oChoiceList.GetVariableValue("vItems")
+ ' Dim anz As Integer = 0
- For Each CLItem In Values
- If oChoiceList.aName IsNot Nothing Then
- anz += 1
- End If
- Next
- Dim strListe(anz - 1)
- Dim zahl As Integer = 0
- For Each CLItem In Values
- If oChoiceList.aName IsNot Nothing Then
- dtresult.Rows.Add(CLItem)
- strListe(zahl) = CLItem
- zahl += 1
- End If
- dtresult.AcceptChanges()
- Next
- Return dtresult
- Else
- Logger.Warn("WMchoicelist: " & NameChoicelist & " not found!")
- Return dtresult
- End If
+ ' For Each CLItem In oValues
+ ' If oChoiceList.aName IsNot Nothing Then
+ ' anz += 1
+ ' End If
+ ' Next
+ ' Dim strListe(anz - 1)
+ ' Dim zahl As Integer = 0
+ ' For Each CLItem In oValues
+ ' If oChoiceList.aName IsNot Nothing Then
+ ' dtresult.Rows.Add(CLItem)
+ ' strListe(zahl) = CLItem
+ ' zahl += 1
+ ' End If
+ ' dtresult.AcceptChanges()
+ ' Next
+ ' Return dtresult
+ ' Else
+ ' Logger.Warn("WMchoicelist: " & NameChoicelist & " not found!")
+ ' Return dtresult
+ ' End If
- Catch ex As Exception
- Logger.Error(ex)
- Return Nothing
- End Try
- End Function
+ ' Catch ex As Exception
+ ' Logger.Error(ex)
+ ' Return Nothing
+ ' End Try
+ 'End Function
'''
''' Returns all Objecttypes of current server as array of strings
'''
@@ -584,10 +594,13 @@ Public Class Windream
''' Name of the Docid Index
''' Returns datatable
'''
- Public Function GetSearchDocuments(ByVal wdfLocation As String, NameIndexDocID As String)
+ Public Function GetSearchDocuments(ByVal wdfLocation As String, NameIndexDocID As String) As DataTable
Dim dt As New DataTable
dt.Columns.Add("DOC_ID", GetType(Integer))
dt.Columns.Add("PATH", GetType(String))
+ If CurrentSession.aLoggedin Then
+ dt
+ End If
Try
Dim ProfileName = wdfLocation.Substring(wdfLocation.LastIndexOf("\") + 1)
Dim ProfilePath = wdfLocation.Substring(0, wdfLocation.Length - ProfileName.Length)
@@ -609,7 +622,7 @@ Public Class Windream
Case "WMOSRCH.WMQUICKSEARCH"
srchQuick.WMSession = CreateObject("Windream.WMSession", CurrentWMServer)
- CurrentWMConnect.LoginSession(srchQuick.WMSession)
+ CurrentConnect.LoginSession(srchQuick.WMSession)
srchQuick.ClearSearch()
srchQuick.SearchProfilePath = ProfilePath
@@ -620,7 +633,7 @@ Public Class Windream
Case "WMOSRCH.WMINDEXSEARCH"
srchIndex.WMSession = CreateObject("Windream.WMSession", CurrentWMServer)
- CurrentWMConnect.LoginSession(srchIndex.WMSession)
+ CurrentConnect.LoginSession(srchIndex.WMSession)
srchIndex.ClearSearch()
srchIndex.SearchProfilePath = ProfilePath
@@ -631,7 +644,7 @@ Public Class Windream
Case "WMOSRCH.WMOBJECTTYPESEARCH"
srchObjectType.WMSession = CreateObject("Windream.WMSession", CurrentWMServer)
- CurrentWMConnect.LoginSession(srchObjectType.WMSession)
+ CurrentConnect.LoginSession(srchObjectType.WMSession)
srchObjectType.ClearSearch()
srchObjectType.SearchProfilePath = ProfilePath
@@ -671,8 +684,11 @@ Public Class Windream
'''
Public Function GetTypeOfIndexAsInt(ByVal indexname As String) As Integer
Try
+ If CurrentSession.aLoggedin Then
+ Return False
+ End If
Dim oAttribute = CurrentSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname)
- Dim vType = oAttribute.getVariableValue("dwAttrType")
+ Dim vType = oAttribute.GetVariableValue("dwAttrType")
Return vType
Catch ex As Exception
Return Nothing
@@ -732,6 +748,9 @@ Public Class Windream
'''
Public Function Return_VektorArray(ByVal oDocument As WMObject, vktIndexName As String, arrIndexwerte As Object, vType As Object)
Try
+ If CurrentSession.aLoggedin Then
+ Return False
+ End If
Dim missing As Boolean = False
Dim valueCount As Integer = 0
Dim ValueArray() = Nothing
@@ -805,6 +824,9 @@ Public Class Windream
'''
Public Function GetWMObjectForFile(ByVal WMPath As String) As WMObject
Try
+ If CurrentSession.aLoggedin Then
+ Return False
+ End If
WMPath = NormalizePath(WMPath)
Dim oWMObject As WINDREAMLib.WMObject
Try
@@ -829,6 +851,9 @@ Public Class Windream
'''
Public Function TestFolderExists(folderpath As String)
Try
+ If CurrentSession.aLoggedin Then
+ Return False
+ End If
folderpath = NormalizePath(folderpath)
Try
Dim exists = CurrentSession.WMObjectExists(WMEntityFolder, folderpath, 0, 0)
@@ -849,6 +874,9 @@ Public Class Windream
'''
Public Function TestFileExists(ByVal WMPath As String)
Try
+ If CurrentSession.aLoggedin Then
+ Return False
+ End If
WMPath = NormalizePath(WMPath)
Try
Dim WMObject As WINDREAMLib.WMObject = CurrentSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, WMPath)
@@ -874,6 +902,40 @@ Public Class Windream
Return False
End Try
End Function
+ '''
+ ''' Checks if user exists in windream.
+ '''
+ ''' test username
+ ''' Returns true if exists, false if not
+ '''
+ Public Function TestWMUSerExists(username As String) As Boolean
+ Try
+ If TestSession() = False Then
+ Return False
+ End If
+ Return CurrentSession.WMObjectExists(WINDREAMLib.WMEntity.WMEntityUser, username, 0, 0)
+ Catch ex As Exception
+ Logger.Error(ex)
+ Return False
+ End Try
+ End Function
+ '''
+ ''' Checks if group exists in windream.
+ '''
+ ''' test username
+ ''' Returns true if exists, false if not
+ '''
+ Public Function TestWMGroupExists(groupname As String)
+ Try
+ If TestSession() = False Then
+ Return False
+ End If
+ Return CurrentSession.WMObjectExists(WINDREAMLib.WMEntity.WMEntityGroups, groupname, 0, 0)
+ Catch ex As Exception
+ Logger.Error(ex)
+ Return False
+ End Try
+ End Function
#End Region
#Region "+++++ Remove +++++"
'''
diff --git a/TestGUI/Form1.Designer.vb b/TestGUI/Form1.Designer.vb
index f011c98b..2122469a 100644
--- a/TestGUI/Form1.Designer.vb
+++ b/TestGUI/Form1.Designer.vb
@@ -64,7 +64,7 @@ Partial Class Form1
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(16, 55)
Me.Label1.Name = "Label1"
- Me.Label1.Size = New System.Drawing.Size(46, 13)
+ Me.Label1.Size = New System.Drawing.Size(45, 13)
Me.Label1.TabIndex = 5
Me.Label1.Text = "WMFile:"
'
@@ -73,7 +73,7 @@ Partial Class Form1
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(16, 101)
Me.Label2.Name = "Label2"
- Me.Label2.Size = New System.Drawing.Size(56, 13)
+ Me.Label2.Size = New System.Drawing.Size(57, 13)
Me.Label2.TabIndex = 6
Me.Label2.Text = "WMIndex:"
'
@@ -90,7 +90,7 @@ Partial Class Form1
'
Me.txtWMValue.Location = New System.Drawing.Point(287, 117)
Me.txtWMValue.Name = "txtWMValue"
- Me.txtWMValue.Size = New System.Drawing.Size(263, 20)
+ Me.txtWMValue.Size = New System.Drawing.Size(263, 21)
Me.txtWMValue.TabIndex = 8
'
'IndexFile
@@ -116,7 +116,7 @@ Partial Class Form1
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(20, 195)
Me.Label4.Name = "Label4"
- Me.Label4.Size = New System.Drawing.Size(46, 13)
+ Me.Label4.Size = New System.Drawing.Size(45, 13)
Me.Label4.TabIndex = 12
Me.Label4.Text = "WMFile:"
'
@@ -125,7 +125,7 @@ Partial Class Form1
Me.txtwmsearch.DataBindings.Add(New System.Windows.Forms.Binding("Text", Global.TestGUI.My.MySettings.Default, "WMSearch", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged))
Me.txtwmsearch.Location = New System.Drawing.Point(19, 214)
Me.txtwmsearch.Name = "txtwmsearch"
- Me.txtwmsearch.Size = New System.Drawing.Size(535, 20)
+ Me.txtwmsearch.Size = New System.Drawing.Size(535, 21)
Me.txtwmsearch.TabIndex = 11
Me.txtwmsearch.Text = Global.TestGUI.My.MySettings.Default.WMSearch
'
@@ -134,7 +134,7 @@ Partial Class Form1
Me.txtWMIndex.DataBindings.Add(New System.Windows.Forms.Binding("Text", Global.TestGUI.My.MySettings.Default, "WMIndexName", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged))
Me.txtWMIndex.Location = New System.Drawing.Point(15, 117)
Me.txtWMIndex.Name = "txtWMIndex"
- Me.txtWMIndex.Size = New System.Drawing.Size(267, 20)
+ Me.txtWMIndex.Size = New System.Drawing.Size(267, 21)
Me.txtWMIndex.TabIndex = 4
Me.txtWMIndex.Text = Global.TestGUI.My.MySettings.Default.WMIndexName
'
@@ -143,7 +143,7 @@ Partial Class Form1
Me.txtWMFile.DataBindings.Add(New System.Windows.Forms.Binding("Text", Global.TestGUI.My.MySettings.Default, "WMFilepath", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged))
Me.txtWMFile.Location = New System.Drawing.Point(15, 74)
Me.txtWMFile.Name = "txtWMFile"
- Me.txtWMFile.Size = New System.Drawing.Size(535, 20)
+ Me.txtWMFile.Size = New System.Drawing.Size(535, 21)
Me.txtWMFile.TabIndex = 3
Me.txtWMFile.Text = Global.TestGUI.My.MySettings.Default.WMFilepath
'
@@ -189,6 +189,7 @@ Partial Class Form1
Me.Controls.Add(Me.txtWMFile)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button1)
+ Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).EndInit()
diff --git a/TestGUI/Form1.vb b/TestGUI/Form1.vb
index 505bb3e8..d5d622ac 100644
--- a/TestGUI/Form1.vb
+++ b/TestGUI/Form1.vb
@@ -17,7 +17,7 @@ Public Class Form1
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
- MyLogger = New Logger(Logger.PathType.AppData)
+ MyLogger = New Logger(Logger.PathType.CurrentDirectory)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles GetValue.Click