public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implements BundleService
| Modifier and Type | Field and Description |
|---|---|
protected AuthorizeService |
authorizeService |
protected BitstreamService |
bitstreamService |
protected BundleDAO |
bundleDAO |
protected ItemService |
itemService |
protected ResourcePolicyService |
resourcePolicyService |
choiceAuthorityService, handleService, metadataAuthorityService, metadataFieldService, metadataValueService| Modifier | Constructor and Description |
|---|---|
protected |
BundleServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addBitstream(Context context,
Bundle bundle,
Bitstream bitstream)
Add an existing bitstream to this bundle
|
int |
countTotal(Context context) |
Bundle |
create(Context context,
Item item,
String name)
Create a new bundle, with a new ID and link it to the provided item
|
void |
delete(Context context,
Bundle bundle) |
Bundle |
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.
|
Bundle |
findByIdOrLegacyId(Context context,
String id) |
Bundle |
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.
|
DSpaceObject |
getAdminObject(Context context,
Bundle bundle,
int action)
Return the dspace object where an ADMIN action right is sufficient to
grant the initial authorize check.
|
Bitstream |
getBitstreamByName(Bundle bundle,
String name) |
List<ResourcePolicy> |
getBitstreamPolicies(Context context,
Bundle bundle) |
List<ResourcePolicy> |
getBundlePolicies(Context context,
Bundle bundle) |
DSpaceObject |
getParentObject(Context context,
Bundle bundle)
Return the dspace object that "own" the current object in the hierarchy.
|
int |
getSupportsTypeConstant()
Returns the Constants which this service supports
|
void |
inheritCollectionDefaultPolicies(Context context,
Bundle bundle,
Collection collection)
remove all policies on the bundle and its contents, and replace them with
the DEFAULT_BITSTREAM_READ policies belonging to the collection.
|
void |
removeBitstream(Context context,
Bundle bundle,
Bitstream bitstream)
Remove a bitstream from this bundle - the bitstream is only deleted if
this was the last reference to it
|
void |
replaceAllBitstreamPolicies(Context context,
Bundle bundle,
List<ResourcePolicy> newpolicies)
remove all of the policies for the bundle and bitstream contents and replace
them with a new list of policies
|
void |
setOrder(Context context,
Bundle bundle,
UUID[] bitstreamIds)
Changes bitstream order according to the array
|
void |
update(Context context,
Bundle bundle) |
void |
updateLastModified(Context context,
Bundle dso) |
addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, deleteMetadata, getAuthoritiesAndConfidences, 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 BundleDAO bundleDAO
@Autowired(required=true) protected BitstreamService bitstreamService
@Autowired(required=true) protected ItemService itemService
@Autowired(required=true) protected AuthorizeService authorizeService
@Autowired(required=true) protected ResourcePolicyService resourcePolicyService
public Bundle find(Context context, UUID id) throws SQLException
DSpaceObjectServicefind in interface DSpaceObjectService<Bundle>context - - the contextid - - id within table of type'd objectsSQLException - only upon failure accessing the database.public Bundle create(Context context, Item item, String name) throws SQLException, AuthorizeException
BundleServicecreate in interface BundleServicecontext - DSpace context objectSQLExceptionAuthorizeExceptionpublic Bitstream getBitstreamByName(Bundle bundle, String name)
getBitstreamByName in interface BundleServicepublic void addBitstream(Context context, Bundle bundle, Bitstream bitstream) throws SQLException, AuthorizeException
BundleServiceaddBitstream in interface BundleServicebitstream - the bitstream to addSQLExceptionAuthorizeExceptionpublic void removeBitstream(Context context, Bundle bundle, Bitstream bitstream) throws AuthorizeException, SQLException, IOException
BundleService
If the bitstream in question is the primary bitstream recorded for the
bundle the primary bitstream field is unset in order to free the
bitstream from the foreign key constraint so that the
cleanup process can run normally.
removeBitstream in interface BundleServicebitstream - the bitstream to removeAuthorizeExceptionSQLExceptionIOExceptionpublic void inheritCollectionDefaultPolicies(Context context, Bundle bundle, Collection collection) throws SQLException, AuthorizeException
BundleServiceinheritCollectionDefaultPolicies in interface BundleServicecollection - CollectionSQLException - if an SQL error or if no default policies found. It's a bit
draconian, but default policies must be enforced.AuthorizeExceptionpublic void replaceAllBitstreamPolicies(Context context, Bundle bundle, List<ResourcePolicy> newpolicies) throws SQLException, AuthorizeException
BundleServicereplaceAllBitstreamPolicies in interface BundleServicenewpolicies - -
this will be all of the new policies for the bundle and
bitstream contentsSQLExceptionAuthorizeExceptionpublic List<ResourcePolicy> getBitstreamPolicies(Context context, Bundle bundle) throws SQLException
getBitstreamPolicies in interface BundleServiceSQLExceptionpublic List<ResourcePolicy> getBundlePolicies(Context context, Bundle bundle) throws SQLException
getBundlePolicies in interface BundleServiceSQLExceptionpublic void setOrder(Context context, Bundle bundle, UUID[] bitstreamIds) throws AuthorizeException, SQLException
BundleServicesetOrder in interface BundleServicebitstreamIds - the identifiers in the order they are to be setAuthorizeException - If the user can't make the changesSQLException - when an SQL error has occurred (querying DSpace)public DSpaceObject getAdminObject(Context context, Bundle bundle, 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<Bundle>getAdminObject in class DSpaceObjectServiceImpl<Bundle>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, Bundle bundle) throws SQLException
DSpaceObjectServicegetParentObject in interface DSpaceObjectService<Bundle>getParentObject in class DSpaceObjectServiceImpl<Bundle>SQLExceptionpublic void updateLastModified(Context context, Bundle dso)
updateLastModified in interface DSpaceObjectService<Bundle>public void update(Context context, Bundle bundle) throws SQLException, AuthorizeException
update in interface DSpaceObjectService<Bundle>update in class DSpaceObjectServiceImpl<Bundle>SQLExceptionAuthorizeExceptionpublic void delete(Context context, Bundle bundle) throws SQLException, AuthorizeException, IOException
delete in interface DSpaceObjectService<Bundle>SQLExceptionAuthorizeExceptionIOExceptionpublic int getSupportsTypeConstant()
DSpaceObjectServicegetSupportsTypeConstant in interface DSpaceObjectLegacySupportService<Bundle>getSupportsTypeConstant in interface DSpaceObjectService<Bundle>public Bundle findByIdOrLegacyId(Context context, String id) throws SQLException
findByIdOrLegacyId in interface DSpaceObjectLegacySupportService<Bundle>SQLExceptionpublic Bundle findByLegacyId(Context context, int id) throws SQLException
DSpaceObjectLegacySupportServicefindByLegacyId in interface DSpaceObjectLegacySupportService<Bundle>context - - the contextid - - the legacy id within table of type'd objectsSQLException - only upon failure accessing the database.public int countTotal(Context context) throws SQLException
countTotal in interface BundleServiceSQLExceptionCopyright © 2016 DuraSpace. All Rights Reserved.