Interface BundleService

All Superinterfaces:
DSpaceObjectLegacySupportService<Bundle>, DSpaceObjectService<Bundle>
All Known Implementing Classes:
BundleServiceImpl

public interface BundleService extends DSpaceObjectService<Bundle>, DSpaceObjectLegacySupportService<Bundle>
Service interface class for the Bundle object. The implementation of this class is responsible for all business logic calls for the Bundle object and is autowired by spring
Author:
kevinvandevelde at atmire.com
  • Method Details

    • create

      Bundle create(Context context, Item item, String name) throws SQLException, AuthorizeException
      Create a new bundle, with a new ID and link it to the provided item
      Parameters:
      context - DSpace context object
      item - DSpace item
      name - bundle name
      Returns:
      the newly created bundle
      Throws:
      AuthorizeException - if authorization error
      SQLException - if database error
    • getBitstreamByName

      Bitstream getBitstreamByName(Bundle bundle, String name)
    • addBitstream

      void addBitstream(Context context, Bundle bundle, Bitstream bitstream) throws SQLException, AuthorizeException
      Add an existing bitstream to this bundle
      Parameters:
      context - DSpace Context
      bundle - the bitstream bundle
      bitstream - the bitstream to add
      Throws:
      AuthorizeException - if authorization error
      SQLException - if database error
    • removeBitstream

      void removeBitstream(Context context, Bundle bundle, Bitstream bitstream) throws AuthorizeException, SQLException, IOException
      Remove a bitstream from this bundle - the bitstream is only deleted if this was the last reference to it

      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.

      Parameters:
      context - DSpace Context
      bundle - the bitstream bundle
      bitstream - the bitstream to remove
      Throws:
      IOException - if IO error
      AuthorizeException - if authorization error
      SQLException - if database error
    • inheritCollectionDefaultPolicies

      void inheritCollectionDefaultPolicies(Context context, Bundle bundle, Collection collection) throws SQLException, AuthorizeException
      remove all policies on the bundle and its contents, and replace them with the DEFAULT_BITSTREAM_READ policies belonging to the collection.
      Parameters:
      context - DSpace Context
      bundle - the bitstream bundle
      collection - Collection
      Throws:
      SQLException - 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
    • replaceAllBitstreamPolicies

      void replaceAllBitstreamPolicies(Context context, Bundle bundle, List<ResourcePolicy> newpolicies) throws SQLException, AuthorizeException
      remove all of the policies for the bundle and bitstream contents and replace them with a new list of policies
      Parameters:
      context - DSpace Context
      bundle - the bitstream bundle
      newpolicies - - this will be all of the new policies for the bundle and bitstream contents
      Throws:
      SQLException - if database error
      AuthorizeException - if authorization error
    • getBitstreamPolicies

      List<ResourcePolicy> getBitstreamPolicies(Context context, Bundle bundle) throws SQLException
      Throws:
      SQLException
    • getBundlePolicies

      List<ResourcePolicy> getBundlePolicies(Context context, Bundle bundle) throws SQLException
      Throws:
      SQLException
    • updateBitstreamOrder

      void updateBitstreamOrder(Context context, Bundle bundle, int from, int to) throws AuthorizeException, SQLException
      Moves a bitstream within a bundle from one place to another, shifting all other bitstreams in the process
      Parameters:
      context - DSpace Context
      bundle - The bitstream bundle
      from - The index of the bitstream to move
      to - The index to move the bitstream to
      Throws:
      AuthorizeException - when an SQL error has occurred (querying DSpace)
      SQLException - If the user can't make the changes
    • moveBitstreamToBundle

      void moveBitstreamToBundle(Context context, Bundle targetBundle, Bitstream bitstream) throws SQLException, AuthorizeException, IOException
      Moves a bitstream from its current bundle to a new target bundle
      Parameters:
      context - DSpace Context
      targetBundle - The target bundle where bitstream will be moved to
      bitstream - The bitstream being moved
      Throws:
      SQLException - if database error
      AuthorizeException - if authorization error
      IOException - if IO error
    • setOrder

      void setOrder(Context context, Bundle bundle, UUID[] bitstreamIds) throws AuthorizeException, SQLException
      Changes bitstream order according to the array
      Parameters:
      context - DSpace Context
      bundle - the bitstream bundle
      bitstreamIds - the identifiers in the order they are to be set
      Throws:
      SQLException - when an SQL error has occurred (querying DSpace)
      AuthorizeException - If the user can't make the changes
    • countTotal

      int countTotal(Context context) throws SQLException
      Throws:
      SQLException