Sha256: 673cf035c0d629218551f1d175b0ff60380a3128aed168cf6d76d600409d2205

Contents?: true

Size: 1.8 KB

Versions: 11

Compression:

Stored size: 1.8 KB

Contents

module Ddr
  module Models
    class Base < ActiveFedora::Base

      include Describable
      include Governable
      include AccessControllable
      include Licensable
      include HasProperties
      include HasThumbnail
      include EventLoggable
      include FixityCheckable
      include FileManagement
      include Indexing
      include Hydra::Validations
      include HasAdminMetadata

      extend Deprecation
      # Deprecate Hydra permissions-related methods
      deprecation_deprecate *(Hydra::AccessControls::Permissions.public_instance_methods)

      after_destroy do
        notify_event :deletion
      end

      def copy_admin_policy_or_permissions_from(other)
        warn "[DEPRECATION] `copy_admin_policy_or_permissions_from` is deprecated." \
             " Use `copy_admin_policy_or_roles_from` instead." \
             " (#{caller.first})."
        copy_admin_policy_or_roles_from(other)
      end

      def copy_admin_policy_or_roles_from(other)
        copy_resource_roles_from(other) unless copy_admin_policy_from(other)
      end

      def association_query(association)
        # XXX Ideally we would include a clause to limit by AF model, but this should suffice
        ActiveFedora::SolrService.construct_query_for_rel(reflections[association].options[:property] => internal_uri)
      end

      # e.g., "Collection duke:1"
      def model_pid
        [self.class.to_s, pid].join(" ")
      end

      # @override ActiveFedora::Core
      # See ActiveFedora overrides in engine initializers
      def adapt_to_cmodel
        super
      rescue ::TypeError
        raise ContentModelError, "Cannot adapt to nil content model."
      end

      def has_extracted_text?
        false
      end

      def legacy_authorization
        Ddr::Auth::LegacyAuthorization.new(self)
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ddr-models-2.0.0 lib/ddr/models/base.rb
ddr-models-2.0.0.rc6 lib/ddr/models/base.rb
ddr-models-2.0.0.rc5 lib/ddr/models/base.rb
ddr-models-2.0.0.rc4 lib/ddr/models/base.rb
ddr-models-2.0.0.rc3 lib/ddr/models/base.rb
ddr-models-2.0.0.rc2 lib/ddr/models/base.rb
ddr-models-2.0.0.rc1 lib/ddr/models/base.rb
ddr-models-2.0.0.pre.5 lib/ddr/models/base.rb
ddr-models-2.0.0.pre.4 lib/ddr/models/base.rb
ddr-models-2.0.0.pre.3 lib/ddr/models/base.rb
ddr-models-2.0.0.pre.2 lib/ddr/models/base.rb