Class: Operaton::Bpm::Client::Variable::Impl::Mapper::ByteArrayValueMapper
- Inherits:
-
PrimitiveValueMapper
- Object
- AbstractTypedValueMapper
- PrimitiveValueMapper
- Operaton::Bpm::Client::Variable::Impl::Mapper::ByteArrayValueMapper
- Defined in:
- lib/operaton/bpm/client/variable/impl/mapper/byte_array_value_mapper.rb
Overview
Mirrors org.operaton.bpm.client.variable.impl.mapper.ByteArrayValueMapper
Instance Attribute Summary
Attributes inherited from AbstractTypedValueMapper
Instance Method Summary collapse
- #convert_to_typed_value(untyped_value) ⇒ Object
-
#initialize ⇒ ByteArrayValueMapper
constructor
A new instance of ByteArrayValueMapper.
- #read_typed_value(typed_value_field) ⇒ Object
- #write_value(bytes_value, typed_value_field) ⇒ Object
Methods inherited from PrimitiveValueMapper
Methods inherited from AbstractTypedValueMapper
#can_handle_typed_value, #can_handle_typed_value_field, #serialization_dataformat, #type
Methods included from ValueMapper
#can_handle_typed_value, #can_handle_typed_value_field, #read_value, #serialization_dataformat, #type
Constructor Details
#initialize ⇒ ByteArrayValueMapper
Returns a new instance of ByteArrayValueMapper.
15 16 17 |
# File 'lib/operaton/bpm/client/variable/impl/mapper/byte_array_value_mapper.rb', line 15 def initialize super(Engine::Variable::ValueType::BYTES) end |
Instance Method Details
#convert_to_typed_value(untyped_value) ⇒ Object
19 20 21 22 23 |
# File 'lib/operaton/bpm/client/variable/impl/mapper/byte_array_value_mapper.rb', line 19 def convert_to_typed_value(untyped_value) value = untyped_value.value byte_arr = value.respond_to?(:read) ? value.read : value Engine::Variable::Variables.byte_array_value(byte_arr) end |
#read_typed_value(typed_value_field) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/operaton/bpm/client/variable/impl/mapper/byte_array_value_mapper.rb', line 25 def read_typed_value(typed_value_field) byte_arr = nil value = typed_value_field.value byte_arr = Base64.decode64(value) unless value.nil? Engine::Variable::Variables.byte_array_value(byte_arr) end |
#write_value(bytes_value, typed_value_field) ⇒ Object
32 33 34 35 |
# File 'lib/operaton/bpm/client/variable/impl/mapper/byte_array_value_mapper.rb', line 32 def write_value(bytes_value, typed_value_field) bytes = bytes_value.value typed_value_field.value = Base64.strict_encode64(bytes) unless bytes.nil? end |