public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements ItemService
| Modifier and Type | Field and Description |
|---|---|
protected AuthorizeService |
authorizeService |
protected BitstreamFormatService |
bitstreamFormatService |
protected BitstreamService |
bitstreamService |
protected BundleService |
bundleService |
protected CollectionService |
collectionService |
protected CommunityService |
communityService |
protected HarvestedItemService |
harvestedItemService |
protected IdentifierService |
identifierService |
protected InstallItemService |
installItemService |
protected ItemDAO |
itemDAO |
protected MetadataSchemaService |
metadataSchemaService |
protected ResourcePolicyService |
resourcePolicyService |
protected VersioningService |
versioningService |
choiceAuthorityService, handleService, metadataAuthorityService, metadataFieldService, metadataValueService| Modifier | Constructor and Description |
|---|---|
protected |
ItemServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addBundle(Context context,
Item item,
Bundle bundle)
Add an existing bundle to this item.
|
void |
adjustBundleBitstreamPolicies(Context context,
Item item,
Collection collection) |
void |
adjustItemPolicies(Context context,
Item item,
Collection collection) |
boolean |
canEdit(Context context,
Item item)
return TRUE if context's user can edit item, false otherwise
|
int |
countItems(Context context,
Collection collection)
counts items in the given collection
|
int |
countItems(Context context,
Community community)
counts items in the given community
|
int |
countNotArchivedItems(Context context)
counts all items not in archive
|
int |
countTotal(Context context)
counts all items
|
int |
countWithdrawnItems(Context context)
counts all withdrawn items
|
Item |
create(Context context,
WorkspaceItem workspaceItem)
Create a new item, with a new internal ID.
|
protected Item |
createItem(Context context) |
Bitstream |
createSingleBitstream(Context context,
InputStream is,
Item item)
Convenience method, calls createSingleBitstream() with name "ORIGINAL"
|
Bitstream |
createSingleBitstream(Context context,
InputStream is,
Item item,
String name)
Create a single bitstream in a new bundle.
|
Item |
createTemplateItem(Context context,
Collection collection)
Create an empty template item for this collection.
|
void |
delete(Context context,
Item item) |
protected void |
deleteBundle(Context context,
Item item,
Bundle b) |
protected List<ResourcePolicy> |
filterPoliciesToAdd(Context context,
List<ResourcePolicy> defaultCollectionPolicies,
DSpaceObject dso) |
Item |
find(Context context,
UUID id)
Generic find for when the precise type of a DSO is not known, just the
a pair of type number and database ID.
|
Iterator<Item> |
findAll(Context context)
Get all the items in the archive.
|
Iterator<Item> |
findAllByCollection(Context context,
Collection collection)
Get all the items in this collection.
|
Iterator<Item> |
findAllUnfiltered(Context context)
Get all "final" items in the archive, both archived ("in archive" flag) or
withdrawn items are included.
|
Iterator<Item> |
findByAuthorityValue(Context context,
String schema,
String element,
String qualifier,
String value)
Find all the items in the archive with a given authority key value
in the indicated metadata field.
|
Iterator<Item> |
findByCollection(Context context,
Collection collection)
Get all the items in this collection.
|
Iterator<Item> |
findByCollection(Context context,
Collection collection,
Integer limit,
Integer offset)
Get all the items in this collection.
|
Item |
findByIdOrLegacyId(Context context,
String id) |
Iterator<Item> |
findByLastModifiedSince(Context context,
Date last)
Find all Items modified since a Date.
|
Item |
findByLegacyId(Context context,
int id)
Generic find for when the precise type of a DSO is not known, just the
a pair of type number and database ID.
|
Iterator<Item> |
findByMetadataField(Context context,
String schema,
String element,
String qualifier,
String value)
Returns an iterator of Items possessing the passed metadata field, or only
those matching the passed value, if value is not Item.ANY
|
Iterator<Item> |
findByMetadataFieldAuthority(Context context,
String mdString,
String authority) |
Iterator<Item> |
findByMetadataQuery(Context context,
List<List<MetadataField>> listFieldList,
List<String> query_op,
List<String> query_val,
List<UUID> collectionUuids,
String regexClause,
int offset,
int limit) |
Iterator<Item> |
findBySubmitter(Context context,
EPerson eperson)
Find all the items in the archive by a given submitter.
|
Iterator<Item> |
findBySubmitterDateSorted(Context context,
EPerson eperson,
Integer limit)
Retrieve the list of Items submitted by eperson, ordered by recently submitted, optionally limitable
|
Iterator<Item> |
findInArchiveOrWithdrawnDiscoverableModifiedSince(Context context,
Date since)
Get all Items installed or withdrawn, discoverable, and modified since a Date.
|
DSpaceObject |
getAdminObject(Context context,
Item item,
int action)
Return the dspace object where an ADMIN action right is sufficient to
grant the initial authorize check.
|
protected void |
getAuthoritiesAndConfidences(String fieldKey,
Collection collection,
List<String> values,
List<String> authorities,
List<Integer> confidences,
int i) |
List<Bundle> |
getBundles(Item item,
String name)
Get the bundles matching a bundle name (name corresponds roughly to type)
|
List<Collection> |
getCollectionsNotLinked(Context context,
Item item)
Get the collections this item is not in.
|
List<Community> |
getCommunities(Context context,
Item item)
Get the communities this item is in.
|
List<Bitstream> |
getNonInternalBitstreams(Context context,
Item item)
Get all non-internal bitstreams in the item.
|
DSpaceObject |
getParentObject(Context context,
Item item)
Return the dspace object that "own" the current object in the hierarchy.
|
int |
getSupportsTypeConstant()
Returns the Constants which this service supports
|
Thumbnail |
getThumbnail(Context context,
Item item,
boolean requireOriginal) |
boolean |
hasUploadedFiles(Item item)
Check the bundle ORIGINAL to see if there are any uploaded files
|
void |
inheritCollectionDefaultPolicies(Context context,
Item item,
Collection collection)
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 |
isIn(Item item,
Collection collection)
See whether this Item is contained by a given Collection.
|
boolean |
isItemListedForUser(Context context,
Item item)
Service method for knowing if this Item should be visible in the item list.
|
boolean |
isOwningCollection(Item item,
Collection collection)
Return true if this Collection 'owns' this item
|
void |
move(Context context,
Item item,
Collection from,
Collection to)
Moves the item from one collection to another one
|
void |
move(Context context,
Item item,
Collection from,
Collection to,
boolean inheritDefaultPolicies)
Moves the item from one collection to another one
|
protected void |
rawDelete(Context context,
Item item) |
void |
reinstate(Context context,
Item item)
Reinstate a withdrawn item
|
void |
removeAllBundles(Context context,
Item item)
Remove all bundles linked to this item.
|
void |
removeBundle(Context context,
Item item,
Bundle bundle)
Remove a bundle.
|
void |
removeDSpaceLicense(Context context,
Item item)
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(Context context,
Item item,
Group group)
remove all of the policies for item's bitstreams and bundles that belong
to a given Group
|
void |
removeLicenses(Context context,
Item item)
Remove all licenses from an item - it was rejected
|
protected void |
removeVersion(Context context,
Item item) |
void |
replaceAllBitstreamPolicies(Context context,
Item item,
List<ResourcePolicy> newpolicies)
remove all of the policies for item's bitstreams and bundles and replace
them with a new list of policies
|
void |
replaceAllItemPolicies(Context context,
Item item,
List<ResourcePolicy> newpolicies)
remove all of the policies for item and replace them with a new list of
policies
|
void |
update(Context context,
Item item) |
void |
updateLastModified(Context context,
Item item) |
void |
withdraw(Context context,
Item item)
Withdraw the item from the archive.
|
addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, getElements, getElementsFilled, getIdentifiers, getMDValueByField, getMDValueByLegacyField, getMetadata, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getMetadataValuePlace, getName, getTypeText, match, removeMetadataValues, setMetadataSingleValueclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, getIdentifiers, getMetadata, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getName, getTypeText, removeMetadataValues, setMetadataSingleValue@Autowired(required=true) protected ItemDAO itemDAO
@Autowired(required=true) protected CommunityService communityService
@Autowired(required=true) protected AuthorizeService authorizeService
@Autowired(required=true) protected BundleService bundleService
@Autowired(required=true) protected BitstreamFormatService bitstreamFormatService
@Autowired(required=true) protected MetadataSchemaService metadataSchemaService
@Autowired(required=true) protected BitstreamService bitstreamService
@Autowired(required=true) protected InstallItemService installItemService
@Autowired(required=true) protected ResourcePolicyService resourcePolicyService
@Autowired(required=true) protected CollectionService collectionService
@Autowired(required=true) protected IdentifierService identifierService
@Autowired(required=true) protected VersioningService versioningService
@Autowired(required=true) protected HarvestedItemService harvestedItemService
public Thumbnail getThumbnail(Context context, Item item, boolean requireOriginal) throws SQLException
getThumbnail in interface ItemServiceSQLExceptionpublic Item find(Context context, UUID id) throws SQLException
DSpaceObjectServicefind in interface DSpaceObjectService<Item>context - - the contextid - - id within table of type'd objectsSQLException - only upon failure accessing the database.public Item create(Context context, WorkspaceItem workspaceItem) throws SQLException, AuthorizeException
ItemServicecreate in interface ItemServicecontext - DSpace context objectworkspaceItem - in progress workspace itemSQLException - if database errorAuthorizeException - if authorization errorpublic Item createTemplateItem(Context context, Collection collection) throws SQLException, AuthorizeException
ItemServiceupdate on
the collection after doing this, or the item will have been created but
the collection record will not refer to it.createTemplateItem in interface ItemServicecontext - DSpace context objectcollection - Collection (parent)SQLException - if database errorAuthorizeException - if authorization errorpublic Iterator<Item> findAll(Context context) throws SQLException
ItemServicefindAll in interface ItemServicecontext - DSpace context objectSQLException - if database errorpublic Iterator<Item> findAllUnfiltered(Context context) throws SQLException
ItemServicefindAllUnfiltered in interface ItemServicecontext - DSpace context objectSQLException - if database errorpublic Iterator<Item> findBySubmitter(Context context, EPerson eperson) throws SQLException
ItemServicefindBySubmitter in interface ItemServicecontext - DSpace context objecteperson - the submitterSQLException - if database errorpublic Iterator<Item> findBySubmitterDateSorted(Context context, EPerson eperson, Integer limit) throws SQLException
ItemServicefindBySubmitterDateSorted in interface ItemServicecontext - contexteperson - epersonlimit - a positive integer to limit, -1 or null for unlimitedSQLException - if database errorpublic Iterator<Item> findByCollection(Context context, Collection collection) throws SQLException
ItemServicefindByCollection in interface ItemServicecontext - DSpace context objectcollection - Collection (parent)SQLException - if database errorpublic Iterator<Item> findByCollection(Context context, Collection collection, Integer limit, Integer offset) throws SQLException
ItemServicefindByCollection in interface ItemServicecontext - DSpace context objectcollection - Collection (parent)limit - limited number of itemsoffset - offset valueSQLException - if database errorpublic Iterator<Item> findAllByCollection(Context context, Collection collection) throws SQLException
ItemServicefindAllByCollection in interface ItemServicecontext - DSpace context objectcollection - Collection (parent)SQLException - if database errorpublic Iterator<Item> findInArchiveOrWithdrawnDiscoverableModifiedSince(Context context, Date since) throws SQLException
ItemServicefindInArchiveOrWithdrawnDiscoverableModifiedSince in interface ItemServicecontext - contextsince - earliest interesting last-modified date, or null for no date test.SQLException - if database errorpublic void updateLastModified(Context context, Item item) throws SQLException, AuthorizeException
updateLastModified in interface DSpaceObjectService<Item>SQLExceptionAuthorizeExceptionpublic boolean isIn(Item item, Collection collection) throws SQLException
ItemServiceisIn in interface ItemServiceitem - Itemcollection - Collection (parentcollection contains this Item.SQLException - if database errorpublic List<Community> getCommunities(Context context, Item item) throws SQLException
ItemServicegetCommunities in interface ItemServicecontext - DSpace context objectitem - ItemSQLException - if database errorpublic List<Bundle> getBundles(Item item, String name) throws SQLException
ItemServicegetBundles in interface ItemServiceitem - Itemname - name of bundle (ORIGINAL/TEXT/THUMBNAIL)SQLException - if database errorpublic void addBundle(Context context, Item item, Bundle bundle) throws SQLException, AuthorizeException
ItemServiceaddBundle in interface ItemServicecontext - DSpace context objectitem - Itembundle - the bundle to addSQLException - if database errorAuthorizeException - if authorization errorpublic void removeBundle(Context context, Item item, Bundle bundle) throws SQLException, AuthorizeException, IOException
ItemServiceremoveBundle in interface ItemServicecontext - DSpace context objectitem - Itembundle - the bundle to removeSQLException - if database errorAuthorizeException - if authorization errorIOException - if IO errorpublic Bitstream createSingleBitstream(Context context, InputStream is, Item item, String name) throws AuthorizeException, IOException, SQLException
ItemServicecreateSingleBitstream in interface ItemServicecontext - DSpace context objectis - the stream to create the new bitstream fromitem - Itemname - is the name of the bundle (ORIGINAL, TEXT, THUMBNAIL)AuthorizeException - if authorization errorIOException - if IO errorSQLException - if database errorpublic Bitstream createSingleBitstream(Context context, InputStream is, Item item) throws AuthorizeException, IOException, SQLException
ItemServicecreateSingleBitstream in interface ItemServicecontext - DSpace context objectis - InputStreamitem - ItemAuthorizeException - if authorization errorIOException - if IO errorSQLException - if database errorpublic List<Bitstream> getNonInternalBitstreams(Context context, Item item) throws SQLException
ItemServicegetNonInternalBitstreams in interface ItemServicecontext - DSpace context objectitem - ItemSQLException - if database errorprotected Item createItem(Context context) throws SQLException, AuthorizeException
SQLExceptionAuthorizeExceptionpublic void removeDSpaceLicense(Context context, Item item) throws SQLException, AuthorizeException, IOException
ItemServiceThis method is used by the org.dspace.submit.step.LicenseStep class
removeDSpaceLicense in interface ItemServicecontext - DSpace context objectitem - ItemSQLException - if database errorAuthorizeException - if authorization errorIOException - if IO errorpublic void removeLicenses(Context context, Item item) throws SQLException, AuthorizeException, IOException
ItemServiceremoveLicenses in interface ItemServicecontext - DSpace context objectitem - ItemSQLException - if database errorAuthorizeException - if authorization errorIOException - if IO errorpublic void update(Context context, Item item) throws SQLException, AuthorizeException
update in interface DSpaceObjectService<Item>update in class DSpaceObjectServiceImpl<Item>SQLExceptionAuthorizeExceptionpublic void withdraw(Context context, Item item) throws SQLException, AuthorizeException
ItemServicewithdraw in interface ItemServicecontext - DSpace context objectitem - ItemSQLException - if database errorAuthorizeException - if authorization errorpublic void reinstate(Context context, Item item) throws SQLException, AuthorizeException
ItemServicereinstate in interface ItemServicecontext - DSpace context objectitem - ItemSQLException - if database errorAuthorizeException - if authorization errorpublic void delete(Context context, Item item) throws SQLException, AuthorizeException, IOException
delete in interface DSpaceObjectService<Item>SQLExceptionAuthorizeExceptionIOExceptionpublic int getSupportsTypeConstant()
DSpaceObjectServicegetSupportsTypeConstant in interface DSpaceObjectLegacySupportService<Item>getSupportsTypeConstant in interface DSpaceObjectService<Item>protected void rawDelete(Context context, Item item) throws AuthorizeException, SQLException, IOException
public void removeAllBundles(Context context, Item item) throws AuthorizeException, SQLException, IOException
ItemServiceremoveAllBundles in interface ItemServicecontext - DSpace context objectitem - the item from which to remove our bundlesAuthorizeException - if authorization errorSQLException - if database errorIOException - if IO errorprotected void deleteBundle(Context context, Item item, Bundle b) throws AuthorizeException, SQLException, IOException
protected void removeVersion(Context context, Item item) throws AuthorizeException, SQLException
AuthorizeExceptionSQLExceptionpublic boolean isOwningCollection(Item item, Collection collection)
ItemServiceisOwningCollection in interface ItemServiceitem - Itemcollection - Collectionpublic void replaceAllItemPolicies(Context context, Item item, List<ResourcePolicy> newpolicies) throws SQLException, AuthorizeException
ItemServicereplaceAllItemPolicies in interface ItemServicecontext - DSpace context objectitem - Itemnewpolicies - -
this will be all of the new policies for the item and its
contentsSQLException - if database errorAuthorizeException - if authorization errorpublic void replaceAllBitstreamPolicies(Context context, Item item, List<ResourcePolicy> newpolicies) throws SQLException, AuthorizeException
ItemServicereplaceAllBitstreamPolicies in interface ItemServicecontext - DSpace context objectitem - Itemnewpolicies - -
this will be all of the new policies for the bundle and
bitstream contentsSQLException - if database errorAuthorizeException - if authorization errorpublic void removeGroupPolicies(Context context, Item item, Group group) throws SQLException, AuthorizeException
ItemServiceremoveGroupPolicies in interface ItemServicecontext - DSpace context objectitem - Itemgroup - Group referenced by policies that needs to be removedSQLException - if database errorAuthorizeException - if authorization errorpublic void inheritCollectionDefaultPolicies(Context context, Item item, Collection collection) throws SQLException, AuthorizeException
ItemServiceinheritCollectionDefaultPolicies in interface ItemServicecontext - DSpace context objectitem - Itemcollection - CollectionSQLException - if database error
if an SQL error or if no default policies found. It's a bit
draconian, but default policies must be enforced.AuthorizeException - if authorization errorpublic void adjustBundleBitstreamPolicies(Context context, Item item, Collection collection) throws SQLException, AuthorizeException
adjustBundleBitstreamPolicies in interface ItemServiceSQLExceptionAuthorizeExceptionpublic void adjustItemPolicies(Context context, Item item, Collection collection) throws SQLException, AuthorizeException
adjustItemPolicies in interface ItemServiceSQLExceptionAuthorizeExceptionpublic void move(Context context, Item item, Collection from, Collection to) throws SQLException, AuthorizeException, IOException
ItemServicemove in interface ItemServicecontext - DSpace context objectitem - Itemfrom - Collection to move fromto - Collection to move toSQLException - if database errorAuthorizeException - if authorization errorIOException - if IO errorpublic void move(Context context, Item item, Collection from, Collection to, boolean inheritDefaultPolicies) throws SQLException, AuthorizeException, IOException
ItemServicemove in interface ItemServicecontext - DSpace context objectitem - Itemfrom - Collection to move fromto - Collection to move toinheritDefaultPolicies - whether to inherit policies from new collectionSQLException - if database errorAuthorizeException - if authorization errorIOException - if IO errorpublic boolean hasUploadedFiles(Item item) throws SQLException
ItemServicehasUploadedFiles in interface ItemServiceitem - ItemSQLException - if database errorpublic List<Collection> getCollectionsNotLinked(Context context, Item item) throws SQLException
ItemServicegetCollectionsNotLinked in interface ItemServicecontext - DSpace context objectitem - ItemSQLException - if database errorpublic boolean canEdit(Context context, Item item) throws SQLException
ItemServicecanEdit in interface ItemServicecontext - DSpace context objectitem - ItemSQLException - if database errorprotected List<ResourcePolicy> filterPoliciesToAdd(Context context, List<ResourcePolicy> defaultCollectionPolicies, DSpaceObject dso) throws SQLException, AuthorizeException
SQLExceptionAuthorizeExceptionpublic Iterator<Item> findByMetadataField(Context context, String schema, String element, String qualifier, String value) throws SQLException, AuthorizeException, IOException
findByMetadataField in interface ItemServicecontext - DSpace context objectschema - metadata field schemaelement - metadata field elementqualifier - metadata field qualifiervalue - field value or Item.ANY to match any valueSQLException - if database errorAuthorizeException - if authorization errorIOException - if IO errorpublic Iterator<Item> findByMetadataQuery(Context context, List<List<MetadataField>> listFieldList, List<String> query_op, List<String> query_val, List<UUID> collectionUuids, String regexClause, int offset, int limit) throws SQLException, AuthorizeException, IOException
findByMetadataQuery in interface ItemServiceSQLExceptionAuthorizeExceptionIOExceptionpublic DSpaceObject getAdminObject(Context context, Item item, int action) throws SQLException
DSpaceObjectServiceDefault 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 interface DSpaceObjectService<Item>getAdminObject in class DSpaceObjectServiceImpl<Item>context - DSpace contextitem - 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 thrownSQLException - if database errorpublic DSpaceObject getParentObject(Context context, Item item) throws SQLException
DSpaceObjectServicegetParentObject in interface DSpaceObjectService<Item>getParentObject in class DSpaceObjectServiceImpl<Item>context - DSpace contextitem - DSpaceObjectSQLException - if database errorpublic Iterator<Item> findByAuthorityValue(Context context, String schema, String element, String qualifier, String value) throws SQLException, AuthorizeException
ItemServicefindByAuthorityValue in interface ItemServicecontext - DSpace context objectschema - metadata field schemaelement - metadata field elementqualifier - metadata field qualifiervalue - the value of authority key to look forSQLException - if database errorAuthorizeException - if authorization errorpublic Iterator<Item> findByMetadataFieldAuthority(Context context, String mdString, String authority) throws SQLException, AuthorizeException
findByMetadataFieldAuthority in interface ItemServiceSQLExceptionAuthorizeExceptionpublic boolean isItemListedForUser(Context context, Item item)
ItemServiceisItemListedForUser in interface ItemServicecontext - contextitem - itempublic int countItems(Context context, Collection collection) throws SQLException
ItemServicecountItems in interface ItemServicecontext - DSpace context objectcollection - CollectionSQLException - if database errorpublic int countItems(Context context, Community community) throws SQLException
ItemServicecountItems in interface ItemServicecontext - DSpace context objectcommunity - CommunitySQLException - if database errorprotected void getAuthoritiesAndConfidences(String fieldKey, Collection collection, List<String> values, List<String> authorities, List<Integer> confidences, int i)
getAuthoritiesAndConfidences in class DSpaceObjectServiceImpl<Item>public Item findByIdOrLegacyId(Context context, String id) throws SQLException
findByIdOrLegacyId in interface DSpaceObjectLegacySupportService<Item>SQLExceptionpublic Item findByLegacyId(Context context, int id) throws SQLException
DSpaceObjectLegacySupportServicefindByLegacyId in interface DSpaceObjectLegacySupportService<Item>context - - the contextid - - the legacy id within table of type'd objectsSQLException - only upon failure accessing the database.public Iterator<Item> findByLastModifiedSince(Context context, Date last) throws SQLException
ItemServicefindByLastModifiedSince in interface ItemServicecontext - contextlast - Earliest interesting last-modified date.SQLException - if database errorpublic int countTotal(Context context) throws SQLException
ItemServicecountTotal in interface ItemServicecontext - DSpace context objectSQLException - if database errorpublic int countNotArchivedItems(Context context) throws SQLException
ItemServicecountNotArchivedItems in interface ItemServicecontext - DSpace context objectSQLException - if database errorpublic int countWithdrawnItems(Context context) throws SQLException
ItemServicecountWithdrawnItems in interface ItemServicecontext - DSpace context objectSQLException - if database errorCopyright © 2016 DuraSpace. All rights reserved.