2017-08-14 11:56:23 +00:00
|
|
|
class Sequencer
|
|
|
|
class Unit
|
|
|
|
module Import
|
|
|
|
module Common
|
|
|
|
module Model
|
|
|
|
class Create < Sequencer::Unit::Base
|
|
|
|
include ::Sequencer::Unit::Import::Common::Model::Mixin::HandleFailure
|
2017-09-01 12:02:12 +00:00
|
|
|
prepend ::Sequencer::Unit::Import::Common::Model::Mixin::Skip::InstanceAction
|
|
|
|
|
|
|
|
skip_any_instance_action
|
2017-08-14 11:56:23 +00:00
|
|
|
|
|
|
|
uses :mapped, :model_class
|
|
|
|
provides :instance, :instance_action
|
|
|
|
|
|
|
|
def process
|
|
|
|
instance = model_class.new(mapped)
|
|
|
|
state.provide(:instance, instance)
|
|
|
|
state.provide(:instance_action, :created)
|
|
|
|
rescue => e
|
|
|
|
handle_failure(e)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|