You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2013/02/25 20:23:01 UTC
[5/9] git commit: CIMI models: move validate! to CIMI::Model::Resource
CIMI models: move validate! to CIMI::Model::Resource
It also needs to be available for collections, which do not derive from Base
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/32872268
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/32872268
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/32872268
Branch: refs/heads/master
Commit: 32872268ff416f9f290d1ceed73b1bf098084a56
Parents: 800695f
Author: David Lutterkort <lu...@redhat.com>
Authored: Fri Feb 22 13:52:16 2013 -0800
Committer: David Lutterkort <lu...@redhat.com>
Committed: Mon Feb 25 11:22:37 2013 -0800
----------------------------------------------------------------------
server/lib/cimi/models/base.rb | 7 -------
server/lib/cimi/models/resource.rb | 7 +++++++
2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/32872268/server/lib/cimi/models/base.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/base.rb b/server/lib/cimi/models/base.rb
index 4b03495..12105f2 100644
--- a/server/lib/cimi/models/base.rb
+++ b/server/lib/cimi/models/base.rb
@@ -141,13 +141,6 @@ module CIMI::Model
self
end
- def validate!(format=:xml)
- failed_attrs = self.class.required_attributes.map do |attr|
- attr.send("#{format}_name") unless attr.valid?(send(attr.name))
- end.compact
- raise CIMI::Model::ValidationError.new(failed_attrs, format) unless failed_attrs.empty?
- end
-
# FIXME: Kludge around the fact that we do not have proper *Create
# objects that deserialize properties by themselves
def extract_properties!(data)
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/32872268/server/lib/cimi/models/resource.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/resource.rb b/server/lib/cimi/models/resource.rb
index ad62e49..246b135 100644
--- a/server/lib/cimi/models/resource.rb
+++ b/server/lib/cimi/models/resource.rb
@@ -184,6 +184,13 @@ module CIMI
end
end
+ def validate!(format=:xml)
+ failed_attrs = self.class.required_attributes.map do |attr|
+ attr.send("#{format}_name") unless attr.valid?(send(attr.name))
+ end.compact
+ raise CIMI::Model::ValidationError.new(failed_attrs, format) unless failed_attrs.empty?
+ end
+
def base_id
self.id || @base_id
end