|
||||||||||
| 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.Item
public class Item
Class representing an item in DSpace.
This class holds in memory the item Dublin Core metadata, the bundles in the
item, and the bitstreams in those bundles. When modifying the item, if you
modify the Dublin Core or the "in archive" flag, you must call
update for the changes to be written to the database.
Creating, adding or removing bundles or bitstreams has immediate effect in
the database.
| Field Summary | |
|---|---|
static String |
ANY
Wild card for Dublin Core metadata qualifiers/languages |
| Method Summary | |
|---|---|
void |
addBundle(Bundle b)
Add an existing bundle to this item. |
void |
addDC(String element,
String qualifier,
String lang,
String value)
Deprecated. |
void |
addDC(String element,
String qualifier,
String lang,
String[] values)
Deprecated. |
void |
addMetadata(String schema,
String element,
String qualifier,
String lang,
String value)
Add a single metadata field. |
void |
addMetadata(String schema,
String element,
String qualifier,
String lang,
String[] values)
Add metadata fields. |
boolean |
canEdit()
return TRUE if context's user can edit item, false otherwise |
void |
clearDC(String element,
String qualifier,
String lang)
Deprecated. |
void |
clearMetadata(String schema,
String element,
String qualifier,
String lang)
Clear metadata values. |
Bundle |
createBundle(String name)
Create a bundle in this item, with immediate effect |
Bitstream |
createSingleBitstream(InputStream is)
Convenience method, calls createSingleBitstream() with name "ORIGINAL" |
Bitstream |
createSingleBitstream(InputStream is,
String name)
Create a single bitstream in a new bundle. |
void |
decache()
Remove item and all its sub-structure from the context cache. |
boolean |
equals(DSpaceObject other)
Return true if other is the same Item as
this object, false otherwise |
static Item |
find(Context context,
int id)
Get an item from the database. |
static ItemIterator |
findAll(Context context)
Get all the items in the archive. |
static ItemIterator |
findBySubmitter(Context context,
EPerson eperson)
Find all the items in the archive by a given submitter. |
Bundle[] |
getBundles()
Get the bundles in this item. |
Bundle[] |
getBundles(String name)
Get the bundles matching a bundle name (name corresponds roughly to type) |
Collection[] |
getCollections()
Get the collections this item is in. |
Collection[] |
getCollectionsNotLinked()
Get the collections this item is not in. |
Community[] |
getCommunities()
Get the communities this item is in. |
DCValue[] |
getDC(String element,
String qualifier,
String lang)
Deprecated. |
String |
getHandle()
Get the Handle of the object. |
int |
getID()
Get the internal ID of this item. |
Date |
getLastModified()
Get the date the item was last modified, or the current date if last_modified is null |
DCValue[] |
getMetadata(String mdString)
Retrieve metadata field values from a given metadata string of the form |
DCValue[] |
getMetadata(String schema,
String element,
String qualifier,
String lang)
Get metadata for the item in a chosen schema. |
String |
getName()
Get a proper name for the object. |
Bitstream[] |
getNonInternalBitstreams()
Get all non-internal bitstreams in the item. |
Collection |
getOwningCollection()
Get the owning Collection for the item |
EPerson |
getSubmitter()
Get the e-person that originally submitted this item |
int |
getType()
return type found in Constants |
void |
inheritCollectionDefaultPolicies(Collection c)
remove all policies on an item and its contents, and replace them with the DEFAULT_ITEM_READ and DEFAULT_BITSTREAM_READ policies belonging to the collection. |
boolean |
isArchived()
Find out if the item is part of the main archive |
boolean |
isOwningCollection(Collection c)
Return true if this Collection 'owns' this item |
boolean |
isWithdrawn()
Find out if the item has been withdrawn |
void |
licenseGranted(String license,
EPerson eperson)
Store a copy of the license a user granted in this item. |
void |
move(Collection from,
Collection to)
Moves the item from one collection to another one |
void |
reinstate()
Reinstate a withdrawn item |
void |
removeBundle(Bundle b)
Remove a bundle. |
void |
removeDSpaceLicense()
Remove just the DSpace license from an item This is useful to update the current DSpace license, in case the user must accept the DSpace license again (either the item was rejected, or resumed after saving) |
void |
removeGroupPolicies(Group g)
remove all of the policies for item's bitstreams and bundles that belong to a given Group |
void |
removeLicenses()
Remove all licenses from an item - it was rejected |
void |
replaceAllBitstreamPolicies(List newpolicies)
remove all of the policies for item's bitstreams and bundles and replace them with a new list of policies |
void |
replaceAllItemPolicies(List newpolicies)
remove all of the policies for item and replace them with a new list of policies |
void |
setArchived(boolean isArchived)
Set the "is_archived" flag. |
void |
setOwningCollection(Collection c)
Set the owning Collection for the item |
void |
setSubmitter(EPerson sub)
Set the e-person that originally submitted this item. |
void |
update()
Update the item "in archive" flag and Dublin Core metadata in the database |
void |
withdraw()
Withdraw the item from the archive. |
| Methods inherited from class org.dspace.content.DSpaceObject |
|---|
addDetails, clearDetails, find, getDetails |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ANY
| Method Detail |
|---|
public static Item find(Context context,
int id)
throws SQLException
context - DSpace context objectid - Internal ID of the item
SQLException
public static ItemIterator findAll(Context context)
throws SQLException
context - DSpace context object
SQLException
public static ItemIterator findBySubmitter(Context context,
EPerson eperson)
throws SQLException
context - DSpace context objecteperson - the submitter
SQLExceptionpublic int getID()
getID in class DSpaceObjectpublic String getHandle()
DSpaceObjectnull
getHandle in class DSpaceObjectnull if it doesn't have
oneDSpaceObject.getHandle()public boolean isArchived()
public boolean isWithdrawn()
public Date getLastModified()
public void setArchived(boolean isArchived)
WorkflowItem.archive() should set this.
isArchived - new value for the flagpublic void setOwningCollection(Collection c)
c - Collection
public Collection getOwningCollection()
throws SQLException
SQLException
@Deprecated
public DCValue[] getDC(String element,
String qualifier,
String lang)
null value for qualifier
or lang only matches Dublin Core fields where that
qualifier or languages is actually null.
Passing in Item.ANY
retrieves all metadata fields with any value for the qualifier or
language, including null
Examples:
Return values of the unqualified "title" field, in any language. Qualified title fields (e.g. "title.uniform") are NOT returned:
item.getDC( "title", null, Item.ANY );
Return all US English values of the "title" element, with any qualifier (including unqualified):
item.getDC( "title", Item.ANY, "en_US" );
The ordering of values of a particular element/qualifier/language combination is significant. When retrieving with wildcards, values of a particular element/qualifier/language combinations will be adjacent, but the overall ordering of the combinations is indeterminate.
element - the Dublin Core element. Item.ANY matches any
element. null doesn't really make sense as all
DC must have an element.qualifier - the qualifier. null means unqualified, and
Item.ANY means any qualifier (including
unqualified.)lang - the ISO639 language code, optionally followed by an underscore
and the ISO3166 country code. null means only
values with no language are returned, and
Item.ANY means values with any country code or
no country code are returned.
public DCValue[] getMetadata(String schema,
String element,
String qualifier,
String lang)
MetadataSchema for more information about schemas.
Passing in a null value for qualifier
or lang only matches metadata fields where that
qualifier or languages is actually null.
Passing in Item.ANY
retrieves all metadata fields with any value for the qualifier or
language, including null
Examples:
Return values of the unqualified "title" field, in any language. Qualified title fields (e.g. "title.uniform") are NOT returned:
item.getMetadata("dc", "title", null, Item.ANY );
Return all US English values of the "title" element, with any qualifier (including unqualified):
item.getMetadata("dc, "title", Item.ANY, "en_US" );
The ordering of values of a particular element/qualifier/language combination is significant. When retrieving with wildcards, values of a particular element/qualifier/language combinations will be adjacent, but the overall ordering of the combinations is indeterminate.
schema - the schema for the metadata field. Must match
the name of an existing metadata schema.element - the element name. Item.ANY matches any
element. null doesn't really make sense as all
metadata must have an element.qualifier - the qualifier. null means unqualified, and
Item.ANY means any qualifier (including
unqualified.)lang - the ISO639 language code, optionally followed by an underscore
and the ISO3166 country code. null means only
values with no language are returned, and
Item.ANY means values with any country code or
no country code are returned.
public DCValue[] getMetadata(String mdString)
mdString - The metadata string of the form
@Deprecated
public void addDC(String element,
String qualifier,
String lang,
String[] values)
clearDC to remove values. The ordering of values
passed in is maintained.
element - the Dublin Core elementqualifier - the Dublin Core qualifer, or null for
unqualifiedlang - the ISO639 language code, optionally followed by an underscore
and the ISO3166 country code. null means the
value has no language (for example, a date).values - the values to add.
@Deprecated
public void addDC(String element,
String qualifier,
String lang,
String value)
clearDC to remove values.
element - the Dublin Core elementqualifier - the Dublin Core qualifer, or null for
unqualifiedlang - the ISO639 language code, optionally followed by an underscore
and the ISO3166 country code. null means the
value has no language (for example, a date).value - the value to add.
public void addMetadata(String schema,
String element,
String qualifier,
String lang,
String[] values)
clearDC to remove values. The ordering of values
passed in is maintained.
schema - the schema for the metadata field. Must match
the name of an existing metadata schema.element - the metadata element namequalifier - the metadata qualifer name, or null for
unqualifiedlang - the ISO639 language code, optionally followed by an underscore
and the ISO3166 country code. null means the
value has no language (for example, a date).values - the values to add.
public void addMetadata(String schema,
String element,
String qualifier,
String lang,
String value)
clearDC to remove values.
schema - the schema for the metadata field. Must match
the name of an existing metadata schema.element - the metadata element namequalifier - the metadata qualifer, or null for
unqualifiedlang - the ISO639 language code, optionally followed by an underscore
and the ISO3166 country code. null means the
value has no language (for example, a date).value - the value to add.
@Deprecated
public void clearDC(String element,
String qualifier,
String lang)
getDC above,
passing in null only matches fields where the qualifier or
language is actually null.Item.ANY will
match any element, qualifier or language, including null.
Thus, item.clearDC(Item.ANY, Item.ANY, Item.ANY) will
remove all Dublin Core metadata associated with an item.
element - the Dublin Core element to remove, or Item.ANYqualifier - the qualifier. null means unqualified, and
Item.ANY means any qualifier (including
unqualified.)lang - the ISO639 language code, optionally followed by an underscore
and the ISO3166 country code. null means only
values with no language are removed, and Item.ANY
means values with any country code or no country code are
removed.
public void clearMetadata(String schema,
String element,
String qualifier,
String lang)
getDC above,
passing in null only matches fields where the qualifier or
language is actually null.Item.ANY will
match any element, qualifier or language, including null.
Thus, item.clearDC(Item.ANY, Item.ANY, Item.ANY) will
remove all Dublin Core metadata associated with an item.
schema - the schema for the metadata field. Must match
the name of an existing metadata schema.element - the Dublin Core element to remove, or Item.ANYqualifier - the qualifier. null means unqualified, and
Item.ANY means any qualifier (including
unqualified.)lang - the ISO639 language code, optionally followed by an underscore
and the ISO3166 country code. null means only
values with no language are removed, and Item.ANY
means values with any country code or no country code are
removed.
public EPerson getSubmitter()
throws SQLException
SQLExceptionpublic void setSubmitter(EPerson sub)
update must be called to write the change to the
database.
sub - the submitter
public Collection[] getCollections()
throws SQLException
SQLException
public Community[] getCommunities()
throws SQLException
SQLException
public Bundle[] getBundles()
throws SQLException
SQLException
public Bundle[] getBundles(String name)
throws SQLException
name - name of bundle (ORIGINAL/TEXT/THUMBNAIL)
SQLException
public Bundle createBundle(String name)
throws SQLException,
AuthorizeException
name - bundle name (ORIGINAL/TEXT/THUMBNAIL)
SQLException
AuthorizeException
public void addBundle(Bundle b)
throws SQLException,
AuthorizeException
b - the bundle to add
SQLException
AuthorizeException
public void removeBundle(Bundle b)
throws SQLException,
AuthorizeException,
IOException
b - the bundle to remove
SQLException
AuthorizeException
IOException
public Bitstream createSingleBitstream(InputStream is,
String name)
throws AuthorizeException,
IOException,
SQLException
is - the stream to create the new bitstream fromname - is the name of the bundle (ORIGINAL, TEXT, THUMBNAIL)
AuthorizeException
IOException
SQLException
public Bitstream createSingleBitstream(InputStream is)
throws AuthorizeException,
IOException,
SQLException
is - InputStream
AuthorizeException
IOException
SQLException
public Bitstream[] getNonInternalBitstreams()
throws SQLException
SQLException
public void licenseGranted(String license,
EPerson eperson)
throws SQLException,
IOException,
AuthorizeException
license - the license the user grantedeperson - the eperson who granted the license
SQLException
IOException
AuthorizeException
public void removeDSpaceLicense()
throws SQLException,
AuthorizeException,
IOException
This method is used by the org.dspace.submit.step.LicenseStep class
SQLException
AuthorizeException
IOException
public void removeLicenses()
throws SQLException,
AuthorizeException,
IOException
SQLException
AuthorizeException
IOException
public void update()
throws SQLException,
AuthorizeException
SQLException
AuthorizeException
public void withdraw()
throws SQLException,
AuthorizeException,
IOException
SQLException
AuthorizeException
IOException
public void reinstate()
throws SQLException,
AuthorizeException,
IOException
SQLException
AuthorizeException
IOException
public void decache()
throws SQLException
SQLExceptionpublic boolean equals(DSpaceObject other)
true if other is the same Item as
this object, false otherwise
other - object to compare to
true if object passed in represents the same item
as this objectpublic boolean isOwningCollection(Collection c)
c - Collection
public int getType()
getType in class DSpaceObject
public void replaceAllItemPolicies(List newpolicies)
throws SQLException,
AuthorizeException
newpolicies - -
this will be all of the new policies for the item and its
contents
SQLException
AuthorizeException
public void replaceAllBitstreamPolicies(List newpolicies)
throws SQLException,
AuthorizeException
newpolicies - -
this will be all of the new policies for the bundle and
bitstream contents
SQLException
AuthorizeException
public void removeGroupPolicies(Group g)
throws SQLException
g - Group referenced by policies that needs to be removed
SQLException
public void inheritCollectionDefaultPolicies(Collection c)
throws SQLException,
AuthorizeException
c - Collection
SQLException - if an SQL error or if no default policies found. It's a bit
draconian, but default policies must be enforced.
AuthorizeException
public void move(Collection from,
Collection to)
throws SQLException,
AuthorizeException,
IOException
SQLException
AuthorizeException
IOException
public Collection[] getCollectionsNotLinked()
throws SQLException
SQLException
public boolean canEdit()
throws SQLException
SQLExceptionpublic String getName()
DSpaceObjectnull.
Name should be suitable for display in a user interface.
getName in class DSpaceObjectnull if it doesn't have
one
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||