Module: BpmManager::Oracle

Defined in:
lib/bpm_manager/oracle.rb

Class Method Summary collapse

Class Method Details

.assign_task(task_id, user_id) ⇒ Object

Assigns a Task for an User



28
29
30
# File 'lib/bpm_manager/oracle.rb', line 28

def self.assign_task(task_id, user_id)
  RestClient.post(URI.encode(BpmManager.uri('/task/assign/' + task_id.to_s + '/' + user_id.to_s)), :headers => {:content_type => :json, :accept => :json})
end

.fail_task(task_id) ⇒ Object

Fails a Task



68
69
70
# File 'lib/bpm_manager/oracle.rb', line 68

def self.fail_task(task_id)
  RestClient.post(URI.encode(BpmManager.uri('/task/action/' + task_id.to_s + '/SYS_ERROR')), :headers => {:content_type => :json, :accept => :json})
end

.process_instance(process_instance_id) ⇒ Object

Gets a Process Instance



23
24
25
# File 'lib/bpm_manager/oracle.rb', line 23

def self.process_instance(process_instance_id)
  JSON.parse(RestClient.get(BpmManager.uri('/process/' + process_instance_id.to_s), :accept => :json))
end

.process_instancesObject

Gets all Process Instances



18
19
20
# File 'lib/bpm_manager/oracle.rb', line 18

def self.process_instances
  JSON.parse(RestClient.get(BpmManager.uri('/processes'), :accept => :json))
end

.release_task(task_id) ⇒ Object

Releases a Task



33
34
35
# File 'lib/bpm_manager/oracle.rb', line 33

def self.release_task(task_id)
  RestClient.post(URI.encode(BpmManager.uri('/task/release/' + task_id.to_s)), :headers => {:content_type => :json, :accept => :json})
end

.resume_task(task_id) ⇒ Object

Resumes a Task



53
54
55
# File 'lib/bpm_manager/oracle.rb', line 53

def self.resume_task(task_id)
  RestClient.post(URI.encode(BpmManager.uri('/task/action' + task_id.to_s + '/SYS_RESUME')), :headers => {:content_type => :json, :accept => :json})
end

.suspend_task(task_id) ⇒ Object

Suspends a Task



48
49
50
# File 'lib/bpm_manager/oracle.rb', line 48

def self.suspend_task(task_id)
  RestClient.post(URI.encode(BpmManager.uri('/task/action/' + task_id.to_s + '/SYS_SUSPEND')), :headers => {:content_type => :json, :accept => :json})
end

.tasks(user_id = "") ⇒ Object

Gets all tasks, optionally you could specify an user id



8
9
10
# File 'lib/bpm_manager/oracle.rb', line 8

def self.tasks(user_id = "")
  self.structure_task_data(JSON.parse(RestClient.get(BpmManager.uri('/tasks' + (user_id.empty? ? '' : '/' + user_id)), :accept => :json)))
end

.tasks_with_opts(opts = {}) ⇒ Object

Gets all tasks with options



13
14
15
# File 'lib/bpm_manager/oracle.rb', line 13

def self.tasks_with_opts(opts = {})
  self.structure_task_data(JSON.parse(RestClient.get(BpmManager.uri('/tasks' + (opts.empty? ? '' : '?' + opts.map{|k,v| k.to_s + '=' + v.to_s}.join('&'))), :accept => :json)))
end