| java.lang.Object org.dspace.content.DSpaceObject org.dspace.content.Collection
Collection | public class Collection extends DSpaceObject (Code) | | 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.
author: Robert Tansley version: $Revision: 2339 $ |
Method Summary | |
public void | addItem(Item item) Add an item to the collection. | public void | canEdit() | public boolean | canEditBoolean() | public int | countItems() | static Collection | create(Context context) Create a new collection, with a new ID. | public Group | createAdministrators() Create a default administrators group if one does not already exist. | public Group | createSubmitters() Create a default submitters group if one does not already exist. | public void | createTemplateItem() Create an empty template item for this collection. | public Group | createWorkflowGroup(int step) Create a workflow group for the given step if one does not already exist. | void | delete() Delete the collection, including the metadata and logo. | public boolean | equals(Object other) | public static Collection | find(Context context, int id) Get a collection from the database. | public static Collection[] | findAll(Context context) Get all collections in the system. | public 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. | public Group | getAdministrators() Get the default group of administrators, if there is one. | public ItemIterator | getAllItems() Get all the items in this collection. | public Community[] | getCommunities() | public String | getHandle() | public int | getID() | public ItemIterator | getItems() Get the in_archive items in this collection. | public String | getLicense() Get the license that users must grant before submitting to this
collection. | public String | getLicenseCollection() Get the license that users must grant before submitting to this
collection. | public Bitstream | getLogo() Get the logo for the collection. | public String | getMetadata(String field) | public String | getName() | public Group | getSubmitters() Get the default group of submitters, if there is one. | public Item | getTemplateItem() Get the template item for this collection. | public int | getType() | public Group | getWorkflowGroup(int step) Get the the workflow group corresponding to a particular workflow step. | public boolean | hasCustomLicense() | public void | removeItem(Item item) Remove an item. | public void | removeTemplateItem() Remove the template item for this collection, if there is one. | public void | setLicense(String license) Set the license for this collection. | public Bitstream | setLogo(InputStream is) Give the collection a logo. | public void | setMetadata(String field, String value) | public void | setWorkflowGroup(int step, Group g) Set the workflow group corresponding to a particular workflow step. | public void | update() Update the collection metadata (including logo, and workflow groups) to
the database. |
Collection | Collection(Context context, TableRow row) throws SQLException(Code) | | Construct a collection with the given table row
Parameters: context - the context this object exists in Parameters: row - the corresponding row in the table throws: SQLException - |
addItem | public void addItem(Item item) throws SQLException, AuthorizeException(Code) | | Add an item to the collection. This simply adds a relationship between
the item and the collection - it does nothing like set an issue date,
remove a personal workspace item etc. This has instant effect;
update need not be called.
Parameters: item - item to add throws: SQLException - throws: AuthorizeException - |
countItems | public int countItems() throws SQLException(Code) | | counts items in this collection
total items |
createAdministrators | public Group createAdministrators() throws SQLException, AuthorizeException(Code) | | Create a default administrators group if one does not already exist.
Returns either the newly created group or the previously existing one.
Note that other groups may also be administrators.
the default group of editors associated with this collection throws: SQLException - throws: AuthorizeException - |
createSubmitters | public Group createSubmitters() throws SQLException, AuthorizeException(Code) | | Create a default submitters group if one does not already exist. Returns
either the newly created group or the previously existing one. Note that
other groups may also be allowed to submit to this collection by the
authorization system.
the default group of submitters associated with this collection throws: SQLException - throws: AuthorizeException - |
createTemplateItem | public void createTemplateItem() throws SQLException, AuthorizeException(Code) | | Create an empty template item for this collection. If one already exists,
no action is taken. Caution: Make sure you call update on
the collection after doing this, or the item will have been created but
the collection record will not refer to it.
throws: SQLException - throws: AuthorizeException - |
createWorkflowGroup | public Group createWorkflowGroup(int step) throws SQLException, AuthorizeException(Code) | | Create a workflow group for the given step if one does not already exist.
Returns either the newly created group or the previously existing one.
Note that while the new group is created in the database, the association
between the group and the collection is not written until
update is called.
Parameters: step - the step (1-3) of the workflow to create or get the group for the workflow group associated with this collection throws: SQLException - throws: AuthorizeException - |
equals | public boolean equals(Object other)(Code) | | Return true if other is the same Collection
as this object, false otherwise
Parameters: other - object to compare to true if object passed in represents the samecollection as this object |
find | public static Collection find(Context context, int id) throws SQLException(Code) | | Get a collection from the database. Loads in the metadata
Parameters: context - DSpace context object Parameters: id - ID of the collection the collection, or null if the ID is invalid. throws: SQLException - |
findAll | public static Collection[] findAll(Context context) throws SQLException(Code) | | Get all collections in the system. These are alphabetically sorted by
collection name.
Parameters: context - DSpace context object the collections in the system throws: SQLException - |
findAuthorized | public static Collection[] findAuthorized(Context context, Community comm, int actionID) throws java.sql.SQLException(Code) | | 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.
Parameters: context - Parameters: comm - (optional) restrict search to a community, else null Parameters: actionID - fo the action Collection [] of collections with matching permissions throws: SQLException - |
getAdministrators | public Group getAdministrators()(Code) | | Get the default group of administrators, if there is one. Note that the
authorization system may allow others to be administrators for the
collection.
The default group of administrators for collection 100 is the one called
collection_100_admin .
group of administrators, or null if there is nodefault group. |
getID | public int getID()(Code) | | Get the internal ID of this collection
the internal identifier |
getLicense | public String getLicense()(Code) | | Get the license that users must grant before submitting to this
collection. If the collection does not have a specific license, the
site-wide default is returned.
the license for this collection |
getLicenseCollection | public String getLicenseCollection()(Code) | | Get the license that users must grant before submitting to this
collection.
the license for this collection |
getLogo | public Bitstream getLogo()(Code) | | Get the logo for the collection. null is return if the
collection does not have a logo.
the logo of the collection, or null |
getMetadata | public String getMetadata(String field)(Code) | | Get the value of a metadata field
Parameters: field - the name of the metadata field to get the value of the metadata field exception: IllegalArgumentException - if the requested metadata field doesn't exist |
getSubmitters | public Group getSubmitters()(Code) | | Get the default group of submitters, if there is one. Note that the
authorization system may allow others to submit to the collection, so
this is not necessarily a definitive list of potential submitters.
The default group of submitters for collection 100 is the one called
collection_100_submit .
the default group of submitters, or null if thereis no default group. |
getTemplateItem | public Item getTemplateItem() throws SQLException(Code) | | Get the template item for this collection. 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.
the item template, or null |
getType | public int getType()(Code) | | return type found in Constants
int Constants.COLLECTION |
getWorkflowGroup | public Group getWorkflowGroup(int step)(Code) | | Get the the workflow group corresponding to a particular workflow step.
This returns null if there is no group associated with
this collection for the given step.
Parameters: step - the workflow step (1-3) the group of reviewers or null |
hasCustomLicense | public boolean hasCustomLicense()(Code) | | Find out if the collection has a custom license
true if the collection has a custom license |
removeTemplateItem | public void removeTemplateItem() throws SQLException, AuthorizeException, IOException(Code) | | Remove the template item for this collection, if there is one. Note that
since this has to remove the old template item ID from the collection
record in the database, the colletion record will be changed, including
any other changes made; in other words, this method does an
update .
throws: SQLException - throws: AuthorizeException - throws: IOException - |
setLicense | public void setLicense(String license)(Code) | | Set the license for this collection. Passing in null means
that the site-wide default will be used.
Parameters: license - the license, or null |
setLogo | public Bitstream setLogo(InputStream is) throws AuthorizeException, IOException, SQLException(Code) | | Give the collection a logo. Passing in 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(/code> 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.
Parameters: is - the stream to use as the new logo the new logo bitstream, or null if there is nologo (null was passed in) throws: AuthorizeException - throws: IOException - throws: SQLException - |
setWorkflowGroup | public void setWorkflowGroup(int step, Group g)(Code) | | Set the workflow group corresponding to a particular workflow step.
null can be passed in if there should be no associated
group for that workflow step; any existing group is NOT deleted.
Parameters: step - the workflow step (1-3) Parameters: g - the new workflow group, or null |
|
|