Class: Rhoconnect::Handler::Query::PassThroughRunner

Inherits:
Runner
  • Object
show all
Defined in:
lib/rhoconnect/handler/query/pass_through_runner.rb

Instance Attribute Summary

Attributes inherited from Runner

#client, #engine, #p_size, #params, #source

Instance Method Summary collapse

Methods inherited from Runner

#ack_token, #build_page, #compute_errors_page, #compute_links_page, #compute_metadata, #compute_page, #compute_page_bruteforce, #format_result, #initialize, #resend_page, #schema_changed?, #send_new_page_bruteforce

Constructor Details

This class inherits a constructor from Rhoconnect::Handler::Query::Runner

Instance Method Details

#runObject



5
6
7
8
9
10
11
12
# File 'lib/rhoconnect/handler/query/pass_through_runner.rb', line 5

def run
  token = params[:token]
  ack_token(token) if token
  res = []
  query_result = engine.do_sync
  res = send_new_page(query_result)
  format_result(res[0],res[1],res[2],res[3])
end

#send_new_page(data) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rhoconnect/handler/query/pass_through_runner.rb', line 14

def send_new_page(data)
  data ||= {}
  data.each_key do |object_id| 
    data[object_id].each { |attrib,value| data[object_id][attrib] = '' if value.nil? }
  end
  token = ''
  compute_errors_page
  res = build_page do |r|
    r['insert'] = data
    r['metadata'] = 
  end
  if res['insert']
    token = @client.compute_token(:page_token)
  else
    _delete_errors_page 
  end    
  [token,0,data.size,res]
end