Sha256: 46833ea4d59cf7757ade04c114e82ef26483db14cf9fa31ad5b900fff2ff9972

Contents?: true

Size: 1.24 KB

Versions: 5

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true
module Hyrax
  ##
  # Methods for Querying Repository to find Embargoed Objects
  class EmbargoService < RestrictionService
    class << self
      # Returns all assets with embargo release date set to a date in the past
      def assets_with_expired_enforced_embargoes
        builder = Hyrax::ExpiredEmbargoSearchBuilder.new(self)
        presenters(builder)
      end
      alias assets_with_expired_embargoes assets_with_expired_enforced_embargoes

      ##
      # Returns all assets with embargoes that are currently enforced,
      # regardless of whether the embargoes are active or expired.
      #
      # @see Hyrax::EmbargoManager
      def assets_with_enforced_embargoes
        builder = Hyrax::EmbargoSearchBuilder.new(self)
        presenters(builder).select(&:enforced?)
      end
      alias assets_under_embargo assets_with_enforced_embargoes

      # Returns all assets that have had embargoes deactivated in the past.
      def assets_with_deactivated_embargoes
        builder = Hyrax::DeactivatedEmbargoSearchBuilder.new(self)
        presenters(builder)
      end

      def search_state_class
        nil
      end

      private

      def presenter_class
        Hyrax::EmbargoPresenter
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hyrax-5.0.2 app/services/hyrax/embargo_service.rb
hyrax-5.0.1 app/services/hyrax/embargo_service.rb
hyrax-5.0.0 app/services/hyrax/embargo_service.rb
hyrax-5.0.0.rc3 app/services/hyrax/embargo_service.rb
hyrax-5.0.0.rc2 app/services/hyrax/embargo_service.rb