source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/list_source_exporter.rb | Ruby | apache-2.0 | 197 | main | 967 | # frozen_string_literal: true
module Hyrax
##
# @deprecated see Hyrax::GraphExporter::ListSourceExporter
#
# Retrieves the graph for an object with the internal triples removed
# and the uris translated to external uris.
class ListSourceExporter < GraphExporter::ListSourceExporter
##
# @param [Strin... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/graph_exporter.rb | Ruby | apache-2.0 | 197 | main | 4,786 | # frozen_string_literal: true
module Hyrax
##
# @api public
#
# Retrieves the graph for an object with the internal triples removed
# and the uris translated to external uris.
class GraphExporter
##
# @param [SolrDocument, #id] solr_document idea here is that in the future, ActiveFedora may serializ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/derivative_bucketed_storage.rb | Ruby | apache-2.0 | 197 | main | 838 | # frozen_string_literal: true
# this class overrides the Valkyrie::Storage::Disk::BucketStorage class so that file paths match
module Hyrax
class DerivativeBucketedStorage
attr_reader :base_path
def initialize(base_path:)
@base_path = base_path
end
# rubocop:disable Lint/UnusedMethodArgument
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/time_service.rb | Ruby | apache-2.0 | 197 | main | 464 | # frozen_string_literal: true
module Hyrax
##
# Give the current time in UTC
#
# Use of this service allows a single integration point timestamps. If your
# application (or test suite) needs to provide a special time for "now", you
# can override it here.
#
# @example
# Hyrax::TimeService.time_in_ut... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/edit_permissions_service.rb | Ruby | apache-2.0 | 197 | main | 9,936 | # frozen_string_literal: true
module Hyrax
##
# @api public
#
# Encapsulates the logic to determine which object permissions may be edited by a given user
# * user is permitted to update any work permissions coming ONLY from collections they manage
# * user is not permitted to update a work permission if it... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/form_metadata_service.rb | Ruby | apache-2.0 | 197 | main | 656 | # frozen_string_literal: true
module Hyrax
# Answers queries about the cardinality of each field on the form.
class FormMetadataService < HydraEditor::FieldMetadataService
# @param [Class] model_class the class of the object
# @param [Symbol] field the field we want to know about
# @return [Boolean] tru... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/virus_checker_service.rb | Ruby | apache-2.0 | 197 | main | 1,583 | # frozen_string_literal: true
module Hyrax
# Responsible for checking if the given file is a virus. Coordinates
# with the underlying system virus scanner.
class VirusCheckerService
attr_accessor :original_file, :system_virus_scanner
# @api public
# @param original_file [String, #path]
# @return ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/permission_manager.rb | Ruby | apache-2.0 | 197 | main | 5,250 | # frozen_string_literal: true
module Hyrax
##
# Provides setters and getters for the three most common permission modes:
# - :discover
# - :edit
# - :read
#
# @example
# my_resource = Hyrax.persister.save(resource: Hyrax::Resource.new)
# permissions = PermissionManager.new(resource: my_reso... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/multiple_membership_checker.rb | Ruby | apache-2.0 | 197 | main | 7,157 | # frozen_string_literal: true
module Hyrax
# Service class for checking an item's collection memberships, to
# make sure that the item is not added to multiple single-membership
# collections
class MultipleMembershipChecker
attr_reader :item
# @param [#member_of_collection_ids] item an object that belo... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/caching_iiif_manifest_builder.rb | Ruby | apache-2.0 | 197 | main | 1,744 | # frozen_string_literal: true
module Hyrax
##
# constructs IIIF Manifests and holds them in the Rails cache,
# this approach avoids long manifest build times for some kinds of requests,
# at the cost of introducing cache invalidation issues.
class CachingIiifManifestBuilder < ManifestBuilderService
KEY_P... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/embargo_manager.rb | Ruby | apache-2.0 | 197 | main | 10,416 | # frozen_string_literal: true
module Hyrax
##
# Provides utilities for managing the lifecycle of an `Hyrax::Embargo` on a
# `Hyrax::Resource`.
#
# The embargo terminology used here is as follows:
#
# - "Release Date" is the day an embargo is scheduled to be released.
# - "Under Embargo" means the... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/lease_service.rb | Ruby | apache-2.0 | 197 | main | 1,237 | # frozen_string_literal: true
module Hyrax
##
# Methods for Querying Repository to find Objects with leases
class LeaseService < RestrictionService
class << self
# Returns all assets with lease expiration date set to a date in the past
def assets_with_expired_enforced_leases
builder = Hyra... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/lockable.rb | Ruby | apache-2.0 | 197 | main | 406 | # frozen_string_literal: true
require 'forwardable'
module Hyrax
module Lockable
extend Forwardable
extend ActiveSupport::Concern
def_delegator :lock_manager, :lock, :acquire_lock_for
def lock_manager
@lock_manager ||= LockManager.new(
Hyrax.config.lock_time_to_live,
Hyrax.con... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/derivative_path.rb | Ruby | apache-2.0 | 197 | main | 2,156 | # frozen_string_literal: true
module Hyrax
class DerivativePath
attr_reader :id, :destination_name
class << self
# Path on file system where derivative file is stored
# @param [ActiveFedora::Base or String] object either the AF object or its id
# @param [String] destination_name
def d... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/solr_query_service.rb | Ruby | apache-2.0 | 197 | main | 9,141 | # frozen_string_literal: true
module Hyrax
##
# Supports building and executing a solr query.
#
# @note Methods in this class are providing functionality previously supported by
# ActiveFedora::SolrQueryBuilder.
class SolrQueryService < ::SearchBuilder # rubocop:disable Metrics/ClassLength
class_attri... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/batch_create_failure_service.rb | Ruby | apache-2.0 | 197 | main | 458 | # frozen_string_literal: true
module Hyrax
class BatchCreateFailureService < AbstractMessageService
attr_reader :user, :messages
def initialize(user, messages)
@user = user
@messages = messages.to_sentence
end
def message
I18n.t('hyrax.notifications.batch_create_failure.message', us... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/quick_classification_query.rb | Ruby | apache-2.0 | 197 | main | 1,546 | # frozen_string_literal: true
module Hyrax
##
# Provides an enumerator of the Work classes the user is authorized to create.
#
# @example
# QuickClassificationQuery.new(user: current_user).to_a
class QuickClassificationQuery
##
# @!attribute [r] user
# @return [::User]
attr_reader :user
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/restriction_service.rb | Ruby | apache-2.0 | 197 | main | 710 | # frozen_string_literal: true
module Hyrax
class RestrictionService
class << self
##
# @note needed to construct SearchBuilders using self in Blacklight 7+
delegate :blacklight_config, to: :config
private
def presenter_class
raise "RestrictionService is an Abstract class an... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/visibility_map.rb | Ruby | apache-2.0 | 197 | main | 2,210 | # frozen_string_literal: true
module Hyrax
##
# Defines a map from a visibility string value to appropriate permissions
# representing that visibility.
#
# @see Hyrax::VisibilityReader
# @see Hyrax::VisibilityWriter
# @see Hyrax::Resource#visibility
class VisibilityMap
DEFAULT_MAP = {
Hydra::... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/find_objects_via_solr_service.rb | Ruby | apache-2.0 | 197 | main | 1,836 | # frozen_string_literal: true
module Hyrax
# @deprecated This class is being replaced by Hyrax::SolrQueryService #get_objects method.
#
# Methods in this class search solr to get the ids and then use the query service to find the objects.
class FindObjectsViaSolrService
class_attribute :solr_query_builder, ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/solr_service.rb | Ruby | apache-2.0 | 197 | main | 8,076 | # frozen_string_literal: true
module Hyrax
##
# Supports a range of basic Solr interactions.
#
# This class replaces `ActiveFedora::SolrService`, which is deprecated for
# internal use.
class SolrService # rubocop:disable Metrics/ClassLength
COMMIT_PARAMS = { softCommit: true }.freeze
##
# @!g... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/access_control_list.rb | Ruby | apache-2.0 | 197 | main | 6,982 | # frozen_string_literal: true
module Hyrax
##
# @api public
#
# Cast an object to its AccessControlList
#
# @param [Object] an object to try to cast
#
# @return [Hyrax::AccessControlList]
def self.AccessControlList(obj)
case obj
when AccessControlList
obj
else
obj.try(:permiss... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/versioning_service.rb | Ruby | apache-2.0 | 197 | main | 5,326 | # frozen_string_literal: true
module Hyrax
##
# Provides methods for dealing with versions of files across both ActiveFedora
# and Valkyrie.
#
# Note that many of the methods pertaining to version creation are currently
# implemented as static methods.
class VersioningService
##
# @!attribute [rw... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/local_file_service.rb | Ruby | apache-2.0 | 197 | main | 332 | # frozen_string_literal: true
module Hyrax
class LocalFileService
# @param [String] file_name path to the file
# @param [Hash] _options
# @yield [File] opens the file and yields it to the block
def self.call(file_name, _options)
File.open(file_name) do |file|
yield(file)
end
en... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/persist_derivatives.rb | Ruby | apache-2.0 | 197 | main | 1,495 | # frozen_string_literal: true
module Hyrax
class PersistDerivatives < Hydra::Derivatives::PersistOutputFileService
# Persists a derivative to the local file system.
# This Service conforms to the signature of `Hydra::Derivatives::PersistOutputFileService`.
# This service is an alternative to the default H... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/curation_concern.rb | Ruby | apache-2.0 | 197 | main | 3,039 | # frozen_string_literal: true
module Hyrax
class CurationConcern
##
# The actor middleware stack can be customized like so:
# # Adding a new middleware
# Hyrax::CurationConcern.actor_factory.use MyCustomActor
#
# # Inserting a new middleware at a specific position
# Hyrax::Curation... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/working_directory.rb | Ruby | apache-2.0 | 197 | main | 2,544 | # frozen_string_literal: true
module Hyrax
# @deprecated Use JobIoWrapper instead
class WorkingDirectory
class << self
# @deprecated No longer used anywhere in Hyrax code, naively assumes filenames of versions/revisions are distinct
# Returns the file passed as filepath if that file exists. Otherwis... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/batch_create_success_service.rb | Ruby | apache-2.0 | 197 | main | 379 | # frozen_string_literal: true
module Hyrax
class BatchCreateSuccessService < AbstractMessageService
attr_reader :user
def initialize(user)
@user = user
end
def message
I18n.t('hyrax.notifications.batch_create_success.message', user: user)
end
def subject
I18n.t('hyrax.noti... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/simple_schema_loader.rb | Ruby | apache-2.0 | 197 | main | 2,681 | # frozen_string_literal: true
module Hyrax
##
# @api private
#
# This is a simple yaml config-driven schema loader
#
# @see config/metadata/basic_metadata.yaml for an example configuration
class SimpleSchemaLoader < Hyrax::SchemaLoader
def view_definitions_for(schema:, version: 1, contexts: nil) # ru... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/valkyrie_upload.rb | Ruby | apache-2.0 | 197 | main | 4,004 | # frozen_string_literal: true
class Hyrax::ValkyrieUpload
# @param [IO] io
# @param [String] filename
# @param [Hyrax::FileSet] file_set
# @param [Valkyrie::StorageAdapter] storage_adapter
# @param [RDF::URI] use
# @param [User] user
#
# @see Hyrax::FileMetadata::Use
# @return [Hyrax::FileMetadata] t... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/visibility_reader.rb | Ruby | apache-2.0 | 197 | main | 1,451 | # frozen_string_literal: true
module Hyrax
##
# Translates a set of ACLs into a visibility string.
#
# @example
# resource = Hyrax::Resource.new
# reader = Hyrax::VisibilityReader.new(resource: resource)
# reader.read # => "restricted"
#
# resource.read_groups = ["public"]
# reader.read... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/collection_thumbnail_path_service.rb | Ruby | apache-2.0 | 197 | main | 250 | # frozen_string_literal: true
module Hyrax
class CollectionThumbnailPathService < Hyrax::ThumbnailPathService
class << self
def default_image
ActionController::Base.helpers.image_path 'collection.png'
end
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/work_uploads_handler.rb | Ruby | apache-2.0 | 197 | main | 7,014 | # frozen_string_literal: true
module Hyrax
##
# @api public
#
# Mediates uploads to a work.
#
# Given an existing Work object, `#add` some set of files, then call `#attach`
# to handle creation/attachment of File Sets, and trigger persistence of files
# to the storage backend.
#
# This class provid... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/messenger_service.rb | Ruby | apache-2.0 | 197 | main | 264 | # frozen_string_literal: true
module Hyrax
class MessengerService
def self.deliver(sender, recipients, body, subject, *args)
sender.send_message(recipients, body, subject, *args)
StreamNotificationsJob.perform_later(recipients)
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/file_set_fixity_check_service.rb | Ruby | apache-2.0 | 197 | main | 5,088 | # frozen_string_literal: true
module Hyrax
##
# This class runs fixity checks on a {FileSetBehavior}, potentially on multiple
# files each with multiple versions in the +FileSet+.
#
# The fixity check itself is performed by {FixityCheckJob}, which
# just uses the fedora service to ask for fixity verificatio... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/solr_query_builder_service.rb | Ruby | apache-2.0 | 197 | main | 5,161 | # frozen_string_literal: true
module Hyrax
##
# @deprecated
# This class is being replaced by Hyrax::SolrQueryService.
#
# Methods in this class are from/based on ActiveFedora::SolrQueryBuilder
#
# @see Hyrax::SolrQueryService
class SolrQueryBuilderService
class << self
# Construct a solr quer... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/database_migrator.rb | Ruby | apache-2.0 | 197 | main | 2,469 | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/active_record'
module Hyrax
##
# {Hyrax::DatabaseMigrator} is responsible for copying {Hyrax}'s required database
# migrations into applications.
#
# Rails engines typically use the built-in +[ENGINE_NAME]:install:migrations+
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/manifest_builder_service.rb | Ruby | apache-2.0 | 197 | main | 2,535 | # frozen_string_literal: true
module Hyrax
##
# A class responsible for converting a Hyrax::Work like thing into a IIIF
# manifest.
#
# @see !{.as_json}
class ManifestBuilderService
##
# @api public
#
# @param presenter [Hyrax::WorkShowPresenter] the work presenter from which
# w... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/search_service.rb | Ruby | apache-2.0 | 197 | main | 839 | # frozen_string_literal: true
module Hyrax
class SearchService < Blacklight::SearchService
private
def scope
@context[:scope]
end
def method_missing(method_name, *arguments, &block)
if scope&.respond_to?(method_name)
Deprecation.warn("Calling `#{method_name}` on scope " \
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/resource_types_service.rb | Ruby | apache-2.0 | 197 | main | 797 | # frozen_string_literal: true
module Hyrax
module ResourceTypesService
def self.authority
@authority ||= Qa::Authorities::Local.subauthority_for('resource_types')
end
def self.authority=(val)
@authority = val
end
def self.select_options
authority.all.map do |element|
[e... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/form_factory.rb | Ruby | apache-2.0 | 197 | main | 780 | # frozen_string_literal: true
module Hyrax
##
# A factory class for Hyrax forms.
#
# @note We use a factory class (rather than a factory method like `.for`) to
# provide compatibility with the legacy `Hyrax::WorkFormService`.
#
# @example
# factory = Hyrax::FormFactory.new
#
# form_change_set... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/admin_set_create_service.rb | Ruby | apache-2.0 | 197 | main | 12,164 | # frozen_string_literal: true
module Hyrax
# Responsible for creating a Hyrax::AdministrativeSet and its corresponding data.
#
# * An associated permission template
# * Available workflows
# * An active workflow
#
# @see Hyrax::AdministrativeSet
# @see Hyrax::PermissionTemplate
# @see Sipity::Workflow... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/indexes_thumbnails.rb | Ruby | apache-2.0 | 197 | main | 888 | # frozen_string_literal: true
module Hyrax
module IndexesThumbnails
extend ActiveSupport::Concern
included do
class_attribute :thumbnail_path_service
self.thumbnail_path_service = ThumbnailPathService
class_attribute :thumbnail_field
self.thumbnail_field = 'thumbnail_path_ss'
end
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/user_stat_importer.rb | Ruby | apache-2.0 | 197 | main | 5,507 | # frozen_string_literal: true
module Hyrax
# Cache work view, file view & file download stats for all users
# this is called by 'rake hyrax:stats:user_stats'
class UserStatImporter
UserRecord = Struct.new("UserRecord", :id, :user_key, :last_stats_update)
def initialize(options = {})
if options[:ver... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/change_content_depositor_service.rb | Ruby | apache-2.0 | 197 | main | 2,794 | # frozen_string_literal: true
module Hyrax
class ChangeContentDepositorService
# Set the given `user` as the depositor of the given `work`; If
# `reset` is true, first remove all previous permissions.
#
# @param work [ActiveFedora::Base, Valkyrie::Resource] the work
# that is receiving... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/qa_select_service.rb | Ruby | apache-2.0 | 197 | main | 2,274 | # frozen_string_literal: true
module Hyrax
# This is an abstract class to provide select options from a
# questioning authority backed authority
class QaSelectService
attr_reader :authority
def initialize(authority_name)
@authority = Qa::Authorities::Local.subauthority_for(authority_name)
end
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/default_middleware_stack.rb | Ruby | apache-2.0 | 197 | main | 2,602 | # frozen_string_literal: true
module Hyrax
##
# Defines the Hyrax "Actor Stack", used in creation of works when using
# +ActiveFedora+.
#
# @note this stack, and the Actor classes it calls, is not used when
# +Valkyrie+ models are defined by the application. in that context,
# this behavior is replace... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/visibility_intention_applicator.rb | Ruby | apache-2.0 | 197 | main | 1,206 | # frozen_string_literal: true
module Hyrax
##
# Applies a `VisibilityIntention` to a repository object.
class VisibilityIntentionApplicator
##
# @!attribute [rw] intention
# @return [VisibilityIntention]
attr_accessor :intention
##
# @param [VisibilityIntention] intention
def initia... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/m3_schema_loader.rb | Ruby | apache-2.0 | 197 | main | 4,611 | # frozen_string_literal: true
module Hyrax
##
# @api private
#
# Read m3 profiles from the database
#
# @see config/metadata_profiles/m3_profile.yaml for an example configuration
class M3SchemaLoader < Hyrax::SchemaLoader
def view_definitions_for(schema:, version: 1, contexts: nil)
definitions(... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/work_query_service.rb | Ruby | apache-2.0 | 197 | main | 1,539 | # frozen_string_literal: true
module Hyrax
# Responsible for retrieving information based on the given work.
#
# @see ProxyDepositRequest
# @see Hyrax::VaklyrieWorkRelation
# @see SolrDocument
# @see Hyrax::SolrService
# @see ActiveFedora::SolrQueryBuilder
# @note This was extracted from the ProxyDeposi... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/m3_profile_editor.rb | Ruby | apache-2.0 | 197 | main | 963 | # frozen_string_literal: true
module Hyrax
class M3ProfileEditor
attr_accessor :profile_path
def initialize(profile_path)
@profile_path = profile_path
end
def profile_data
return @profile_data if @profile_data
# Use the provided path or default to the dassie m3_profile.yaml
r... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/collections_service.rb | Ruby | apache-2.0 | 197 | main | 1,553 | # frozen_string_literal: true
module Hyrax
class CollectionsService < Hyrax::SearchService
attr_reader :context
class_attribute :list_search_builder_class
self.list_search_builder_class = Hyrax::CollectionSearchBuilder
# @param [#repository,#blacklight_config,#current_ability] context
def initia... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/contextual_path.rb | Ruby | apache-2.0 | 197 | main | 1,325 | # frozen_string_literal: true
module Hyrax
##
# @api public
#
# Provides a polymorphic path for a target object (presenter) nested under the
# path of the parent, if given.
#
# @see WorkShowPresenter#contextual_path
#
# @example
# Hyrax::ContextualPath.new(my_file_set, parent_object).show
# # ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/listeners.rb | Ruby | apache-2.0 | 197 | main | 1,206 | # frozen_string_literal: true
module Hyrax
# @note
# Did you encounter an exception similar to the following:
#
# "A copy of Hyrax::Listeners::ObjectLifecycleListener has been removed from the module tree but is still active!"
#
# You may need to register a listener as autoload. See
# ./app/s... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/valkyrie_persist_derivatives.rb | Ruby | apache-2.0 | 197 | main | 3,126 | # frozen_string_literal: true
module Hyrax
class ValkyriePersistDerivatives < Hydra::Derivatives::PersistOutputFileService
# Persists a derivative using the defined Valkyrie storage adapter
#
# This Service conforms to the signature of `Hydra::Derivatives::PersistOutputFileService`.
# This service is ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/file_set_visibility_propagator.rb | Ruby | apache-2.0 | 197 | main | 1,226 | # frozen_string_literal: true
module Hyrax
##
# Propagates visibility from a given Work to its FileSets
class FileSetVisibilityPropagator
##
# @!attribute [rw] source
# @return [#visibility]
attr_accessor :source
##
# @param source [#visibility] the object to propagate visibility from
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/noid.rb | Ruby | apache-2.0 | 197 | main | 385 | # frozen_string_literal: true
module Hyrax
module Noid
extend ActiveSupport::Concern
## This overrides the default behavior, which is to ask Fedora for an id
# @see ActiveFedora::Persistence.assign_id
def assign_id
service.mint if Hyrax.config.enable_noids?
end
private
def service... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/work_thumbnail_path_service.rb | Ruby | apache-2.0 | 197 | main | 237 | # frozen_string_literal: true
module Hyrax
class WorkThumbnailPathService < Hyrax::ThumbnailPathService
class << self
def default_image
ActionController::Base.helpers.image_path 'work.png'
end
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/derivative_service.rb | Ruby | apache-2.0 | 197 | main | 2,011 | # frozen_string_literal: true
# @api public
#
# A factory class _and_ interface defining class that finds the **first** valid registered service for the given object.
#
# The .for method is the factory. The instance_methods of this class defines the interface.
#
# @see https://github.com/samvera-labs/newspaper_works/... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/repository_fixity_check_service.rb | Ruby | apache-2.0 | 197 | main | 472 | # frozen_string_literal: true
module Hyrax
class RepositoryFixityCheckService
# This is a service that folks can use in their own rake tasks,
# etc. It is not otherwise called or relied upon in Hyrax.
# @see https://github.com/samvera/hyrax/wiki/Hyrax-Management-Guide#fixity-checking
def self.fixity_c... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/file_set_derivatives_service.rb | Ruby | apache-2.0 | 197 | main | 5,840 | # frozen_string_literal: true
module Hyrax
# Responsible for creating and cleaning up the derivatives of a file_set
class FileSetDerivativesService
attr_reader :file_set
delegate :mime_type, to: :file_set
# @param file_set [Hyrax::FileSet, Hyrax::FileMetadata] At least for this class, it must have #uri... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/permission_template_applicator.rb | Ruby | apache-2.0 | 197 | main | 1,511 | # frozen_string_literal: true
module Hyrax
##
# Applies a `PermissionTemplate` to a given model object by adding the
# template's manage and view users to the model's permissions.
#
# @example applying a template
# applicator = PermissionTemplateApplicator.new(template: my_template)
# applicator.apply... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/resource_visibility_propagator.rb | Ruby | apache-2.0 | 197 | main | 1,652 | # frozen_string_literal: true
module Hyrax
##
# Propagates visibility from a valkyrie Work to its FileSets
class ResourceVisibilityPropagator
##
# @!attribute [rw] source
# @return [#visibility]
attr_accessor :source
##
# @!attribute [r] embargo_manager
# @return [Hyrax::EmbargoM... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/resource_status.rb | Ruby | apache-2.0 | 197 | main | 1,770 | # frozen_string_literal: true
module Hyrax
##
# Implements the Fedora objState ontology against the given resource.
#
# Use the provided constants as values for `#status` to set state. The
# boolean methods provide easy checking of state.
#
# We assume that no-state, means none of the three object status... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/work_form_service.rb | Ruby | apache-2.0 | 197 | main | 427 | # frozen_string_literal: true
module Hyrax
##
# A factory that builds work forms based on the `#model_name` of the work.
class WorkFormService
def self.build(curation_concern, current_ability, *extra)
form_class(curation_concern).new(curation_concern, current_ability, *extra)
end
def self.form_... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/file_set_csv_service.rb | Ruby | apache-2.0 | 197 | main | 1,576 | # frozen_string_literal: true
require 'csv'
module Hyrax
#
# Generates CSV from a FileSet
#
# @attr_reader [FileSet] file_set file that will be examined to generate the CSVs
# @attr_reader [Array] terms list of terms that will be output in CSV form
# @attr_reader [String] multi_value_separator separator fo... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/work_resource_query_service.rb | Ruby | apache-2.0 | 197 | main | 1,185 | # frozen_string_literal: true
module Hyrax
# Responsible for retrieving information based on the given work.
#
# @see ProxyDepositRequest
# @see SolrDocument
# @see Hyrax::SolrService
# @note This was extracted from the ProxyDepositRequest, which was coordinating lots of effort. It was also an ActiveRecord ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/rights_statement_service.rb | Ruby | apache-2.0 | 197 | main | 256 | # frozen_string_literal: true
module Hyrax
# Provide select options for the copyright status (edm:rights) field
class RightsStatementService < QaSelectService
def initialize(_authority_name = nil)
super('rights_statements')
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/custom_queries.rb | Ruby | apache-2.0 | 197 | main | 1,187 | # frozen_string_literal: true
module Hyrax
##
# These custom queries are used throughout the Hyrax codebase. They are
# intended for use with Valkyrie's custom query interface (i.e. you
# shouldn't call classes in this namespace directly except to configure that
# interface).
#
# In this namespace, we pro... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/schema_loader.rb | Ruby | apache-2.0 | 197 | main | 5,391 | # frozen_string_literal: true
module Hyrax
##
# @api private
#
# This is a simple yaml config-driven schema loader
#
# @see config/metadata/basic_metadata.yaml for an example configuration
class SchemaLoader
class UndefinedSchemaError < ArgumentError; end
##
# @param [Symbol] schema
#
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/admin_set_service.rb | Ruby | apache-2.0 | 197 | main | 2,579 | # frozen_string_literal: true
module Hyrax
# Returns AdminSets that the current user has permission to use.
class AdminSetService
attr_reader :context, :search_builder
class_attribute :default_search_builder
self.default_search_builder = Hyrax::AdminSetSearchBuilder
# @param [#repository,#blacklig... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/microdata.rb | Ruby | apache-2.0 | 197 | main | 2,657 | # frozen_string_literal: true
module Hyrax
# Responsible for extracting information related to Schema.org microdata.
#
# You may load more than one source file. Source files that are later in the load process will overlay files that are earlier.
#
# @see Hyrax::Microdata.load_paths
# @see Hyrax::Microdata.f... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/callbacks.rb | Ruby | apache-2.0 | 197 | main | 2,391 | # frozen_string_literal: true
module Hyrax
##
# @deprecated
module Callbacks
extend ActiveSupport::Concern
included do
# Define class instance variable as endpoint to the
# Callback::Registry api.
@callback = Registry.new
end
module ClassMethods
# Reader for class instan... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/lease_manager.rb | Ruby | apache-2.0 | 197 | main | 7,538 | # frozen_string_literal: true
module Hyrax
##
# Provides utilities for managing the lifecycle of an `Hyrax::Lease` on a
# `Hyrax::Resource`.
#
# The lease terminology used here is as follows:
#
# - "Expiration Date" is the day a lease is scheduled to expire.
# - "Under Lease" means the lease is "... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/embargo_service.rb | Ruby | apache-2.0 | 197 | main | 1,272 | # 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 = Hy... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/collection_member_service.rb | Ruby | apache-2.0 | 197 | main | 964 | # frozen_string_literal: true
module Hyrax
##
# Returns a list of solr documents for collections the item is a part of
class CollectionMemberService
include Blacklight::Configurable
attr_reader :item, :current_ability
copy_blacklight_config_from(CatalogController)
##
# @param [SolrDocument... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/lock_manager.rb | Ruby | apache-2.0 | 197 | main | 1,917 | # frozen_string_literal: true
require 'redlock'
module Hyrax
class LockManager
class UnableToAcquireLockError < StandardError; end
##
# @param [Fixnum] time_to_live How long to hold the lock in milliseconds
# @param [Fixnum] retry_count How many times to retry to acquire the lock before raising Unabl... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/identifier/registrar.rb | Ruby | apache-2.0 | 197 | main | 1,091 | # frozen_string_literal: true
module Hyrax
module Identifier
class Registrar
class << self
##
# @param type [Symbol]
# @param opts [Hash]
# @option opts [Hyrax::Identifier::Builder] :builder
#
# @return [Hyrax::Identifier::Registrar] a registrar for the given ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/identifier/dispatcher.rb | Ruby | apache-2.0 | 197 | main | 2,178 | # frozen_string_literal: true
module Hyrax
module Identifier
class Dispatcher
##
# @!attribute [rw] registrar
# @return [Hyrax::Identifier::Registrar]
attr_accessor :registrar
##
# @param registrar [Hyrax::Identifier::Registrar]
def initialize(registrar:)
@regi... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/identifier/builder.rb | Ruby | apache-2.0 | 197 | main | 1,478 | # frozen_string_literal: true
module Hyrax
module Identifier
##
# Builds an identifier string.
#
# Implementations must accept a `prefix:` to `#initialize`, and a `hint:` to
# `#build`. Either or both may be used at the preference of the specific
# implementer or ignored entirely when `#build`... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/permission_generator.rb | Ruby | apache-2.0 | 197 | main | 5,306 | # frozen_string_literal: true
require 'active_support/core_ext/array/wrap'
module Hyrax
module Workflow
##
# @api public
#
# This has three major uses:
#
# * To assign Work specific permissions (e.g. Sipity::EntitySpecificResponsibility)
# - a depositor of a work has a Work specific per... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/workflow_action_service.rb | Ruby | apache-2.0 | 197 | main | 1,922 | # frozen_string_literal: true
module Hyrax
module Workflow
# Responsible for coordinating the behavior of an action taken within a workflow
class WorkflowActionService
def self.run(subject:, action:, comment: nil)
new(subject: subject, action: action, comment: comment).run
end
def i... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/workflow_importer.rb | Ruby | apache-2.0 | 197 | main | 7,866 | # frozen_string_literal: true
module Hyrax
module Workflow
# Responsible for loading workflows from a data source.
#
# @see .load_workflows
# @see .generate_from_json_file
class WorkflowImporter
class_attribute :default_logger
self.default_logger = Hyrax.logger
class_attribute :p... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/permission_query.rb | Ruby | apache-2.0 | 197 | main | 20,440 | # frozen_string_literal: true
module Hyrax
module Workflow
# Welcome intrepid developer. You have stumbled into some complex data
# interactions. There are a lot of data collaborators regarding these tests.
# I would love this to be more in isolation, but that is not in the cards as
# there are at lea... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/sipity_actions_generator.rb | Ruby | apache-2.0 | 197 | main | 3,681 | # frozen_string_literal: true
module Hyrax
module Workflow
# Responsible for creating database entries for the given workflow's actions
class SipityActionsGenerator
# @api public
#
# Responsible for creating database entries for the given workflow's actions
#
# @param [Sipity::Wo... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/action_taken_service.rb | Ruby | apache-2.0 | 197 | main | 3,127 | # frozen_string_literal: true
module Hyrax
module Workflow
# Responsible for performing additional functions when the given criteria is met.
class ActionTakenService
# For the given target and :action
# - Find the appropriate "function" to call
# - Then call that function. If the function re... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/status_list_service.rb | Ruby | apache-2.0 | 197 | main | 3,270 | # frozen_string_literal: true
module Hyrax
module Workflow
##
# @deprecated use the Hyrax::Workflow::ActionableObjects enumerator instead.
# that service is designed as a more efficient and ergonomic replacement
# for this one, and has fewer dependencies on specific indexing behavior.
#
# ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/notification_configuration_parameter.rb | Ruby | apache-2.0 | 197 | main | 1,581 | # frozen_string_literal: true
module Hyrax
module Workflow
# Helps consolidate and map a notification configuration.
#
# @note In an effort to appease Rubocop, I'm crafting this parameter object. It makes more sense anyway.
class NotificationConfigurationParameter
def self.build_from_workflow_ac... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/revoke_edit_from_depositor.rb | Ruby | apache-2.0 | 197 | main | 783 | # frozen_string_literal: true
module Hyrax
module Workflow
##
# This is a built in function for workflow, so that a workflow action can be created that
# removes the creators the ability to alter it.
module RevokeEditFromDepositor
def self.call(target:, **)
return true unless target.try(... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/activate_object.rb | Ruby | apache-2.0 | 197 | main | 545 | # frozen_string_literal: true
module Hyrax
module Workflow
module ActivateObject
##
# This is a built in function for workflow, setting the +#state+
# of the target to the Fedora +active+ status URI
#
# @param target [#state] an instance of a model with a +#state+ property;
# ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/method_generator.rb | Ruby | apache-2.0 | 197 | main | 1,480 | # frozen_string_literal: true
module Hyrax
module Workflow
# Responsible for writing the database records for the given :action and :method list.
class MethodGenerator
# @api public
#
# @param action [Sipity::WorkflowAction]
# @param list [Array<String>]
def self.call(action:, li... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/grant_read_to_depositor.rb | Ruby | apache-2.0 | 197 | main | 890 | # frozen_string_literal: true
module Hyrax
module Workflow
##
# This is a built in function for workflow, so that a workflow action can be created that
# grants the creator the ability to view their work.
module GrantReadToDepositor
# @param [#read_users=, #read_users] target to which we are add... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/notification_service.rb | Ruby | apache-2.0 | 197 | main | 2,654 | # frozen_string_literal: true
module Hyrax
module Workflow
# Responsible for determining the appropriate notification(s) to deliver based on the given
# criteria.
class NotificationService
# @api public
#
# For the given :entity and :action
# - For each associated notification
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/actionable_objects.rb | Ruby | apache-2.0 | 197 | main | 2,986 | # frozen_string_literal: true
module Hyrax
module Workflow
##
# Produces a list of workflow-ready objects for a given user. Results are
# given as a presenter objects with SolrDocument-like behavior, with added
# support for workflow states.
#
# @example
# Hyrax::Workflow::ActionableObje... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/workflow_permissions_generator.rb | Ruby | apache-2.0 | 197 | main | 1,679 | # frozen_string_literal: true
module Hyrax
module Workflow
# Responsible for creating database entries for the given workflow's permissions
class WorkflowPermissionsGenerator
# @api public
#
# Responsible for creating database entries for the given workflow's permissions
#
# @par... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/grant_edit_to_depositor.rb | Ruby | apache-2.0 | 197 | main | 904 | # frozen_string_literal: true
module Hyrax
module Workflow
##
# This is a built in function for workflow, so that a workflow action can be created that
# grants the creator the ability to alter it.
module GrantEditToDepositor
# @param [#read_users=, #read_users] target (likely an ActiveRecord::B... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/workflow_factory.rb | Ruby | apache-2.0 | 197 | main | 2,917 | # frozen_string_literal: true
module Hyrax
module Workflow
# Responsible for:
#
# * Creating a Sipity::Entity (aka a database proxy for the given work)
# * Assigning specific roles to the Sipity::Entity (but not the workflow)
# * Running the deposit_action
#
# @see Sipity:Entity
# @see... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/changes_required_notification.rb | Ruby | apache-2.0 | 197 | main | 599 | # frozen_string_literal: true
module Hyrax
module Workflow
class ChangesRequiredNotification < AbstractNotification
private
def subject
I18n.t('hyrax.notifications.workflow.changes_required.subject')
end
def message
I18n.t('hyrax.notifications.workflow.changes_required.me... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/workflow_schema.rb | Ruby | apache-2.0 | 197 | main | 2,445 | # frozen_string_literal: true
module Hyrax
module Workflow
# Responsible for describing the JSON schema for a Workflow.
#
# The `workflows name` defines the name of the Sipity::Workflow.
# The `workflows actions` defines the actions that can be taken in the given states (e.g. :from_states) by the give... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/services/hyrax/workflow/invalid_state_removal_exception.rb | Ruby | apache-2.0 | 197 | main | 257 | # frozen_string_literal: true
module Hyrax
module Workflow
class InvalidStateRemovalException < ::RuntimeError
attr_reader :states
def initialize(message, states)
super(message)
@states = states
end
end
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.