You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2013/03/01 14:32:23 UTC

[PATCH core 3/9] CIMI: Apply $filter and $select in Base#list

From: Michal Fojtik <mf...@redhat.com>

No need to have ugly chained methods in collections.

Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/lib/cimi/collections/machines.rb | 2 +-
 server/lib/cimi/service/base.rb         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/lib/cimi/collections/machines.rb b/server/lib/cimi/collections/machines.rb
index 0337f86..f3cb62a 100644
--- a/server/lib/cimi/collections/machines.rb
+++ b/server/lib/cimi/collections/machines.rb
@@ -24,7 +24,7 @@ module CIMI::Collections
       operation :index, :with_capability => :instances do
         description "List all machines"
         control do
-          machines = Machine.list(self).select_by(params['$select']).filter_by(params['$filter'])
+          machines = Machine.list(self)
           respond_to do |format|
             format.xml { machines.to_xml }
             format.json { machines.to_json }
diff --git a/server/lib/cimi/service/base.rb b/server/lib/cimi/service/base.rb
index 9c281b7..9f2c765 100644
--- a/server/lib/cimi/service/base.rb
+++ b/server/lib/cimi/service/base.rb
@@ -97,7 +97,7 @@ module CIMI::Service
       params = {}
       params[:desc] = "#{self.name.split("::").last} Collection for the #{ctx.driver.name.capitalize} driver"
       params[:add_url] = create_url(ctx)
-      model_class.list(id, entries, params)
+      model_class.list(id, entries, params).select_by(ctx.params['$select']).filter_by(ctx.params['$filter'])
     end
 
     def self.create_url(ctx)
-- 
1.8.1.2