Method: App42::Storage::QueryBuilder#compoundOperator

Defined in:
lib/storage/QueryBuilder.rb

#compoundOperator(q1, op, q2) ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/storage/QueryBuilder.rb', line 89

def compoundOperator(q1, op, q2)
  util = Util.new()
  util.throwExceptionIfNullOrBlank(q1, "q1");
  util.throwExceptionIfNullOrBlank(q2, "q2");
  jsonArray = Array.new()
  query = Query.new(jsonArray)
  begin
    if q1.getType().instance_of?(Hash)
      jsonArray.push(q1.getType());
    else
      jsonArray.push(q1.getType());
    end
    jsonObj = Hash.new()
    jsonObj.store("compoundOpt", op);
    jsonArray.push(jsonObj);

    if q2.getType().instance_of?(Hash)
      jsonArray.push(q2.getType());
    else
      jsonArray.push(q2.getType());
    end
  rescue Exception => ex
    raise App42Exception.new(ex)
  end
  return query
end