public class Collection extends DSpaceObject
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.
| Modifier and Type | Method and Description |
|---|---|
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(java.lang.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[] |
findAll(Context context,
java.lang.Integer limit,
java.lang.Integer offset)
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
|
java.lang.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.
|
ItemIterator |
getItems(java.lang.Integer limit,
java.lang.Integer offset)
Get the in_archive items in this collection.
|
java.lang.String |
getLicense()
Get the license that users must grant before submitting to this
collection.
|
java.lang.String |
getLicenseCollection()
Get the license that users must grant before submitting to this
collection.
|
Bitstream |
getLogo()
Get the logo for the collection.
|
java.lang.String |
getMetadata(java.lang.String field)
Get the value of a metadata field
|
java.lang.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(java.lang.String license)
Set the license for this collection.
|
Bitstream |
setLogo(java.io.InputStream is)
Give the collection a logo.
|
void |
setMetadata(java.lang.String field,
java.lang.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() |
addDetails, clearDetails, find, getDetails, getTypeTextpublic static Collection find(Context context, int id) throws java.sql.SQLException
context - DSpace context objectid - ID of the collectionjava.sql.SQLExceptionpublic static Collection[] findAll(Context context) throws java.sql.SQLException
context - DSpace context objectjava.sql.SQLExceptionpublic static Collection[] findAll(Context context, java.lang.Integer limit, java.lang.Integer offset) throws java.sql.SQLException
context - limit - offset - java.sql.SQLExceptionpublic ItemIterator getItems() throws java.sql.SQLException
java.sql.SQLExceptionpublic ItemIterator getItems(java.lang.Integer limit, java.lang.Integer offset) throws java.sql.SQLException
limit - Max number of results in setoffset - Number of results to jump ahead by. 100 = 100th result is first, not 100th page.java.sql.SQLExceptionpublic ItemIterator getAllItems() throws java.sql.SQLException
java.sql.SQLExceptionpublic int getID()
getID in class DSpaceObjectpublic java.lang.String getHandle()
DSpaceObjectnullgetHandle in class DSpaceObjectnull if it doesn't have
oneDSpaceObject.getHandle()public java.lang.String getMetadata(java.lang.String field)
field - the name of the metadata field to getjava.lang.IllegalArgumentException - if the requested metadata field doesn't existpublic void setMetadata(java.lang.String field,
java.lang.String value)
throws java.util.MissingResourceException
field - the name of the metadata field to getvalue - value to set the field tojava.lang.IllegalArgumentException - if the requested metadata field doesn't existjava.util.MissingResourceExceptionpublic java.lang.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.nullpublic Bitstream setLogo(java.io.InputStream is) throws AuthorizeException, java.io.IOException, java.sql.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 logonull if there is no
logo (null was passed in)AuthorizeExceptionjava.io.IOExceptionjava.sql.SQLExceptionpublic Group createWorkflowGroup(int step) throws java.sql.SQLException, AuthorizeException
update is called.step - the step (1-3) of the workflow to create or get the group forjava.sql.SQLExceptionAuthorizeExceptionpublic 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)nullpublic Group createSubmitters() throws java.sql.SQLException, AuthorizeException
java.sql.SQLExceptionAuthorizeExceptionpublic void removeSubmitters()
throws java.sql.SQLException,
AuthorizeException
java.sql.SQLExceptionAuthorizeExceptionpublic 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 java.sql.SQLException, AuthorizeException
java.sql.SQLExceptionAuthorizeExceptionpublic void removeAdministrators()
throws java.sql.SQLException,
AuthorizeException
java.sql.SQLExceptionAuthorizeExceptionpublic 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 java.lang.String getLicense()
public java.lang.String getLicenseCollection()
public boolean hasCustomLicense()
true if the collection has a custom licensepublic void setLicense(java.lang.String license)
null means
that the site-wide default will be used.license - the license, or nullpublic Item getTemplateItem() throws java.sql.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.nulljava.sql.SQLExceptionpublic void createTemplateItem()
throws java.sql.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.java.sql.SQLExceptionAuthorizeExceptionpublic void removeTemplateItem()
throws java.sql.SQLException,
AuthorizeException,
java.io.IOException
update.java.sql.SQLExceptionAuthorizeExceptionjava.io.IOExceptionpublic void addItem(Item item) throws java.sql.SQLException, AuthorizeException
update need not be called.item - item to addjava.sql.SQLExceptionAuthorizeExceptionpublic void removeItem(Item item) throws java.sql.SQLException, AuthorizeException, java.io.IOException
item - item to removejava.sql.SQLExceptionAuthorizeExceptionjava.io.IOExceptionpublic void update()
throws java.sql.SQLException,
AuthorizeException
update in class DSpaceObjectjava.sql.SQLExceptionjava.io.IOExceptionAuthorizeExceptionpublic boolean canEditBoolean()
throws java.sql.SQLException
java.sql.SQLExceptionpublic boolean canEditBoolean(boolean useInheritance)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void canEdit()
throws AuthorizeException,
java.sql.SQLException
AuthorizeExceptionjava.sql.SQLExceptionpublic void canEdit(boolean useInheritance)
throws AuthorizeException,
java.sql.SQLException
AuthorizeExceptionjava.sql.SQLExceptionpublic Community[] getCommunities() throws java.sql.SQLException
Community objectsjava.sql.SQLExceptionpublic boolean equals(java.lang.Object other)
true if other is the same Collection
as this object, false otherwiseequals in class java.lang.Objectother - object to compare totrue if object passed in represents the same
collection as this objectpublic int hashCode()
hashCode in class java.lang.Objectpublic int getType()
getType in class DSpaceObjectpublic static Collection[] findAuthorized(Context context, Community comm, int actionID) throws java.sql.SQLException
context - comm - (optional) restrict search to a community, else nullactionID - of the actionjava.sql.SQLExceptionpublic int countItems()
throws java.sql.SQLException
java.sql.SQLExceptionpublic DSpaceObject getAdminObject(int action) throws java.sql.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 thrownjava.sql.SQLExceptionpublic DSpaceObject getParentObject() throws java.sql.SQLException
DSpaceObjectgetParentObject in class DSpaceObjectjava.sql.SQLExceptionpublic void updateLastModified()
updateLastModified in class DSpaceObjectCopyright © 2013 DuraSpace. All Rights Reserved.