app/models/bplmodels/mods_desc_metadata.rb
#include Hydra::Datastream::CommonModsIndexMethods
# MODS XML constants.
include Hydra::Datastream::CommonModsIndexMethods
MODS XML constants.
include Hydra :: Datastream :: CommonModsIndexMethods MODS XML constants .
def insert_subject_temporal(date)
      duplicate = false
      converted = BplEnrich::Dates.standardize(date)
      subject_index = self.mods(0).subject.count
      if converted.has_key?(:single_date)
        (0..self.mods(0).subject.length-1).each do |index|
          if self.mods(0).subject(index).temporal == [converted[:single_date]]
            duplicate = true
          end
        end
        temporal_index = self.mods(0).subject(subject_index).temporal.length
        self.mods(0).subject(subject_index).temporal(temporal_index, converted[:single_date]) unless converted[:single_date].blank? || duplicate
      elsif converted.has_key?(:date_range)
        , FIXME: Is there case this doesn't work?
        (0..self.mods(0).subject.length-1).each do |index|
          if self.mods(0).subject(index).temporal == [converted[:date_range][:start], converted[:date_range][:end]]
            duplicate = true
          end
        end
        temporal_index = self.mods(0).subject(subject_index).temporal.length
        self.mods(0).subject(subject_index).temporal(temporal_index, converted[:date_range][:start]) unless converted[:date_range][:start].blank? || duplicate
        self.mods(0).subject(subject_index).temporal(temporal_index).point = 'start' unless converted[:date_range][:start].blank? || duplicate
        temporal_index = self.mods(0).subject(subject_index).temporal.length
        self.mods(0).subject(subject_index).temporal(temporal_index, converted[:date_range][:end]) unless converted[:date_range][:end].blank? || duplicate
        self.mods(0).subject(subject_index).temporal(temporal_index).point = 'end' unless converted[:date_range][:end].blank? || duplicate
      end
    end
def insert_subject_temporal ( date ) duplicate = false converted = BplEnrich :: Dates . standardize ( date ) subject_index = self . mods ( 0 ) . subject . count if converted . has_key? ( :single_date ) ( 0 .. self . mods ( 0 ) . subject . length - 1 ) . each do | index | if self . mods ( 0 ) . subject ( index ) . temporal == [ converted [ :single_date ] ] duplicate = true end end temporal_index = self . mods ( 0 ) . subject ( subject_index ) . temporal . length self . mods ( 0 ) . subject ( subject_index ) . temporal ( temporal_index , converted [ :single_date ] ) unless converted [ :single_date ] . blank? || duplicate elsif converted . has_key? ( :date_range ) ( 0 .. self . mods ( 0 ) . subject . length - 1 ) . each do | index | if self . mods ( 0 ) . subject ( index ) . temporal == [ converted [ :date_range ] [ :start ] , converted [ :date_range ] [ :end ] ] duplicate = true end end temporal_index = self . mods ( 0 ) . subject ( subject_index ) . temporal . length self . mods ( 0 ) . subject ( subject_index ) . temporal ( temporal_index , converted [ :date_range ] [ :start ] ) unless converted [ :date_range ] [ :start ] . blank? || duplicate self . mods ( 0 ) . subject ( subject_index ) . temporal ( temporal_index ) . point = 'start' unless converted [ :date_range ] [ :start ] . blank? || duplicate temporal_index = self . mods ( 0 ) . subject ( subject_index ) . temporal . length self . mods ( 0 ) . subject ( subject_index ) . temporal ( temporal_index , converted [ :date_range ] [ :end ] ) unless converted [ :date_range ] [ :end ] . blank? || duplicate self . mods ( 0 ) . subject ( subject_index ) . temporal ( temporal_index ) . point = 'end' unless converted [ :date_range ] [ :end ] . blank? || duplicate end end
include Hydra::Datastream::CommonModsIndexMethods
MODS XML constants.
include Hydra :: Datastream :: CommonModsIndexMethods MODS XML constants .
#converted = Bplmodels::DatastreamInputFuncs.convert_to_mods_date(date) #Check for duplicates #Check for duplicates, FIXME: Is there case this doesn't work?
date