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 | Field and Description |
|---|---|
static String |
COPYRIGHT_TEXT |
static String |
INTRODUCTORY_TEXT |
static String |
PROVENANCE_TEXT |
static String |
SHORT_DESCRIPTION |
static String |
SIDEBAR_TEXT |
| 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(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,
Integer limit,
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
|
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(Integer limit,
Integer offset)
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() |
addDetails, clearDetails, find, getDetails, getTypeTextpublic static final String COPYRIGHT_TEXT
public static final String INTRODUCTORY_TEXT
public static final String SHORT_DESCRIPTION
public static final String SIDEBAR_TEXT
public static final String PROVENANCE_TEXT
public static Collection find(Context context, int id) throws SQLException
context - DSpace context objectid - ID of the collectionSQLExceptionpublic static Collection[] findAll(Context context) throws SQLException
context - DSpace context objectSQLExceptionpublic static Collection[] findAll(Context context, Integer limit, Integer offset) throws SQLException
context - limit - offset - SQLExceptionpublic ItemIterator getItems() throws SQLException
SQLExceptionpublic ItemIterator getItems(Integer limit, Integer offset) throws SQLException
limit - Max number of results in setoffset - Number of results to jump ahead by. 100 = 100th result is first, not 100th page.SQLExceptionpublic ItemIterator getAllItems() throws SQLException
SQLExceptionpublic int getID()
getID in class DSpaceObjectpublic String getHandle()
DSpaceObjectnullgetHandle in class DSpaceObjectnull if it doesn't have
oneDSpaceObject.getHandle()public String getMetadata(String field)
field - the name of the metadata field to getIllegalArgumentException - if the requested metadata field doesn't existpublic void setMetadata(String field, String value) throws MissingResourceException
field - the name of the metadata field to getvalue - value to set the field toIllegalArgumentException - if the requested metadata field doesn't existMissingResourceExceptionpublic 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(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 logonull if there is no
logo (null was passed in)AuthorizeExceptionIOExceptionSQLExceptionpublic Group createWorkflowGroup(int step) throws SQLException, AuthorizeException
update is called.step - the step (1-3) of the workflow to create or get the group forSQLExceptionAuthorizeExceptionpublic 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 SQLException, AuthorizeException
SQLExceptionAuthorizeExceptionpublic void removeSubmitters()
throws SQLException,
AuthorizeException
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 SQLException, AuthorizeException
SQLExceptionAuthorizeExceptionpublic void removeAdministrators()
throws SQLException,
AuthorizeException
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 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 nullpublic 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.nullSQLExceptionpublic 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.SQLExceptionAuthorizeExceptionpublic void removeTemplateItem()
throws SQLException,
AuthorizeException,
IOException
update.public void addItem(Item item) throws SQLException, AuthorizeException
update need not be called.item - item to addSQLExceptionAuthorizeExceptionpublic void removeItem(Item item) throws SQLException, AuthorizeException, IOException
item - item to removeSQLExceptionAuthorizeExceptionIOExceptionpublic void update()
throws SQLException,
AuthorizeException
update in class DSpaceObjectSQLExceptionIOExceptionAuthorizeExceptionpublic boolean canEditBoolean()
throws SQLException
SQLExceptionpublic boolean canEditBoolean(boolean useInheritance)
throws SQLException
SQLExceptionpublic void canEdit()
throws AuthorizeException,
SQLException
AuthorizeExceptionSQLExceptionpublic void canEdit(boolean useInheritance)
throws AuthorizeException,
SQLException
AuthorizeExceptionSQLExceptionpublic Community[] getCommunities() throws SQLException
Community objectsSQLExceptionpublic boolean equals(Object other)
true if other is the same Collection
as this object, false otherwisepublic int getType()
getType in class DSpaceObjectpublic static Collection[] findAuthorized(Context context, Community comm, int actionID) throws SQLException
context - comm - (optional) restrict search to a community, else nullactionID - of the actionSQLExceptionpublic int countItems()
throws SQLException
SQLExceptionpublic 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 thrownSQLExceptionpublic DSpaceObject getParentObject() throws SQLException
DSpaceObjectgetParentObject in class DSpaceObjectSQLExceptionpublic void updateLastModified()
updateLastModified in class DSpaceObjectCopyright © 2014 DuraSpace. All Rights Reserved.