Sha256: 0a074291301f22b11a12d0d9b3ca9789d04fd8125663c5d5e0c0b0b96eccb219
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
module Ddr module Managers class WorkflowManager < Manager PUBLISHED = "published" UNPUBLISHED = "unpublished" def published? object.workflow_state == PUBLISHED end def publish!(include_descendants: true) unless published? publish object.save! end if include_descendants && object.respond_to?(:children) solr_results = object.children(response_format: :solr) ActiveFedora::SolrService.lazy_reify_solr_results(solr_results).each do |child| child.publish!(include_descendants: include_descendants) end end end def unpublish! if published? unpublish object.save! end if object.respond_to?(:children) object.children.each { |child| child.unpublish! } end end private def publish object.workflow_state = PUBLISHED end def unpublish object.workflow_state = UNPUBLISHED end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ddr-models-2.5.3 | lib/ddr/managers/workflow_manager.rb |
ddr-models-2.5.2 | lib/ddr/managers/workflow_manager.rb |
ddr-models-2.5.1 | lib/ddr/managers/workflow_manager.rb |