Version 1.4.0.0
This commit is contained in:
@@ -106,7 +106,7 @@ Public Class clsDateiverarbeitung
|
||||
|
||||
|
||||
If oArrValue Is Nothing = False Then
|
||||
' MsgBox("now indexing with: " & idxvalue)
|
||||
|
||||
windream_index.RunIndexing(WMdok, oarrIndex, oArrValue, WMObjekttyp)
|
||||
Else
|
||||
Logger.Warn("arrValue is nothing - keine Indexierung")
|
||||
@@ -206,7 +206,60 @@ Public Class clsDateiverarbeitung
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
Public Function Archive_Document(pWMObject As WMObject, pDateOperator As String, pIntervall As Integer, pFromDate As String) As Boolean
|
||||
Dim oDateFrom As Date
|
||||
Try
|
||||
Const WMObjectEditModeLifeCycleEdit = "&H00000080"
|
||||
Const WMLifeCycleTypeArchivePeriod = 2
|
||||
|
||||
pWMObject.LockFor(WMObjectEditModeLifeCycleEdit)
|
||||
Dim oLC = pWMObject.aWMLifeCycle()
|
||||
|
||||
If pFromDate = "Now" Then
|
||||
oDateFrom = Now
|
||||
Else
|
||||
oDateFrom = CDate(pFromDate)
|
||||
End If
|
||||
Dim oDateIntervall As DateInterval
|
||||
Select Case pDateOperator
|
||||
Case "y"
|
||||
oDateIntervall = DateInterval.Year
|
||||
Case "m"
|
||||
oDateIntervall = DateInterval.Month
|
||||
Case "d"
|
||||
oDateIntervall = DateInterval.Day
|
||||
Case Else
|
||||
Logger.Warn($"ATTENTION: Following DateOperator [{pDateOperator}] is not integrated! ")
|
||||
If pWMObject.aLocked Then
|
||||
pWMObject.unlock()
|
||||
End If
|
||||
Return False
|
||||
End Select
|
||||
Dim archBis = DateAdd(oDateIntervall, pIntervall, oDateFrom)
|
||||
'Dim pArchiveDate As String = archBis.ToString("yyyy-MM-dd")
|
||||
oLC.SetPeriodEndDate(WMLifeCycleTypeArchivePeriod, archBis)
|
||||
|
||||
pWMObject.Save()
|
||||
If pWMObject.aLocked Then
|
||||
pWMObject.unlock()
|
||||
End If
|
||||
Logger.Info($"Archive-Date of file [{pWMObject.aName}] was changed successfully!")
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Try
|
||||
If pWMObject.aLocked Then
|
||||
pWMObject.unlock()
|
||||
End If
|
||||
Catch ex1 As Exception
|
||||
|
||||
End Try
|
||||
|
||||
Logger.Error(ex)
|
||||
Logger.Info($"Unexpected error in Archive_Document [{ex.Message}]")
|
||||
Logger.Info($"oDateFrom so far is [{oDateFrom.ToString}]")
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
Private Function BuildExportPath(BasePath As String, FilenameWithoutExtension As String, Extension As String, Optional Version As Integer = 1)
|
||||
Dim oFilename
|
||||
|
||||
@@ -219,63 +272,8 @@ Public Class clsDateiverarbeitung
|
||||
Return Path.Combine(BasePath, oFilename)
|
||||
End Function
|
||||
|
||||
' Alte Funktion 25.03.19
|
||||
'Public Function Export_WMFile2HDD(oWMFile As WMObject, MyExportpath As String)
|
||||
' Try
|
||||
' If Not MyExportpath.EndsWith("\") Then
|
||||
' MyExportpath &= "\"
|
||||
' End If
|
||||
|
||||
|
||||
' Try
|
||||
' Logger.Info("Working on WMFile: " & oWMFile.aName)
|
||||
' Catch ex As Exception
|
||||
' Logger.Error(ex)
|
||||
' Return False
|
||||
' End Try
|
||||
' Dim ExportFileIO = New WMOTOOLLib.WMFileIO ' CreateObject("WMOTOOLLib.WMFileIO") ' New WMOTOOLLib.WMFileIO
|
||||
' Logger.Debug("ExportFileIO created...")
|
||||
|
||||
' Dim oWMStream = oWMFile.OpenStream("BinaryObject", 1)
|
||||
' '### VERSIONIERUNG ###
|
||||
' Dim version As Integer = 2
|
||||
' 'Dim Stammname As String = System.IO.Path.GetFileNameWithoutExtension(Quelle)
|
||||
' Dim oFilename = oWMFile.aName.Substring(0, oWMFile.aName.LastIndexOf("."))
|
||||
' Dim oExtension = oWMFile.aName.Substring(oWMFile.aName.LastIndexOf("."))
|
||||
' Dim oTempFilename As String = MyExportpath & oFilename & oExtension
|
||||
' 'Überprüfen ob File existiert
|
||||
' Do While IO.File.Exists(oTempFilename) = True
|
||||
' oTempFilename = MyExportpath & oFilename & "_" & version & oExtension
|
||||
' version = version + 1
|
||||
' Loop
|
||||
' Logger.Debug("Exportfilename is: " & oTempFilename)
|
||||
' ' den Dateiinhalt der neuen Datei zuweisen
|
||||
' ExportFileIO.bstrOriginalFileName = oTempFilename
|
||||
' ExportFileIO.aWMStream = oWMStream
|
||||
|
||||
' 'Das eigentliche kopieren
|
||||
' ExportFileIO.ExportOriginal(True)
|
||||
' ' close the windream file stream
|
||||
' oWMStream.Close()
|
||||
' If File.Exists(oTempFilename) Then
|
||||
' clsCURRENT.EXPORTED_FILENAME = oTempFilename
|
||||
' Logger.Info($"File Export to HDD [{clsCURRENT.EXPORTED_FILENAME}]was successfull (File.Exists = True)!")
|
||||
' aktfile_Exportresult = clsCURRENT.EXPORTED_FILENAME
|
||||
' clsCURRENT.TEMP_FILES.Add(clsCURRENT.EXPORTED_FILENAME)
|
||||
' Logger.Debug("FileInfo Added to variables...")
|
||||
' Return True
|
||||
' Else
|
||||
' Logger.Warn($"Export not successfull or File.Exists = false Export: [{oTempFilename}]")
|
||||
' Return False
|
||||
' End If
|
||||
|
||||
' Catch ex As Exception
|
||||
' Logger.Error(ex)
|
||||
' Logger.Info("Unexpected error in Export_WMFile: " & ex.Message)
|
||||
' Return False
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
Public Function Rename_File(WMFile As WMObject, konvention As String)
|
||||
Try
|
||||
Logger.Debug("Konvention: '" & konvention & "'")
|
||||
|
||||
Reference in New Issue
Block a user