2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2017-05-05 08:58:05 +00:00
|
|
|
|
|
|
|
module Import
|
|
|
|
class Base
|
|
|
|
|
2018-02-17 11:28:38 +00:00
|
|
|
# Checks if the backend is active.
|
|
|
|
#
|
|
|
|
# @example
|
|
|
|
# Import::ExampleBackend.active?
|
|
|
|
# #=> true
|
|
|
|
#
|
|
|
|
# return [Boolean]
|
|
|
|
def self.active?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2017-05-11 15:18:03 +00:00
|
|
|
# Checks if the backend is able to get queued by the Scheduler.
|
2017-05-05 08:58:05 +00:00
|
|
|
#
|
|
|
|
# @example
|
|
|
|
# Import::ExampleBackend.queueable?
|
|
|
|
# #=> true
|
|
|
|
#
|
|
|
|
# return [Boolean]
|
|
|
|
def self.queueable?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2017-05-11 15:18:03 +00:00
|
|
|
# Checks if the backend is able to get rescheduled in case the Scheduler
|
|
|
|
# got (re-)started while this ImportJob was running. Defaults to false.
|
|
|
|
#
|
|
|
|
# @example
|
|
|
|
# instance = Import::LDAP.new(import_job)
|
|
|
|
# instance.reschedule?(delayed_job)
|
|
|
|
# #=> false
|
|
|
|
#
|
|
|
|
# return [false]
|
|
|
|
def reschedule?(_delayed_job)
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
# Initializes a new instance with a stored reference to the ImportJob.
|
2017-05-05 08:58:05 +00:00
|
|
|
#
|
|
|
|
# @example
|
|
|
|
# instance = Import::ExampleBackend.new(import_job)
|
|
|
|
#
|
|
|
|
# return [Import::ExampleBackend]
|
|
|
|
def initialize(import_job)
|
|
|
|
@import_job = import_job
|
|
|
|
end
|
|
|
|
|
|
|
|
# Starts the life or dry run import of the backend.
|
|
|
|
#
|
|
|
|
# @example
|
|
|
|
# instance = Import::ExampleBackend.new(import_job)
|
|
|
|
#
|
|
|
|
# @raise [RuntimeError] Raised if the implementation of this mandatory method is missing
|
|
|
|
#
|
|
|
|
# return [nil]
|
|
|
|
def start
|
2021-05-25 12:30:12 +00:00
|
|
|
raise "Missing implementation of the 'start' method."
|
2017-05-05 08:58:05 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|