Class: Bplmodels::WorkflowMetadata

Inherits:
ActiveFedora::OmDatastream
  • Object
show all
Includes:
OM::XML::Document
Defined in:
app/models/bplmodels/workflow_metadata.rb

Constant Summary collapse

WORKFLOW_NS =
'http://www.bpl.org/repository/xml/ns/workflow'
WORKFLOW_SCHEMA =
'http://www.bpl.org/repository/xml/xsd/workflow.xsd'
WORKFLOW_PARAMS =
{
    "version"            => "0.0.1",
    "xmlns:xlink"        => "http://www.w3.org/1999/xlink",
    "xmlns:xsi"          => "http://www.w3.org/2001/XMLSchema-instance",
    "xmlns"              => WORKFLOW_NS,
    "xsi:schemaLocation" => "#{WORKFLOW_NS} #{WORKFLOW_SCHEMA}",
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.xml_templateObject



59
60
61
62
63
64
65
# File 'app/models/bplmodels/workflow_metadata.rb', line 59

def self.xml_template
  Nokogiri::XML::Builder.new do |xml|
    xml.(WORKFLOW_PARAMS) {

    }
  end.doc
end

Instance Method Details

#insert_file_name(value = nil) ⇒ Object



80
81
82
83
84
# File 'app/models/bplmodels/workflow_metadata.rb', line 80

def insert_file_name(value=nil)
  ingest_filename_index = self.item_source.ingest_filepath.count

  self.item_source.ingest_filename(ingest_filename_index, value) unless value.blank? || self.item_source.ingest_filepath.include?(value)
end

#insert_file_path(value = nil) ⇒ Object



74
75
76
77
78
# File 'app/models/bplmodels/workflow_metadata.rb', line 74

def insert_file_path(value=nil)
  ingest_filepath_index = self.item_source.ingest_filepath.count

  self.item_source.ingest_filepath(ingest_filepath_index, value) unless value.blank? || self.item_source.ingest_filepath.include?(value)
end

#insert_file_source(filepath, filename, datastream) ⇒ Object



86
87
88
89
90
91
92
# File 'app/models/bplmodels/workflow_metadata.rb', line 86

def insert_file_source(filepath, filename, datastream)
  source_count = self.source.count

  self.source(source_count).ingest_filepath(0, filepath) unless filepath.blank?
  self.source(source_count).ingest_filename(0, filename) unless filename.blank?
  self.source(source_count).ingest_datastream(0, datastream) unless datastream.blank?
end

#insert_flagged(value = nil) ⇒ Object



94
95
96
# File 'app/models/bplmodels/workflow_metadata.rb', line 94

def insert_flagged(value=nil)
  self.item_designations(0).flagged_for_content(0, value) unless value.blank?
end

#insert_oai_defaultsObject



98
99
100
101
102
103
# File 'app/models/bplmodels/workflow_metadata.rb', line 98

def insert_oai_defaults
  self.item_status(0).state = "published"
  self.item_status(0).state_comment = "OAI Harvested Record"
  self.item_status(0).processing = "complete"
  self.item_status(0).processing_comment = "Object Processing Complete"
end

#prefix(path = nil) ⇒ Object

Required for Active Fedora 9



68
69
70
# File 'app/models/bplmodels/workflow_metadata.rb', line 68

def prefix(path=nil)
  return ''
end