Class: Dor::WorkflowObject
- Defined in:
- lib/dor/models/workflow_object.rb
Constant Summary collapse
- @@xml_cache =
{}
- @@repo_cache =
{}
Constants included from Processable
Constants included from Identifiable
Identifiable::CATKEY_TYPE_ID, Identifiable::PREVIOUS_CATKEY_TYPE_ID
Class Method Summary collapse
-
.find_and_cache_workflow_xml_and_repo(name) ⇒ Object
Searches DOR for the workflow definition object.
- .find_by_name(name) ⇒ Object
-
.initial_repo(name) ⇒ String
Returns the repository attribute from the workflow definition It will cache the result for subsequent requests.
-
.initial_workflow(name) ⇒ String
Searches for the workflow definition object in DOR, then returns an object’s initial workflow as defined in the worfklowDefinition datastream It will cache the result for subsequent requests.
Instance Method Summary collapse
- #definition ⇒ Dor::WorkflowDefinitionDs
- #generate_initial_workflow ⇒ Object (also: #generate_intial_workflow)
Methods inherited from Abstract
Methods included from Preservable
#build_provenanceMetadata_datastream, #sdr_ingest_transfer
Methods included from Processable
#build_datastream, #cleanup, #create_workflow, #initialize_workflow, #milestones, #status, #status_info
Methods included from Versionable
#allows_modification?, #close_version, #current_version, #new_version_open?, #open_new_version, #start_version, #submit_version
Methods included from Describable
#build_descMetadata_datastream, #fetch_descMetadata_datastream, #full_title, #generate_dublin_core, #generate_public_desc_md, get_collection_title, #set_desc_metadata_using_label, #stanford_mods
Methods included from Rightsable
#build_rightsMetadata_datastream, #world_doc
Methods included from Governable
#add_collection, #initiate_apo_workflow, #reapplyAdminPolicyObjectDefaults, #remove_collection, #reset_to_apo_default, #rights, #set_read_rights, #unshelve_and_unpublish
Methods included from Eventable
Methods included from Identifiable
#adapt_to_cmodel, #add_other_Id, #add_tag, #catkey, #catkey=, #content_type_tag, #druid_regex, #pid_regex, #previous_catkeys, #remove_druid_prefix, #remove_other_Id, #remove_tag, #source_id, #source_id=, #tags, #update_other_Id, #update_tag
Class Method Details
.find_and_cache_workflow_xml_and_repo(name) ⇒ Object
Searches DOR for the workflow definition object. It then caches the workflow repository and xml
62 63 64 65 66 67 68 69 |
# File 'lib/dor/models/workflow_object.rb', line 62 def self.find_and_cache_workflow_xml_and_repo(name) wobj = find_by_name(name) raise "Failed to find workflow via find_by_name('#{name}')" if wobj.nil? @@repo_cache[name] = wobj.definition.repo @@xml_cache[name] = wobj.generate_initial_workflow wobj end |
.find_by_name(name) ⇒ Object
21 22 23 |
# File 'lib/dor/models/workflow_object.rb', line 21 def self.find_by_name(name) Dor::WorkflowObject.where(Solrizer.solr_name('workflow_name', :symbol) => name).first end |
.initial_repo(name) ⇒ String
Returns the repository attribute from the workflow definition It will cache the result for subsequent requests
41 42 43 44 45 46 |
# File 'lib/dor/models/workflow_object.rb', line 41 def self.initial_repo(name) return @@repo_cache[name] if @@repo_cache.include?(name) find_and_cache_workflow_xml_and_repo name @@repo_cache[name] end |
.initial_workflow(name) ⇒ String
Searches for the workflow definition object in DOR, then returns an object’s initial workflow as defined in the worfklowDefinition datastream It will cache the result for subsequent requests
30 31 32 33 34 35 |
# File 'lib/dor/models/workflow_object.rb', line 30 def self.initial_workflow(name) return @@xml_cache[name] if @@xml_cache.include?(name) find_and_cache_workflow_xml_and_repo name @@xml_cache[name] end |
Instance Method Details
#definition ⇒ Dor::WorkflowDefinitionDs
49 50 51 |
# File 'lib/dor/models/workflow_object.rb', line 49 def definition datastreams['workflowDefinition'] end |
#generate_initial_workflow ⇒ Object Also known as: generate_intial_workflow
53 54 55 |
# File 'lib/dor/models/workflow_object.rb', line 53 def generate_initial_workflow datastreams['workflowDefinition'].initial_workflow end |