config/initializers/active_fedora_base.rb in ddr-models-2.11.0 vs config/initializers/active_fedora_base.rb in ddr-models-3.0.0.alpha.1

- old
+ new

@@ -16,11 +16,11 @@ def has_children? can_have_children? and children.size > 0 end def can_have_content? - datastreams.include? "content" + datastreams.key? "content" end def has_content? can_have_content? && content.has_content? end @@ -35,55 +35,36 @@ def has_admin_policy? governable? && admin_policy.present? end + def has_rights_metadata? + ds = self.datastreams[Ddr::Datastreams::RIGHTS_METADATA] + ds && ds.size && ds.size > 0 + end + def can_have_struct_metadata? - datastreams.include? Ddr::Datastreams::STRUCT_METADATA + datastreams.key? Ddr::Datastreams::STRUCT_METADATA end def has_struct_metadata? can_have_struct_metadata? && structMetadata.has_content? end - def can_have_intermediate_file? - datastreams.include? Ddr::Datastreams::INTERMEDIATE_FILE - end - - def has_intermediate_file? - can_have_intermediate_file? && datastreams[Ddr::Datastreams::INTERMEDIATE_FILE].has_content? - end - def can_have_multires_image? - datastreams.include? Ddr::Datastreams::MULTIRES_IMAGE + respond_to? :multires_image_file_path end def has_multires_image? - can_have_multires_image? && datastreams[Ddr::Datastreams::MULTIRES_IMAGE].has_content? + can_have_multires_image? && multires_image_file_path.present? end - + def can_have_thumbnail? - datastreams.include? "thumbnail" + datastreams.key? "thumbnail" end def has_thumbnail? can_have_thumbnail? && thumbnail.has_content? - end - - def captionable? - datastreams.include? Ddr::Datastreams::CAPTION - end - - def captioned? - captionable? && datastreams[Ddr::Datastreams::CAPTION].has_content? - end - - def can_be_streamable? - datastreams.include? Ddr::Datastreams::STREAMABLE_MEDIA - end - - def streamable? - can_be_streamable? && datastreams[Ddr::Datastreams::STREAMABLE_MEDIA].has_content? end def safe_id id.sub(/:/, "-") end