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 Summary
Modifier and TypeMethodDescriptionvoidauthorizeAccessByAccessToken(Context context, RequestItem requestItem, Bitstream bitstream, String accessToken) Taking into account 'accepted' flag, bitstream id or allfiles flag, decision date and access period, either return cleanly or throw an AuthorizeExceptionvoidauthorizeAccessByAccessToken(Context context, Bitstream bitstream, String accessToken) Taking into account 'accepted' flag, bitstream id or allfiles flag, decision date and access period, either return cleanly or throw an AuthorizeExceptioncreateRequest(Context context, Bitstream bitstream, Item item, boolean allFiles, String reqEmail, String reqName, String reqMessage) Generate a request item representing the request and put it into the DBvoiddelete(Context context, RequestItem request) Remove the record from the database.Fetch all item requests.findByAccessToken(Context context, String token) Retrieve a request by its access token, for use by the requesterfindByItem(Context context, Item item) Retrieve a request based on the item.findByToken(Context context, String token) Retrieve a request by its approver token.getLinkTokenEmail(String token) Generate a link back to DSpace, to act on a request.booleanisRestricted(Context context, DSpaceObject o) Is there at least one valid READ resource policy for this object?voidsanitizeRequestItem(Context context, RequestItem requestItem) Sanitize a RequestItem depending on the current session user.voidsetAccessExpiry(RequestItem requestItem, String delta) Set the access expiry timestamp for a request item by delta string.voidsetAccessExpiry(RequestItem requestItem, Instant accessExpiry) Set the access expiry timestamp for a request item.voidupdate(Context context, RequestItem requestItem) Save updates to the record.
-
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 bitstreamitem- The requested itemreqMessage- Request message textallFiles- true indicates that all bitstreams of this item are requestedreqEmail- email Requester emailreqName- Requester name- Returns:
- the token of the request item
- Throws:
SQLException- if database error
-
findAll
Fetch all item requests.- Parameters:
context- current DSpace session.- Returns:
- all item requests.
- Throws:
SQLException- passed through.
-
findByToken
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
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
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
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
Remove the record from the database.- Parameters:
context- current DSpace context.request- record to be removed.
-
isRestricted
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
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 itemaccessExpiry- the expiry timestamp
-
setAccessExpiry
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 itemdelta- 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 contextrequestItem- the request item containing request and approval databitstream- the bitstream to which access is requestedaccessToken- 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 contextbitstream- the bitstream to which access is requestedaccessToken- the access token supplied by the user (e.g. to REST controller)- Throws:
AuthorizeException
-
getLinkTokenEmail
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
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-
-