Class: DataMapper::Adapters::AppEngineAdapter::QueryBuilder
- Inherits:
-
Object
- Object
- DataMapper::Adapters::AppEngineAdapter::QueryBuilder
- Defined in:
- lib/appengine-paginator/datamapper_ext.rb
Instance Method Summary collapse
Instance Method Details
#get_entities ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/appengine-paginator/datamapper_ext.rb', line 43 def get_entities if is_get? Datastore.get(@keys) else prepare_java_query.collect { |e| e } end end |
#old_run ⇒ Object
41 |
# File 'lib/appengine-paginator/datamapper_ext.rb', line 41 alias :old_run :run |
#prepare_java_query ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/appengine-paginator/datamapper_ext.rb', line 51 def prepare_java_query begin chunk_size = FetchOptions::DEFAULT_CHUNK_SIZE = FetchOptions::Builder.with_chunk_size( chunk_size) .limit(@limit) if @limit .offset(@offset) if @offset .cursor(@dm_query.cursor) if @dm_query.respond_to?(:cursor) && @dm_query.cursor @query.pquery.as_query_result_list() rescue java.lang.IllegalArgumentException => ex raise ArgumentError, ex. end end |
#run ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/appengine-paginator/datamapper_ext.rb', line 65 def run resources = old_run class << resources; def singleton_class; self.class; end ; end cursor = prepare_java_query.cursor resources.singleton_class.send :define_method, :cursor do Paginator::Cursor.new(cursor) end resources end |