Class: SakaiInfo::DeletedContentResource
- Inherits:
-
ContentResource
- Object
- SakaiObject
- Content
- ContentResource
- SakaiInfo::DeletedContentResource
- Defined in:
- lib/sakai-info/content.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#dbrow ⇒ Object
readonly
Returns the value of attribute dbrow.
-
#deleted_at ⇒ Object
readonly
Returns the value of attribute deleted_at.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#resource_type_id ⇒ Object
readonly
Returns the value of attribute resource_type_id.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Attributes inherited from Content
Attributes inherited from SakaiObject
Class Method Summary collapse
- .clear_cache ⇒ Object
- .count_by_parent(parent_id) ⇒ Object
- .find(id) ⇒ Object
- .find_by_delete_userid(user_id) ⇒ Object
- .find_by_parent(parent_id) ⇒ Object
- .query_by_parent(parent_id) ⇒ Object
Instance Method Summary collapse
- #default_serialization ⇒ Object
- #deleted_by ⇒ Object
-
#initialize(dbrow) ⇒ DeletedContentResource
constructor
A new instance of DeletedContentResource.
Methods inherited from ContentResource
#detailed_summary_serialization, find_by_uuid, #size_on_disk, #summary_serialization
Methods inherited from Content
all_serializations, #binary_entity, #child_summary_serialization, #effective_realm, #mod_details_serialization, #mod_serialization, #original_mod_details_serialization, #original_mod_serialization, #parent, #properties_serialization, #realm, #realm_serialization, #size_on_disk, #summary_serialization
Methods included from ModProps
Methods inherited from SakaiObject
all_serializations, #dbrow_only_serialization, #dbrow_serialization, descendants, #object_type_serialization, #serialize, #shell_serialization, #summary_serialization, #to_csv, #to_json, #to_yaml
Constructor Details
#initialize(dbrow) ⇒ DeletedContentResource
Returns a new instance of DeletedContentResource.
266 267 268 269 270 |
# File 'lib/sakai-info/content.rb', line 266 def initialize(dbrow) super(dbrow) @table_name = "content_resource_delete" @deleted_at = @dbrow[:delete_date].strftime("%Y-%m-%d %H:%M:%S") end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
259 260 261 |
# File 'lib/sakai-info/content.rb', line 259 def context @context end |
#dbrow ⇒ Object (readonly)
Returns the value of attribute dbrow.
259 260 261 |
# File 'lib/sakai-info/content.rb', line 259 def dbrow @dbrow end |
#deleted_at ⇒ Object (readonly)
Returns the value of attribute deleted_at.
259 260 261 |
# File 'lib/sakai-info/content.rb', line 259 def deleted_at @deleted_at end |
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
259 260 261 |
# File 'lib/sakai-info/content.rb', line 259 def file_path @file_path end |
#resource_type_id ⇒ Object (readonly)
Returns the value of attribute resource_type_id.
259 260 261 |
# File 'lib/sakai-info/content.rb', line 259 def resource_type_id @resource_type_id end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
259 260 261 |
# File 'lib/sakai-info/content.rb', line 259 def uuid @uuid end |
Class Method Details
.clear_cache ⇒ Object
261 262 263 |
# File 'lib/sakai-info/content.rb', line 261 def self.clear_cache @@cache = {} end |
.count_by_parent(parent_id) ⇒ Object
309 310 311 |
# File 'lib/sakai-info/content.rb', line 309 def self.count_by_parent(parent_id) DeletedContentResource.query_by_parent(parent_id).count end |
.find(id) ⇒ Object
272 273 274 275 276 277 278 279 280 281 |
# File 'lib/sakai-info/content.rb', line 272 def self.find(id) if @@cache[id].nil? row = DB.connect[:content_resource_delete].where(:resource_id => id).first if row.nil? raise ObjectNotFoundException.new(DeletedContentResource, id) end @@cache[id] = DeletedContentResource.new(row) end @@cache[id] end |
.find_by_delete_userid(user_id) ⇒ Object
287 288 289 290 291 292 293 294 |
# File 'lib/sakai-info/content.rb', line 287 def self.find_by_delete_userid(user_id) resources = [] DB.connect[:content_resource_delete].where(:delete_userid => user_id).all.each do |row| @@cache[row[:resource_id]] = DeletedContentResource.new(row) resources << @@cache[row[:resource_id]] end resources end |
.find_by_parent(parent_id) ⇒ Object
300 301 302 303 304 305 306 307 |
# File 'lib/sakai-info/content.rb', line 300 def self.find_by_parent(parent_id) resources = [] DeletedContentResource.query_by_parent(parent_id).all.each do |row| @@cache[row[:resource_id]] = DeletedContentResource.new(row) resources << @@cache[row[:resource_id]] end resources end |
Instance Method Details
#default_serialization ⇒ Object
313 314 315 316 317 318 |
# File 'lib/sakai-info/content.rb', line 313 def default_serialization result = super result["deleted_at"] = self.deleted_at result["deleted_by"] = self.deleted_by.serialize(:summary) result end |