Class: Operaton::Bpm::Client::Variable::Impl::Mapper::ObjectValueMapper
- Inherits:
-
AbstractTypedValueMapper
- Object
- AbstractTypedValueMapper
- Operaton::Bpm::Client::Variable::Impl::Mapper::ObjectValueMapper
- Defined in:
- lib/operaton/bpm/client/variable/impl/mapper/object_value_mapper.rb
Overview
Mirrors org.operaton.bpm.client.variable.impl.mapper.ObjectValueMapper
Constant Summary collapse
- VALUE_INFO_OBJECT_TYPE_NAME =
Engine::Variable::ObjectValueType::VALUE_INFO_OBJECT_TYPE_NAME
- VALUE_INFO_SERIALIZATION_DATA_FORMAT =
Engine::Variable::ObjectValueType::VALUE_INFO_SERIALIZATION_DATA_FORMAT
Instance Attribute Summary collapse
-
#data_format ⇒ Object
readonly
Returns the value of attribute data_format.
Attributes inherited from AbstractTypedValueMapper
Instance Method Summary collapse
- #convert_to_typed_value(untyped_value) ⇒ Object
-
#initialize(serialization_data_format, data_format) ⇒ ObjectValueMapper
constructor
A new instance of ObjectValueMapper.
- #read_value(typed_value_field, deserialize_object_value) ⇒ Object
- #serialization_dataformat ⇒ Object
- #write_value(typed_value, typed_value_field) ⇒ Object
Methods inherited from AbstractTypedValueMapper
#can_handle_typed_value, #can_handle_typed_value_field, #type
Methods included from ValueMapper
#can_handle_typed_value, #can_handle_typed_value_field, #type
Constructor Details
#initialize(serialization_data_format, data_format) ⇒ ObjectValueMapper
Returns a new instance of ObjectValueMapper.
22 23 24 25 26 |
# File 'lib/operaton/bpm/client/variable/impl/mapper/object_value_mapper.rb', line 22 def initialize(serialization_data_format, data_format) super(Engine::Variable::ValueType::OBJECT) @serialization_data_format = serialization_data_format @data_format = data_format end |
Instance Attribute Details
#data_format ⇒ Object (readonly)
Returns the value of attribute data_format.
20 21 22 |
# File 'lib/operaton/bpm/client/variable/impl/mapper/object_value_mapper.rb', line 20 def data_format @data_format end |
Instance Method Details
#convert_to_typed_value(untyped_value) ⇒ Object
32 33 34 |
# File 'lib/operaton/bpm/client/variable/impl/mapper/object_value_mapper.rb', line 32 def convert_to_typed_value(untyped_value) Engine::Variable::Variables.object_value(untyped_value.value).create end |
#read_value(typed_value_field, deserialize_object_value) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/operaton/bpm/client/variable/impl/mapper/object_value_mapper.rb', line 54 def read_value(typed_value_field, deserialize_object_value) serialized_string_value = typed_value_field.value if deserialize_object_value deserialized_object = nil unless serialized_string_value.nil? begin object_type_name = read_object_name_from_fields(typed_value_field) deserialized_object = data_format.read_value(serialized_string_value, object_type_name) rescue StandardError => e raise logger.value_mapper_exception_while_deserializing_object(e) end end create_deserialized_value(deserialized_object, serialized_string_value, typed_value_field) else create_serialized_value(serialized_string_value, typed_value_field) end end |
#serialization_dataformat ⇒ Object
28 29 30 |
# File 'lib/operaton/bpm/client/variable/impl/mapper/object_value_mapper.rb', line 28 def serialization_dataformat @serialization_data_format end |
#write_value(typed_value, typed_value_field) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/operaton/bpm/client/variable/impl/mapper/object_value_mapper.rb', line 36 def write_value(typed_value, typed_value_field) serialized_string_value = typed_value.value_serialized if typed_value.deserialized? object_to_serialize = typed_value.instance_variable_get(:@value) unless object_to_serialize.nil? begin serialized_string_value = data_format.write_value(object_to_serialize) rescue StandardError => e raise logger.value_mapper_exception_while_serializing_object(e) end end end typed_value_field.value = serialized_string_value update_typed_value(typed_value, serialized_string_value) end |