MS WMsharedrive Integration

This commit is contained in:
2022-11-11 14:37:36 +01:00
parent f01ffe312d
commit 01b066e4e3
19 changed files with 280 additions and 435 deletions

View File

@@ -4,6 +4,7 @@ Imports System.Security.Principal
Imports System.Data.SqlClient
Imports Oracle.ManagedDataAccess.Client
Imports DD_LIB_Standards
Imports DigitalData.Modules.Windream
Public Class frmWM_IndexFile
Dim droptype As String
@@ -11,6 +12,8 @@ Public Class frmWM_IndexFile
Dim MULTIFILES As Integer = 0
Dim formloaded As Boolean = False
Dim DTVWPMO_DOKUMENTTYPES As DataTable
Dim _wm As Windream
Dim oWMObjecttype As String
Public Class SW
Public label As String
@@ -52,7 +55,7 @@ Public Class frmWM_IndexFile
sw = New SW("CheckFileExists")
Dim existsonlyasMaster = False
If clsWD_GET.WDFile_exists(CURRENT_NEWFILENAME.Substring(2), clsDatabase.DB_PROXY_INITIALIZED, ClassProxy.MyLinkedServer) = True Then
If _wm.TestFileExists(CURRENT_NEWFILENAME) = True Then ' clsWM_GET.WDFile_exists(CURRENT_NEWFILENAME.Substring(2), clsDatabase.DB_PROXY_INITIALIZED, ClassProxy.MyLinkedServer) = True Then
Dim msg = "Eine Datei mit identischem Namen existiert bereits! Wollen Sie die bestehende Datei ersetzen?"
If USER_LANGUAGE <> "de-DE" Then
msg = "There is already a file with the same name! Would You like to replace the file?"
@@ -60,7 +63,7 @@ Public Class frmWM_IndexFile
Dim result As MsgBoxResult
result = MessageBox.Show(msg, "File alredy exists:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.Yes Then
If clsWD_SET.Delete_WDFile(CURRENT_NEWFILENAME.Substring(2)) = False Then
If _wm.RemoveFile(CURRENT_NEWFILENAME) Then 'clsWM_SET.Delete_WDFile(CURRENT_NEWFILENAME) = False Then
swWORK_FILE.Done()
Return False
End If
@@ -69,7 +72,7 @@ Public Class frmWM_IndexFile
End If
Else
If clsWD_GET.WDFile_exists(CURRENT_NEWFILENAME.Substring(2), clsDatabase.DB_PROXY_INITIALIZED, ClassProxy.MyLinkedServer, True) = True Then
If _wm.TestFileExists(CURRENT_NEWFILENAME) = True Then ' clsWM_GET.WDFile_exists(CURRENT_NEWFILENAME.Substring(2), clsDatabase.DB_PROXY_INITIALIZED, ClassProxy.MyLinkedServer, True)
ClassHelper.InsertEssential_Log(CURRENT_RECORD_ID, "RECORD-ID", "FILE ALREADY EXISTED WITH NON-USER RIGHTS: " & CURRENT_NEWFILENAME)
CURRENT_NEWFILENAME = ClassHelper.Versionierung_Datei(CURRENT_NEWFILENAME)
existsonlyasMaster = True
@@ -85,7 +88,7 @@ Public Class frmWM_IndexFile
'Stream File to windream
'#################################################################
sw = New SW("File Stream")
Dim streamresult = clsWD_SET.Stream_File(ImportFilePath, CURRENT_NEWFILENAME, False)
Dim streamresult = _wm.NewFileStream(ImportFilePath, CURRENT_NEWFILENAME) 'clsWM_SET.Stream_File(ImportFilePath, CURRENT_NEWFILENAME, False)
sw.Done()
'#################################################################
If streamresult = True Then
@@ -93,13 +96,13 @@ Public Class frmWM_IndexFile
sw = New SW("File Indexing")
CURRENT_FILEIN_WD = CURRENT_NEWFILENAME
Dim DOCID
DOCID = clsWD_GET.Index_GetVariableValue(CURRENT_FILEIN_WD, "Dokument-ID")
DOCID = _wm.GetIndexValue(CURRENT_FILEIN_WD, "Dokument-ID") ' clsWM_GET.Index_GetVariableValue(CURRENT_FILEIN_WD, "Dokument-ID")
If Not IsNothing(DOCID) Then
CURRENT_DOC_ID = DOCID
CURRENT_DOC_ID = DOCID(0)
Else
DOCID = clsWD_GET.Index_GetVariableValue(CURRENT_FILEIN_WD, "Document-ID")
DOCID = _wm.GetIndexValue(CURRENT_FILEIN_WD, "Document-ID") ' clsWM_GET.Index_GetVariableValue(CURRENT_FILEIN_WD, "Document-ID")
If Not IsNothing(DOCID) Then
CURRENT_DOC_ID = DOCID
CURRENT_DOC_ID = DOCID(0)
End If
End If
@@ -124,58 +127,36 @@ Public Class frmWM_IndexFile
'Erst die Objekttyp-Indices indexieren
'den Entity-Key auslesen
Dim DTTBPMO_WD_OBJECTTYPE As DataTable
sql = "Select Top 1 * from TBPMO_WD_OBJECTTYPE where Upper(object_type) = Upper('" & clsWindream.MY_WDOBJECTTYPE & "')"
DTTBPMO_WD_OBJECTTYPE = ClassDatabase.Return_Datatable(sql, True)
sql = "Select Top 1 * from TBPMO_WD_OBJECTTYPE" ' where Upper(object_type) = Upper('" & clsWM.MY_WDOBJECTTYPE & "')"
DTTBPMO_WD_OBJECTTYPE = ClassDatabase.Return_Datatable(sql, True)
If Not DTTBPMO_WD_OBJECTTYPE Is Nothing Then
If DTTBPMO_WD_OBJECTTYPE.Rows.Count = 1 Then
Dim indexname
''den Record_Key auslesen
'Dim indexname = DT.Rows(0).Item("IDXNAME_RECORDID").ToString
'LOGGER.Debug("Record-ID: " & CURRENT_RECORD_ID.ToString, False)
'indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, CURRENT_RECORD_ID, clsWindream.MY_WDOBJECTTYPE)
'If indexierung_erfolgreich = False Then
' err = True
' ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error: ", "Unexpected Error in WorkFile-indexing RecordID '" & indexname & "') - Check logfile!")
' sw.Done()
' Return False
'End If
'den Entity-Key auslesen
'indexname = DT.Rows(0).Item("IDXNAME_ENTITYID").ToString
'LOGGER.Debug("Entity-ID: " & CURRENT_ENTITY_ID.ToString, False)
'indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, CURRENT_ENTITY_ID, clsWindream.MY_WDOBJECTTYPE)
'If indexierung_erfolgreich = False Then
' err = True
' ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error: ", "Unexpected Error in WorkFile-indexing EntityID '" & indexname & "') - Check logfile!")
' sw.Done()
' Return False
'End If
'If CURRENT_REDUNDANT_FORM_ID <> 0 Then
' indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, CURRENT_REDUNDANT_FORM_ID, clsWindream.MY_WDOBJECTTYPE)
'End If
'den Doctype auslesen
indexname = DTTBPMO_WD_OBJECTTYPE.Rows(0).Item("IDXNAME_DOCTYPE").ToString
LOGGER.Debug("Doctype: " & vDokart.ToString, False)
indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, vDokart, clsWindream.MY_WDOBJECTTYPE)
If indexierung_erfolgreich = False Then
err = True
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error: ", "Unexpected Error in WorkFile-indexing Doctype '" & indexname & "') - Check logfile!")
sw.Done()
swWORK_FILE.Done()
Return False
End If
indexname = DTTBPMO_WD_OBJECTTYPE.Rows(0).Item("IDXNAME_RELATION").ToString
indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, "ADDI-RELATION", clsWindream.MY_WDOBJECTTYPE)
If indexierung_erfolgreich = False Then
err = True
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error: ", "Unexpected Error in WorkFile-indexing AddiRelation '" & indexname & "') - Check logfile!")
sw.Done()
swWORK_FILE.Done()
Return False
End If
If DTTBPMO_WD_OBJECTTYPE.Rows.Count = 1 Then
oWMObjecttype = DTTBPMO_WD_OBJECTTYPE.Rows(0).Item("OBJECT_TYPE").ToString
Dim indexname
'den Doctype auslesen
indexname = DTTBPMO_WD_OBJECTTYPE.Rows(0).Item("IDXNAME_DOCTYPE").ToString
LOGGER.Debug("Doctype: " & vDokart.ToString, False)
indexierung_erfolgreich = _wm.SetFileIndex(CURRENT_FILEIN_WD, indexname, vDokart, oWMObjecttype) ' clsWM_SET.IndexFile(CURRENT_FILEIN_WD, indexname, vDokart, oWMObjecttype) 'clsWM.MY_WDOBJECTTYPE)
If indexierung_erfolgreich = False Then
err = True
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error: ", "Unexpected Error in WorkFile-indexing Doctype '" & indexname & "') - Check logfile!")
sw.Done()
swWORK_FILE.Done()
Return False
End If
indexname = DTTBPMO_WD_OBJECTTYPE.Rows(0).Item("IDXNAME_RELATION").ToString
indexierung_erfolgreich = _wm.SetFileIndex(CURRENT_FILEIN_WD, indexname, "ADDI-RELATION", oWMObjecttype) 'clsWM_SET.IndexFile(CURRENT_FILEIN_WD, indexname, "ADDI-RELATION", oWMObjecttype) 'clsWM.MY_WDOBJECTTYPE)
If indexierung_erfolgreich = False Then
err = True
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error: ", "Unexpected Error in WorkFile-indexing AddiRelation '" & indexname & "') - Check logfile!")
sw.Done()
swWORK_FILE.Done()
Return False
End If
End If
End If
sw.Done()
If DT_AUTO_INDEXE Is Nothing = False Then 'CHECK DD
If DT_AUTO_INDEXE.Rows.Count > 0 Then
@@ -238,14 +219,14 @@ Public Class frmWM_IndexFile
End If
LOGGER.Debug("Value for Indexing : '" & idxvalue.ToString & "'", False)
Count += 1
indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, idxvalue, clsWindream.MY_WDOBJECTTYPE)
If indexierung_erfolgreich = False Then
indexierung_erfolgreich = _wm.SetFileIndex(CURRENT_FILEIN_WD, indexname, idxvalue, oWMObjecttype) 'clsWM_SET.IndexFile(CURRENT_FILEIN_WD, indexname, idxvalue, oWMObjecttype) 'clsWM.MY_WDOBJECTTYPE)
If indexierung_erfolgreich = False Then
MsgBox("Unexpected Error in indexing file - See log", MsgBoxStyle.Critical)
err = True
Exit For
End If
'ByVal WD_File As String, ByVal _Indexname As String, ByVal _Value As String
Next
Next
If err = True Then
swWORK_FILE.Done()
Return False
@@ -283,8 +264,8 @@ Public Class frmWM_IndexFile
Next
If IsNothing(CURRENT_DOC_ID) Then
sw = New SW("GettingDocID")
sql = String.Format("SELECT DocID FROM VWPMO_DOC_SYNC WHERE UPPER(FULL_FILENAME) = UPPER('{0}') AND CONVERT(DATE,Change_DateTime) = CONVERT(DATE,GETDATE())", CURRENT_FILEIN_WD)
CURRENT_DOC_ID = ClassDatabase.Execute_Scalar(sql)
sql = String.Format("SELECT DocID FROM VWPMO_DOC_SYNC WHERE FULL_FILENAME = '{0}' AND CONVERT(DATE,Change_DateTime) = CONVERT(DATE,GETDATE())", CURRENT_FILEIN_WD)
CURRENT_DOC_ID = ClassDatabase.Execute_Scalar(sql)
sw.Done()
End If
@@ -314,11 +295,11 @@ Public Class frmWM_IndexFile
Next
End If
If clsWindream.Create_Session() = False Then
MsgBox("Could not create a windream-session!", MsgBoxStyle.Critical)
Else
'Create Session um Fehler bei windows Session nicht zu erzeugen
FAU_AD_USER = ""
If _wm.SessionLoggedin = False Then 'clsWM.Create_Session() = False Then
MsgBox("Could not create a windream-session!", MsgBoxStyle.Critical)
Else
'Create Session um Fehler bei windows Session nicht zu erzeugen
FAU_AD_USER = ""
ClassFileResult.DocID = CURRENT_DOC_ID
ClassFileResult.SET_DOCID_INDICES()
If ClassDOC_SEARCH.CREATE_DOC_RELATED_LINKS(CURRENT_DOC_ID, CURRENT_RECORD_ID) = False Then
@@ -486,7 +467,8 @@ Public Class frmWM_IndexFile
If cmbDokumentart.SelectedIndex <> -1 Then
My.Settings.WD_INDEXDOKART_SAVE = cmbDokumentart.Text
My.Settings.Save()
If clsWindream.Create_Session = True Then
If _wm.SessionLoggedin = True Then 'clsWM.Create_Session = True Then
Handle_File(cmbDokumentart.SelectedValue)
Else
MsgBox("Could not create a windream-session! Please contact Your admin!", MsgBoxStyle.Critical)
@@ -502,7 +484,7 @@ Public Class frmWM_IndexFile
Try
Me.Cursor = Cursors.WaitCursor
SaveMySettingsValue("WD_IndexDeleteDocs", WD_IndexDeleteDocs, "ConfigMain")
clsWindream.MY_WDOBJECTTYPE = Me.OBJECT_TYPETextBox.Text
' clsWM.MY_WDOBJECTTYPE = Me.OBJECT_TYPETextBox.Text
'Multi-Indexer ist aktiv
If chkMultiIndexer.Visible = True And chkMultiIndexer.Checked = True Then
'Die erste Datei indexieren
@@ -1153,6 +1135,7 @@ Public Class frmWM_IndexFile
LOGGER.Debug("frmWD_Index_Dokart_Load", False)
chkdelete_origin.Checked = False
chkdelete_origin.Visible = False
_wm = New Windream(LOGCONFIG, False, WMDriveLetter, WMPATH_PREFIX, True, "", "", "", "")
Dim HandleType As String
For Each row As DataRow In CURRENT_TBPMO_FILES_USER.Rows
If row.Item("GUID") = CURRENT_FILEID Then