class DCollection

This class wraps an org.dspace.content.Collection object

Public Class Methods

all() click to toggle source

return array of all org.dspace.content.Collection objects

# File lib/dspace/dcollection.rb, line 9
def self.all()
  java_import org.dspace.content.Collection;
  return Collection.findAll(DSpace.context)
end
create(name, community) click to toggle source
create and return org.dspace.content.Collection with given name in the given community

community must be a org.dspace.content.Communiy obj

# File lib/dspace/dcollection.rb, line 27
def self.create(name, community)
  java_import org.dspace.content.Collection;
  new_col = Collection.create(DSpace.context)
  new_col.setMetadata("name", name)
  new_col.update
  community.addCollection(new_col)
  return new_col
end
find(id) click to toggle source

returns nil or the org.dspace.content.Collection object with the given id

id must be an integer

# File lib/dspace/dcollection.rb, line 18
def self.find(id)
  java_import org.dspace.content.Collection;
  return Collection.find(DSpace.context, id)
end

Public Instance Methods

items() click to toggle source

return all items listed by the dspace item iterator

# File lib/dspace/dcollection.rb, line 38
def items
  items, iter  = [], @obj.items
  while (i = iter.next) do
    items << i
  end
  items
end