Module: Sufia::IdService

Defined in:
lib/sufia/models/id_service.rb

Class Method Summary collapse

Class Method Details

.mintObject



19
20
21
22
23
24
25
26
# File 'lib/sufia/models/id_service.rb', line 19

def self.mint
  @semaphore.synchronize do
    while true
      pid = self.next_id
      return pid unless ActiveFedora::Base.exists?(pid)
    end
  end
end

.noid_templateObject



6
7
8
# File 'lib/sufia/models/id_service.rb', line 6

def self.noid_template
  Sufia.config.noid_template
end

.valid?(identifier) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
# File 'lib/sufia/models/id_service.rb', line 14

def self.valid?(identifier)
  # remove the fedora namespace since it's not part of the noid
  noid = identifier.split(":").last
  return @minter.valid? noid
end