Interface RequestItemService

All Known Implementing Classes:
RequestItemServiceImpl

public interface RequestItemService
Service interface class for the RequestItem object. The implementation of this class is responsible for all business logic calls for the RequestItem object and is autowired by Spring.
Author:
kevinvandevelde at atmire.com, Kim Shepherd
  • Method Details

    • createRequest

      String createRequest(Context context, Bitstream bitstream, Item item, boolean allFiles, String reqEmail, String reqName, String reqMessage) throws SQLException
      Generate a request item representing the request and put it into the DB
      Parameters:
      context - The relevant DSpace Context.
      bitstream - The requested bitstream
      item - The requested item
      reqMessage - Request message text
      allFiles - true indicates that all bitstreams of this item are requested
      reqEmail - email Requester email
      reqName - Requester name
      Returns:
      the token of the request item
      Throws:
      SQLException - if database error
    • findAll

      List<RequestItem> findAll(Context context) throws SQLException
      Fetch all item requests.
      Parameters:
      context - current DSpace session.
      Returns:
      all item requests.
      Throws:
      SQLException - passed through.
    • findByToken

      RequestItem findByToken(Context context, String token)
      Retrieve a request by its approver token.
      Parameters:
      context - current DSpace session.
      token - the token identifying the request to be approved.
      Returns:
      the matching request, or null if not found.
    • findByAccessToken

      RequestItem findByAccessToken(Context context, String token)
      Retrieve a request by its access token, for use by the requester
      Parameters:
      context - current DSpace session.
      token - the token identifying the request to be temporarily accessed
      Returns:
      the matching request, or null if not found.
    • findByItem

      Iterator<RequestItem> findByItem(Context context, Item item) throws SQLException
      Retrieve a request based on the item.
      Parameters:
      context - current DSpace session.
      item - the item to find requests for.
      Returns:
      the matching requests, or null if not found.
      Throws:
      SQLException
    • update

      void update(Context context, RequestItem requestItem)
      Save updates to the record. Only accept_request, decision_date, access_period are settable. Note: the "is settable" rules mentioned here are enforced in RequestItemRest with annotations meaning that these JSON properties are considered READ-ONLY by the core DSpaceRestRepository methods
      Parameters:
      context - The relevant DSpace Context.
      requestItem - requested item
    • delete

      void delete(Context context, RequestItem request)
      Remove the record from the database.
      Parameters:
      context - current DSpace context.
      request - record to be removed.
    • isRestricted

      boolean isRestricted(Context context, DSpaceObject o) throws SQLException
      Is there at least one valid READ resource policy for this object?
      Parameters:
      context - current DSpace session.
      o - the object.
      Returns:
      true if a READ policy applies.
      Throws:
      SQLException - passed through.
    • setAccessExpiry

      void setAccessExpiry(RequestItem requestItem, Instant accessExpiry)
      Set the access expiry timestamp for a request item. After this date, the bitstream(s) will no longer be available for download even with a token.
      Parameters:
      requestItem - the request item
      accessExpiry - the expiry timestamp
    • setAccessExpiry

      void setAccessExpiry(RequestItem requestItem, String delta)
      Set the access expiry timestamp for a request item by delta string. After this date, the bitstream(s) will no longer be available for download even with a token.
      Parameters:
      requestItem - the request item
      delta - the delta to calculate the expiry timestamp, from the decision date
    • authorizeAccessByAccessToken

      void authorizeAccessByAccessToken(Context context, RequestItem requestItem, Bitstream bitstream, String accessToken) throws AuthorizeException
      Taking into account 'accepted' flag, bitstream id or allfiles flag, decision date and access period, either return cleanly or throw an AuthorizeException
      Parameters:
      context - the DSpace context
      requestItem - the request item containing request and approval data
      bitstream - the bitstream to which access is requested
      accessToken - the access token supplied by the user (e.g. to REST controller)
      Throws:
      AuthorizeException
    • authorizeAccessByAccessToken

      void authorizeAccessByAccessToken(Context context, Bitstream bitstream, String accessToken) throws AuthorizeException
      Taking into account 'accepted' flag, bitstream id or allfiles flag, decision date and access period, either return cleanly or throw an AuthorizeException
      Parameters:
      context - the DSpace context
      bitstream - the bitstream to which access is requested
      accessToken - the access token supplied by the user (e.g. to REST controller)
      Throws:
      AuthorizeException
    • getLinkTokenEmail

      String getLinkTokenEmail(String token) throws URISyntaxException, MalformedURLException
      Generate a link back to DSpace, to act on a request.
      Parameters:
      token - identifies the request.
      Returns:
      URL to the item request API, with the token as request parameter "token".
      Throws:
      URISyntaxException - passed through.
      MalformedURLException - passed through.
    • sanitizeRequestItem

      void sanitizeRequestItem(Context context, RequestItem requestItem)
      Sanitize a RequestItem depending on the current session user. If the current user is not the approver, an administrator or other privileged group, the following values in the return object are nullified: - approver token (aka token) - requester name - requester email - requester message These properties contain personal information, or can be used to access personal information and are not needed except for sending the original request and grant/deny emails
      Parameters:
      requestItem -