Class ItemServiceImpl
- java.lang.Object
-
- org.dspace.content.DSpaceObjectServiceImpl<Item>
-
- org.dspace.content.ItemServiceImpl
-
- All Implemented Interfaces:
DSpaceObjectLegacySupportService<Item>,DSpaceObjectService<Item>,ItemService
public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements ItemService
Service implementation for the Item object. This class is responsible for all business logic calls for the Item object and is autowired by spring. This class should never be accessed directly.- Author:
- kevinvandevelde at atmire.com
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthorizeServiceauthorizeServiceprotected BitstreamFormatServicebitstreamFormatServiceprotected BitstreamServicebitstreamServiceprotected BundleServicebundleServiceprotected CollectionServicecollectionServiceprotected CommunityServicecommunityServiceprotected ConfigurationServiceconfigurationServiceprotected HarvestedItemServiceharvestedItemServiceprotected IdentifierServiceidentifierServiceprotected InstallItemServiceinstallItemServiceprotected ItemDAOitemDAOprotected MetadataSchemaServicemetadataSchemaServiceprotected RelationshipServicerelationshipServiceprotected ResourcePolicyServiceresourcePolicyServiceprotected VersioningServiceversioningServiceprotected VirtualMetadataPopulatorvirtualMetadataPopulatorprotected WorkflowItemServiceworkflowItemServiceprotected WorkspaceItemServiceworkspaceItemService-
Fields inherited from class org.dspace.content.DSpaceObjectServiceImpl
choiceAuthorityService, handleService, metadataAuthorityService, metadataFieldService, metadataValueService
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedItemServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBundle(Context context, Item item, Bundle bundle)Add 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 objectvoidadjustBundleBitstreamPolicies(Context context, Item item, Collection collection)voidadjustItemPolicies(Context context, Item item, Collection collection)booleancanCreateNewVersion(Context context, Item item)return TRUE if context's user can create new version of the item, false otherwise.booleancanEdit(Context context, Item item)return 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).intcountItems(Context context, Collection collection)counts items in the given collectionintcountItems(Context context, Community community)counts items in the given communityintcountNotArchivedItems(Context context)counts all items not in archiveintcountTotal(Context context)counts all itemsintcountWithdrawnItems(Context context)counts all withdrawn itemsItemcreate(Context context, WorkspaceItem workspaceItem)Create a new item, with a new internal ID.protected ItemcreateItem(Context context)BitstreamcreateSingleBitstream(Context context, InputStream is, Item item)Convenience method, calls createSingleBitstream() with name "ORIGINAL"BitstreamcreateSingleBitstream(Context context, InputStream is, Item item, String name)Create a single bitstream in a new bundle.ItemcreateTemplateItem(Context context, Collection collection)Create an empty template item for this collection.voiddelete(Context context, Item item)protected voiddeleteBundle(Context context, Item item, Bundle b)Itemfind(Context context, UUID id)Generic find for when the precise type of an Entity is not knownIterator<Item>findAll(Context context)Get all the items in the archive.Iterator<Item>findAll(Context context, Integer limit, Integer offset)Get all the items in the archive.Iterator<Item>findAllByCollection(Context context, Collection collection)Get all the items (including private and withdrawn) in this collection.Iterator<Item>findAllByCollection(Context context, Collection collection, Integer limit, Integer offset)Get all the items (including private and withdrawn) 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 archived items in this collection.Iterator<Item>findByCollection(Context context, Collection collection, Integer limit, Integer offset)Get all the archived items in this collection.Iterator<Item>findByCollectionMapping(Context context, Collection collection, Integer limit, Integer offset)Get all the archived items mapped to this collection (excludes owning collection).ItemfindByIdOrLegacyId(Context context, String id)Iterator<Item>findByLastModifiedSince(Context context, Date last)Find all Items modified since a Date.ItemfindByLegacyId(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.ANYIterator<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 limitableIterator<Item>findInArchiveOrWithdrawnDiscoverableModifiedSince(Context context, Date since)Get all Items installed or withdrawn, discoverable, and modified since a Date.Iterator<Item>findInArchiveOrWithdrawnNonDiscoverableModifiedSince(Context context, Date since)Get all Items installed or withdrawn, NON-discoverable, and modified since a Date.DSpaceObjectgetAdminObject(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)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<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 relationshipsList<MetadataValue>getMetadata(Item item, String schema, String element, String qualifier, String lang, boolean enableVirtualMetadata)Get metadata for the DSpace Object in a chosen schema.List<Bitstream>getNonInternalBitstreams(Context context, Item item)Get all non-internal bitstreams in the item.DSpaceObjectgetParentObject(Context context, Item item)Return the dspace object that "own" the current object in the hierarchy.intgetSupportsTypeConstant()Returns the Constants which this service supportsThumbnailgetThumbnail(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.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.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 voidrawDelete(Context context, Item item)voidreinstate(Context context, Item item)Reinstate 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 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 policiesvoidupdate(Context context, Item item)voidupdateLastModified(Context context, Item item)voidwithdraw(Context context, Item item)Withdraw the item from the archive.-
Methods inherited from class org.dspace.content.DSpaceObjectServiceImpl
addAndShiftRightMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, getElements, getElementsFilled, getIdentifiers, getMDValueByField, getMDValueByLegacyField, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getMetadataValuePlace, getName, getTypeText, match, moveMetadata, removeMetadataValues, replaceMetadata, setMetadataModified, setMetadataSingleValue
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.dspace.content.service.DSpaceObjectService
addAndShiftRightMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, getIdentifiers, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getName, getTypeText, moveMetadata, removeMetadataValues, replaceMetadata, setMetadataModified, setMetadataSingleValue
-
-
-
-
Field Detail
-
itemDAO
@Autowired(required=true) protected ItemDAO itemDAO
-
communityService
@Autowired(required=true) protected CommunityService communityService
-
authorizeService
@Autowired(required=true) protected AuthorizeService authorizeService
-
bundleService
@Autowired(required=true) protected BundleService bundleService
-
bitstreamFormatService
@Autowired(required=true) protected BitstreamFormatService bitstreamFormatService
-
metadataSchemaService
@Autowired(required=true) protected MetadataSchemaService metadataSchemaService
-
bitstreamService
@Autowired(required=true) protected BitstreamService bitstreamService
-
installItemService
@Autowired(required=true) protected InstallItemService installItemService
-
resourcePolicyService
@Autowired(required=true) protected ResourcePolicyService resourcePolicyService
-
collectionService
@Autowired(required=true) protected CollectionService collectionService
-
identifierService
@Autowired(required=true) protected IdentifierService identifierService
-
versioningService
@Autowired(required=true) protected VersioningService versioningService
-
harvestedItemService
@Autowired(required=true) protected HarvestedItemService harvestedItemService
-
configurationService
@Autowired(required=true) protected ConfigurationService configurationService
-
workspaceItemService
@Autowired(required=true) protected WorkspaceItemService workspaceItemService
-
workflowItemService
@Autowired(required=true) protected WorkflowItemService workflowItemService
-
relationshipService
@Autowired(required=true) protected RelationshipService relationshipService
-
virtualMetadataPopulator
@Autowired(required=true) protected VirtualMetadataPopulator virtualMetadataPopulator
-
-
Method Detail
-
getThumbnail
public Thumbnail getThumbnail(Context context, Item item, boolean requireOriginal) throws SQLException
- Specified by:
getThumbnailin interfaceItemService- Throws:
SQLException
-
find
public Item find(Context context, UUID id) throws SQLException
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 type'd 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. This method is not public, since items need to be created as workspace items. Authorisation is the responsibility of the caller.- 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
-
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
-
findAll
public Iterator<Item> findAll(Context context) throws SQLException
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
public Iterator<Item> findAll(Context context, Integer limit, Integer offset) throws SQLException
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
public Iterator<Item> findAllUnfiltered(Context context) throws SQLException
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
-
findBySubmitter
public Iterator<Item> findBySubmitter(Context context, EPerson eperson) throws SQLException
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
-
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
public Iterator<Item> findByCollection(Context context, Collection collection) 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)- 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
public int countByCollectionMapping(Context context, Collection collection) throws SQLException
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, Date 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, Date 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
public void updateLastModified(Context context, Item item) throws SQLException, AuthorizeException
- Specified by:
updateLastModifiedin interfaceDSpaceObjectService<Item>- Throws:
SQLExceptionAuthorizeException
-
isIn
public boolean isIn(Item item, Collection collection) throws SQLException
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
public List<Community> getCommunities(Context context, Item item) throws SQLException
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
public List<Bundle> getBundles(Item item, String name) throws SQLException
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
public List<Bitstream> getNonInternalBitstreams(Context context, Item item) throws SQLException
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
protected Item createItem(Context context) throws SQLException, AuthorizeException
- 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
public void update(Context context, Item item) throws SQLException, AuthorizeException
- Specified by:
updatein interfaceDSpaceObjectService<Item>- Overrides:
updatein classDSpaceObjectServiceImpl<Item>- Throws:
SQLExceptionAuthorizeException
-
withdraw
public void withdraw(Context context, Item item) throws SQLException, AuthorizeException
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
public void reinstate(Context context, Item item) throws SQLException, AuthorizeException
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
public void delete(Context context, Item item) throws SQLException, AuthorizeException, IOException
- 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
-
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
protected void removeVersion(Context context, Item item) throws AuthorizeException, SQLException
- Throws:
AuthorizeExceptionSQLException
-
isOwningCollection
public boolean isOwningCollection(Item item, Collection collection)
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
-
adjustBundleBitstreamPolicies
public void adjustBundleBitstreamPolicies(Context context, Item item, Collection collection) throws SQLException, AuthorizeException
- Specified by:
adjustBundleBitstreamPoliciesin interfaceItemService- Throws:
SQLExceptionAuthorizeException
-
adjustItemPolicies
public void adjustItemPolicies(Context context, Item item, Collection collection) throws SQLException, AuthorizeException
- Specified by:
adjustItemPoliciesin interfaceItemService- Throws:
SQLExceptionAuthorizeException
-
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
public boolean hasUploadedFiles(Item item) throws SQLException
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
public List<Collection> getCollectionsNotLinked(Context context, Item item) throws SQLException
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
public boolean canEdit(Context context, Item item) throws SQLException
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
-
isInProgressSubmission
public boolean isInProgressSubmission(Context context, Item item) throws SQLException
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.
-
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 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
- Specified by:
findByMetadataQueryin interfaceItemService- Throws:
SQLExceptionAuthorizeExceptionIOException
-
getAdminObject
public DSpaceObject getAdminObject(Context context, Item item, int action) throws SQLException
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
public DSpaceObject getParentObject(Context context, Item item) throws SQLException
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
public boolean isItemListedForUser(Context context, Item item)
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
public int countItems(Context context, Collection collection) throws SQLException
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
public int countAllItems(Context context, Collection collection) throws SQLException
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
public int countItems(Context context, Community community) throws SQLException
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
public int countAllItems(Context context, Community community) throws SQLException
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
public Item findByIdOrLegacyId(Context context, String id) throws SQLException
- Specified by:
findByIdOrLegacyIdin interfaceDSpaceObjectLegacySupportService<Item>- Throws:
SQLException
-
findByLegacyId
public Item findByLegacyId(Context context, int id) throws SQLException
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
public Iterator<Item> findByLastModifiedSince(Context context, Date last) throws SQLException
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
public int countTotal(Context context) throws SQLException
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
public int countNotArchivedItems(Context context) throws SQLException
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
public int countArchivedItems(Context context) throws SQLException
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
public int countWithdrawnItems(Context context) throws SQLException
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
public boolean canCreateNewVersion(Context context, Item item) throws SQLException
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
-
-