|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dspace.content.DSpaceObject
org.dspace.content.Collection
public class Collection
Class representing a collection.
The collection's metadata (name, introductory text etc), workflow groups, and
default group of submitters are loaded into memory. Changes to metadata are
not written to the database until update is called. If you
create or remove a workflow group, the change is only reflected in the
database after calling update. The default group of
submitters is slightly different - creating or removing this has instant
effect.
| Method Summary | |
|---|---|
void |
addItem(Item item)
Add an item to the collection. |
void |
canEdit()
|
void |
canEdit(boolean useInheritance)
|
boolean |
canEditBoolean()
|
boolean |
canEditBoolean(boolean useInheritance)
|
int |
countItems()
counts items in this collection |
Group |
createAdministrators()
Create a default administrators group if one does not already exist. |
Group |
createSubmitters()
Create a default submitters group if one does not already exist. |
void |
createTemplateItem()
Create an empty template item for this collection. |
Group |
createWorkflowGroup(int step)
Create a workflow group for the given step if one does not already exist. |
boolean |
equals(Object other)
Return true if other is the same Collection
as this object, false otherwise |
static Collection |
find(Context context,
int id)
Get a collection from the database. |
static Collection[] |
findAll(Context context)
Get all collections in the system. |
static Collection[] |
findAuthorized(Context context,
Community comm,
int actionID)
return an array of collections that user has a given permission on (useful for trimming 'select to collection' list) or figuring out which collections a person is an editor for. |
Group |
getAdministrators()
Get the default group of administrators, if there is one. |
DSpaceObject |
getAdminObject(int action)
Return the dspace object where an ADMIN action right is sufficient to grant the initial authorize check. |
ItemIterator |
getAllItems()
Get all the items in this collection. |
Community[] |
getCommunities()
Get the communities this collection appears in |
String |
getHandle()
Get the Handle of the object. |
int |
getID()
Get the internal ID of this collection |
ItemIterator |
getItems()
Get the in_archive items in this collection. |
String |
getLicense()
Get the license that users must grant before submitting to this collection. |
String |
getLicenseCollection()
Get the license that users must grant before submitting to this collection. |
Bitstream |
getLogo()
Get the logo for the collection. |
String |
getMetadata(String field)
Get the value of a metadata field |
String |
getName()
Get a proper name for the object. |
DSpaceObject |
getParentObject()
Return the dspace object that "own" the current object in the hierarchy. |
Group |
getSubmitters()
Get the default group of submitters, if there is one. |
Item |
getTemplateItem()
Get the template item for this collection. |
int |
getType()
return type found in Constants |
Group |
getWorkflowGroup(int step)
Get the the workflow group corresponding to a particular workflow step. |
boolean |
hasCustomLicense()
Find out if the collection has a custom license |
int |
hashCode()
|
void |
removeAdministrators()
Remove the administrators group, if no group has already been created then return without error. |
void |
removeItem(Item item)
Remove an item. |
void |
removeSubmitters()
Remove the submitters group, if no group has already been created then return without error. |
void |
removeTemplateItem()
Remove the template item for this collection, if there is one. |
void |
setLicense(String license)
Set the license for this collection. |
Bitstream |
setLogo(InputStream is)
Give the collection a logo. |
void |
setMetadata(String field,
String value)
Set a metadata value |
void |
setWorkflowGroup(int step,
Group g)
Set the workflow group corresponding to a particular workflow step. |
void |
update()
Update the collection metadata (including logo and workflow groups) to the database. |
void |
updateLastModified()
|
| Methods inherited from class org.dspace.content.DSpaceObject |
|---|
addDetails, clearDetails, find, getDetails, getTypeText |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Collection find(Context context,
int id)
throws SQLException
context - DSpace context objectid - ID of the collection
SQLException
public static Collection[] findAll(Context context)
throws SQLException
context - DSpace context object
SQLException
public ItemIterator getItems()
throws SQLException
SQLException
public ItemIterator getAllItems()
throws SQLException
SQLExceptionpublic int getID()
getID in class DSpaceObjectpublic String getHandle()
DSpaceObjectnull
getHandle in class DSpaceObjectnull if it doesn't have
oneDSpaceObject.getHandle()public String getMetadata(String field)
field - the name of the metadata field to get
IllegalArgumentException - if the requested metadata field doesn't exist
public void setMetadata(String field,
String value)
throws MissingResourceException
field - the name of the metadata field to getvalue - value to set the field to
IllegalArgumentException - if the requested metadata field doesn't exist
MissingResourceExceptionpublic String getName()
DSpaceObjectnull.
Name should be suitable for display in a user interface.
getName in class DSpaceObjectnull if it doesn't have
onepublic Bitstream getLogo()
null is returned if the
collection does not have a logo.
null
public Bitstream setLogo(InputStream is)
throws AuthorizeException,
IOException,
SQLException
null removes any
existing logo. You will need to set the format of the new logo bitstream
before it will work, for example to "JPEG". Note that
update will need to be called for the change to take
effect. Setting a logo and not calling update later may
result in a previous logo lying around as an "orphaned" bitstream.
is - the stream to use as the new logo
null if there is no
logo (null was passed in)
AuthorizeException
IOException
SQLException
public Group createWorkflowGroup(int step)
throws SQLException,
AuthorizeException
update is called.
step - the step (1-3) of the workflow to create or get the group for
SQLException
AuthorizeException
public void setWorkflowGroup(int step,
Group g)
null can be passed in if there should be no associated
group for that workflow step; any existing group is NOT deleted.
step - the workflow step (1-3)g - the new workflow group, or nullpublic Group getWorkflowGroup(int step)
null if there is no group associated with
this collection for the given step.
step - the workflow step (1-3)
null
public Group createSubmitters()
throws SQLException,
AuthorizeException
SQLException
AuthorizeException
public void removeSubmitters()
throws SQLException,
AuthorizeException
SQLException
AuthorizeExceptionpublic Group getSubmitters()
The default group of submitters for collection 100 is the one called
collection_100_submit.
null if there
is no default group.
public Group createAdministrators()
throws SQLException,
AuthorizeException
SQLException
AuthorizeException
public void removeAdministrators()
throws SQLException,
AuthorizeException
SQLException
AuthorizeExceptionpublic Group getAdministrators()
The default group of administrators for collection 100 is the one called
collection_100_admin.
null if there is no
default group.public String getLicense()
public String getLicenseCollection()
public boolean hasCustomLicense()
true if the collection has a custom licensepublic void setLicense(String license)
null means
that the site-wide default will be used.
license - the license, or null
public Item getTemplateItem()
throws SQLException
null is
returned if the collection does not have a template. Submission
mechanisms may copy this template to provide a convenient starting point
for a submission.
null
SQLException
public void createTemplateItem()
throws SQLException,
AuthorizeException
update on
the collection after doing this, or the item will have been created but
the collection record will not refer to it.
SQLException
AuthorizeException
public void removeTemplateItem()
throws SQLException,
AuthorizeException,
IOException
update.
SQLException
AuthorizeException
IOException
public void addItem(Item item)
throws SQLException,
AuthorizeException
update need not be called.
item - item to add
SQLException
AuthorizeException
public void removeItem(Item item)
throws SQLException,
AuthorizeException,
IOException
item - item to remove
SQLException
AuthorizeException
IOException
public void update()
throws SQLException,
AuthorizeException
update in class DSpaceObjectSQLException
IOException
AuthorizeException
public boolean canEditBoolean()
throws SQLException
SQLException
public boolean canEditBoolean(boolean useInheritance)
throws SQLException
SQLException
public void canEdit()
throws AuthorizeException,
SQLException
AuthorizeException
SQLException
public void canEdit(boolean useInheritance)
throws AuthorizeException,
SQLException
AuthorizeException
SQLException
public Community[] getCommunities()
throws SQLException
Community objects
SQLExceptionpublic boolean equals(Object other)
true if other is the same Collection
as this object, false otherwise
equals in class Objectother - object to compare to
true if object passed in represents the same
collection as this objectpublic int hashCode()
hashCode in class Objectpublic int getType()
getType in class DSpaceObject
public static Collection[] findAuthorized(Context context,
Community comm,
int actionID)
throws SQLException
context - comm - (optional) restrict search to a community, else nullactionID - of the action
SQLException
public int countItems()
throws SQLException
SQLException
public DSpaceObject getAdminObject(int action)
throws SQLException
DSpaceObjectDefault behaviour is ADMIN right on the object grant right on all other action on the object itself. Subclass should override this method as needed.
getAdminObject in class DSpaceObjectaction - ID of action being attempted, from
org.dspace.core.Constants. The ADMIN action is
not a valid parameter for this method, an
IllegalArgumentException should be thrown
SQLException
public DSpaceObject getParentObject()
throws SQLException
DSpaceObject
getParentObject in class DSpaceObjectSQLExceptionpublic void updateLastModified()
updateLastModified in class DSpaceObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||