Jonathan Jenne 7b7147eeee 07-12-2022
2022-12-07 16:45:31 +01:00

44 lines
1.5 KiB
VB.net

Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging
Imports ECM.JobRunner.Common
Imports Quartz
Namespace Scheduler.Jobs
Public Class BaseJob
Friend LogConfig As LogConfig
Friend Logger As Logger
Friend Database As MSSQLServer
Friend State As State
Friend Id As Integer
Friend Name As String
Private ctx As IJobExecutionContext
Public Function InitializeJob(context As IJobExecutionContext) As Dictionary(Of String, String)
ctx = context
Dim oJobData = context.MergedJobDataMap
Dim oArgs As Dictionary(Of String, String) = oJobData.Item(Constants.Scheduler.JOB_CONFIG_ARGUMENTS)
LogConfig = oJobData.Item(Constants.Scheduler.JOB_CONFIG_LOGCONFIG)
Database = oJobData.Item(Constants.Scheduler.JOB_CONFIG_DATABASE)
State = oJobData.Item(Constants.Scheduler.JOB_CONFIG_STATE)
Logger = LogConfig.GetLogger()
Id = Integer.Parse(oArgs.Item("Id"))
Name = oArgs.Item("Name")
State.JobStatus.Start(ctx)
Return oJobData.Item(Constants.Scheduler.JOB_CONFIG_ARGUMENTS)
End Function
Public Sub UpdateProgress(pCurrentValue As Integer, pTotalValue As Integer)
State.JobStatus.Update(ctx, pCurrentValue, pTotalValue)
End Sub
Public Sub CompleteJob()
State.JobStatus.Complete(ctx)
End Sub
End Class
End Namespace