Module: Dor::Processable

Extended by:
ActiveSupport::Concern, Deprecation
Included in:
Abstract
Defined in:
lib/dor/models/concerns/processable.rb

Constant Summary collapse

STEPS =
ActiveSupport::Deprecation::DeprecatedConstantProxy.new('STEPS', 'Dor::StatusService::STEPS')

Instance Method Summary collapse

Instance Method Details

#build_datastream(datastream, force = false, is_required = false) ⇒ ActiveFedora::Datastream

The ContentMetadata and DescMetadata robot are allowed to build the datastream by reading a file from the /dor/workspace that matches the datastream name. This allows assembly or pre-assembly to prebuild the datastreams from templates or using other means (like the assembly-objectfile gem) and then have those datastreams picked up and added to the object during accessionWF.

This method builds that datastream using the content of a file if such a file exists and is newer than the object’s current datastream (see above); otherwise, builds the datastream by calling build_fooMetadata_datastream.

Parameters:

  • datastream (String)

    name of a datastream (e.g. “fooMetadata”)

  • force (Boolean) (defaults to: false)

    overwrite existing datastream

  • is_required (Boolean) (defaults to: false)

Returns:



35
36
37
38
39
40
41
42
43
44
# File 'lib/dor/models/concerns/processable.rb', line 35

def build_datastream(datastream, force = false, is_required = false)
  ds = datastreams[datastream]
  builder = Dor::DatastreamBuilder.new(object: self,
                                       datastream: ds,
                                       force: force,
                                       required: is_required)
  builder.build

  ds
end

#cleanupObject



47
48
49
# File 'lib/dor/models/concerns/processable.rb', line 47

def cleanup
  CleanupService.cleanup(self)
end

#create_workflow(name, create_ds = true, priority = 0) ⇒ Object

Initilizes workflow for the object in the workflow service

It will set the priorty of the new workflow to the current_priority if it is > 0
It will set lane_id from the item's APO default workflow lane

Parameters:

  • name (String)

    of the workflow to be initialized

  • create_ds (Boolean) (defaults to: true)

    create a ‘workflows’ datastream in Fedora for the object

  • priority (Integer) (defaults to: 0)

    the workflow’s priority level



76
77
78
# File 'lib/dor/models/concerns/processable.rb', line 76

def create_workflow(name, create_ds = true, priority = 0)
  CreateWorkflowService.create_workflow(self, name: name, create_ds: create_ds, priority: priority)
end

#initialize_workflow(name, create_ds = true, priority = 0) ⇒ Object



81
82
83
84
# File 'lib/dor/models/concerns/processable.rb', line 81

def initialize_workflow(name, create_ds = true, priority = 0)
  warn 'WARNING: initialize_workflow is deprecated, use create_workflow instead'
  create_workflow(name, create_ds, priority)
end

#milestonesObject



65
66
67
# File 'lib/dor/models/concerns/processable.rb', line 65

def milestones
  StatusService.new(self).milestones
end

#status(include_time = false) ⇒ String

Returns single composed status from status_info.

Parameters:

  • include_time (Boolean) (defaults to: false)

Returns:

  • (String)

    single composed status from status_info



60
61
62
# File 'lib/dor/models/concerns/processable.rb', line 60

def status(include_time = false)
  StatusService.status(self, include_time)
end

#status_infoHash{Symbol => Object}

Returns including :current_version, :status_code and :status_time.

Returns:

  • (Hash{Symbol => Object})

    including :current_version, :status_code and :status_time



53
54
55
# File 'lib/dor/models/concerns/processable.rb', line 53

def status_info
  StatusService.status_info(self)
end