2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-10-20 09:43:35 +00:00
|
|
|
|
|
|
|
class Sequencer
|
|
|
|
class Unit
|
|
|
|
module Import
|
|
|
|
module Kayako
|
|
|
|
module ObjectAttribute
|
|
|
|
class Config < Sequencer::Unit::Base
|
|
|
|
prepend ::Sequencer::Unit::Import::Common::Model::Mixin::Skip::Action
|
|
|
|
include ::Sequencer::Unit::Import::Common::Model::Mixin::HandleFailure
|
|
|
|
|
|
|
|
skip_any_action
|
|
|
|
|
|
|
|
uses :resource, :sanitized_name, :model_class, :default_language
|
|
|
|
provides :config
|
|
|
|
|
|
|
|
def process
|
|
|
|
attribute_config = attribute_type.config
|
|
|
|
|
|
|
|
state.provide(:config) do
|
|
|
|
{
|
|
|
|
object: model_class.to_s,
|
|
|
|
name: sanitized_name,
|
|
|
|
}.merge(attribute_config)
|
|
|
|
end
|
|
|
|
rescue => e
|
|
|
|
logger.error "The custom field type '#{resource['type']}' can not be mapped to an internal field."
|
|
|
|
handle_failure(e)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def attribute_type
|
|
|
|
"Sequencer::Unit::Import::Kayako::ObjectAttribute::AttributeType::#{resource['type'].capitalize}".constantize.new(resource, default_language)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|