Class ItemServiceImpl
- All Implemented Interfaces:
DSpaceObjectLegacySupportService<Item>,DSpaceObjectService<Item>,ItemService
- Author:
- kevinvandevelde at atmire.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuthorizeServiceprotected BitstreamFormatServiceprotected BitstreamServiceprotected BundleServiceprotected CollectionServiceprotected CommunityServiceprotected ConfigurationServiceprotected DOIServiceprotected GroupServiceprotected HarvestedItemServiceprotected IdentifierServiceprotected InstallItemServiceprotected ItemDAOprotected MetadataSchemaServiceprotected RelationshipServiceprotected ResourcePolicyServiceprotected SearchServiceprotected SubscribeServiceprotected VersioningServiceprotected VirtualMetadataPopulatorprotected WorkflowItemServiceprotected WorkspaceItemServiceFields inherited from class org.dspace.content.DSpaceObjectServiceImpl
choiceAuthorityService, handleService, metadataAuthorityService, metadataFieldService, metadataValueServiceFields inherited from interface org.dspace.content.service.DSpaceObjectService
MD_COPYRIGHT_TEXT, MD_INTRODUCTORY_TEXT, MD_LICENSE, MD_NAME, MD_PROVENANCE_DESCRIPTION, MD_SHORT_DESCRIPTION, MD_SIDEBAR_TEXT, MD_SOURCE, MD_USER_FORMAT_DESCRIPTION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an existing bundle to this item.protected voidaddDefaultPoliciesNotInPlace(Context context, DSpaceObject dso, List<ResourcePolicy> defaultCollectionPolicies) Add the default policies, which have not been already added to the given DSpace objectaddMetadata(Context context, Item dso, String schema, String element, String qualifier, String lang, String value, String authority, int confidence, int place) Add a single metadata value at the given place position.voidadjustBitstreamPolicies(Context context, Item item, Collection collection, Bitstream bitstream) Adjust the Bitstream policies to reflect what have been defined during the submission/workflow.voidadjustBitstreamPolicies(Context context, Item item, Collection collection, Bitstream bitstream, boolean replaceReadRPWithCollectionRP) Adjust the Bitstream policies to reflect what have been defined during the submission/workflow.voidadjustBundleBitstreamPolicies(Context context, Item item, Collection collection) Adjust the Bundle and Bitstream policies to reflect what have been defined during the submission/workflow.voidadjustBundleBitstreamPolicies(Context context, Item item, Collection collection, boolean replaceReadRPWithCollectionRP) Adjust the Bundle and Bitstream policies to reflect what have been defined during the submission/workflow.voidadjustItemPolicies(Context context, Item item, Collection collection) Adjust the Item's policies to reflect what have been defined during the submission/workflow.voidadjustItemPolicies(Context context, Item item, Collection collection, boolean replaceReadRPWithCollectionRP) Adjust the Item's policies to reflect what have been defined during the submission/workflow.booleancanCreateNewVersion(Context context, Item item) return TRUE if context's user can create new version of the item, false otherwise.booleanreturn TRUE if context's user can edit item, false otherwiseintcountAllItems(Context context, Collection collection) counts all items in the given collection including withdrawn itemsintcountAllItems(Context context, Community community) counts all items in the given community including withdrawnintcountArchivedItems(Context context) counts all items in archiveintcountByCollectionMapping(Context context, Collection collection) Count all the archived items mapped to this collection (excludes owning collection).longcountForMetadataQuery(Context context, List<QueryPredicate> queryPredicates, List<UUID> collectionUuids) Returns the total number of items that match the given predicates, within the specified collections, if any.intcountItems(Context context, Collection collection) counts items in the given collectionintcountItems(Context context, Community community) counts items in the given communityintcountItemsWithEdit(Context context) counts all items for which the current user has editing rightsintcountNotArchivedItems(Context context) counts all items not in archiveintcountTotal(Context context) counts all itemsintcountWithdrawnItems(Context context) counts all withdrawn itemscreate(Context context, WorkspaceItem workspaceItem) Create a new item, with a new internal ID.create(Context context, WorkspaceItem workspaceItem, UUID uuid) Create a new item, with a provided ID.protected ItemcreateItem(Context context) protected ItemcreateItem(Context context, UUID uuid) createSingleBitstream(Context context, InputStream is, Item item) Convenience method, calls createSingleBitstream() with name "ORIGINAL"createSingleBitstream(Context context, InputStream is, Item item, String name) Create a single bitstream in a new bundle.createTemplateItem(Context context, Collection collection) Create an empty template item for this collection.voidprotected voiddeleteBundle(Context context, Item item, Bundle b) Generic find for when the precise type of an Entity is not knownGet all the items in the archive.Get all the items in the archive.findAllByCollection(Context context, Collection collection) Get all the items (including private and withdrawn) in this collection.findAllByCollection(Context context, Collection collection, Integer limit, Integer offset) Get all the items (including private and withdrawn) in this collection.findAllRegularItems(Context context) Find all items that are: - NOT in the workspace - NOT in the workflow - NOT a template item for e.g. a collection This implies that the result also contains older versions of items and withdrawn items.findAllUnfiltered(Context context) Get all "final" items in the archive, both archived ("in archive" flag) or withdrawn items are included.findArchivedByMetadataField(Context context, String metadataField, String value) Returns an iterator of in archive items possessing the passed metadata field, or only those matching the passed value, if value is not Item.ANYfindArchivedByMetadataField(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.ANYfindByAuthorityValue(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.findByCollection(Context context, Collection collection) Get all the archived items in this collection.findByCollection(Context context, Collection collection, Integer limit, Integer offset) Get all the archived items in this collection.findByCollectionMapping(Context context, Collection collection, Integer limit, Integer offset) Get all the archived items mapped to this collection (excludes owning collection).findByIdOrLegacyId(Context context, String id) findByLastModifiedSince(Context context, Instant last) Find all Items modified since a Date.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.Returns an iterator of Items possessing the passed metadata field, or only those matching the passed value, if value is not Item.ANYfindByMetadataFieldAuthority(Context context, String mdString, String authority) findByMetadataQuery(Context context, List<QueryPredicate> queryPredicates, List<UUID> collectionUuids, long offset, int limit) Returns a list of items that match the given predicates, within the specified collections, if any.findBySubmitter(Context context, EPerson eperson) Find all the items in the archive by a given submitter.findBySubmitter(Context context, EPerson eperson, boolean retrieveAllItems) Find all the items by a given submitter.findBySubmitterDateSorted(Context context, EPerson eperson, Integer limit) Retrieve the list of items submitted by eperson, ordered by recently submitted, optionally limitablefindInArchiveOrWithdrawnDiscoverableModifiedSince(Context context, Instant since) Get all Items installed or withdrawn, discoverable, and modified since a Date.findInArchiveOrWithdrawnNonDiscoverableModifiedSince(Context context, Instant since) Get all Items installed or withdrawn, NON-discoverable, and modified since a Date.findItemsWithEdit(Context context, int offset, int limit) finds all items for which the current user has editing rightsgetAdminObject(Context context, Item item, int action) Return the dspace object where an ADMIN action right is sufficient to grant the initial authorize check.protected voidgetAuthoritiesAndConfidences(String fieldKey, Collection collection, List<String> values, List<String> authorities, List<Integer> confidences, int i) getBundles(Item item, String name) Get the bundles matching a bundle name (name corresponds roughly to type)getCollectionsNotLinked(Context context, Item item) Get the collections this item is not in.getCommunities(Context context, Item item) Get the communities this item is in.getEntityType(Context context, Item item) Retrieve the entity type of the given item.getEntityTypeLabel(Item item) Retrieve the label of the entity type of the given item.This method will return a list of MetadataValue objects that contains all the regular metadata of the item passed along in the parameters as well as all the virtual metadata which will be generated and processed together with theVirtualMetadataPopulatorby processing the item's relationshipsgetMetadata(Item item, String schema, String element, String qualifier, String lang, boolean enableVirtualMetadata) Get metadata for the DSpace Object in a chosen schema.getNonInternalBitstreams(Context context, Item item) Get all non-internal bitstreams in the item.getParentObject(Context context, Item item) Return the dspace object that "own" the current object in the hierarchy.intReturns the Constants which this service supportsgetThumbnail(Context context, Item item, boolean requireOriginal) booleanhasUploadedFiles(Item item) Check the bundle ORIGINAL to see if there are any uploaded filesvoidinheritCollectionDefaultPolicies(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.voidinheritCollectionDefaultPolicies(Context context, Item item, Collection collection, boolean replaceReadRPWithCollectionRP) Remove all submission and workflow policies on an item and its contents, and add default collection policies which are not yet already in place.booleanisIn(Item item, Collection collection) See whether this Item is contained by a given Collection.booleanisInProgressSubmission(Context context, Item item) Check if the item is an inprogress submissionbooleanisItemListedForUser(Context context, Item item) Service method for knowing if this Item should be visible in the item list.booleanisLatestVersion(Context context, Item item) Check whether the given item is the latest version.booleanisOwningCollection(Item item, Collection collection) Return true if this Collection 'owns' this itemvoidmove(Context context, Item item, Collection from, Collection to) Moves the item from one collection to another onevoidmove(Context context, Item item, Collection from, Collection to, boolean inheritDefaultPolicies) Moves the item from one collection to another oneprotected voidmoveSingleMetadataValue(Context context, Item dso, int place, MetadataValue rr) Supports moving metadata by adding the metadata value or updating the place of the relationshipvoidpopulateWithTemplateItemMetadata(Context context, Collection collection, boolean template, Item item) Populate the given item with all template item specified metadata.protected voidvoidReinstate a withdrawn itemvoidremoveAllBundles(Context context, Item item) Remove all bundles linked to this item.voidremoveBundle(Context context, Item item, Bundle bundle) Remove a bundle.voidremoveDSpaceLicense(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)voidremoveGroupPolicies(Context context, Item item, Group group) remove all of the policies for item's bitstreams and bundles that belong to a given GroupvoidremoveLicenses(Context context, Item item) Remove all licenses from an item - it was rejectedprotected voidremoveRequest(Context context, Item item) protected voidremoveVersion(Context context, Item item) voidreplaceAllBitstreamPolicies(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 policiesvoidreplaceAllItemPolicies(Context context, Item item, List<ResourcePolicy> newpolicies) remove all of the policies for item and replace them with a new list of policiesvoidvoidupdateLastModified(Context context, Item item) voidWithdraw the item from the archive.Methods inherited from class org.dspace.content.DSpaceObjectServiceImpl
addAndShiftRightMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, getElements, getElementsFilled, getIdentifiers, getMDValueByField, getMDValueByLegacyField, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getMetadataFirstValue, getMetadataValuePlace, getName, getTypeText, match, moveMetadata, removeMetadataValues, replaceMetadata, setMetadataModified, setMetadataSingleValue, setMetadataSingleValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.dspace.content.service.DSpaceObjectService
addAndShiftRightMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, getIdentifiers, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getMetadataFirstValue, getName, getTypeText, moveMetadata, removeMetadataValues, replaceMetadata, setMetadataModified, setMetadataSingleValue, setMetadataSingleValue
-
Field Details
-
itemDAO
-
communityService
-
groupService
-
authorizeService
-
bundleService
-
bitstreamFormatService
-
metadataSchemaService
-
bitstreamService
-
installItemService
-
searchService
-
resourcePolicyService
-
collectionService
-
identifierService
-
doiService
-
versioningService
-
harvestedItemService
-
configurationService
-
workspaceItemService
-
workflowItemService
-
relationshipService
-
virtualMetadataPopulator
-
subscribeService
-
-
Constructor Details
-
ItemServiceImpl
protected ItemServiceImpl()
-
-
Method Details
-
getThumbnail
public Thumbnail getThumbnail(Context context, Item item, boolean requireOriginal) throws SQLException - Specified by:
getThumbnailin interfaceItemService- Throws:
SQLException
-
find
Description copied from interface:DSpaceObjectServiceGeneric find for when the precise type of an Entity is not known- Specified by:
findin interfaceDSpaceObjectService<Item>- Parameters:
context- - the contextid- - uuid within table of typed dspace objects- Returns:
- the dspace object found, or null if it does not exist.
- Throws:
SQLException- only upon failure accessing the database.
-
create
public Item create(Context context, WorkspaceItem workspaceItem) throws SQLException, AuthorizeException Description copied from interface:ItemServiceCreate a new item, with a new internal ID. Authorization is done inside of this method.- Specified by:
createin interfaceItemService- Parameters:
context- DSpace context objectworkspaceItem- in progress workspace item- Returns:
- the newly created item
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
create
public Item create(Context context, WorkspaceItem workspaceItem, UUID uuid) throws SQLException, AuthorizeException Description copied from interface:ItemServiceCreate a new item, with a provided ID. Authorisation is done inside of this method.- Specified by:
createin interfaceItemService- Parameters:
context- DSpace context objectworkspaceItem- in progress workspace itemuuid- the pre-determined UUID to assign to the new item- Returns:
- the newly created item
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
createTemplateItem
public Item createTemplateItem(Context context, Collection collection) throws SQLException, AuthorizeException Description copied from interface:ItemServiceCreate an empty template item for this collection. If one already exists, no action is taken. Caution: Make sure you callupdateon the collection after doing this, or the item will have been created but the collection record will not refer to it.- Specified by:
createTemplateItemin interfaceItemService- Parameters:
context- DSpace context objectcollection- Collection (parent)- Returns:
- empty template item for this collection
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
populateWithTemplateItemMetadata
public void populateWithTemplateItemMetadata(Context context, Collection collection, boolean template, Item item) throws SQLException Description copied from interface:ItemServicePopulate the given item with all template item specified metadata.- Specified by:
populateWithTemplateItemMetadatain interfaceItemService- Parameters:
context- DSpace context objectcollection- Collection (parent)template- iftrue, the item inherits all collection's template item metadataitem- item to populate with template item specified metadata- Throws:
SQLException- if database error
-
findAll
Description copied from interface:ItemServiceGet all the items in the archive. Only items with the "in archive" flag set are included. The order of the list is indeterminate.- Specified by:
findAllin interfaceItemService- Parameters:
context- DSpace context object- Returns:
- an iterator over the items in the archive.
- Throws:
SQLException- if database error
-
findAll
Description copied from interface:ItemServiceGet all the items in the archive. Only items with the "in archive" flag set are included. The order of the list is indeterminate.- Specified by:
findAllin interfaceItemService- Parameters:
context- DSpace context objectlimit- limitoffset- offset- Returns:
- an iterator over the items in the archive.
- Throws:
SQLException- if database error
-
findAllUnfiltered
Description copied from interface:ItemServiceGet all "final" items in the archive, both archived ("in archive" flag) or withdrawn items are included. The order of the list is indeterminate.- Specified by:
findAllUnfilteredin interfaceItemService- Parameters:
context- DSpace context object- Returns:
- an iterator over the items in the archive.
- Throws:
SQLException- if database error
-
findAllRegularItems
Description copied from interface:ItemServiceFind all items that are: - NOT in the workspace - NOT in the workflow - NOT a template item for e.g. a collection This implies that the result also contains older versions of items and withdrawn items.- Specified by:
findAllRegularItemsin interfaceItemService- Parameters:
context- the DSpace context.- Returns:
- iterator over all regular items.
- Throws:
SQLException- if database error.
-
findBySubmitter
Description copied from interface:ItemServiceFind all the items in the archive by a given submitter. The order is indeterminate. Only items with the "in archive" flag set are included.- Specified by:
findBySubmitterin interfaceItemService- Parameters:
context- DSpace context objecteperson- the submitter- Returns:
- an iterator over the items submitted by eperson
- Throws:
SQLException- if database error
-
findBySubmitter
public Iterator<Item> findBySubmitter(Context context, EPerson eperson, boolean retrieveAllItems) throws SQLException Description copied from interface:ItemServiceFind all the items by a given submitter. The order is indeterminate. All items are included.- Specified by:
findBySubmitterin interfaceItemService- Parameters:
context- DSpace context objecteperson- the submitterretrieveAllItems- flag to determine if all items should be returned or only archived items. If true, all items (regardless of status) are returned. If false, only archived items will be returned.- Returns:
- an iterator over the items submitted by eperson
- Throws:
SQLException- if database error
-
findBySubmitterDateSorted
public Iterator<Item> findBySubmitterDateSorted(Context context, EPerson eperson, Integer limit) throws SQLException Description copied from interface:ItemServiceRetrieve the list of items submitted by eperson, ordered by recently submitted, optionally limitable- Specified by:
findBySubmitterDateSortedin interfaceItemService- Parameters:
context- DSpace context objecteperson- the submitterlimit- a positive integer to limit, -1 or null for unlimited- Returns:
- an iterator over the items submitted by eperson
- Throws:
SQLException- if database error
-
findByCollection
Description copied from interface:ItemServiceGet all the archived items in this collection. The order is indeterminate.- Specified by:
findByCollectionin interfaceItemService- Parameters:
context- DSpace context objectcollection- Collection (parent)- Returns:
- an iterator over the items in the collection.
- Throws:
SQLException- if database error
-
findByCollection
public Iterator<Item> findByCollection(Context context, Collection collection, Integer limit, Integer offset) throws SQLException Description copied from interface:ItemServiceGet all the archived items in this collection. The order is indeterminate.- Specified by:
findByCollectionin interfaceItemService- Parameters:
context- DSpace context objectcollection- Collection (parent)limit- limited number of itemsoffset- offset value- Returns:
- an iterator over the items in the collection.
- Throws:
SQLException- if database error
-
findByCollectionMapping
public Iterator<Item> findByCollectionMapping(Context context, Collection collection, Integer limit, Integer offset) throws SQLException Description copied from interface:ItemServiceGet all the archived items mapped to this collection (excludes owning collection). The order is indeterminate.- Specified by:
findByCollectionMappingin interfaceItemService- Parameters:
context- DSpace context objectcollection- Collection (parent)limit- limited number of itemsoffset- offset value- Returns:
- an iterator over the items in the collection.
- Throws:
SQLException- if database error
-
countByCollectionMapping
Description copied from interface:ItemServiceCount all the archived items mapped to this collection (excludes owning collection). The order is indeterminate.- Specified by:
countByCollectionMappingin interfaceItemService- Parameters:
context- DSpace context objectcollection- Collection (parent)- Returns:
- an iterator over the items in the collection.
- Throws:
SQLException- if database error
-
findAllByCollection
public Iterator<Item> findAllByCollection(Context context, Collection collection) throws SQLException Description copied from interface:ItemServiceGet all the items (including private and withdrawn) in this collection. The order is indeterminate.- Specified by:
findAllByCollectionin interfaceItemService- Parameters:
context- DSpace context objectcollection- Collection (parent)- Returns:
- an iterator over the items in the collection.
- Throws:
SQLException- if database error
-
findAllByCollection
public Iterator<Item> findAllByCollection(Context context, Collection collection, Integer limit, Integer offset) throws SQLException Description copied from interface:ItemServiceGet all the items (including private and withdrawn) in this collection. The order is indeterminate.- Specified by:
findAllByCollectionin interfaceItemService- Parameters:
context- DSpace context objectcollection- Collection (parent)limit- limited number of itemsoffset- offset value- Returns:
- an iterator over the items in the collection.
- Throws:
SQLException- if database error
-
findInArchiveOrWithdrawnDiscoverableModifiedSince
public Iterator<Item> findInArchiveOrWithdrawnDiscoverableModifiedSince(Context context, Instant since) throws SQLException Description copied from interface:ItemServiceGet all Items installed or withdrawn, discoverable, and modified since a Date.- Specified by:
findInArchiveOrWithdrawnDiscoverableModifiedSincein interfaceItemService- Parameters:
context- DSpace context objectsince- earliest interesting last-modified date, or null for no date test.- Returns:
- an iterator over the items in the collection.
- Throws:
SQLException- if database error
-
findInArchiveOrWithdrawnNonDiscoverableModifiedSince
public Iterator<Item> findInArchiveOrWithdrawnNonDiscoverableModifiedSince(Context context, Instant since) throws SQLException Description copied from interface:ItemServiceGet all Items installed or withdrawn, NON-discoverable, and modified since a Date.- Specified by:
findInArchiveOrWithdrawnNonDiscoverableModifiedSincein interfaceItemService- Parameters:
context- contextsince- earliest interesting last-modified date, or null for no date test.- Returns:
- an iterator over the items in the collection.
- Throws:
SQLException- if database error
-
updateLastModified
- Specified by:
updateLastModifiedin interfaceDSpaceObjectService<Item>- Throws:
SQLExceptionAuthorizeException
-
isIn
Description copied from interface:ItemServiceSee whether this Item is contained by a given Collection.- Specified by:
isInin interfaceItemService- Parameters:
item- item to checkcollection- Collection (parent- Returns:
- true if
collectioncontains this Item. - Throws:
SQLException- if database error
-
getCommunities
Description copied from interface:ItemServiceGet the communities this item is in. Returns an unordered array of the communities that house the collections this item is in, including parent communities of the owning collections.- Specified by:
getCommunitiesin interfaceItemService- Parameters:
context- DSpace context objectitem- item to check- Returns:
- the communities this item is in.
- Throws:
SQLException- if database error
-
getBundles
Description copied from interface:ItemServiceGet the bundles matching a bundle name (name corresponds roughly to type)- Specified by:
getBundlesin interfaceItemService- Parameters:
item- item to checkname- name of bundle (ORIGINAL/TEXT/THUMBNAIL)- Returns:
- the bundles in an unordered array
- Throws:
SQLException- if database error
-
addBundle
public void addBundle(Context context, Item item, Bundle bundle) throws SQLException, AuthorizeException Description copied from interface:ItemServiceAdd an existing bundle to this item. This has immediate effect.- Specified by:
addBundlein interfaceItemService- Parameters:
context- DSpace context objectitem- item to add the bundle tobundle- the bundle to add- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
removeBundle
public void removeBundle(Context context, Item item, Bundle bundle) throws SQLException, AuthorizeException, IOException Description copied from interface:ItemServiceRemove a bundle. This may result in the bundle being deleted, if the bundle is orphaned.- Specified by:
removeBundlein interfaceItemService- Parameters:
context- DSpace context objectitem- Itembundle- the bundle to remove- Throws:
SQLException- if database errorAuthorizeException- if authorization errorIOException- if IO error
-
createSingleBitstream
public Bitstream createSingleBitstream(Context context, InputStream is, Item item, String name) throws AuthorizeException, IOException, SQLException Description copied from interface:ItemServiceCreate a single bitstream in a new bundle. Provided as a convenience method for the most common use.- Specified by:
createSingleBitstreamin interfaceItemService- Parameters:
context- DSpace context objectis- the stream to create the new bitstream fromitem- item to create bitstream onname- is the name of the bundle (ORIGINAL, TEXT, THUMBNAIL)- Returns:
- Bitstream that is created
- Throws:
AuthorizeException- if authorization errorIOException- if IO errorSQLException- if database error
-
createSingleBitstream
public Bitstream createSingleBitstream(Context context, InputStream is, Item item) throws AuthorizeException, IOException, SQLException Description copied from interface:ItemServiceConvenience method, calls createSingleBitstream() with name "ORIGINAL"- Specified by:
createSingleBitstreamin interfaceItemService- Parameters:
context- DSpace context objectis- InputStreamitem- item to create bitstream on- Returns:
- created bitstream
- Throws:
AuthorizeException- if authorization errorIOException- if IO errorSQLException- if database error
-
getNonInternalBitstreams
Description copied from interface:ItemServiceGet all non-internal bitstreams in the item. This is mainly used for auditing for provenance messages and adding format.* DC values. The order is indeterminate.- Specified by:
getNonInternalBitstreamsin interfaceItemService- Parameters:
context- DSpace context objectitem- item to check- Returns:
- non-internal bitstreams.
- Throws:
SQLException- if database error
-
createItem
- Throws:
SQLExceptionAuthorizeException
-
createItem
- Throws:
SQLExceptionAuthorizeException
-
removeDSpaceLicense
public void removeDSpaceLicense(Context context, Item item) throws SQLException, AuthorizeException, IOException Description copied from interface:ItemServiceRemove 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)This method is used by the org.dspace.submit.step.LicenseStep class
- Specified by:
removeDSpaceLicensein interfaceItemService- Parameters:
context- DSpace context objectitem- item to remove DSpace license from- Throws:
SQLException- if database errorAuthorizeException- if authorization errorIOException- if IO error
-
removeLicenses
public void removeLicenses(Context context, Item item) throws SQLException, AuthorizeException, IOException Description copied from interface:ItemServiceRemove all licenses from an item - it was rejected- Specified by:
removeLicensesin interfaceItemService- Parameters:
context- DSpace context objectitem- item to remove all licenses from- Throws:
SQLException- if database errorAuthorizeException- if authorization errorIOException- if IO error
-
update
- Specified by:
updatein interfaceDSpaceObjectService<Item>- Overrides:
updatein classDSpaceObjectServiceImpl<Item>- Throws:
SQLExceptionAuthorizeException
-
withdraw
Description copied from interface:ItemServiceWithdraw the item from the archive. It is kept in place, and the content and metadata are not deleted, but it is not publicly accessible.- Specified by:
withdrawin interfaceItemService- Parameters:
context- DSpace context objectitem- item to withdraw- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
reinstate
Description copied from interface:ItemServiceReinstate a withdrawn item- Specified by:
reinstatein interfaceItemService- Parameters:
context- DSpace context objectitem- withdrawn item to reinstate- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
delete
- Specified by:
deletein interfaceDSpaceObjectService<Item>- Throws:
SQLExceptionAuthorizeExceptionIOException
-
getSupportsTypeConstant
public int getSupportsTypeConstant()Description copied from interface:DSpaceObjectServiceReturns the Constants which this service supports- Specified by:
getSupportsTypeConstantin interfaceDSpaceObjectLegacySupportService<Item>- Specified by:
getSupportsTypeConstantin interfaceDSpaceObjectService<Item>- Returns:
- a org.dspace.core.Constants that represents a IndexableObject type
-
rawDelete
protected void rawDelete(Context context, Item item) throws AuthorizeException, SQLException, IOException -
removeRequest
- Throws:
SQLException
-
removeAllBundles
public void removeAllBundles(Context context, Item item) throws AuthorizeException, SQLException, IOException Description copied from interface:ItemServiceRemove all bundles linked to this item. This may result in the bundle being deleted, if the bundle is orphaned.- Specified by:
removeAllBundlesin interfaceItemService- Parameters:
context- DSpace context objectitem- the item from which to remove all bundles- Throws:
AuthorizeException- if authorization errorSQLException- if database errorIOException- if IO error
-
deleteBundle
protected void deleteBundle(Context context, Item item, Bundle b) throws AuthorizeException, SQLException, IOException -
removeVersion
- Throws:
AuthorizeExceptionSQLException
-
isOwningCollection
Description copied from interface:ItemServiceReturn true if this Collection 'owns' this item- Specified by:
isOwningCollectionin interfaceItemService- Parameters:
item- item to checkcollection- Collection- Returns:
- true if this Collection owns this item
-
replaceAllItemPolicies
public void replaceAllItemPolicies(Context context, Item item, List<ResourcePolicy> newpolicies) throws SQLException, AuthorizeException Description copied from interface:ItemServiceremove all of the policies for item and replace them with a new list of policies- Specified by:
replaceAllItemPoliciesin interfaceItemService- Parameters:
context- DSpace context objectitem- item to replace policies onnewpolicies- - this will be all of the new policies for the item and its contents- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
replaceAllBitstreamPolicies
public void replaceAllBitstreamPolicies(Context context, Item item, List<ResourcePolicy> newpolicies) throws SQLException, AuthorizeException Description copied from interface:ItemServiceremove all of the policies for item's bitstreams and bundles and replace them with a new list of policies- Specified by:
replaceAllBitstreamPoliciesin interfaceItemService- Parameters:
context- DSpace context objectitem- item to replace policies onnewpolicies- - this will be all of the new policies for the bundle and bitstream contents- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
removeGroupPolicies
public void removeGroupPolicies(Context context, Item item, Group group) throws SQLException, AuthorizeException Description copied from interface:ItemServiceremove all of the policies for item's bitstreams and bundles that belong to a given Group- Specified by:
removeGroupPoliciesin interfaceItemService- Parameters:
context- DSpace context objectitem- item to remove group policies fromgroup- Group referenced by policies that needs to be removed- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
inheritCollectionDefaultPolicies
public void inheritCollectionDefaultPolicies(Context context, Item item, Collection collection) throws SQLException, AuthorizeException Description copied from interface:ItemServiceRemove 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.- Specified by:
inheritCollectionDefaultPoliciesin interfaceItemService- Parameters:
context- DSpace context objectitem- item to reset policies oncollection- Collection- Throws:
SQLException- 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 error
-
inheritCollectionDefaultPolicies
public void inheritCollectionDefaultPolicies(Context context, Item item, Collection collection, boolean replaceReadRPWithCollectionRP) throws SQLException, AuthorizeException Description copied from interface:ItemServiceRemove all submission and workflow policies on an item and its contents, and add default collection policies which are not yet already in place. If overrideItemReadPolicies is true, then all read policies on the item are replaced (but only if the collection has a default read policy).- Specified by:
inheritCollectionDefaultPoliciesin interfaceItemService- Parameters:
context- DSpace context objectitem- item to reset policies oncollection- CollectionreplaceReadRPWithCollectionRP- if true, all read policies on the item are replaced (but only if the collection has a default read policy)- Throws:
SQLException- 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 error
-
adjustBundleBitstreamPolicies
public void adjustBundleBitstreamPolicies(Context context, Item item, Collection collection) throws SQLException, AuthorizeException Description copied from interface:ItemServiceAdjust the Bundle and Bitstream policies to reflect what have been defined during the submission/workflow. The temporary SUBMISSION and WORKFLOW policies are removed and the policies defined at the item and collection level are copied and inherited as appropriate. Custom selected Item policies are copied to the bundle/bitstream only if no explicit custom policies were already applied to the bundle/bitstream. Collection's policies are inherited if there are no other policies defined or if the append mode is defined by the configuration via the core.authorization.installitem.inheritance-read.append-mode property- Specified by:
adjustBundleBitstreamPoliciesin interfaceItemService- Parameters:
context- DSpace context objectitem- Item to adjust policies oncollection- Collection- Throws:
SQLException- If database errorAuthorizeException- If authorization error
-
adjustBundleBitstreamPolicies
public void adjustBundleBitstreamPolicies(Context context, Item item, Collection collection, boolean replaceReadRPWithCollectionRP) throws SQLException, AuthorizeException Description copied from interface:ItemServiceAdjust the Bundle and Bitstream policies to reflect what have been defined during the submission/workflow. The temporary SUBMISSION and WORKFLOW policies are removed and the policies defined at the item and collection level are copied and inherited as appropriate. Custom selected Item policies are copied to the bundle/bitstream only if no explicit custom policies were already applied to the bundle/bitstream. Collection's policies are inherited if there are no other policies defined or if the append mode is defined by the configuration via the core.authorization.installitem.inheritance-read.append-mode property- Specified by:
adjustBundleBitstreamPoliciesin interfaceItemService- Parameters:
context- DSpace context objectitem- Item to adjust policies oncollection- CollectionreplaceReadRPWithCollectionRP- if true, all read policies on the item are replaced (but only if the collection has a default read policy)- Throws:
SQLException- If database errorAuthorizeException- If authorization error
-
adjustBitstreamPolicies
public void adjustBitstreamPolicies(Context context, Item item, Collection collection, Bitstream bitstream) throws SQLException, AuthorizeException Description copied from interface:ItemServiceAdjust the Bitstream policies to reflect what have been defined during the submission/workflow. The temporary SUBMISSION and WORKFLOW policies are removed and the policies defined at the item and collection level are copied and inherited as appropriate. Custom selected Item policies are copied to the bitstream only if no explicit custom policies were already applied to the bitstream. Collection's policies are inherited if there are no other policies defined or if the append mode is defined by the configuration via the core.authorization.installitem.inheritance-read.append-mode property- Specified by:
adjustBitstreamPoliciesin interfaceItemService- Parameters:
context- DSpace context objectitem- Item to adjust policies oncollection- Collectionbitstream- Bitstream to adjust policies on- Throws:
SQLException- If database errorAuthorizeException- If authorization error
-
adjustBitstreamPolicies
public void adjustBitstreamPolicies(Context context, Item item, Collection collection, Bitstream bitstream, boolean replaceReadRPWithCollectionRP) throws SQLException, AuthorizeException Description copied from interface:ItemServiceAdjust the Bitstream policies to reflect what have been defined during the submission/workflow. The temporary SUBMISSION and WORKFLOW policies are removed and the policies defined at the item and collection level are copied and inherited as appropriate. Custom selected Item policies are copied to the bitstream only if no explicit custom policies were already applied to the bitstream. Collection's policies are inherited if there are no other policies defined or if the append mode is defined by the configuration via the core.authorization.installitem.inheritance-read.append-mode property- Specified by:
adjustBitstreamPoliciesin interfaceItemService- Parameters:
context- DSpace context objectitem- Item to adjust policies oncollection- Collectionbitstream- Bitstream to adjust policies onreplaceReadRPWithCollectionRP- If true, all read policies on the bitstream are replaced (but only if the collection has a default read policy)- Throws:
SQLException- If database errorAuthorizeException- If authorization error
-
adjustItemPolicies
public void adjustItemPolicies(Context context, Item item, Collection collection) throws SQLException, AuthorizeException Description copied from interface:ItemServiceAdjust the Item's policies to reflect what have been defined during the submission/workflow. The temporary SUBMISSION and WORKFLOW policies are removed and the default policies defined at the collection level are inherited as appropriate. Collection's policies are inherited if there are no other policies defined or if the append mode is defined by the configuration via the core.authorization.installitem.inheritance-read.append-mode property- Specified by:
adjustItemPoliciesin interfaceItemService- Parameters:
context- DSpace context objectitem- Item to adjust policies oncollection- Collection- Throws:
SQLException- If database errorAuthorizeException- If authorization error
-
adjustItemPolicies
public void adjustItemPolicies(Context context, Item item, Collection collection, boolean replaceReadRPWithCollectionRP) throws SQLException, AuthorizeException Description copied from interface:ItemServiceAdjust the Item's policies to reflect what have been defined during the submission/workflow. The temporary SUBMISSION and WORKFLOW policies are removed and the default policies defined at the collection level are inherited as appropriate. Collection's policies are inherited if there are no other policies defined or if the append mode is defined by the configuration via the core.authorization.installitem.inheritance-read.append-mode property- Specified by:
adjustItemPoliciesin interfaceItemService- Parameters:
context- DSpace context objectitem- Item to adjust policies oncollection- CollectionreplaceReadRPWithCollectionRP- If true, all read policies on the item are replaced (but only if the collection has a default read policy)- Throws:
SQLException- If database errorAuthorizeException- If authorization error
-
move
public void move(Context context, Item item, Collection from, Collection to) throws SQLException, AuthorizeException, IOException Description copied from interface:ItemServiceMoves the item from one collection to another one- Specified by:
movein interfaceItemService- Parameters:
context- DSpace context objectitem- item to movefrom- Collection to move fromto- Collection to move to- Throws:
SQLException- if database errorAuthorizeException- if authorization errorIOException- if IO error
-
move
public void move(Context context, Item item, Collection from, Collection to, boolean inheritDefaultPolicies) throws SQLException, AuthorizeException, IOException Description copied from interface:ItemServiceMoves the item from one collection to another one- Specified by:
movein interfaceItemService- Parameters:
context- DSpace context objectitem- item to movefrom- Collection to move fromto- Collection to move toinheritDefaultPolicies- whether to inherit policies from new collection- Throws:
SQLException- if database errorAuthorizeException- if authorization errorIOException- if IO error
-
hasUploadedFiles
Description copied from interface:ItemServiceCheck the bundle ORIGINAL to see if there are any uploaded files- Specified by:
hasUploadedFilesin interfaceItemService- Parameters:
item- item to check- Returns:
- true if there is a bundle named ORIGINAL with one or more bitstreams inside
- Throws:
SQLException- if database error
-
getCollectionsNotLinked
Description copied from interface:ItemServiceGet the collections this item is not in.- Specified by:
getCollectionsNotLinkedin interfaceItemService- Parameters:
context- DSpace context objectitem- item to check- Returns:
- the collections this item is not in, if any.
- Throws:
SQLException- if database error
-
canEdit
Description copied from interface:ItemServicereturn TRUE if context's user can edit item, false otherwise- Specified by:
canEditin interfaceItemService- Parameters:
context- DSpace context objectitem- item to check- Returns:
- boolean true = current user can edit item
- Throws:
SQLException- if database error
-
findItemsWithEdit
public List<Item> findItemsWithEdit(Context context, int offset, int limit) throws SQLException, SearchServiceException Description copied from interface:ItemServicefinds all items for which the current user has editing rights- Specified by:
findItemsWithEditin interfaceItemService- Parameters:
context- DSpace context objectoffset- page offsetlimit- page size limit- Returns:
- list of items for which the current user has editing rights
- Throws:
SQLExceptionSearchServiceException
-
countItemsWithEdit
Description copied from interface:ItemServicecounts all items for which the current user has editing rights- Specified by:
countItemsWithEditin interfaceItemService- Parameters:
context- DSpace context object- Returns:
- list of items for which the current user has editing rights
- Throws:
SQLExceptionSearchServiceException
-
isInProgressSubmission
Check if the item is an inprogress submission- Specified by:
isInProgressSubmissionin interfaceItemService- Parameters:
context- The relevant DSpace Context.item- item to check- Returns:
trueif the item is an inprogress submission, i.e. a WorkspaceItem or WorkflowItem- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
addDefaultPoliciesNotInPlace
protected void addDefaultPoliciesNotInPlace(Context context, DSpaceObject dso, List<ResourcePolicy> defaultCollectionPolicies) throws SQLException, AuthorizeException Add the default policies, which have not been already added to the given DSpace object- Parameters:
context- The relevant DSpace Context.dso- The DSpace Object to add policies todefaultCollectionPolicies- list of policies- Throws:
SQLException- An exception that provides information on a database access error or other errors.AuthorizeException- Exception indicating the current user of the context does not have permission to perform a particular action.
-
findArchivedByMetadataField
public Iterator<Item> findArchivedByMetadataField(Context context, String schema, String element, String qualifier, String value) throws SQLException, AuthorizeException Returns an iterator of Items possessing the passed metadata field, or only those matching the passed value, if value is not Item.ANY- Specified by:
findArchivedByMetadataFieldin interfaceItemService- Parameters:
context- DSpace context objectschema- metadata field schemaelement- metadata field elementqualifier- metadata field qualifiervalue- field value or Item.ANY to match any value- Returns:
- an iterator over the items matching that authority value
- Throws:
SQLException- if database error An exception that provides information on a database access error or other errors.AuthorizeException- if authorization error Exception indicating the current user of the context does not have permission to perform a particular action.
-
findArchivedByMetadataField
public Iterator<Item> findArchivedByMetadataField(Context context, String metadataField, String value) throws SQLException, AuthorizeException Description copied from interface:ItemServiceReturns an iterator of in archive items possessing the passed metadata field, or only those matching the passed value, if value is not Item.ANY- Specified by:
findArchivedByMetadataFieldin interfaceItemService- Parameters:
context- DSpace context objectmetadataField- metadatavalue- field value or Item.ANY to match any value- Returns:
- an iterator over the items matching that authority value
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
findByMetadataField
public Iterator<Item> findByMetadataField(Context context, String schema, String element, String qualifier, String value) throws SQLException, AuthorizeException, IOException Returns an iterator of Items possessing the passed metadata field, or only those matching the passed value, if value is not Item.ANY- Specified by:
findByMetadataFieldin interfaceItemService- Parameters:
context- DSpace context objectschema- metadata field schemaelement- metadata field elementqualifier- metadata field qualifiervalue- field value or Item.ANY to match any value- Returns:
- an iterator over the items matching that authority value
- Throws:
SQLException- if database error An exception that provides information on a database access error or other errors.AuthorizeException- if authorization error Exception indicating the current user of the context does not have permission to perform a particular action.IOException- if IO error A general class of exceptions produced by failed or interrupted I/O operations.
-
findByMetadataQuery
public List<Item> findByMetadataQuery(Context context, List<QueryPredicate> queryPredicates, List<UUID> collectionUuids, long offset, int limit) throws SQLException Description copied from interface:ItemServiceReturns a list of items that match the given predicates, within the specified collections, if any. This querying method is used by the Filtered Items report functionality.- Specified by:
findByMetadataQueryin interfaceItemService- Parameters:
context- DSpace context objectqueryPredicates- metadata field predicatescollectionUuids- UUIDs of the collections to searchoffset- position in the list to start returning itemslimit- maximum number of items to return- Returns:
- a list of matching items in the specified collections, or in any collection if no collection UUIDs are provided
- Throws:
SQLException- if a database error occurs
-
countForMetadataQuery
public long countForMetadataQuery(Context context, List<QueryPredicate> queryPredicates, List<UUID> collectionUuids) throws SQLException Description copied from interface:ItemServiceReturns the total number of items that match the given predicates, within the specified collections, if any. This querying method is used for pagination by the Filtered Items report functionality.- Specified by:
countForMetadataQueryin interfaceItemService- Parameters:
context- DSpace context objectqueryPredicates- metadata field predicatescollectionUuids- UUIDs of the collections to search- Returns:
- the total number of matching items in the specified collections, or in any collection if no collection UUIDs are provided
- Throws:
SQLException- if a database error occurs
-
getAdminObject
Description copied from interface:DSpaceObjectServiceReturn the dspace object where an ADMIN action right is sufficient to grant the initial authorize check.Default behaviour is ADMIN right on the object grant right on all other action on the object itself. Subclass should override this method as needed.
- Specified by:
getAdminObjectin interfaceDSpaceObjectService<Item>- Overrides:
getAdminObjectin classDSpaceObjectServiceImpl<Item>- Parameters:
context- DSpace contextitem- DSpaceObjectaction- ID of action being attempted, fromorg.dspace.core.Constants. The ADMIN action is not a valid parameter for this method, an IllegalArgumentException should be thrown- Returns:
- the dspace object, if any, where an ADMIN action is sufficient to grant the original action
- Throws:
SQLException- if database error
-
getParentObject
Description copied from interface:DSpaceObjectServiceReturn the dspace object that "own" the current object in the hierarchy. Note that this method has a meaning slightly different from the getAdminObject because it is independent of the action but it is in a way related to it. It defines the "first" dspace object OTHER then the current one, where allowed ADMIN actions imply allowed ADMIN actions on the object self.- Specified by:
getParentObjectin interfaceDSpaceObjectService<Item>- Overrides:
getParentObjectin classDSpaceObjectServiceImpl<Item>- Parameters:
context- DSpace contextitem- DSpaceObject- Returns:
- the dspace object that "own" the current object in the hierarchy
- Throws:
SQLException- if database error
-
findByAuthorityValue
public Iterator<Item> findByAuthorityValue(Context context, String schema, String element, String qualifier, String value) throws SQLException, AuthorizeException Description copied from interface:ItemServiceFind all the items in the archive with a given authority key value in the indicated metadata field.- Specified by:
findByAuthorityValuein interfaceItemService- Parameters:
context- DSpace context objectschema- metadata field schemaelement- metadata field elementqualifier- metadata field qualifiervalue- the value of authority key to look for- Returns:
- an iterator over the items matching that authority value
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
findByMetadataFieldAuthority
public Iterator<Item> findByMetadataFieldAuthority(Context context, String mdString, String authority) throws SQLException, AuthorizeException - Specified by:
findByMetadataFieldAuthorityin interfaceItemService- Throws:
SQLExceptionAuthorizeException
-
isItemListedForUser
Description copied from interface:ItemServiceService method for knowing if this Item should be visible in the item list. Items only show up in the "item list" if the user has READ permission and if the Item isn't flagged as unlisted.- Specified by:
isItemListedForUserin interfaceItemService- Parameters:
context- DSpace context objectitem- item- Returns:
- true or false
-
countItems
Description copied from interface:ItemServicecounts items in the given collection- Specified by:
countItemsin interfaceItemService- Parameters:
context- DSpace context objectcollection- Collection- Returns:
- total items
- Throws:
SQLException- if database error
-
countAllItems
Description copied from interface:ItemServicecounts all items in the given collection including withdrawn items- Specified by:
countAllItemsin interfaceItemService- Parameters:
context- DSpace context objectcollection- Collection- Returns:
- total items
- Throws:
SQLException- if database error
-
countItems
Description copied from interface:ItemServicecounts items in the given community- Specified by:
countItemsin interfaceItemService- Parameters:
context- DSpace context objectcommunity- Community- Returns:
- total items
- Throws:
SQLException- if database error
-
countAllItems
Description copied from interface:ItemServicecounts all items in the given community including withdrawn- Specified by:
countAllItemsin interfaceItemService- Parameters:
context- DSpace context objectcommunity- Community- Returns:
- total items
- Throws:
SQLException- if database error
-
getAuthoritiesAndConfidences
protected void getAuthoritiesAndConfidences(String fieldKey, Collection collection, List<String> values, List<String> authorities, List<Integer> confidences, int i) - Overrides:
getAuthoritiesAndConfidencesin classDSpaceObjectServiceImpl<Item>
-
findByIdOrLegacyId
- Specified by:
findByIdOrLegacyIdin interfaceDSpaceObjectLegacySupportService<Item>- Throws:
SQLException
-
findByLegacyId
Description copied from interface:DSpaceObjectLegacySupportServiceGeneric find for when the precise type of a DSO is not known, just the a pair of type number and database ID.- Specified by:
findByLegacyIdin interfaceDSpaceObjectLegacySupportService<Item>- Parameters:
context- - the contextid- - the legacy id within table of type'd objects- Returns:
- the object found, or null if it does not exist.
- Throws:
SQLException- only upon failure accessing the database.
-
findByLastModifiedSince
Description copied from interface:ItemServiceFind all Items modified since a Date.- Specified by:
findByLastModifiedSincein interfaceItemService- Parameters:
context- DSpace context objectlast- Earliest interesting last-modified date.- Returns:
- iterator over items
- Throws:
SQLException- if database error
-
countTotal
Description copied from interface:ItemServicecounts all items- Specified by:
countTotalin interfaceItemService- Parameters:
context- DSpace context object- Returns:
- total items
- Throws:
SQLException- if database error
-
countNotArchivedItems
Description copied from interface:ItemServicecounts all items not in archive- Specified by:
countNotArchivedItemsin interfaceItemService- Parameters:
context- DSpace context object- Returns:
- total items NOT in archive
- Throws:
SQLException- if database error
-
countArchivedItems
Description copied from interface:ItemServicecounts all items in archive- Specified by:
countArchivedItemsin interfaceItemService- Parameters:
context- DSpace context object- Returns:
- total items in archive
- Throws:
SQLException- if database error
-
countWithdrawnItems
Description copied from interface:ItemServicecounts all withdrawn items- Specified by:
countWithdrawnItemsin interfaceItemService- Parameters:
context- DSpace context object- Returns:
- total items withdrawn
- Throws:
SQLException- if database error
-
canCreateNewVersion
Description copied from interface:ItemServicereturn TRUE if context's user can create new version of the item, false otherwise.- Specified by:
canCreateNewVersionin interfaceItemService- Parameters:
context- DSpace context objectitem- item to check- Returns:
- boolean true = current user can create new version of the item
- Throws:
SQLException- if database error
-
getMetadata
public List<MetadataValue> getMetadata(Item item, String schema, String element, String qualifier, String lang) This method will return a list of MetadataValue objects that contains all the regular metadata of the item passed along in the parameters as well as all the virtual metadata which will be generated and processed together with theVirtualMetadataPopulatorby processing the item's relationships- Specified by:
getMetadatain interfaceDSpaceObjectService<Item>- Overrides:
getMetadatain classDSpaceObjectServiceImpl<Item>- Parameters:
item- the Item to be processedschema- the schema for the metadata field. Must match thenameof an existing metadata schema.element- the element name.DSpaceObject.ANYmatches any element.nulldoesn't really make sense as all metadata must have an element.qualifier- the qualifier.nullmeans unqualified, andDSpaceObject.ANYmeans any qualifier (including unqualified.)lang- the ISO639 language code, optionally followed by an underscore and the ISO3166 country code.nullmeans only values with no language are returned, andDSpaceObject.ANYmeans values with any country code or no country code are returned.- Returns:
-
getMetadata
public List<MetadataValue> getMetadata(Item item, String schema, String element, String qualifier, String lang, boolean enableVirtualMetadata) Description copied from interface:ItemServiceGet metadata for the DSpace Object in a chosen schema. SeeMetadataSchemafor more information about schemas. Passing in anullvalue forqualifierorlangonly matches metadata fields where that qualifier or languages is actuallynull. Passing inDSpaceObject.ANYretrieves all metadata fields with any value for the qualifier or language, includingnullExamples:
Return values of the unqualified "title" field, in any language. Qualified title fields (e.g. "title.uniform") are NOT returned:
dspaceobject.getMetadataByMetadataString("dc", "title", null, DSpaceObject.ANY );Return all US English values of the "title" element, with any qualifier (including unqualified):
dspaceobject.getMetadataByMetadataString("dc, "title", DSpaceObject.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. If enableVirtualMetadata is set to false, the virtual metadata will not be included
- Specified by:
getMetadatain interfaceItemService- Parameters:
item- Itemschema- the schema for the metadata field. Must match thenameof an existing metadata schema.element- the element name.DSpaceObject.ANYmatches any element.nulldoesn't really make sense as all metadata must have an element.qualifier- the qualifier.nullmeans unqualified, andDSpaceObject.ANYmeans any qualifier (including unqualified.)lang- the ISO639 language code, optionally followed by an underscore and the ISO3166 country code.nullmeans only values with no language are returned, andDSpaceObject.ANYmeans values with any country code or no country code are returned.enableVirtualMetadata- Enables virtual metadata calculation and inclusion from the relationships.- Returns:
- metadata fields that match the parameters
-
moveSingleMetadataValue
Supports moving metadata by adding the metadata value or updating the place of the relationship- Overrides:
moveSingleMetadataValuein classDSpaceObjectServiceImpl<Item>- Parameters:
context- current DSpace session.dso- unused.place- ordinal position of the value in the list of that field's values.rr- the value to be placed.
-
addMetadata
public MetadataValue addMetadata(Context context, Item dso, String schema, String element, String qualifier, String lang, String value, String authority, int confidence, int place) throws SQLException Description copied from interface:DSpaceObjectServiceAdd a single metadata value at the given place position.- Specified by:
addMetadatain interfaceDSpaceObjectService<Item>- Overrides:
addMetadatain classDSpaceObjectServiceImpl<Item>- Parameters:
context- DSpace contextdso- DSpaceObjectschema- the schema for the metadata field. Must match thenameof an existing metadata schema.element- the metadata element namequalifier- the metadata qualifier, ornullfor unqualifiedlang- the ISO639 language code, optionally followed by an underscore and the ISO3166 country code.nullmeans the value has no language (for example, a date).value- the value to add.authority- the external authority key for this value (or null)confidence- the authority confidence (default 0)place- the metadata position- Returns:
- the MetadataValue added ot the object
- Throws:
SQLException- if database error
-
getEntityTypeLabel
Description copied from interface:ItemServiceRetrieve the label of the entity type of the given item.- Specified by:
getEntityTypeLabelin interfaceItemService- Parameters:
item- the item.- Returns:
- the label of the entity type, taken from the item metadata, or null if not found.
-
getEntityType
Description copied from interface:ItemServiceRetrieve the entity type of the given item.- Specified by:
getEntityTypein interfaceItemService- Parameters:
context- the DSpace context.item- the item.- Returns:
- the entity type of the given item, or null if not found.
- Throws:
SQLException
-
isLatestVersion
Description copied from interface:ItemServiceCheck whether the given item is the latest version. If the latest item cannot be determined, because either the version history or the latest version is not present, assume the item is latest.- Specified by:
isLatestVersionin interfaceItemService- Parameters:
context- the DSpace context.item- the item that should be checked.- Returns:
- true if the item is the latest version, false otherwise.
- Throws:
SQLException
-