jj: Windream - improve documentation

This commit is contained in:
Jonathan Jenne 2018-10-24 15:54:39 +02:00
parent b2bc096837
commit 028456660f
2 changed files with 101 additions and 59 deletions

View File

@ -17,26 +17,51 @@ Public Class ConnectionBuilder
Me.LogConfig = LogConfig Me.LogConfig = LogConfig
End Sub End Sub
''' <summary>
''' Sets flag in Windream class to reconnect on lost connection
''' </summary>
''' <returns>A IConnectionBuilder instance to allow for chaining</returns>
Public Function WithSessionReconnect() As IConnectionBuilder Implements IConnectionBuilder.WithSessionReconnect Public Function WithSessionReconnect() As IConnectionBuilder Implements IConnectionBuilder.WithSessionReconnect
SessionReconnect = True SessionReconnect = True
Return Me Return Me
End Function End Function
''' <summary>
''' Sets the drive letter of windream drive, default is "W"
''' </summary>
''' <param name="driveLetter">The drive letter to use</param>
''' <returns>A IConnectionBuilder instance to allow for chaining</returns>
Public Function WithDriveLetter(driveLetter As String) As IConnectionBuilder Implements IConnectionBuilder.WithDriveLetter Public Function WithDriveLetter(driveLetter As String) As IConnectionBuilder Implements IConnectionBuilder.WithDriveLetter
Me.DriveLetter = driveLetter Me.DriveLetter = driveLetter
Return Me Return Me
End Function End Function
''' <summary>
''' Sets flag in Windream class to indicate 64-bit support
''' </summary>
''' <returns>A IConnectionBuilder instance to allow for chaining</returns>
Public Function With64BitSupport() As IConnectionBuilder Implements IConnectionBuilder.With64BitSupport Public Function With64BitSupport() As IConnectionBuilder Implements IConnectionBuilder.With64BitSupport
Support64Bit = True Support64Bit = True
Return Me Return Me
End Function End Function
''' <summary>
''' Sets the servername in Windream class, overriding the client setting
''' </summary>
''' <param name="serverName"></param>
''' <returns>A IConnectionBuilder instance to allow for chaining</returns>
Public Function WithServerName(serverName As String) As IConnectionBuilder Implements IConnectionBuilder.WithServerName Public Function WithServerName(serverName As String) As IConnectionBuilder Implements IConnectionBuilder.WithServerName
Me.ServerName = serverName Me.ServerName = serverName
Return Me Return Me
End Function End Function
''' <summary>
''' Sets the username, password and domain in Windream class, overriding the client settings
''' </summary>
''' <param name="userName">The username used for the connection</param>
''' <param name="password">The password used for the connection</param>
''' <param name="domain">The domain used for the connection</param>
''' <returns>A IConnectionBuilder instance to allow for chaining</returns>
Public Function WithImpersonation(userName As String, password As String, domain As String) As IConnectionBuilder Implements IConnectionBuilder.WithImpersonation Public Function WithImpersonation(userName As String, password As String, domain As String) As IConnectionBuilder Implements IConnectionBuilder.WithImpersonation
Me.UserName = userName Me.UserName = userName
Me.Password = password Me.Password = password
@ -44,6 +69,11 @@ Public Class ConnectionBuilder
Return Me Return Me
End Function End Function
''' <summary>
''' Creates a connection.
''' </summary>
''' <exception cref="Exceptions.SessionException">If there was an error while establishing the connection</exception>
''' <returns>A Windream Object</returns>
Public Function Connect() As Windream2 Implements IConnectionBuilder.Connect Public Function Connect() As Windream2 Implements IConnectionBuilder.Connect
Return New Windream2(LogConfig, SessionReconnect, DriveLetter, Support64Bit, ServerName, UserName, Password, Domain) Return New Windream2(LogConfig, SessionReconnect, DriveLetter, Support64Bit, ServerName, UserName, Password, Domain)
End Function End Function

View File

@ -9,53 +9,60 @@ Imports WMOTOOLLib
Imports System.IO Imports System.IO
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
''' <module>Windream</module>
''' <version>0.0.0.2</version>
''' <date>23.10.2018</date>
''' <summary> ''' <summary>
''' MODULE: Windream ''' Module that provides methods to access the Windream ECM
'''
''' 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
'''
''' 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
'''
''' SessionUserName, String
''' Name of the user that is used in the connection. If this is `Nothing`, the currently signed in user is used
'''
''' SessionPassword, String
''' User-password that is used in the connection. If this is `Nothing`, the currently signed in user is used
'''
''' SessionDomain, String
''' User-domain 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)
'''
''' EXAMPLES:
'''
''' REMARKS: This class should not be instanciated directly. Instead, ConnectionBuilder should be used.
''' </summary> ''' </summary>
''' <dependencies>
''' NLog, >= 4.5.8
''' </dependencies>
''' <params>
''' 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`
'''
''' 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
'''
''' SessionUserName, String
''' Name of the user that is used in the connection. If this is `Nothing`, the currently signed in user is used
'''
''' SessionPassword, String
''' User-password that is used in the connection. If this is `Nothing`, the currently signed in user is used
'''
''' SessionDomain, String
''' User-domain that is used in the connection. If this is `Nothing`, the currently signed in user is used
''' </params>
''' <props>
''' ClientDriveLetter, String (readonly)
''' ClientSupports64Bit, Boolean (readonly)
''' Session, IWMSession2 (readonly)
''' SessionLoggedin, Boolean (readonly)
''' SessionReconnect, Boolean (readonly)
''' SessionServername, String (readonly)
''' Objecttypes, List(Of String) (readonly)
''' </props>
''' <example>
''' _windream = New ConnectionBuilder(LogConfig).
''' WithDriveLetter("W").
''' WithSessionReconnect().
''' With64BitSupport().
''' WithServerName("sdd-vmx02-aps01").
''' Connect()
''' </example>
''' <remarks>
''' This class should not be instanciated directly. Instead, ConnectionBuilder should be used.
''' </remarks>
Public Class Windream2 Public Class Windream2
#Region "Private Properties" #Region "Private Properties"
Private ReadOnly _logger As Logger Private ReadOnly _logger As Logger
@ -71,7 +78,7 @@ Public Class Windream2
Public ReadOnly Property ClientSupports64Bit As Boolean Public ReadOnly Property ClientSupports64Bit As Boolean
Public ReadOnly Property Session As IWMSession2 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 SessionReconnect As Boolean
Public ReadOnly Property SessionServername As String Public ReadOnly Property SessionServername As String
@ -621,6 +628,12 @@ Public Class Windream2
End Try End Try
End Function End Function
''' <summary>
''' Returns the result of a search file
''' </summary>
''' <param name="SearchFilePath">Path of a search file (*.wdf)</param>
''' <param name="DocIdIndexName">Index containing the Document-ID</param>
''' <returns>A datatable of the results with columns PATH and DOCID</returns>
Public Function GetSearchDocuments(SearchFilePath As String, DocIdIndexName As String) As DataTable Public Function GetSearchDocuments(SearchFilePath As String, DocIdIndexName As String) As DataTable
Dim oDatatable As New DataTable Dim oDatatable As New DataTable
oDatatable.Columns.Add("PATH", GetType(String)) oDatatable.Columns.Add("PATH", GetType(String))
@ -706,27 +719,20 @@ Public Class Windream2
End Try End Try
End Function End Function
''' <summary> ''' <summary>
''' Gets an array of the actual vektorvalues of index, collated with the passed values ''' Gets an array of the actual vektorvalues of index, collated with the passed values
''' </summary> ''' </summary>
''' <param name="WMDoc">windream-file as WMObject</param> ''' <param name="WindreamObject">windream-file as WMObject</param>
''' <param name="IndexName">Indexname as String</param> ''' <param name="IndexName">Indexname as String</param>
''' <param name="NewValues">The new values as Array</param> ''' <param name="NewValues">The new values as Array</param>
''' <param name="CheckDuplikat">True if duplicates shall be prevented</param> ''' <param name="CheckDuplikat">True if duplicates shall be prevented</param>
''' <exception cref="Exceptions.SessionException"></exception> ''' <exception cref="Exceptions.SessionException"></exception>
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 Try
Dim oAnzahl As Integer = 0 Dim oAnzahl As Integer = 0
Dim oValueArray() Dim oValueArray()
'Jeden Wert des Vektorfeldes durchlaufen 'Jeden Wert des Vektorfeldes durchlaufen
Dim oWMValue = WMDoc.GetVariableValue(IndexName) Dim oWMValue = WindreamObject.GetVariableValue(IndexName)
If oWMValue Is Nothing = False Then If oWMValue Is Nothing = False Then
'Nochmals prüfen ob wirklich Array 'Nochmals prüfen ob wirklich Array
If oWMValue.GetType.ToString.Contains("System.Object") Then If oWMValue.GetType.ToString.Contains("System.Object") Then
@ -819,6 +825,13 @@ Public Class Windream2
Return Nothing Return Nothing
End Try End Try
End Function End Function
''' <summary>
''' Sets objecttype of a folder
''' </summary>
''' <param name="FolderPath"></param>
''' <param name="Objecttype"></param>
''' <returns></returns>
Public Function SetFolderObjecttype(FolderPath As String, Objecttype As String) As Boolean Public Function SetFolderObjecttype(FolderPath As String, Objecttype As String) As Boolean
If TestSessionLoggedIn() = False Then If TestSessionLoggedIn() = False Then
Return False Return False
@ -869,8 +882,7 @@ Public Class Windream2
End If End If
Try Try
Dim oTempSession As IWMSession2 = DirectCast(Session, IWMSession2) Dim oWMObject As WMObject = Session.GetWMObjectByName(WMEntityAttribute, Path)
Dim oWMObject As WMObject = oTempSession.GetWMObjectByName(WMEntityAttribute, Path)
If oWMObject Is Nothing Then If oWMObject Is Nothing Then
Return False Return False
@ -913,7 +925,7 @@ Public Class Windream2
Dim oNewValues As New List(Of Object) Dim oNewValues As New List(Of Object)
oNewValues = oVectorValues.Except(New List(Of Object) From {ValueToDelete}).ToList() oNewValues = oVectorValues.Except(New List(Of Object) From {ValueToDelete}).ToList()
' BEGIN WRITE INDEX ' BEGIN WRITE INDEX
If LockObject(oWMObject, WMObjectEditModeIndexEdit) = False Then If LockObject(oWMObject, WMObjectEditModeIndexEdit) = False Then
_logger.Warn("File {0} could not be locked") _logger.Warn("File {0} could not be locked")
Return False Return False