module DWork
Helper module for DWorkflow and DWorkSpace
Public Class Methods
findAll(obj, klass)
click to toggle source
returns all instances of klass if the obj parameter is nil, otherwise all instances of klass associated with the the given obj
- klass
-
must be org.dspace.workflow.WorkflowItem and org.dspace.workflow.WorkspaceItem
- obj
-
nil or instances of org.dspace.content.Item, Collection, or Community
# File lib/dspace/dwork.rb, line 11 def self.findAll(obj, klass) if (obj.nil?) then return klass.findAll(DSpace.context) end if (obj.getType == DConstants::COLLECTION) return klass.findByCollection(DSpace.context, obj) elsif (obj.getType == DConstants::COMMUNITY) then wsis = [] obj.getAllCollections.each do |col| wsis += findAll(col, klass) end return wsis elsif (obj.getType == DConstants::ITEM) then wi = klass.findByItem(DSpace.context, obj) # to be consistent return array with the unqiue wokflow item return [wi] if wi elsif (obj.getType == DConstants::EPERSON) then wi = klass.findByEPerson(DSpace.context, obj) end # return empty array if no matching workspace items return [] end