MS Integration Services und fileOps
This commit is contained in:
@@ -402,6 +402,75 @@ Public Class Windream2
|
||||
End Function
|
||||
|
||||
#Region "Public Methods"
|
||||
''' <summary>
|
||||
''' changes the archive end date
|
||||
''' </summary>
|
||||
''' <param name="wmfilepath">WM Filepath</param>
|
||||
''' <param name="date_period">number/count of period (if </param>
|
||||
''' <param name="date_unit">date_unity (d,m,y or day(s),month(s),years(s)</param>
|
||||
''' <param name="dateFrom_value">dateFrom_value</param>
|
||||
''' <returns>Returns true when date was set, false if not</returns>
|
||||
''' <remarks></remarks>
|
||||
Public Function NewLifecycle_Period(ByVal wmfilepath As String, ByVal dateFrom_value As Date, ByVal date_period As Double, ByVal date_unit As String)
|
||||
Dim oWMObject As WMObject
|
||||
Try
|
||||
oWMObject = GetFileByPath(wmfilepath)
|
||||
_logger.Info($"Changing the archive end-date for file ' & oWMObject.aName & ' Items: {dateFrom_value},{date_period} {date_unit} ")
|
||||
Try
|
||||
' die Datei sperren
|
||||
oWMObject.LockFor(WMObjectEditModeLifeCycleEdit)
|
||||
_logger.Debug(">> object locked")
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
' nichts tun (Datei ist bereits gesperrt)
|
||||
End Try
|
||||
|
||||
Dim oObjectLifecycle = oWMObject.aWMLifeCycle
|
||||
|
||||
Dim oIntervalType As DateInterval
|
||||
If date_unit.ToLower = "d" Or date_unit.ToLower = "day(s)" Then
|
||||
oIntervalType = DateInterval.Day
|
||||
ElseIf date_unit.ToLower = "m" Or date_unit.ToLower = "month(s)" Then
|
||||
oIntervalType = DateInterval.Month
|
||||
ElseIf date_unit.ToLower = "y" Or date_unit.ToLower = "year(s)" Then
|
||||
oIntervalType = DateInterval.Year
|
||||
End If
|
||||
|
||||
Dim oArchUntil = DateAdd(oIntervalType, date_period, dateFrom_value)
|
||||
_logger.Debug("New date shall be: " & oArchUntil.ToString)
|
||||
oObjectLifecycle.SetPeriodEndDate(2, oArchUntil)
|
||||
_logger.Info("Archive end-date has been changed!")
|
||||
oWMObject.Save()
|
||||
oWMObject.unlock()
|
||||
Return SetArchive_Active(oWMObject)
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Warn($"Unexpected Error in NewLifecycle_Period {ex.Message}")
|
||||
If Not IsNothing(oWMObject) Then
|
||||
If oWMObject.aLocked = True Then
|
||||
oWMObject.unlock()
|
||||
End If
|
||||
End If
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
''' <summary>
|
||||
''' Archives windream object immediately
|
||||
''' </summary>
|
||||
''' <returns>Returns true when archiving was set, false if not</returns>
|
||||
''' <remarks></remarks>
|
||||
Private Function SetArchive_Active(oWMObject As WMObject)
|
||||
Try
|
||||
oWMObject.MoveToArchivePool()
|
||||
_logger.Info("oWMObject has been archived!")
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_logger.Warn($"Unexpected Error in SetArchive_Active {ex.Message}")
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function NewFolder(Path As String) As Boolean
|
||||
If Not TestSessionLoggedIn() Then
|
||||
Return False
|
||||
|
||||
Reference in New Issue
Block a user