Method: Sufia::AdminSetCreateService.create_default!

Defined in:
app/services/sufia/admin_set_create_service.rb

.create_default!Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/services/sufia/admin_set_create_service.rb', line 4

def self.create_default!
  return if AdminSet.exists?(AdminSet::DEFAULT_ID)
  admin_set = AdminSet.new(id: AdminSet::DEFAULT_ID, title: ['Default Admin Set'])
  begin
    new(admin_set, nil, AdminSet::DEFAULT_WORKFLOW_NAME).create
  rescue ActiveFedora::IllegalOperation
    # It is possible that another thread created the AdminSet just before this method
    # was called, so ActiveFedora will raise IllegalOperation. In this case we can safely
    # ignore the error.
    Rails.logger.error("AdminSet ID=#{AdminSet::DEFAULT_ID} may or may not have been created due to threading issues.")
  end
end