You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by lu...@redhat.com on 2013/03/14 01:33:37 UTC
[PATCH 05/14] 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>
TrackedAt: http://tracker.deltacloud.org/patch/c2417e1f3383ae4a76e1d40d04440daed149bf95
---
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 7df57f6..8daa183 100644
--- a/server/lib/cimi/service/base.rb
+++ b/server/lib/cimi/service/base.rb
@@ -117,7 +117,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.4