-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merges CurationConcerns::Curatable into CurationConcerns::GenericWork…
…Behavior and adds CurationConcerns::Permissions to CurationConcerns::GenericWorkBehavior
- Loading branch information
1 parent
298fb89
commit 77b2a4c
Showing
3 changed files
with
49 additions
and
85 deletions.
There are no files selected for viewing
78 changes: 0 additions & 78 deletions
78
curation_concerns-models/app/models/concerns/curation_concerns/curatable.rb
This file was deleted.
Oops, something went wrong.
54 changes: 48 additions & 6 deletions
54
curation_concerns-models/app/models/concerns/curation_concerns/generic_work_behavior.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,67 @@ | ||
module CurationConcerns::GenericWorkBehavior | ||
extend ActiveSupport::Concern | ||
|
||
include Hydra::Works::GenericWorkBehavior | ||
include ::CurationConcerns::Curatable | ||
include ::CurationConcerns::HumanReadableType | ||
include CurationConcerns::Noid | ||
include CurationConcerns::Permissions | ||
include CurationConcerns::Serializers | ||
include Hydra::WithDepositor | ||
include Hydra::Collections::Collectible | ||
include Solrizer::Common | ||
include ::CurationConcerns::HasRepresentative | ||
include ::CurationConcerns::WithGenericFiles | ||
include Hydra::AccessControls::Embargoable | ||
include ::CurationConcerns::WithEditors | ||
|
||
included do | ||
property :owner, predicate: RDF::URI.new('http://opaquenamespace.org/ns/hydra/owner'), multiple: false | ||
class_attribute :human_readable_short_description | ||
attr_accessor :files | ||
end | ||
|
||
module ClassMethods | ||
def indexer | ||
CurationConcerns::GenericWorkIndexingService | ||
end | ||
end | ||
|
||
# Modules in Curate's CurationConcerns::Work that we _might_ pull in later | ||
# include Curate::ActiveModelAdaptor | ||
# include CurationConcerns::WithLinkedContributors | ||
# include CurationConcerns::WithRelatedWorks | ||
|
||
def to_solr(solr_doc={}, opts={}) | ||
super(solr_doc).tap do |solr_doc| | ||
Solrizer.set_field(solr_doc, 'generic_type', 'Work', :facetable) | ||
end | ||
end | ||
|
||
def as_rdf_object | ||
RDF::URI.new(internal_uri) | ||
end | ||
|
||
def to_s | ||
title.join(', ') | ||
end | ||
|
||
# Returns a string identifying the path associated with the object. ActionPack uses this to find a suitable partial to represent the object. | ||
def to_partial_path | ||
"curation_concern/#{super}" | ||
end | ||
|
||
def can_be_member_of_collection?(collection) | ||
collection == self ? false : true | ||
end | ||
|
||
protected | ||
|
||
def index_collection_ids(solr_doc) | ||
solr_doc[Solrizer.solr_name(:collection, :facetable)] ||= [] | ||
solr_doc[Solrizer.solr_name(:collection)] ||= [] | ||
self.collection_ids.each do |collection_id| | ||
collection_obj = ActiveFedora::Base.load_instance_from_solr(collection_id) | ||
if collection_obj.is_a?(Collection) | ||
solr_doc[Solrizer.solr_name(:collection, :facetable)] << collection_id | ||
solr_doc[Solrizer.solr_name(:collection)] << collection_id | ||
end | ||
end | ||
solr_doc | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters