debian-mirror-gitlab/lib/gitlab/jira_import/base_importer.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
1,002 B
Ruby
Raw Normal View History

2020-04-22 19:07:51 +05:30
# frozen_string_literal: true
module Gitlab
module JiraImport
class BaseImporter
2020-05-24 23:13:21 +05:30
attr_reader :project, :client, :formatter, :jira_project_key, :running_import
2020-04-22 19:07:51 +05:30
def initialize(project)
2020-06-23 00:09:42 +05:30
Gitlab::JiraImport.validate_project_settings!(project)
2020-04-22 19:07:51 +05:30
2020-05-24 23:13:21 +05:30
@running_import = project.latest_jira_import
@jira_project_key = running_import&.jira_project_key
2020-04-22 19:07:51 +05:30
raise Projects::ImportService::Error, _('Unable to find Jira project to import data from.') unless @jira_project_key
@project = project
2021-09-30 23:02:18 +05:30
@client = project.jira_integration.client
2020-04-22 19:07:51 +05:30
@formatter = Gitlab::ImportFormatter.new
end
private
def imported_items_cache_key
raise NotImplementedError
end
def mark_as_imported(id)
Gitlab::Cache::Import::Caching.set_add(imported_items_cache_key, id)
end
def already_imported?(id)
Gitlab::Cache::Import::Caching.set_includes?(imported_items_cache_key, id)
end
end
end
end