Class: CmisServer::Query::WhereClause

Inherits:
Object
  • Object
show all
Defined in:
lib/cmis_server/query/simple_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conditions) ⇒ WhereClause

Returns a new instance of WhereClause.



226
227
228
# File 'lib/cmis_server/query/simple_parser.rb', line 226

def initialize(conditions)
  @conditions = conditions
end

Instance Attribute Details

#conditionsObject

Returns the value of attribute conditions.



224
225
226
# File 'lib/cmis_server/query/simple_parser.rb', line 224

def conditions
  @conditions
end

Instance Method Details

#to_hObject

Convert to hash format for the connector



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/cmis_server/query/simple_parser.rb', line 231

def to_h
  # For now, convert simple conditions to a hash
  result = {}
  
  @conditions.each do |cond|
    next unless cond.is_a?(WhereCondition)
    
    # Map CMIS properties to search parameters
    property = cond.left.sub(/^\w+\./, '') # Remove alias if present
    
    case property
    when 'cmis:name'
      result['name'] = cond.right
    when 'cmis:objectTypeId'
      result['type_id'] = cond.right
    when 'cmis:parentId'
      result['parent_id'] = cond.right
    else
      result[property] = cond.right
    end
  end
  
  result
end