Class: Dor::WorkflowDefinitionDs

Inherits:
ActiveFedora::OmDatastream
  • Object
show all
Includes:
SolrDocHelper
Defined in:
lib/dor/datastreams/workflow_definition_ds.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SolrDocHelper

#add_solr_value

Class Method Details

.xml_templateObject



33
34
35
# File 'lib/dor/datastreams/workflow_definition_ds.rb', line 33

def self.xml_template
  Nokogiri::XML('<workflow-def/>')
end

Instance Method Details

#add_process(attributes) ⇒ Object



37
38
39
40
# File 'lib/dor/datastreams/workflow_definition_ds.rb', line 37

def add_process(attributes)
  ng_xml_will_change!
  add_child_node(ng_xml.at_xpath('/workflow-def'), :process, self, attributes)
end

#nameObject



48
49
50
# File 'lib/dor/datastreams/workflow_definition_ds.rb', line 48

def name
  ng_xml.at_xpath('/workflow-def/@id').to_s
end

#prefixObject

maintain AF < 8 indexing behavior



66
67
68
# File 'lib/dor/datastreams/workflow_definition_ds.rb', line 66

def prefix
  ''
end

#processesObject



42
43
44
45
46
# File 'lib/dor/datastreams/workflow_definition_ds.rb', line 42

def processes
  ng_xml.xpath('/workflow-def/process').collect do |node|
    Workflow::Process.new(repo, name, node)
  end.sort { |a, b| (a.sequence || 0) <=> (b.sequence || 0) }
end

#repoObject



52
53
54
# File 'lib/dor/datastreams/workflow_definition_ds.rb', line 52

def repo
  ng_xml.at_xpath('/workflow-def/@repository').to_s
end

#to_solr(solr_doc = {}, *args) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/dor/datastreams/workflow_definition_ds.rb', line 56

def to_solr(solr_doc = {}, *args)
  solr_doc = super(solr_doc, *args)
  add_solr_value(solr_doc, 'workflow_name', name, :symbol, [:symbol])
  processes.each do |p|
    add_solr_value(solr_doc, 'process', "#{p.name}|#{p.label}", :symbol, [:displayable])
  end
  solr_doc
end