Class | OpenWFE::WorklistClient |
In: |
lib/openwfe/orest/worklistclient.rb
|
Parent: | RestClient |
a client to an OpenWFE worklists.
# File lib/openwfe/orest/worklistclient.rb, line 62 62: def initialize (url, username, password) 63: super 64: end
Delegate the workitem (transfer it to another store).
# File lib/openwfe/orest/worklistclient.rb, line 217 217: def delegate (workitem, targetStoreName) 218: 219: ewi = OpenWFE.encode(workitem) 220: 221: params = {} 222: params[TARGETSTORE] = targetStoreName 223: 224: decode(post('delegate', workitem.store, params, ewi)) 225: end
Delegate the workitem (ask the worklist to deliver it to another participant).
# File lib/openwfe/orest/worklistclient.rb, line 231 231: def delegate_to_participant (workitem, targetParticipantName) 232: 233: ewi = OpenWFE.encode(workitem) 234: 235: params = {} 236: params[TARGETPARTICIPANT] = targetParticipantName 237: 238: decode(post('delegate', workitem.store, params, ewi)) 239: end
TODO : rdoc me
# File lib/openwfe/orest/worklistclient.rb, line 93 93: def find_flow_instance (store_name, workflow_instance_id) 94: 95: params = {} 96: params["id"] = workflow_instance_id 97: 98: decode(get('findFlowInstance', store_name, params)) 99: end
Returns a workitem and makes sure it‘s locked in the worklist. Thus, the usage of the methods saveWorkitem() and forwardWorkitem() is possible.
# File lib/openwfe/orest/worklistclient.rb, line 131 131: def get_and_lock_workitem (storeName, flowExpressionId) 132: 133: #puts "...getAndLockWorkitem() for #{flowExpressionId}" 134: 135: get_item('getAndLockWorkitem', storeName, flowExpressionId) 136: end
Returns the headers of a given store.
# File lib/openwfe/orest/worklistclient.rb, line 82 82: def get_headers (storeName, limit=1000) 83: 84: params = {} 85: params["limit"] = limit 86: 87: decode(get('getHeaders', storeName, params)) 88: end
Returns a workitem (but doesn‘t put a lock on it, thus modifications to it cannot be communicated with saveWorkitem() or forwardWorkitem() to the worklist)
# File lib/openwfe/orest/worklistclient.rb, line 121 121: def get_workitem (storeName, flowExpressionId) 122: 123: get_item('getWorkitem', storeName, flowExpressionId) 124: end
Launches a flow (on a given engine and with a given launchitem). The ‘engineId’ corresponds to an engine‘s participant name (see etc/engine/participant-map.xml)
# File lib/openwfe/orest/worklistclient.rb, line 106 106: def launch_flow (engineId, launchitem) 107: 108: eli = OpenWFE::XmlCodec::encode(launchitem) 109: 110: params = {} 111: params[ENGINEID] = engineId 112: 113: decode(post('launchFlow', nil, params, eli)) 114: end
Returns the list of flow URLs the user owning this session may launch.
# File lib/openwfe/orest/worklistclient.rb, line 207 207: def list_launchables () 208: 209: params = {} 210: 211: decode(get('listLaunchables', nil, params)) 212: end
Returns the list of stores the worklist hosts
# File lib/openwfe/orest/worklistclient.rb, line 69 69: def list_stores 70: r = get('listStores', nil, nil) 71: decode(r) 72: end
Returns the workitem to the worklist so that it can resume its flow (changes to the workitem are saved).
# File lib/openwfe/orest/worklistclient.rb, line 196 196: def proceed_workitem (workitem) 197: 198: post_item('forwardWorkitem', workitem) 199: end
Given a queryMap (a dict of keys and values), locks and returns the first workitem matching.
# File lib/openwfe/orest/worklistclient.rb, line 142 142: def query_and_lock_workitem (storeName, queryMap) 143: 144: hs = get_headers(storeName) 145: hs.each do |h| 146: 147: #puts "...h.id #{h.flowExpressionId}" 148: #h.attributes.each do |k, v| 149: # puts "......h '#{k}' => '#{v}'" 150: #end 151: 152: ok = true 153: id = nil 154: 155: queryMap.each do |key, value| 156: 157: #puts "...'#{key}' => '#{h.attributes[key]}' ?= '#{value}'" 158: ok = (ok and h.attributes[key] == value) 159: # 160: # the parenthesis are very important 161: 162: #puts " .ok is #{ok}" 163: #puts " .id is #{h.flowExpressionId}" 164: break unless ok 165: end 166: 167: #puts " .id is #{h.flowExpressionId}" 168: 169: get_and_lock_workitem(storeName, h.flow_expression_id) if ok 170: end 171: 172: nil 173: end
Notifies the worklist that the given workitem has to be unlocked any local (client-side) modification to it are ignored.
# File lib/openwfe/orest/worklistclient.rb, line 179 179: def release_workitem (workitem) 180: 181: post_item('releaseWorkitem', workitem) 182: end
Saves back the workitem in the worklist (and releases it)
# File lib/openwfe/orest/worklistclient.rb, line 187 187: def save_workitem (workitem) 188: 189: post_item('saveWorkitem', workitem) 190: end
def queryStore (storeName, query) end
# File lib/openwfe/orest/worklistclient.rb, line 246 246: def get_item (rest_method_name, store_name, flow_expression_id) 247: 248: fei = OpenWFE::XmlCodec::encode flow_expression_id 249: fei = OpenWFE::xmldoc_to_string fei, false 250: 251: params = {} 252: 253: wi = decode(post(rest_method_name, store_name, params, fei)) 254: 255: wi.store = store_name if wi 256: 257: wi 258: end