Class: Gitlab::ImportExport::Project::RelationFactory

Inherits:
Base::RelationFactory show all
Defined in:
lib/gitlab/import_export/project/relation_factory.rb

Direct Known Subclasses

Sample::RelationFactory

Constant Summary collapse

OVERRIDES =
{ snippets: :project_snippets,
ci_pipelines: 'Ci::Pipeline',
pipelines: 'Ci::Pipeline',
stages: 'Ci::Stage',
statuses: 'commit_status',
triggers: 'Ci::Trigger',
pipeline_schedules: 'Ci::PipelineSchedule',
builds: 'Ci::Build',
runners: 'Ci::Runner',
hooks: 'ProjectHook',
merge_access_levels: 'ProtectedBranch::MergeAccessLevel',
push_access_levels: 'ProtectedBranch::PushAccessLevel',
create_access_levels: 'ProtectedTag::CreateAccessLevel',
design: 'DesignManagement::Design',
designs: 'DesignManagement::Design',
design_versions: 'DesignManagement::Version',
actions: 'DesignManagement::Action',
labels: :project_labels,
priorities: :label_priorities,
auto_devops: :project_auto_devops,
label: :project_label,
custom_attributes: 'ProjectCustomAttribute',
project_badges: 'Badge',
metrics: 'MergeRequest::Metrics',
ci_cd_settings: 'ProjectCiCdSetting',
error_tracking_setting: 'ErrorTracking::ProjectErrorTrackingSetting',
links: 'Releases::Link',
metrics_setting: 'ProjectMetricsSetting' }.freeze
BUILD_MODELS =
%i[Ci::Build commit_status].freeze
GROUP_REFERENCES =
%w[group_id].freeze
PROJECT_REFERENCES =
%w[project_id source_project_id target_project_id].freeze
EXISTING_OBJECT_RELATIONS =
%i[
  milestone
  milestones
  label
  labels
  project_label
  project_labels
  group_label
  group_labels
  project_feature
  merge_request
  epic
  ProjectCiCdSetting
  container_expiration_policy
  external_pull_request
  external_pull_requests
  DesignManagement::Design
].freeze

Constants inherited from Base::RelationFactory

Base::RelationFactory::IMPORTED_OBJECT_MAX_RETRIES, Base::RelationFactory::TOKEN_RESET_MODELS, Base::RelationFactory::UNIQUE_RELATIONS, Base::RelationFactory::USER_REFERENCES

Instance Method Summary collapse

Methods inherited from Base::RelationFactory

create, existing_object_relations, #initialize, overrides, relation_class

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

This class inherits a constructor from Gitlab::ImportExport::Base::RelationFactory

Instance Method Details

#createObject


61
62
63
64
65
66
67
68
# File 'lib/gitlab/import_export/project/relation_factory.rb', line 61

def create
  @object = super

  # We preload the project, user, and group to re-use objects
  @object = preload_keys(@object, PROJECT_REFERENCES, @importable)
  @object = preload_keys(@object, GROUP_REFERENCES, @importable.group)
  @object = preload_keys(@object, USER_REFERENCES, @user)
end