public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements ItemService
| Modifier and Type | Field and Description |
|---|---|
protected AuthorizeService |
authorizeService |
protected BitstreamFormatService |
bitstreamFormatService |
protected BitstreamService |
bitstreamService |
protected BundleService |
bundleService |
protected CollectionService |
collectionService |
protected CommunityService |
communityService |
protected IdentifierService |
identifierService |
protected InstallItemService |
installItemService |
protected ItemDAO |
itemDAO |
protected MetadataSchemaService |
metadataSchemaService |
protected ResourcePolicyService |
resourcePolicyService |
protected VersioningService |
versioningService |
choiceAuthorityService, handleService, metadataAuthorityService, metadataFieldService, metadataValueService| Modifier | Constructor and Description |
|---|---|
protected |
ItemServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addBundle(Context context,
Item item,
Bundle bundle)
Add an existing bundle to this item.
|
void |
adjustBundleBitstreamPolicies(Context context,
Item item,
Collection collection) |
void |
adjustItemPolicies(Context context,
Item item,
Collection collection) |
boolean |
canEdit(Context context,
Item item)
return TRUE if context's user can edit item, false otherwise
|
int |
countItems(Context context,
Collection collection)
counts items in the given collection
|
int |
countItems(Context context,
Community community)
counts items in the given community
|
int |
countNotArchivedItems(Context context) |
int |
countTotal(Context context) |
int |
countWithdrawnItems(Context context) |
Item |
create(Context context,
WorkspaceItem workspaceItem)
Create a new item, with a new internal ID.
|
protected Item |
createItem(Context context) |
Bitstream |
createSingleBitstream(Context context,
InputStream is,
Item item)
Convenience method, calls createSingleBitstream() with name "ORIGINAL"
|
Bitstream |
createSingleBitstream(Context context,
InputStream is,
Item item,
String name)
Create a single bitstream in a new bundle.
|
Item |
createTemplateItem(Context context,
Collection collection)
Create an empty template item for this collection.
|
void |
delete(Context context,
Item item) |
protected void |
deleteBundle(Context context,
Item item,
Bundle b) |
protected List<ResourcePolicy> |
filterPoliciesToAdd(Context context,
List<ResourcePolicy> defaultCollectionPolicies,
DSpaceObject dso) |
Item |
find(Context context,
UUID id)
Generic find for when the precise type of a DSO is not known, just the
a pair of type number and database ID.
|
Iterator<Item> |
findAll(Context context)
Get all the items in the archive.
|
Iterator<Item> |
findAllByCollection(Context context,
Collection collection)
Get all the items in this collection.
|
Iterator<Item> |
findAllUnfiltered(Context context)
Get all "final" items in the archive, both archived ("in archive" flag) or
withdrawn items are included.
|
Iterator<Item> |
findByAuthorityValue(Context context,
String schema,
String element,
String qualifier,
String value)
Find all the items in the archive with a given authority key value
in the indicated metadata field.
|
Iterator<Item> |
findByCollection(Context context,
Collection collection)
Get all the items in this collection.
|
Iterator<Item> |
findByCollection(Context context,
Collection collection,
Integer limit,
Integer offset)
Get all the items in this collection.
|
Item |
findByIdOrLegacyId(Context context,
String id) |
Iterator<Item> |
findByLastModifiedSince(Context context,
Date last)
Find all Items modified since a Date.
|
Item |
findByLegacyId(Context context,
int id)
Generic find for when the precise type of a DSO is not known, just the
a pair of type number and database ID.
|
Iterator<Item> |
findByMetadataField(Context context,
String schema,
String element,
String qualifier,
String value)
Returns an iterator of Items possessing the passed metadata field, or only
those matching the passed value, if value is not Item.ANY
|
Iterator<Item> |
findByMetadataFieldAuthority(Context context,
String mdString,
String authority) |
Iterator<Item> |
findByMetadataQuery(Context context,
List<List<MetadataField>> listFieldList,
List<String> query_op,
List<String> query_val,
List<UUID> collectionUuids,
String regexClause,
int offset,
int limit) |
Iterator<Item> |
findBySubmitter(Context context,
EPerson eperson)
Find all the items in the archive by a given submitter.
|
Iterator<Item> |
findBySubmitterDateSorted(Context context,
EPerson eperson,
Integer limit)
Retrieve the list of Items submitted by eperson, ordered by recently submitted, optionally limitable
|
Iterator<Item> |
findInArchiveOrWithdrawnDiscoverableModifiedSince(Context context,
Date since)
Get all Items installed or withdrawn, discoverable, and modified since a Date.
|
DSpaceObject |
getAdminObject(Context context,
Item item,
int action)
Return the dspace object where an ADMIN action right is sufficient to
grant the initial authorize check.
|
protected void |
getAuthoritiesAndConfidences(String fieldKey,
Collection collection,
List<String> values,
List<String> authorities,
List<Integer> confidences,
int i) |
List<Bundle> |
getBundles(Item item,
String name)
Get the bundles matching a bundle name (name corresponds roughly to type)
|
List<Collection> |
getCollectionsNotLinked(Context context,
Item item)
Get the collections this item is not in.
|
List<Community> |
getCommunities(Context context,
Item item)
Get the communities this item is in.
|
List<Bitstream> |
getNonInternalBitstreams(Context context,
Item item)
Get all non-internal bitstreams in the item.
|
DSpaceObject |
getParentObject(Context context,
Item item)
Return the dspace object that "own" the current object in the hierarchy.
|
int |
getSupportsTypeConstant()
Returns the Constants which this service supports
|
Thumbnail |
getThumbnail(Context context,
Item item,
boolean requireOriginal) |
boolean |
hasUploadedFiles(Item item)
Check the bundle ORIGINAL to see if there are any uploaded files
|
void |
inheritCollectionDefaultPolicies(Context context,
Item item,
Collection collection)
remove all policies on an item and its contents, and replace them with
the DEFAULT_ITEM_READ and DEFAULT_BITSTREAM_READ policies belonging to
the collection.
|
boolean |
isIn(Item item,
Collection collection)
See whether this Item is contained by a given Collection.
|
boolean |
isItemListedForUser(Context context,
Item item)
Service method for knowing if this Item should be visible in the item list.
|
boolean |
isOwningCollection(Item item,
Collection collection)
Return true if this Collection 'owns' this item
|
void |
move(Context context,
Item item,
Collection from,
Collection to)
Moves the item from one collection to another one
|
void |
move(Context context,
Item item,
Collection from,
Collection to,
boolean inheritDefaultPolicies)
Moves the item from one collection to another one
|
protected void |
rawDelete(Context context,
Item item) |
void |
reinstate(Context context,
Item item)
Reinstate a withdrawn item
|
void |
removeAllBundles(Context context,
Item item)
Remove all bundles linked to this item.
|
void |
removeBundle(Context context,
Item item,
Bundle bundle)
Remove a bundle.
|
void |
removeDSpaceLicense(Context context,
Item item)
Remove just the DSpace license from an item This is useful to update the
current DSpace license, in case the user must accept the DSpace license
again (either the item was rejected, or resumed after saving)
|
void |
removeGroupPolicies(Context context,
Item item,
Group group)
remove all of the policies for item's bitstreams and bundles that belong
to a given Group
|
void |
removeLicenses(Context context,
Item item)
Remove all licenses from an item - it was rejected
|
protected void |
removeVersion(Context context,
Item item) |
void |
replaceAllBitstreamPolicies(Context context,
Item item,
List<ResourcePolicy> newpolicies)
remove all of the policies for item's bitstreams and bundles and replace
them with a new list of policies
|
void |
replaceAllItemPolicies(Context context,
Item item,
List<ResourcePolicy> newpolicies)
remove all of the policies for item and replace them with a new list of
policies
|
void |
update(Context context,
Item item) |
void |
updateLastModified(Context context,
Item item) |
void |
withdraw(Context context,
Item item)
Withdraw the item from the archive.
|
addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, deleteMetadata, getElements, getElementsFilled, getIdentifiers, getMDValueByField, getMDValueByLegacyField, getMetadata, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getMetadataValuePlace, getName, getTypeText, match, removeMetadataValues, setMetadataSingleValueclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, getIdentifiers, getMetadata, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getName, getTypeText, removeMetadataValues, setMetadataSingleValue@Autowired(required=true) protected ItemDAO itemDAO
@Autowired(required=true) protected CommunityService communityService
@Autowired(required=true) protected AuthorizeService authorizeService
@Autowired(required=true) protected BundleService bundleService
@Autowired(required=true) protected BitstreamFormatService bitstreamFormatService
@Autowired(required=true) protected MetadataSchemaService metadataSchemaService
@Autowired(required=true) protected BitstreamService bitstreamService
@Autowired(required=true) protected InstallItemService installItemService
@Autowired(required=true) protected ResourcePolicyService resourcePolicyService
@Autowired(required=true) protected CollectionService collectionService
@Autowired(required=true) protected IdentifierService identifierService
@Autowired(required=true) protected VersioningService versioningService
public Thumbnail getThumbnail(Context context, Item item, boolean requireOriginal) throws SQLException
getThumbnail in interface ItemServiceSQLExceptionpublic Item find(Context context, UUID id) throws SQLException
DSpaceObjectServicefind in interface DSpaceObjectService<Item>context - - the contextid - - id within table of type'd objectsSQLException - only upon failure accessing the database.public Item create(Context context, WorkspaceItem workspaceItem) throws SQLException, AuthorizeException
ItemServicecreate in interface ItemServicecontext - DSpace context objectSQLExceptionAuthorizeExceptionpublic Item createTemplateItem(Context context, Collection collection) throws SQLException, AuthorizeException
ItemServiceupdate on
the collection after doing this, or the item will have been created but
the collection record will not refer to it.createTemplateItem in interface ItemServiceSQLExceptionAuthorizeExceptionpublic Iterator<Item> findAll(Context context) throws SQLException
ItemServicefindAll in interface ItemServicecontext - DSpace context objectSQLExceptionpublic Iterator<Item> findAllUnfiltered(Context context) throws SQLException
ItemServicefindAllUnfiltered in interface ItemServicecontext - DSpace context objectSQLExceptionpublic Iterator<Item> findBySubmitter(Context context, EPerson eperson) throws SQLException
ItemServicefindBySubmitter in interface ItemServicecontext - DSpace context objecteperson - the submitterSQLExceptionpublic Iterator<Item> findBySubmitterDateSorted(Context context, EPerson eperson, Integer limit) throws SQLException
ItemServicefindBySubmitterDateSorted in interface ItemServicelimit - a positive integer to limit, -1 or null for unlimitedSQLExceptionpublic Iterator<Item> findByCollection(Context context, Collection collection) throws SQLException
ItemServicefindByCollection in interface ItemServiceSQLExceptionpublic Iterator<Item> findByCollection(Context context, Collection collection, Integer limit, Integer offset) throws SQLException
ItemServicefindByCollection in interface ItemServiceSQLExceptionpublic Iterator<Item> findAllByCollection(Context context, Collection collection) throws SQLException
ItemServicefindAllByCollection in interface ItemServiceSQLExceptionpublic Iterator<Item> findInArchiveOrWithdrawnDiscoverableModifiedSince(Context context, Date since) throws SQLException
ItemServicefindInArchiveOrWithdrawnDiscoverableModifiedSince in interface ItemServicesince - earliest interesting last-modified date, or null for no date test.SQLExceptionpublic void updateLastModified(Context context, Item item) throws SQLException, AuthorizeException
updateLastModified in interface DSpaceObjectService<Item>SQLExceptionAuthorizeExceptionpublic boolean isIn(Item item, Collection collection) throws SQLException
ItemServiceisIn in interface ItemServicecollection contains this Item.SQLExceptionpublic List<Community> getCommunities(Context context, Item item) throws SQLException
ItemServicegetCommunities in interface ItemServiceSQLExceptionpublic List<Bundle> getBundles(Item item, String name) throws SQLException
ItemServicegetBundles in interface ItemServicename - name of bundle (ORIGINAL/TEXT/THUMBNAIL)SQLExceptionpublic void addBundle(Context context, Item item, Bundle bundle) throws SQLException, AuthorizeException
ItemServiceaddBundle in interface ItemServicebundle - the bundle to addSQLExceptionAuthorizeExceptionpublic void removeBundle(Context context, Item item, Bundle bundle) throws SQLException, AuthorizeException, IOException
ItemServiceremoveBundle in interface ItemServicebundle - the bundle to removeSQLExceptionAuthorizeExceptionIOExceptionpublic Bitstream createSingleBitstream(Context context, InputStream is, Item item, String name) throws AuthorizeException, IOException, SQLException
ItemServicecreateSingleBitstream in interface ItemServiceis - the stream to create the new bitstream fromname - is the name of the bundle (ORIGINAL, TEXT, THUMBNAIL)AuthorizeExceptionIOExceptionSQLExceptionpublic Bitstream createSingleBitstream(Context context, InputStream is, Item item) throws AuthorizeException, IOException, SQLException
ItemServicecreateSingleBitstream in interface ItemServiceis - InputStreamAuthorizeExceptionIOExceptionSQLExceptionpublic List<Bitstream> getNonInternalBitstreams(Context context, Item item) throws SQLException
ItemServicegetNonInternalBitstreams in interface ItemServiceSQLExceptionprotected Item createItem(Context context) throws SQLException, AuthorizeException
SQLExceptionAuthorizeExceptionpublic void removeDSpaceLicense(Context context, Item item) throws SQLException, AuthorizeException, IOException
ItemServiceThis method is used by the org.dspace.submit.step.LicenseStep class
removeDSpaceLicense in interface ItemServiceSQLExceptionAuthorizeExceptionIOExceptionpublic void removeLicenses(Context context, Item item) throws SQLException, AuthorizeException, IOException
ItemServiceremoveLicenses in interface ItemServiceSQLExceptionAuthorizeExceptionIOExceptionpublic void update(Context context, Item item) throws SQLException, AuthorizeException
update in interface DSpaceObjectService<Item>update in class DSpaceObjectServiceImpl<Item>SQLExceptionAuthorizeExceptionpublic void withdraw(Context context, Item item) throws SQLException, AuthorizeException
ItemServicewithdraw in interface ItemServiceSQLExceptionAuthorizeExceptionpublic void reinstate(Context context, Item item) throws SQLException, AuthorizeException
ItemServicereinstate in interface ItemServiceSQLExceptionAuthorizeExceptionpublic void delete(Context context, Item item) throws SQLException, AuthorizeException, IOException
delete in interface DSpaceObjectService<Item>SQLExceptionAuthorizeExceptionIOExceptionpublic int getSupportsTypeConstant()
DSpaceObjectServicegetSupportsTypeConstant in interface DSpaceObjectLegacySupportService<Item>getSupportsTypeConstant in interface DSpaceObjectService<Item>protected void rawDelete(Context context, Item item) throws AuthorizeException, SQLException, IOException
public void removeAllBundles(Context context, Item item) throws AuthorizeException, SQLException, IOException
ItemServiceremoveAllBundles in interface ItemServiceitem - the item from which to remove our bundlesAuthorizeExceptionSQLExceptionIOExceptionprotected void deleteBundle(Context context, Item item, Bundle b) throws AuthorizeException, SQLException, IOException
protected void removeVersion(Context context, Item item) throws AuthorizeException, SQLException
AuthorizeExceptionSQLExceptionpublic boolean isOwningCollection(Item item, Collection collection)
ItemServiceisOwningCollection in interface ItemServicecollection - Collectionpublic void replaceAllItemPolicies(Context context, Item item, List<ResourcePolicy> newpolicies) throws SQLException, AuthorizeException
ItemServicereplaceAllItemPolicies in interface ItemServicenewpolicies - -
this will be all of the new policies for the item and its
contentsSQLExceptionAuthorizeExceptionpublic void replaceAllBitstreamPolicies(Context context, Item item, List<ResourcePolicy> newpolicies) throws SQLException, AuthorizeException
ItemServicereplaceAllBitstreamPolicies in interface ItemServicenewpolicies - -
this will be all of the new policies for the bundle and
bitstream contentsSQLExceptionAuthorizeExceptionpublic void removeGroupPolicies(Context context, Item item, Group group) throws SQLException, AuthorizeException
ItemServiceremoveGroupPolicies in interface ItemServicegroup - Group referenced by policies that needs to be removedSQLExceptionAuthorizeExceptionpublic void inheritCollectionDefaultPolicies(Context context, Item item, Collection collection) throws SQLException, AuthorizeException
ItemServiceinheritCollectionDefaultPolicies in interface ItemServicecollection - CollectionSQLException - if an SQL error or if no default policies found. It's a bit
draconian, but default policies must be enforced.AuthorizeExceptionpublic void adjustBundleBitstreamPolicies(Context context, Item item, Collection collection) throws SQLException, AuthorizeException
adjustBundleBitstreamPolicies in interface ItemServiceSQLExceptionAuthorizeExceptionpublic void adjustItemPolicies(Context context, Item item, Collection collection) throws SQLException, AuthorizeException
adjustItemPolicies in interface ItemServiceSQLExceptionAuthorizeExceptionpublic void move(Context context, Item item, Collection from, Collection to) throws SQLException, AuthorizeException, IOException
ItemServicemove in interface ItemServiceSQLExceptionAuthorizeExceptionIOExceptionpublic void move(Context context, Item item, Collection from, Collection to, boolean inheritDefaultPolicies) throws SQLException, AuthorizeException, IOException
ItemServicemove in interface ItemServiceSQLExceptionAuthorizeExceptionIOExceptionpublic boolean hasUploadedFiles(Item item) throws SQLException
ItemServicehasUploadedFiles in interface ItemServiceSQLExceptionpublic List<Collection> getCollectionsNotLinked(Context context, Item item) throws SQLException
ItemServicegetCollectionsNotLinked in interface ItemServiceSQLExceptionpublic boolean canEdit(Context context, Item item) throws SQLException
ItemServicecanEdit in interface ItemServiceSQLExceptionprotected List<ResourcePolicy> filterPoliciesToAdd(Context context, List<ResourcePolicy> defaultCollectionPolicies, DSpaceObject dso) throws SQLException, AuthorizeException
SQLExceptionAuthorizeExceptionpublic Iterator<Item> findByMetadataField(Context context, String schema, String element, String qualifier, String value) throws SQLException, AuthorizeException, IOException
findByMetadataField in interface ItemServicecontext - DSpace context objectschema - metadata field schemaelement - metadata field elementqualifier - metadata field qualifiervalue - field value or Item.ANY to match any valueSQLException, - AuthorizeException, IOExceptionSQLExceptionAuthorizeExceptionIOExceptionpublic Iterator<Item> findByMetadataQuery(Context context, List<List<MetadataField>> listFieldList, List<String> query_op, List<String> query_val, List<UUID> collectionUuids, String regexClause, int offset, int limit) throws SQLException, AuthorizeException, IOException
findByMetadataQuery in interface ItemServiceSQLExceptionAuthorizeExceptionIOExceptionpublic DSpaceObject getAdminObject(Context context, Item item, int action) throws SQLException
DSpaceObjectServiceDefault behaviour is ADMIN right on the object grant right on all other action on the object itself. Subclass should override this method as needed.
getAdminObject in interface DSpaceObjectService<Item>getAdminObject in class DSpaceObjectServiceImpl<Item>action - ID of action being attempted, from
org.dspace.core.Constants. The ADMIN action is
not a valid parameter for this method, an
IllegalArgumentException should be thrownSQLExceptionpublic DSpaceObject getParentObject(Context context, Item item) throws SQLException
DSpaceObjectServicegetParentObject in interface DSpaceObjectService<Item>getParentObject in class DSpaceObjectServiceImpl<Item>SQLExceptionpublic Iterator<Item> findByAuthorityValue(Context context, String schema, String element, String qualifier, String value) throws SQLException, AuthorizeException
ItemServicefindByAuthorityValue in interface ItemServicecontext - DSpace context objectschema - metadata field schemaelement - metadata field elementqualifier - metadata field qualifiervalue - the value of authority key to look forSQLExceptionAuthorizeExceptionpublic Iterator<Item> findByMetadataFieldAuthority(Context context, String mdString, String authority) throws SQLException, AuthorizeException
findByMetadataFieldAuthority in interface ItemServiceSQLExceptionAuthorizeExceptionpublic boolean isItemListedForUser(Context context, Item item)
ItemServiceisItemListedForUser in interface ItemServicepublic int countItems(Context context, Collection collection) throws SQLException
ItemServicecountItems in interface ItemServiceSQLExceptionpublic int countItems(Context context, Community community) throws SQLException
ItemServicecountItems in interface ItemServiceSQLExceptionprotected void getAuthoritiesAndConfidences(String fieldKey, Collection collection, List<String> values, List<String> authorities, List<Integer> confidences, int i)
getAuthoritiesAndConfidences in class DSpaceObjectServiceImpl<Item>public Item findByIdOrLegacyId(Context context, String id) throws SQLException
findByIdOrLegacyId in interface DSpaceObjectLegacySupportService<Item>SQLExceptionpublic Item findByLegacyId(Context context, int id) throws SQLException
DSpaceObjectLegacySupportServicefindByLegacyId in interface DSpaceObjectLegacySupportService<Item>context - - the contextid - - the legacy id within table of type'd objectsSQLException - only upon failure accessing the database.public Iterator<Item> findByLastModifiedSince(Context context, Date last) throws SQLException
ItemServicefindByLastModifiedSince in interface ItemServicelast - Earliest interesting last-modified date.SQLExceptionpublic int countTotal(Context context) throws SQLException
countTotal in interface ItemServiceSQLExceptionpublic int countNotArchivedItems(Context context) throws SQLException
countNotArchivedItems in interface ItemServiceSQLExceptionpublic int countWithdrawnItems(Context context) throws SQLException
countWithdrawnItems in interface ItemServiceSQLExceptionCopyright © 2016 DuraSpace. All Rights Reserved.