bpm_manager 1.0.20 → 1.0.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7c9ebb30468ff7de163b1bdbcbe61d620ad39d6
4
- data.tar.gz: a460a7df04ed7de6d795608f0a2983d46976672a
3
+ metadata.gz: 143400626215977ba4c15b52b2193ee96bb4803c
4
+ data.tar.gz: 7bb238a363033e2f3cfe561e917de0b1739e4c86
5
5
  SHA512:
6
- metadata.gz: 614cda378e9d9423f1672211dfe07c9a1b5be7267e29aa71825e7028a3e03404b0f495c3113ba2ad0ccfc92a9d1c3ce5d8779f0773a59ca2e72781644bc2ffad
7
- data.tar.gz: 2a27ec5afcd8fa5ae59d2111892d74ccaf8b089226e039b7e547c9f03d7dc5dfdb2dd317c26325ba1093ad05c15d9b81eaa5223581807f7cfcf6f3420cb91970
6
+ metadata.gz: 753d836073de90b4b9dc317e9c439073d1257cf46b5e36234fbe0da0029f48cd99d3787cee4e17a8358071d8719f672fa1e43c30e129fb578ad9e2bf3449d33a
7
+ data.tar.gz: 50a36686db2ed87a05d30c1d3f14973e1852201de4185020663195ca5c8790d5336a8c72431fb5ffd05afc8ba6db4a0f8288a84cc6b3d46a61a93b8b705bcff4
@@ -162,8 +162,26 @@ module BpmManager
162
162
  def self.clear_all_history()
163
163
  BpmManager.server['/history/clear'].post({})
164
164
  end
165
-
165
+
166
166
  # Gets the SLA for a Process Instance
167
+ def self.get_process_sla(process_instance_id, process_sla_hours = 0, warning_offset_percent = 20)
168
+ my_process = self.process_instance(process_instance_id).first
169
+
170
+ unless my_process.nil?
171
+ sla = OpenStruct.new(:process => OpenStruct.new)
172
+
173
+ # Calculates the process sla
174
+ sla.process.status = calculate_sla((my_process['start_on']/1000), process_sla_hours, warning_offset_percent)
175
+ sla.process.status_name = (calculate_sla((my_process['start_on']/1000), process_sla_hours, warning_offset_percent) == 0) ? 'ok' : (calculate_sla((my_process['start_on']/ 1000), process_sla_hours, warning_offset_percent) == 1 ? 'warning' : 'due')
176
+ sla.process.percentages = calculate_sla_percent((my_process['start_on']/1000), process_sla_hours, warning_offset_percent)
177
+ else
178
+ sla = nil
179
+ end
180
+
181
+ return sla
182
+ end
183
+
184
+ # Gets the SLA for a Task Instance
167
185
  def self.get_task_sla(task_instance_id, process_sla_hours = 0, task_sla_hours = 0, warning_offset_percent = 20)
168
186
  my_task = self.tasks_with_opts('taskId' => task_instance_id).first
169
187
 
@@ -262,7 +280,7 @@ module BpmManager
262
280
  my_task.process.deployment_id = task['deployment-id']
263
281
  my_task.process.id = my_task.process.data['process-id']
264
282
  my_task.process.instance_id = my_task.process.data['process-instance-id']
265
- my_task.process.start_on = Time.at(my_task.process.data['start']/1000)
283
+ my_task.process.start_on = my_task.process.data['start'].nil? ? Time.now : Time.at(my_task.process.data['start']/1000)
266
284
  my_task.process.name = my_task.process.data['process-name']
267
285
  my_task.process.version = my_task.process.data['process-version']
268
286
  my_task.process.creator = my_task.process.data['identity']
@@ -307,7 +325,7 @@ module BpmManager
307
325
  my_task.process.deployment_id = task['deployment-id']
308
326
  my_task.process.id = my_task.process.data['process-id']
309
327
  my_task.process.instance_id = my_task.process.data['process-instance-id']
310
- my_task.process.start_on = Time.at(my_task.process.data['start']/1000)
328
+ my_task.process.start_on = my_task.process.data['start'].nil? ? Time.now : Time.at(my_task.process.data['start']/1000)
311
329
  my_task.process.name = my_task.process.data['process-name']
312
330
  my_task.process.version = my_task.process.data['process-version']
313
331
  my_task.process.creator = my_task.process.data['identity']
@@ -1,3 +1,3 @@
1
1
  module BpmManager
2
- VERSION = "1.0.20"
2
+ VERSION = "1.0.22"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bpm_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.20
4
+ version: 1.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ariel Presa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-19 00:00:00.000000000 Z
11
+ date: 2017-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client