Sha256: 186fe13359030df3dbc37018339c81949558f9032d39bae5bdda70135944f8ab
Contents?: true
Size: 1.11 KB
Versions: 27
Compression:
Stored size: 1.11 KB
Contents
module Ddr module Managers class WorkflowManager < Manager PUBLISHED = "published" UNPUBLISHED = "unpublished" def published? object.workflow_state == PUBLISHED end def unpublished? object.workflow_state == UNPUBLISHED 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
27 entries across 27 versions & 1 rubygems