Class: Operaton::Bpm::Client::Task::Impl::ExternalTaskImpl

Inherits:
Object
  • Object
show all
Includes:
ExternalTask
Defined in:
lib/operaton/bpm/client/task/impl/external_task_impl.rb

Overview

Mirrors org.operaton.bpm.client.task.impl.ExternalTaskImpl

Constant Summary

Constants included from ExternalTask

ExternalTask::INTERFACE_METHODS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeExternalTaskImpl

Returns a new instance of ExternalTaskImpl.



57
58
59
60
61
62
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 57

def initialize
  @variables = {}
  @received_variable_map = {}
  @extension_properties = nil
  @priority = 0
end

Instance Attribute Details

#activity_idObject

Returns the value of attribute activity_id.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def activity_id
  @activity_id
end

#activity_instance_idObject

Returns the value of attribute activity_instance_id.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def activity_instance_id
  @activity_instance_id
end

#business_keyObject

Returns the value of attribute business_key.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def business_key
  @business_key
end

#create_timeObject

Returns the value of attribute create_time.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def create_time
  @create_time
end

#error_detailsObject

Returns the value of attribute error_details.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def error_details
  @error_details
end

#error_messageObject

Returns the value of attribute error_message.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def error_message
  @error_message
end

#execution_idObject

Returns the value of attribute execution_id.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def execution_id
  @execution_id
end

#idObject

Returns the value of attribute id.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def id
  @id
end

#lock_expiration_timeObject

Returns the value of attribute lock_expiration_time.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def lock_expiration_time
  @lock_expiration_time
end

#priorityObject

Returns the value of attribute priority.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def priority
  @priority
end

#process_definition_idObject

Returns the value of attribute process_definition_id.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def process_definition_id
  @process_definition_id
end

#process_definition_keyObject

Returns the value of attribute process_definition_key.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def process_definition_key
  @process_definition_key
end

#process_definition_version_tagObject

Returns the value of attribute process_definition_version_tag.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def process_definition_version_tag
  @process_definition_version_tag
end

#process_instance_idObject

Returns the value of attribute process_instance_id.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def process_instance_id
  @process_instance_id
end

#received_variable_mapObject

Returns the value of attribute received_variable_map.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def received_variable_map
  @received_variable_map
end

#retriesObject

Returns the value of attribute retries.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def retries
  @retries
end

#tenant_idObject

Returns the value of attribute tenant_id.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def tenant_id
  @tenant_id
end

#topic_nameObject

Returns the value of attribute topic_name.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def topic_name
  @topic_name
end

#variablesObject

Returns the value of attribute variables.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def variables
  @variables
end

#worker_idObject

Returns the value of attribute worker_id.



16
17
18
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 16

def worker_id
  @worker_id
end

Class Method Details

.from_json(hash, object_mapper) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 23

def self.from_json(hash, object_mapper)
  task = new
  task.activity_id = hash["activityId"]
  task.activity_instance_id = hash["activityInstanceId"]
  task.error_message = hash["errorMessage"]
  task.error_details = hash["errorDetails"]
  task.execution_id = hash["executionId"]
  task.id = hash["id"]
  task.lock_expiration_time = parse_time(hash["lockExpirationTime"], object_mapper)
  task.create_time = parse_time(hash["createTime"], object_mapper)
  task.process_definition_id = hash["processDefinitionId"]
  task.process_definition_key = hash["processDefinitionKey"]
  task.process_definition_version_tag = hash["processDefinitionVersionTag"]
  task.process_instance_id = hash["processInstanceId"]
  task.retries = hash["retries"]
  task.worker_id = hash["workerId"]
  task.topic_name = hash["topicName"]
  task.tenant_id = hash["tenantId"]
  task.priority = hash["priority"] || 0
  task.business_key = hash["businessKey"]
  task.variables = (hash["variables"] || {}).transform_values do |field|
    Variable::Impl::TypedValueField.from_json(field)
  end
  task.set_extension_properties(hash["extensionProperties"])
  task
end

Instance Method Details

#all_variablesObject

Mirrors getAllVariables



65
66
67
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 65

def all_variables
  received_variable_map.keys.to_h { |name| [name, variable(name)] }
end

#all_variables_typed(deserialize_object_values = true) ⇒ Object

Mirrors getAllVariablesTyped



76
77
78
79
80
81
82
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 76

def all_variables_typed(deserialize_object_values = true)
  vars = Engine::Variable::VariableMap.new
  received_variable_map.each_key do |variable_name|
    vars.put_value_typed(variable_name, variable_typed(variable_name, deserialize_object_values))
  end
  vars
end

#extension_propertiesObject



90
91
92
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 90

def extension_properties
  @extension_properties || {}
end

#extension_property(property_key) ⇒ Object



98
99
100
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 98

def extension_property(property_key)
  @extension_properties&.[](property_key)
end

#set_extension_properties(extension_properties) ⇒ Object

rubocop:disable Naming/AccessorMethodName



94
95
96
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 94

def set_extension_properties(extension_properties) # rubocop:disable Naming/AccessorMethodName
  @extension_properties = extension_properties
end

#to_sObject



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 102

def to_s
  "ExternalTaskImpl [" \
    "activityId=#{activity_id}, " \
    "activityInstanceId=#{activity_instance_id}, " \
    "businessKey=#{business_key}, " \
    "errorDetails=#{error_details}, " \
    "errorMessage=#{error_message}, " \
    "executionId=#{execution_id}, " \
    "id=#{id}, " \
    "lockExpirationTime=#{lock_expiration_time}, " \
    "createTime=#{create_time}, " \
    "priority=#{priority}, " \
    "processDefinitionId=#{process_definition_id}, " \
    "processDefinitionKey=#{process_definition_key}, " \
    "processDefinitionVersionTag=#{process_definition_version_tag}, " \
    "processInstanceId=#{process_instance_id}, " \
    "retries=#{retries}, " \
    "tenantId=#{tenant_id}, " \
    "topicName=#{topic_name}, " \
    "workerId=#{worker_id}]"
end

#variable(variable_name) ⇒ Object

Mirrors getVariable



70
71
72
73
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 70

def variable(variable_name)
  variable_value = received_variable_map[variable_name]
  variable_value&.value
end

#variable_typed(variable_name, deserialize_object_values = true) ⇒ Object

Mirrors getVariableTyped



85
86
87
88
# File 'lib/operaton/bpm/client/task/impl/external_task_impl.rb', line 85

def variable_typed(variable_name, deserialize_object_values = true)
  variable_value = received_variable_map[variable_name]
  variable_value&.typed_value(deserialize_object_values)
end