Module: Hydra::ModelMethods

Included in:
FileAsset, GenericContent, GenericImage, Image
Defined in:
vendor/plugins/hydra_repository/lib/hydra/model_methods.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) apply_depositor_metadata(depositor_id)

Adds metadata about the depositor to the asset



5
6
7
8
9
10
11
12
13
14
# File 'vendor/plugins/hydra_repository/lib/hydra/model_methods.rb', line 5

def (depositor_id)
  prop_ds = self.datastreams_in_memory["properties"]
  rights_ds = self.datastreams_in_memory["rightsMetadata"]

  if !prop_ds.nil? && prop_ds.respond_to?(:depositor_values)
    prop_ds.depositor_values = depositor_id unless prop_ds.nil?
  end
  rights_ds.update_indexed_attributes([:edit_access, :person]=>depositor_id) unless rights_ds.nil?
  return true
end

- (Object) insert_contributor(type, opts = {})

Call insert_contributor on the descMetadata datastream



27
28
29
30
31
# File 'vendor/plugins/hydra_repository/lib/hydra/model_methods.rb', line 27

def insert_contributor(type, opts={})
  ds = self.datastreams_in_memory["descMetadata"]   
  node, index = ds.insert_contributor(type,opts)
  return node, index
end

- (Object) remove_contributor(type, index)

Call remove_contributor on the descMetadata datastream



34
35
36
37
38
# File 'vendor/plugins/hydra_repository/lib/hydra/model_methods.rb', line 34

def remove_contributor(type, index)
  ds = self.datastreams_in_memory["descMetadata"]   
  result = ds.remove_contributor(type,index)
  return result
end

- (Object) set_collection_type(collection)

Set the collection type (e.g. hydrangea_article) for the asset



19
20
21
22
23
24
# File 'vendor/plugins/hydra_repository/lib/hydra/model_methods.rb', line 19

def set_collection_type(collection)
  prop_ds = self.datastreams_in_memory["properties"]
  if !prop_ds.nil? && prop_ds.respond_to?(:collection_values)
    prop_ds.collection_values = collection
  end
end