class DCommunity
This class wraps an org.dspace.content.Community object
Public Class Methods
all()
click to toggle source
return array of all org.dspace.content.Community objects
# File lib/dspace/dcommunity.rb, line 9 def self.all() java_import org.dspace.content.Community; return Community.findAll(DSpace.context) end
create(name)
click to toggle source
create and return top level org.dspace.content.Community with given name
# File lib/dspace/dcommunity.rb, line 25 def self.create(name) comm = Community.create(nil, DSpace.context) comm.setMetadata("name", name) comm.update return comm end
find(id)
click to toggle source
returns nil or the org.dspace.content.Community object with the given id
id must be an integer
# File lib/dspace/dcommunity.rb, line 18 def self.find(id) java_import org.dspace.content.Community; return Community.find(DSpace.context, id) end
getCollections(com)
click to toggle source
# File lib/dspace/dcommunity.rb, line 36 def self.getCollections(com) colls = [] if (not com.is_a? Array) then com = [com] end com.each do |c| colls = colls + c.getCollections.collect { |c| c } colls = colls + getCollections(c.getSubcommunities.collect{ |sc| sc}) end return colls end
Public Instance Methods
getCollections()
click to toggle source
# File lib/dspace/dcommunity.rb, line 32 def getCollections return DCommunity.getCollections(self.dso) end