From 028456660fca9dabd7672d11e198c48463889c68 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 24 Oct 2018 15:54:39 +0200 Subject: [PATCH] jj: Windream - improve documentation --- Modules.Windream/ConnectionBuilder.vb | 30 +++++++ Modules.Windream/Windream2.vb | 118 ++++++++++++++------------ 2 files changed, 95 insertions(+), 53 deletions(-) diff --git a/Modules.Windream/ConnectionBuilder.vb b/Modules.Windream/ConnectionBuilder.vb index 7cefc255..da7e5321 100644 --- a/Modules.Windream/ConnectionBuilder.vb +++ b/Modules.Windream/ConnectionBuilder.vb @@ -17,26 +17,51 @@ Public Class ConnectionBuilder Me.LogConfig = LogConfig End Sub + ''' + ''' Sets flag in Windream class to reconnect on lost connection + ''' + ''' A IConnectionBuilder instance to allow for chaining Public Function WithSessionReconnect() As IConnectionBuilder Implements IConnectionBuilder.WithSessionReconnect SessionReconnect = True Return Me End Function + ''' + ''' Sets the drive letter of windream drive, default is "W" + ''' + ''' The drive letter to use + ''' A IConnectionBuilder instance to allow for chaining Public Function WithDriveLetter(driveLetter As String) As IConnectionBuilder Implements IConnectionBuilder.WithDriveLetter Me.DriveLetter = driveLetter Return Me End Function + ''' + ''' Sets flag in Windream class to indicate 64-bit support + ''' + ''' A IConnectionBuilder instance to allow for chaining Public Function With64BitSupport() As IConnectionBuilder Implements IConnectionBuilder.With64BitSupport Support64Bit = True Return Me End Function + ''' + ''' Sets the servername in Windream class, overriding the client setting + ''' + ''' + ''' A IConnectionBuilder instance to allow for chaining Public Function WithServerName(serverName As String) As IConnectionBuilder Implements IConnectionBuilder.WithServerName Me.ServerName = serverName Return Me End Function + ''' + ''' Sets the username, password and domain in Windream class, overriding the client settings + ''' + ''' The username used for the connection + ''' The password used for the connection + ''' The domain used for the connection + ''' A IConnectionBuilder instance to allow for chaining Public Function WithImpersonation(userName As String, password As String, domain As String) As IConnectionBuilder Implements IConnectionBuilder.WithImpersonation Me.UserName = userName Me.Password = password @@ -44,6 +69,11 @@ Public Class ConnectionBuilder Return Me End Function + ''' + ''' Creates a connection. + ''' + ''' If there was an error while establishing the connection + ''' A Windream Object Public Function Connect() As Windream2 Implements IConnectionBuilder.Connect Return New Windream2(LogConfig, SessionReconnect, DriveLetter, Support64Bit, ServerName, UserName, Password, Domain) End Function diff --git a/Modules.Windream/Windream2.vb b/Modules.Windream/Windream2.vb index 125338eb..b9ab51af 100644 --- a/Modules.Windream/Windream2.vb +++ b/Modules.Windream/Windream2.vb @@ -9,53 +9,60 @@ Imports WMOTOOLLib Imports System.IO Imports DigitalData.Modules.Logging +''' Windream +''' 0.0.0.2 +''' 23.10.2018 ''' -''' MODULE: Windream -''' -''' VERSION: 0.0.0.2 -''' -''' DATE: 08.10.2018 -''' -''' DESCRIPTION: -''' -''' DEPENDENCIES: NLog, >= 4.5.8 -''' -''' PARAMETERS: LogConfig, DigitalData.Modules.Logging.LogConfig -''' The LogFactory containing the current log config. Used to instanciate the class logger for this and any dependent class +''' Module that provides methods to access the Windream ECM +''' +''' +''' NLog, >= 4.5.8 +''' +''' +''' LogConfig, DigitalData.Modules.Logging.LogConfig +''' The LogFactory containing the current log config. Used to instanciate the class logger for this and any dependent class ''' -''' ClientDriveLetter, String -''' Drive Letter of the Windream Drive, should default to `W` +''' ClientDriveLetter, String +''' Drive Letter of the Windream Drive, should default to `W` ''' -''' ClientSupport64Bit, Boolean -''' Should this session support 64bit methods/functionality? -''' -''' SessionReconnect, Boolean -''' Should the session reconnect automatically when the connection to the server is lost? -''' -''' SessionServerName, String -''' Name of the server used in the connection. If this is `Nothing`, the current server defined in the client is used +''' ClientSupport64Bit, Boolean +''' Should this session support 64bit methods/functionality? ''' -''' SessionUserName, String -''' Name of the user that is used in the connection. If this is `Nothing`, the currently signed in user is used +''' SessionReconnect, Boolean +''' Should the session reconnect automatically when the connection to the server is lost? ''' -''' SessionPassword, String -''' User-password that is used in the connection. If this is `Nothing`, the currently signed in user is used +''' SessionServerName, String +''' Name of the server used in the connection. If this is `Nothing`, the current server defined in the client is used ''' -''' SessionDomain, String -''' User-domain that is used in the connection. If this is `Nothing`, the currently signed in user is used +''' SessionUserName, String +''' Name of the user that is used in the connection. If this is `Nothing`, the currently signed in user is used ''' -''' PROPERTIES: ClientDriveLetter, String (readonly) -''' ClientSupports64Bit, Boolean (readonly) -''' Session, IWMSession2 (readonly) -''' SessionLoggedin, Boolean (readonly) -''' SessionReconnect, Boolean (readonly) -''' SessionServername, String (readonly) -''' Objecttypes, List(Of String) (readonly) +''' SessionPassword, String +''' User-password that is used in the connection. If this is `Nothing`, the currently signed in user is used ''' -''' EXAMPLES: -''' -''' REMARKS: This class should not be instanciated directly. Instead, ConnectionBuilder should be used. -''' +''' SessionDomain, String +''' User-domain that is used in the connection. If this is `Nothing`, the currently signed in user is used +''' +''' +''' ClientDriveLetter, String (readonly) +''' ClientSupports64Bit, Boolean (readonly) +''' Session, IWMSession2 (readonly) +''' SessionLoggedin, Boolean (readonly) +''' SessionReconnect, Boolean (readonly) +''' SessionServername, String (readonly) +''' Objecttypes, List(Of String) (readonly) +''' +''' +''' _windream = New ConnectionBuilder(LogConfig). +''' WithDriveLetter("W"). +''' WithSessionReconnect(). +''' With64BitSupport(). +''' WithServerName("sdd-vmx02-aps01"). +''' Connect() +''' +''' +''' This class should not be instanciated directly. Instead, ConnectionBuilder should be used. +''' Public Class Windream2 #Region "Private Properties" Private ReadOnly _logger As Logger @@ -71,7 +78,7 @@ Public Class Windream2 Public ReadOnly Property ClientSupports64Bit As Boolean Public ReadOnly Property Session As IWMSession2 - Public ReadOnly Property SessionLoggedin As Boolean + Public ReadOnly Property SessionLoggedin As Boolean = False Public ReadOnly Property SessionReconnect As Boolean Public ReadOnly Property SessionServername As String @@ -621,6 +628,12 @@ Public Class Windream2 End Try End Function + ''' + ''' Returns the result of a search file + ''' + ''' Path of a search file (*.wdf) + ''' Index containing the Document-ID + ''' A datatable of the results with columns PATH and DOCID Public Function GetSearchDocuments(SearchFilePath As String, DocIdIndexName As String) As DataTable Dim oDatatable As New DataTable oDatatable.Columns.Add("PATH", GetType(String)) @@ -706,27 +719,20 @@ Public Class Windream2 End Try End Function - - - - - - - ''' ''' Gets an array of the actual vektorvalues of index, collated with the passed values ''' - ''' windream-file as WMObject + ''' windream-file as WMObject ''' Indexname as String ''' The new values as Array ''' True if duplicates shall be prevented ''' - Public Function GetVektorData_Combined(ByVal WMDoc As WMObject, IndexName As String, NewValues As Object, CheckDuplikat As Boolean) + Public Function GetVektorData_Combined(ByVal WindreamObject As WMObject, IndexName As String, NewValues As Object, CheckDuplikat As Boolean) Try Dim oAnzahl As Integer = 0 Dim oValueArray() 'Jeden Wert des Vektorfeldes durchlaufen - Dim oWMValue = WMDoc.GetVariableValue(IndexName) + Dim oWMValue = WindreamObject.GetVariableValue(IndexName) If oWMValue Is Nothing = False Then 'Nochmals prüfen ob wirklich Array If oWMValue.GetType.ToString.Contains("System.Object") Then @@ -819,6 +825,13 @@ Public Class Windream2 Return Nothing End Try End Function + + ''' + ''' Sets objecttype of a folder + ''' + ''' + ''' + ''' Public Function SetFolderObjecttype(FolderPath As String, Objecttype As String) As Boolean If TestSessionLoggedIn() = False Then Return False @@ -869,8 +882,7 @@ Public Class Windream2 End If Try - Dim oTempSession As IWMSession2 = DirectCast(Session, IWMSession2) - Dim oWMObject As WMObject = oTempSession.GetWMObjectByName(WMEntityAttribute, Path) + Dim oWMObject As WMObject = Session.GetWMObjectByName(WMEntityAttribute, Path) If oWMObject Is Nothing Then Return False @@ -913,7 +925,7 @@ Public Class Windream2 Dim oNewValues As New List(Of Object) oNewValues = oVectorValues.Except(New List(Of Object) From {ValueToDelete}).ToList() - ' BEGIN WRITE INDEX + ' BEGIN WRITE INDEX If LockObject(oWMObject, WMObjectEditModeIndexEdit) = False Then _logger.Warn("File {0} could not be locked") Return False