operaton-bpm-client 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +134 -0
- data/lib/operaton/bpm/client/backoff/backoff_strategy.rb +20 -0
- data/lib/operaton/bpm/client/backoff/error_aware_backoff_strategy.rb +22 -0
- data/lib/operaton/bpm/client/backoff/exponential_backoff_strategy.rb +38 -0
- data/lib/operaton/bpm/client/backoff/exponential_error_backoff_strategy.rb +38 -0
- data/lib/operaton/bpm/client/exceptions.rb +74 -0
- data/lib/operaton/bpm/client/external_task_client.rb +20 -0
- data/lib/operaton/bpm/client/external_task_client_builder.rb +18 -0
- data/lib/operaton/bpm/client/impl/engine_client.rb +132 -0
- data/lib/operaton/bpm/client/impl/engine_client_exception.rb +25 -0
- data/lib/operaton/bpm/client/impl/engine_client_logger.rb +54 -0
- data/lib/operaton/bpm/client/impl/engine_rest_exception_dto.rb +28 -0
- data/lib/operaton/bpm/client/impl/external_task_client_builder_impl.rb +349 -0
- data/lib/operaton/bpm/client/impl/external_task_client_impl.rb +41 -0
- data/lib/operaton/bpm/client/impl/external_task_client_logger.rb +236 -0
- data/lib/operaton/bpm/client/impl/object_mapper.rb +44 -0
- data/lib/operaton/bpm/client/impl/permanent_url_resolver.rb +22 -0
- data/lib/operaton/bpm/client/impl/request_dto.rb +24 -0
- data/lib/operaton/bpm/client/impl/request_executor.rb +143 -0
- data/lib/operaton/bpm/client/interceptor/auth/basic_auth_provider.rb +42 -0
- data/lib/operaton/bpm/client/interceptor/client_request_context.rb +16 -0
- data/lib/operaton/bpm/client/interceptor/client_request_interceptor.rb +18 -0
- data/lib/operaton/bpm/client/interceptor/impl/client_request_context_impl.rb +28 -0
- data/lib/operaton/bpm/client/interceptor/impl/request_interceptor_handler.rb +43 -0
- data/lib/operaton/bpm/client/spi/data_format.rb +32 -0
- data/lib/operaton/bpm/client/spi/data_format_configurator.rb +31 -0
- data/lib/operaton/bpm/client/spi/data_format_provider.rb +31 -0
- data/lib/operaton/bpm/client/task/external_task.rb +22 -0
- data/lib/operaton/bpm/client/task/external_task_handler.rb +28 -0
- data/lib/operaton/bpm/client/task/external_task_service.rb +18 -0
- data/lib/operaton/bpm/client/task/impl/dto/bpmn_error_request_dto.rb +35 -0
- data/lib/operaton/bpm/client/task/impl/dto/complete_request_dto.rb +33 -0
- data/lib/operaton/bpm/client/task/impl/dto/extend_lock_request_dto.rb +29 -0
- data/lib/operaton/bpm/client/task/impl/dto/failure_request_dto.rb +43 -0
- data/lib/operaton/bpm/client/task/impl/dto/lock_request_dto.rb +29 -0
- data/lib/operaton/bpm/client/task/impl/dto/set_variables_request_dto.rb +29 -0
- data/lib/operaton/bpm/client/task/impl/external_task_impl.rb +128 -0
- data/lib/operaton/bpm/client/task/impl/external_task_service_impl.rb +90 -0
- data/lib/operaton/bpm/client/task/ordering_config.rb +78 -0
- data/lib/operaton/bpm/client/task/sorting_dto.rb +29 -0
- data/lib/operaton/bpm/client/topic/impl/dto/fetch_and_lock_request_dto.rb +47 -0
- data/lib/operaton/bpm/client/topic/impl/dto/fetch_and_lock_response_dto.rb +32 -0
- data/lib/operaton/bpm/client/topic/impl/dto/topic_request_dto.rb +70 -0
- data/lib/operaton/bpm/client/topic/impl/topic_subscription_builder_impl.rb +164 -0
- data/lib/operaton/bpm/client/topic/impl/topic_subscription_impl.rb +76 -0
- data/lib/operaton/bpm/client/topic/impl/topic_subscription_manager.rb +222 -0
- data/lib/operaton/bpm/client/topic/impl/topic_subscription_manager_logger.rb +52 -0
- data/lib/operaton/bpm/client/topic/topic_subscription.rb +20 -0
- data/lib/operaton/bpm/client/topic/topic_subscription_builder.rb +22 -0
- data/lib/operaton/bpm/client/url_resolver.rb +15 -0
- data/lib/operaton/bpm/client/variable/client_values.rb +33 -0
- data/lib/operaton/bpm/client/variable/impl/abstract_typed_value_mapper.rb +59 -0
- data/lib/operaton/bpm/client/variable/impl/default_value_mappers.rb +71 -0
- data/lib/operaton/bpm/client/variable/impl/format/json/json_data_format.rb +82 -0
- data/lib/operaton/bpm/client/variable/impl/format/json/json_data_format_provider.rb +34 -0
- data/lib/operaton/bpm/client/variable/impl/mapper/boolean_value_mapper.rb +35 -0
- data/lib/operaton/bpm/client/variable/impl/mapper/byte_array_value_mapper.rb +53 -0
- data/lib/operaton/bpm/client/variable/impl/mapper/date_value_mapper.rb +61 -0
- data/lib/operaton/bpm/client/variable/impl/mapper/double_value_mapper.rb +36 -0
- data/lib/operaton/bpm/client/variable/impl/mapper/file_value_mapper.rb +73 -0
- data/lib/operaton/bpm/client/variable/impl/mapper/integer_value_mapper.rb +36 -0
- data/lib/operaton/bpm/client/variable/impl/mapper/json_value_mapper.rb +35 -0
- data/lib/operaton/bpm/client/variable/impl/mapper/long_value_mapper.rb +36 -0
- data/lib/operaton/bpm/client/variable/impl/mapper/null_value_mapper.rb +45 -0
- data/lib/operaton/bpm/client/variable/impl/mapper/number_value_mapper.rb +25 -0
- data/lib/operaton/bpm/client/variable/impl/mapper/object_value_mapper.rb +151 -0
- data/lib/operaton/bpm/client/variable/impl/mapper/primitive_value_mapper.rb +44 -0
- data/lib/operaton/bpm/client/variable/impl/mapper/short_value_mapper.rb +36 -0
- data/lib/operaton/bpm/client/variable/impl/mapper/string_value_mapper.rb +35 -0
- data/lib/operaton/bpm/client/variable/impl/mapper/xml_value_mapper.rb +35 -0
- data/lib/operaton/bpm/client/variable/impl/type/json_type_impl.rb +24 -0
- data/lib/operaton/bpm/client/variable/impl/type/xml_type_impl.rb +24 -0
- data/lib/operaton/bpm/client/variable/impl/typed_value_field.rb +36 -0
- data/lib/operaton/bpm/client/variable/impl/typed_values.rb +100 -0
- data/lib/operaton/bpm/client/variable/impl/value/deferred_file_value_impl.rb +57 -0
- data/lib/operaton/bpm/client/variable/impl/value/json_value_impl.rb +26 -0
- data/lib/operaton/bpm/client/variable/impl/value/xml_value_impl.rb +26 -0
- data/lib/operaton/bpm/client/variable/impl/value_mapper.rb +42 -0
- data/lib/operaton/bpm/client/variable/impl/value_mappers.rb +26 -0
- data/lib/operaton/bpm/client/variable/impl/variable_value.rb +55 -0
- data/lib/operaton/bpm/client/variable/value/deferred_file_value.rb +19 -0
- data/lib/operaton/bpm/client/variable/value/json_value.rb +16 -0
- data/lib/operaton/bpm/client/variable/value/xml_value.rb +16 -0
- data/lib/operaton/bpm/client/version.rb +9 -0
- data/lib/operaton/bpm/client.rb +121 -0
- data/lib/operaton/bpm/engine/variable/typed_value.rb +153 -0
- data/lib/operaton/bpm/engine/variable/value_type.rb +126 -0
- data/lib/operaton/bpm/engine/variable/variable_map.rb +72 -0
- data/lib/operaton/bpm/engine/variable/variables.rb +197 -0
- data/lib/operaton-bpm-client.rb +3 -0
- metadata +188 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "primitive_value_mapper"
|
|
4
|
+
require_relative "../../../../engine/variable/variables"
|
|
5
|
+
|
|
6
|
+
module Operaton
|
|
7
|
+
module Bpm
|
|
8
|
+
module Client
|
|
9
|
+
module Variable
|
|
10
|
+
module Impl
|
|
11
|
+
module Mapper
|
|
12
|
+
# Mirrors org.operaton.bpm.client.variable.impl.mapper.StringValueMapper
|
|
13
|
+
class StringValueMapper < PrimitiveValueMapper
|
|
14
|
+
def initialize
|
|
15
|
+
super(Engine::Variable::ValueType::STRING)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def convert_to_typed_value(untyped_value)
|
|
19
|
+
Engine::Variable::Variables.string_value(untyped_value.value)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def read_typed_value(typed_value_field)
|
|
23
|
+
Engine::Variable::Variables.string_value(typed_value_field.value)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def write_value(string_value, typed_value_field)
|
|
27
|
+
typed_value_field.value = string_value.value
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "primitive_value_mapper"
|
|
4
|
+
require_relative "../../client_values"
|
|
5
|
+
|
|
6
|
+
module Operaton
|
|
7
|
+
module Bpm
|
|
8
|
+
module Client
|
|
9
|
+
module Variable
|
|
10
|
+
module Impl
|
|
11
|
+
module Mapper
|
|
12
|
+
# Mirrors org.operaton.bpm.client.variable.impl.mapper.XmlValueMapper
|
|
13
|
+
class XmlValueMapper < PrimitiveValueMapper
|
|
14
|
+
def initialize
|
|
15
|
+
super(ClientValues::XML)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def convert_to_typed_value(untyped_value)
|
|
19
|
+
ClientValues.xml_value(untyped_value.value)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def write_value(xml_value, typed_value_field)
|
|
23
|
+
typed_value_field.value = xml_value.value
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def read_typed_value(typed_value_field)
|
|
27
|
+
ClientValues.xml_value(typed_value_field.value)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../../../../engine/variable/value_type"
|
|
4
|
+
|
|
5
|
+
module Operaton
|
|
6
|
+
module Bpm
|
|
7
|
+
module Client
|
|
8
|
+
module Variable
|
|
9
|
+
module Impl
|
|
10
|
+
module Type
|
|
11
|
+
# Mirrors org.operaton.bpm.client.variable.impl.type.JsonTypeImpl
|
|
12
|
+
class JsonTypeImpl < Engine::Variable::PrimitiveValueType
|
|
13
|
+
JSON_TYPE_NAME = "json"
|
|
14
|
+
|
|
15
|
+
def initialize
|
|
16
|
+
super(JSON_TYPE_NAME) { |v| v.is_a?(String) }
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../../../../engine/variable/value_type"
|
|
4
|
+
|
|
5
|
+
module Operaton
|
|
6
|
+
module Bpm
|
|
7
|
+
module Client
|
|
8
|
+
module Variable
|
|
9
|
+
module Impl
|
|
10
|
+
module Type
|
|
11
|
+
# Mirrors org.operaton.bpm.client.variable.impl.type.XmlTypeImpl
|
|
12
|
+
class XmlTypeImpl < Engine::Variable::PrimitiveValueType
|
|
13
|
+
XML_TYPE_NAME = "xml"
|
|
14
|
+
|
|
15
|
+
def initialize
|
|
16
|
+
super(XML_TYPE_NAME) { |v| v.is_a?(String) }
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Operaton
|
|
4
|
+
module Bpm
|
|
5
|
+
module Client
|
|
6
|
+
module Variable
|
|
7
|
+
module Impl
|
|
8
|
+
# Mirrors org.operaton.bpm.client.variable.impl.TypedValueField
|
|
9
|
+
class TypedValueField
|
|
10
|
+
attr_accessor :value, :type, :value_info
|
|
11
|
+
|
|
12
|
+
def self.from_json(hash)
|
|
13
|
+
field = new
|
|
14
|
+
field.value = hash["value"]
|
|
15
|
+
field.type = hash["type"]
|
|
16
|
+
field.value_info = hash["valueInfo"] || {}
|
|
17
|
+
field
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def as_json
|
|
21
|
+
{
|
|
22
|
+
"value" => value,
|
|
23
|
+
"type" => type,
|
|
24
|
+
"valueInfo" => value_info
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def to_s
|
|
29
|
+
"TypedValueField [type=#{type}, value=#{value}, valueInfo=#{value_info}]"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "typed_value_field"
|
|
4
|
+
require_relative "variable_value"
|
|
5
|
+
require_relative "../../impl/external_task_client_logger"
|
|
6
|
+
require_relative "../../../engine/variable/variables"
|
|
7
|
+
|
|
8
|
+
module Operaton
|
|
9
|
+
module Bpm
|
|
10
|
+
module Client
|
|
11
|
+
module Variable
|
|
12
|
+
module Impl
|
|
13
|
+
# Mirrors org.operaton.bpm.client.variable.impl.TypedValues
|
|
14
|
+
class TypedValues
|
|
15
|
+
def initialize(serializers)
|
|
16
|
+
@serializers = serializers
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Serializes a Hash (or Engine::Variable::VariableMap) of variables
|
|
20
|
+
# into a map of variable name => TypedValueField.
|
|
21
|
+
def serialize_variables(variables)
|
|
22
|
+
result = {}
|
|
23
|
+
return result if variables.nil?
|
|
24
|
+
|
|
25
|
+
if variables.is_a?(Engine::Variable::VariableMap)
|
|
26
|
+
variables.keys.each do |variable_name|
|
|
27
|
+
result[variable_name] = serialize_variable(variable_name,
|
|
28
|
+
variables.get_value_typed(variable_name))
|
|
29
|
+
end
|
|
30
|
+
else
|
|
31
|
+
variables.each do |variable_name, variable_value|
|
|
32
|
+
result[variable_name] = serialize_variable(variable_name, variable_value)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
result
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Mirrors wrapVariables: builds lazily-deserialized VariableValue
|
|
40
|
+
# objects out of the raw TypedValueFields received from the engine.
|
|
41
|
+
def wrap_variables(external_task, variables)
|
|
42
|
+
execution_id = external_task.execution_id
|
|
43
|
+
result = {}
|
|
44
|
+
|
|
45
|
+
variables&.each do |variable_name, variable_value|
|
|
46
|
+
type_name = variable_value.type
|
|
47
|
+
if type_name && !type_name.empty?
|
|
48
|
+
variable_value.type = type_name[0].downcase + type_name[1..]
|
|
49
|
+
end
|
|
50
|
+
result[variable_name] = VariableValue.new(execution_id, variable_name, variable_value, @serializers)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
result
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
protected
|
|
57
|
+
|
|
58
|
+
def serialize_variable(variable_name, variable_value)
|
|
59
|
+
typed_value = create_typed_value(variable_value)
|
|
60
|
+
to_typed_value_field(typed_value)
|
|
61
|
+
rescue StandardError => e
|
|
62
|
+
raise logger.cannot_serialize_variable(variable_name, e)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def to_typed_value_field(typed_value)
|
|
66
|
+
serializer = find_serializer(typed_value)
|
|
67
|
+
|
|
68
|
+
if typed_value.is_a?(Engine::Variable::UntypedValue)
|
|
69
|
+
typed_value = serializer.convert_to_typed_value(typed_value)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
typed_value_field = TypedValueField.new
|
|
73
|
+
serializer.write_value(typed_value, typed_value_field)
|
|
74
|
+
|
|
75
|
+
value_type = typed_value.type
|
|
76
|
+
typed_value_field.value_info = value_type.value_info(typed_value)
|
|
77
|
+
type_name = value_type.name
|
|
78
|
+
typed_value_field.type = type_name[0].upcase + type_name[1..]
|
|
79
|
+
typed_value_field
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def find_serializer(typed_value)
|
|
83
|
+
@serializers.find_mapper_for_typed_value(typed_value)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def create_typed_value(value)
|
|
87
|
+
return value if value.is_a?(Engine::Variable::TypedValue)
|
|
88
|
+
|
|
89
|
+
Engine::Variable::Variables.untyped_value(value)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def logger
|
|
93
|
+
Client::Impl::ExternalTaskClientLogger.client_logger
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../../../../engine/variable/typed_value"
|
|
4
|
+
require_relative "../../value/deferred_file_value"
|
|
5
|
+
require_relative "../../../impl/engine_client_exception"
|
|
6
|
+
require_relative "../../../impl/external_task_client_logger"
|
|
7
|
+
|
|
8
|
+
module Operaton
|
|
9
|
+
module Bpm
|
|
10
|
+
module Client
|
|
11
|
+
module Variable
|
|
12
|
+
module Impl
|
|
13
|
+
module Value
|
|
14
|
+
# Mirrors org.operaton.bpm.client.variable.impl.value.DeferredFileValueImpl
|
|
15
|
+
class DeferredFileValueImpl < Engine::Variable::FileValue
|
|
16
|
+
include Variable::Value::DeferredFileValue
|
|
17
|
+
|
|
18
|
+
attr_accessor :variable_name, :execution_id
|
|
19
|
+
|
|
20
|
+
def initialize(filename, engine_client)
|
|
21
|
+
super(filename)
|
|
22
|
+
@engine_client = engine_client
|
|
23
|
+
@is_loaded = false
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def loaded?
|
|
27
|
+
@is_loaded
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Returns the file content, fetching it from the engine on first access.
|
|
31
|
+
def value
|
|
32
|
+
load_content unless loaded?
|
|
33
|
+
super
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def to_s
|
|
37
|
+
"DeferredFileValueImpl [mimeType=#{mime_type}, filename=#{filename}, " \
|
|
38
|
+
"type=#{type}, isTransient=#{transient?}, isLoaded=#{loaded?}]"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
protected
|
|
42
|
+
|
|
43
|
+
def load_content
|
|
44
|
+
bytes = @engine_client.get_local_binary_variable(variable_name, execution_id)
|
|
45
|
+
set_value(bytes)
|
|
46
|
+
@is_loaded = true
|
|
47
|
+
rescue Client::Impl::EngineClientException => e
|
|
48
|
+
raise Client::Impl::ExternalTaskClientLogger.client_logger
|
|
49
|
+
.handled_engine_client_exception("loading deferred file", e)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../../../../engine/variable/typed_value"
|
|
4
|
+
require_relative "../../value/json_value"
|
|
5
|
+
require_relative "../type/json_type_impl"
|
|
6
|
+
|
|
7
|
+
module Operaton
|
|
8
|
+
module Bpm
|
|
9
|
+
module Client
|
|
10
|
+
module Variable
|
|
11
|
+
module Impl
|
|
12
|
+
module Value
|
|
13
|
+
# Mirrors org.operaton.bpm.client.variable.impl.value.JsonValueImpl
|
|
14
|
+
class JsonValueImpl < Engine::Variable::PrimitiveTypeValue
|
|
15
|
+
include Variable::Value::JsonValue
|
|
16
|
+
|
|
17
|
+
def initialize(value, is_transient = false)
|
|
18
|
+
super(value, ClientValues::JSON, is_transient)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../../../../engine/variable/typed_value"
|
|
4
|
+
require_relative "../../value/xml_value"
|
|
5
|
+
require_relative "../type/xml_type_impl"
|
|
6
|
+
|
|
7
|
+
module Operaton
|
|
8
|
+
module Bpm
|
|
9
|
+
module Client
|
|
10
|
+
module Variable
|
|
11
|
+
module Impl
|
|
12
|
+
module Value
|
|
13
|
+
# Mirrors org.operaton.bpm.client.variable.impl.value.XmlValueImpl
|
|
14
|
+
class XmlValueImpl < Engine::Variable::PrimitiveTypeValue
|
|
15
|
+
include Variable::Value::XmlValue
|
|
16
|
+
|
|
17
|
+
def initialize(value, is_transient = false)
|
|
18
|
+
super(value, ClientValues::XML, is_transient)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Operaton
|
|
4
|
+
module Bpm
|
|
5
|
+
module Client
|
|
6
|
+
module Variable
|
|
7
|
+
module Impl
|
|
8
|
+
# Mirrors org.operaton.bpm.client.variable.impl.ValueMapper
|
|
9
|
+
module ValueMapper
|
|
10
|
+
def type
|
|
11
|
+
raise NotImplementedError
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def write_value(typed_value, typed_value_field)
|
|
15
|
+
raise NotImplementedError
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def read_value(typed_value_field, deserialize_value)
|
|
19
|
+
raise NotImplementedError
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def can_handle_typed_value(typed_value)
|
|
23
|
+
raise NotImplementedError
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def can_handle_typed_value_field(typed_value_field)
|
|
27
|
+
raise NotImplementedError
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def convert_to_typed_value(untyped_value)
|
|
31
|
+
raise NotImplementedError
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def serialization_dataformat
|
|
35
|
+
nil
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Operaton
|
|
4
|
+
module Bpm
|
|
5
|
+
module Client
|
|
6
|
+
module Variable
|
|
7
|
+
module Impl
|
|
8
|
+
# Mirrors org.operaton.bpm.client.variable.impl.ValueMappers
|
|
9
|
+
module ValueMappers
|
|
10
|
+
def find_mapper_for_typed_value(typed_value)
|
|
11
|
+
raise NotImplementedError
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def find_mapper_for_typed_value_field(typed_value_field)
|
|
15
|
+
raise NotImplementedError
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def add_mapper(mapper)
|
|
19
|
+
raise NotImplementedError
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Operaton
|
|
4
|
+
module Bpm
|
|
5
|
+
module Client
|
|
6
|
+
module Variable
|
|
7
|
+
module Impl
|
|
8
|
+
# Mirrors org.operaton.bpm.client.variable.impl.VariableValue —
|
|
9
|
+
# lazily deserialized variable value received from the engine.
|
|
10
|
+
class VariableValue
|
|
11
|
+
def initialize(execution_id, variable_name, typed_value_field, mappers)
|
|
12
|
+
@execution_id = execution_id
|
|
13
|
+
@variable_name = variable_name
|
|
14
|
+
@typed_value_field = typed_value_field
|
|
15
|
+
@mappers = mappers
|
|
16
|
+
@serializer = nil
|
|
17
|
+
@cached_value = nil
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def value
|
|
21
|
+
typed_value&.value
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def typed_value(deserialize_value = true)
|
|
25
|
+
if deserialize_value && @cached_value.is_a?(Engine::Variable::ObjectValue) &&
|
|
26
|
+
!@cached_value.deserialized?
|
|
27
|
+
@cached_value = nil
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
if @cached_value.nil?
|
|
31
|
+
@cached_value = serializer.read_value(@typed_value_field, deserialize_value)
|
|
32
|
+
|
|
33
|
+
if @cached_value.is_a?(Value::DeferredFileValueImpl)
|
|
34
|
+
@cached_value.execution_id = @execution_id
|
|
35
|
+
@cached_value.variable_name = @variable_name
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
@cached_value
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def serializer
|
|
43
|
+
@serializer ||= @mappers.find_mapper_for_typed_value_field(@typed_value_field)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def to_s
|
|
47
|
+
"VariableValue [cachedValue=#{@cached_value}, executionId=#{@execution_id}, " \
|
|
48
|
+
"variableName=#{@variable_name}, typedValueField=#{@typed_value_field}]"
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Operaton
|
|
4
|
+
module Bpm
|
|
5
|
+
module Client
|
|
6
|
+
module Variable
|
|
7
|
+
module Value
|
|
8
|
+
# Mirrors org.operaton.bpm.client.variable.value.DeferredFileValue —
|
|
9
|
+
# a file value whose content is lazily fetched from the engine.
|
|
10
|
+
module DeferredFileValue
|
|
11
|
+
def loaded?
|
|
12
|
+
raise NotImplementedError
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Operaton
|
|
4
|
+
module Bpm
|
|
5
|
+
module Client
|
|
6
|
+
module Variable
|
|
7
|
+
module Value
|
|
8
|
+
# Mirrors org.operaton.bpm.client.variable.value.JsonValue — a marker
|
|
9
|
+
# for string-typed JSON values; implemented by Impl::Value::JsonValueImpl.
|
|
10
|
+
module JsonValue
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Operaton
|
|
4
|
+
module Bpm
|
|
5
|
+
module Client
|
|
6
|
+
module Variable
|
|
7
|
+
module Value
|
|
8
|
+
# Mirrors org.operaton.bpm.client.variable.value.XmlValue — a marker
|
|
9
|
+
# for string-typed XML values; implemented by Impl::Value::XmlValueImpl.
|
|
10
|
+
module XmlValue
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Ruby recreation of the Operaton external task client
|
|
4
|
+
# (org.operaton.bpm.client). The namespace mirrors the Java packages:
|
|
5
|
+
#
|
|
6
|
+
# org.operaton.bpm.client -> Operaton::Bpm::Client
|
|
7
|
+
# org.operaton.bpm.client.impl -> Operaton::Bpm::Client::Impl
|
|
8
|
+
# org.operaton.bpm.client.task -> Operaton::Bpm::Client::Task
|
|
9
|
+
# org.operaton.bpm.client.topic -> Operaton::Bpm::Client::Topic
|
|
10
|
+
# org.operaton.bpm.client.backoff -> Operaton::Bpm::Client::Backoff
|
|
11
|
+
# org.operaton.bpm.client.variable -> Operaton::Bpm::Client::Variable
|
|
12
|
+
# org.operaton.bpm.engine.variable -> Operaton::Bpm::Engine::Variable
|
|
13
|
+
#
|
|
14
|
+
# Exception classes from org.operaton.bpm.client.exception live directly
|
|
15
|
+
# under Operaton::Bpm::Client.
|
|
16
|
+
|
|
17
|
+
require_relative "client/version"
|
|
18
|
+
require_relative "client/exceptions"
|
|
19
|
+
|
|
20
|
+
# engine variable commons (org.operaton.bpm.engine.variable)
|
|
21
|
+
require_relative "engine/variable/value_type"
|
|
22
|
+
require_relative "engine/variable/typed_value"
|
|
23
|
+
require_relative "engine/variable/variable_map"
|
|
24
|
+
require_relative "engine/variable/variables"
|
|
25
|
+
|
|
26
|
+
# core interfaces
|
|
27
|
+
require_relative "client/url_resolver"
|
|
28
|
+
require_relative "client/external_task_client"
|
|
29
|
+
require_relative "client/external_task_client_builder"
|
|
30
|
+
|
|
31
|
+
# impl
|
|
32
|
+
require_relative "client/impl/external_task_client_logger"
|
|
33
|
+
require_relative "client/impl/engine_client_logger"
|
|
34
|
+
require_relative "client/impl/engine_client_exception"
|
|
35
|
+
require_relative "client/impl/engine_rest_exception_dto"
|
|
36
|
+
require_relative "client/impl/permanent_url_resolver"
|
|
37
|
+
require_relative "client/impl/request_dto"
|
|
38
|
+
require_relative "client/impl/object_mapper"
|
|
39
|
+
require_relative "client/impl/request_executor"
|
|
40
|
+
require_relative "client/impl/engine_client"
|
|
41
|
+
require_relative "client/impl/external_task_client_impl"
|
|
42
|
+
require_relative "client/impl/external_task_client_builder_impl"
|
|
43
|
+
|
|
44
|
+
# backoff
|
|
45
|
+
require_relative "client/backoff/backoff_strategy"
|
|
46
|
+
require_relative "client/backoff/error_aware_backoff_strategy"
|
|
47
|
+
require_relative "client/backoff/exponential_backoff_strategy"
|
|
48
|
+
require_relative "client/backoff/exponential_error_backoff_strategy"
|
|
49
|
+
|
|
50
|
+
# interceptor
|
|
51
|
+
require_relative "client/interceptor/client_request_context"
|
|
52
|
+
require_relative "client/interceptor/client_request_interceptor"
|
|
53
|
+
require_relative "client/interceptor/impl/client_request_context_impl"
|
|
54
|
+
require_relative "client/interceptor/impl/request_interceptor_handler"
|
|
55
|
+
require_relative "client/interceptor/auth/basic_auth_provider"
|
|
56
|
+
|
|
57
|
+
# spi
|
|
58
|
+
require_relative "client/spi/data_format"
|
|
59
|
+
require_relative "client/spi/data_format_provider"
|
|
60
|
+
require_relative "client/spi/data_format_configurator"
|
|
61
|
+
|
|
62
|
+
# task
|
|
63
|
+
require_relative "client/task/external_task"
|
|
64
|
+
require_relative "client/task/external_task_handler"
|
|
65
|
+
require_relative "client/task/external_task_service"
|
|
66
|
+
require_relative "client/task/ordering_config"
|
|
67
|
+
require_relative "client/task/sorting_dto"
|
|
68
|
+
require_relative "client/task/impl/external_task_impl"
|
|
69
|
+
require_relative "client/task/impl/external_task_service_impl"
|
|
70
|
+
require_relative "client/task/impl/dto/bpmn_error_request_dto"
|
|
71
|
+
require_relative "client/task/impl/dto/complete_request_dto"
|
|
72
|
+
require_relative "client/task/impl/dto/extend_lock_request_dto"
|
|
73
|
+
require_relative "client/task/impl/dto/failure_request_dto"
|
|
74
|
+
require_relative "client/task/impl/dto/lock_request_dto"
|
|
75
|
+
require_relative "client/task/impl/dto/set_variables_request_dto"
|
|
76
|
+
|
|
77
|
+
# topic
|
|
78
|
+
require_relative "client/topic/topic_subscription"
|
|
79
|
+
require_relative "client/topic/topic_subscription_builder"
|
|
80
|
+
require_relative "client/topic/impl/topic_subscription_impl"
|
|
81
|
+
require_relative "client/topic/impl/topic_subscription_builder_impl"
|
|
82
|
+
require_relative "client/topic/impl/topic_subscription_manager"
|
|
83
|
+
require_relative "client/topic/impl/topic_subscription_manager_logger"
|
|
84
|
+
require_relative "client/topic/impl/dto/fetch_and_lock_request_dto"
|
|
85
|
+
require_relative "client/topic/impl/dto/fetch_and_lock_response_dto"
|
|
86
|
+
require_relative "client/topic/impl/dto/topic_request_dto"
|
|
87
|
+
|
|
88
|
+
# variable
|
|
89
|
+
require_relative "client/variable/client_values"
|
|
90
|
+
require_relative "client/variable/value/json_value"
|
|
91
|
+
require_relative "client/variable/value/xml_value"
|
|
92
|
+
require_relative "client/variable/value/deferred_file_value"
|
|
93
|
+
require_relative "client/variable/impl/typed_value_field"
|
|
94
|
+
require_relative "client/variable/impl/typed_values"
|
|
95
|
+
require_relative "client/variable/impl/value_mapper"
|
|
96
|
+
require_relative "client/variable/impl/value_mappers"
|
|
97
|
+
require_relative "client/variable/impl/default_value_mappers"
|
|
98
|
+
require_relative "client/variable/impl/variable_value"
|
|
99
|
+
require_relative "client/variable/impl/abstract_typed_value_mapper"
|
|
100
|
+
require_relative "client/variable/impl/type/json_type_impl"
|
|
101
|
+
require_relative "client/variable/impl/type/xml_type_impl"
|
|
102
|
+
require_relative "client/variable/impl/value/json_value_impl"
|
|
103
|
+
require_relative "client/variable/impl/value/xml_value_impl"
|
|
104
|
+
require_relative "client/variable/impl/value/deferred_file_value_impl"
|
|
105
|
+
require_relative "client/variable/impl/mapper/primitive_value_mapper"
|
|
106
|
+
require_relative "client/variable/impl/mapper/number_value_mapper"
|
|
107
|
+
require_relative "client/variable/impl/mapper/boolean_value_mapper"
|
|
108
|
+
require_relative "client/variable/impl/mapper/byte_array_value_mapper"
|
|
109
|
+
require_relative "client/variable/impl/mapper/date_value_mapper"
|
|
110
|
+
require_relative "client/variable/impl/mapper/double_value_mapper"
|
|
111
|
+
require_relative "client/variable/impl/mapper/file_value_mapper"
|
|
112
|
+
require_relative "client/variable/impl/mapper/integer_value_mapper"
|
|
113
|
+
require_relative "client/variable/impl/mapper/json_value_mapper"
|
|
114
|
+
require_relative "client/variable/impl/mapper/long_value_mapper"
|
|
115
|
+
require_relative "client/variable/impl/mapper/null_value_mapper"
|
|
116
|
+
require_relative "client/variable/impl/mapper/object_value_mapper"
|
|
117
|
+
require_relative "client/variable/impl/mapper/short_value_mapper"
|
|
118
|
+
require_relative "client/variable/impl/mapper/string_value_mapper"
|
|
119
|
+
require_relative "client/variable/impl/mapper/xml_value_mapper"
|
|
120
|
+
require_relative "client/variable/impl/format/json/json_data_format"
|
|
121
|
+
require_relative "client/variable/impl/format/json/json_data_format_provider"
|