Class: BulkImports::Entity
Overview
The BulkImport::Entity represents a Group or Project to be imported during the bulk import process. An entity is nested under the parent group when it is not a top level group.
A full bulk import entity structure might look like this, where the links are parents:
**Before Import** **After Import**
GroupEntity Group
| | | |
GroupEntity ProjectEntity Group Project
| |
ProjectEntity Project
The tree structure of the entities results in the same structure for imported Groups and Projects.
Constant Summary
collapse
- FailedError =
Class.new(StandardError)
ApplicationRecord::MAX_PLUCK
Class Method Summary
collapse
Instance Method Summary
collapse
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
#serializable_hash
Class Method Details
.all_human_statuses ⇒ Object
84
85
86
|
# File 'app/models/bulk_imports/entity.rb', line 84
def self.all_human_statuses
state_machine.states.map(&:human_name)
end
|
Instance Method Details
#base_resource_url_path ⇒ Object
124
125
126
|
# File 'app/models/bulk_imports/entity.rb', line 124
def base_resource_url_path
"/#{pluralized_name}/#{encoded_source_full_path}"
end
|
#create_pipeline_trackers! ⇒ Object
105
106
107
108
109
110
111
112
113
114
|
# File 'app/models/bulk_imports/entity.rb', line 105
def create_pipeline_trackers!
self.class.transaction do
pipelines.each do |stage, pipeline|
trackers.create!(
stage: stage,
pipeline_name: pipeline
)
end
end
end
|
#encoded_source_full_path ⇒ Object
88
89
90
|
# File 'app/models/bulk_imports/entity.rb', line 88
def encoded_source_full_path
ERB::Util.url_encode(source_full_path)
end
|
#entity_type ⇒ Object
116
117
118
|
# File 'app/models/bulk_imports/entity.rb', line 116
def entity_type
source_type.gsub('_entity', '')
end
|
#export_relations_url_path ⇒ Object
128
129
130
|
# File 'app/models/bulk_imports/entity.rb', line 128
def export_relations_url_path
"#{base_resource_url_path}/export_relations"
end
|
#group? ⇒ Boolean
144
145
146
|
# File 'app/models/bulk_imports/entity.rb', line 144
def group?
source_type == 'group_entity'
end
|
#pipeline_exists?(name) ⇒ Boolean
101
102
103
|
# File 'app/models/bulk_imports/entity.rb', line 101
def pipeline_exists?(name)
pipelines.any? { |_, pipeline| pipeline.to_s == name.to_s }
end
|
#pluralized_name ⇒ Object
120
121
122
|
# File 'app/models/bulk_imports/entity.rb', line 120
def pluralized_name
entity_type.pluralize
end
|
#project? ⇒ Boolean
140
141
142
|
# File 'app/models/bulk_imports/entity.rb', line 140
def project?
source_type == 'project_entity'
end
|
#relation_download_url_path(relation) ⇒ Object
132
133
134
|
# File 'app/models/bulk_imports/entity.rb', line 132
def relation_download_url_path(relation)
"#{export_relations_url_path}/download?relation=#{relation}"
end
|
#update_service ⇒ Object
148
149
150
|
# File 'app/models/bulk_imports/entity.rb', line 148
def update_service
"::#{pluralized_name.capitalize}::UpdateService".constantize
end
|
#wikis_url_path ⇒ Object
136
137
138
|
# File 'app/models/bulk_imports/entity.rb', line 136
def wikis_url_path
"#{base_resource_url_path}/wikis"
end
|