Class: Dor::WorkflowDefinitionDs Deprecated

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

Overview

Deprecated.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SolrDocHelper

#add_solr_value

Class Method Details

.xml_templateObject



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

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

Instance Method Details

#add_process(attributes) ⇒ Object



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

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

#nameObject



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

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

#prefixObject

maintain AF < 8 indexing behavior



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

def prefix
  ''
end

#processesObject



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

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



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

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

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



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

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