class SakaiInfo::DeletedContentResource

Attributes

context[R]
dbrow[R]
deleted_at[R]
file_path[R]
resource_type_id[R]
uuid[R]

Public Class Methods

clear_cache() click to toggle source
# File lib/sakai-info/content.rb, line 261
def self.clear_cache
  @@cache = {}
end
count_by_parent(parent_id) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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
new(dbrow) click to toggle source
Calls superclass method SakaiInfo::ContentResource::new
# 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
query_by_parent(parent_id) click to toggle source
# File lib/sakai-info/content.rb, line 296
def self.query_by_parent(parent_id)
  DB.connect[:content_resource_delete].where(:in_collection => parent_id)
end

Public Instance Methods

default_serialization() click to toggle source
# 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
deleted_by() click to toggle source
# File lib/sakai-info/content.rb, line 283
def deleted_by
  @deleted_by ||= User.find(@dbrow[:delete_userid])
end