mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 23:43:06 +00:00
Request-a-copy improvement: Unit and integration tests
This commit is contained in:
@@ -39,6 +39,9 @@ public class RequestItemBuilder
|
||||
private Bitstream bitstream;
|
||||
private Instant decisionDate;
|
||||
private boolean accepted;
|
||||
private String accessToken = null;
|
||||
private int accessPeriod;
|
||||
private boolean allFiles;
|
||||
|
||||
protected RequestItemBuilder(Context context) {
|
||||
super(context);
|
||||
@@ -87,13 +90,29 @@ public class RequestItemBuilder
|
||||
return this;
|
||||
}
|
||||
|
||||
public RequestItemBuilder withAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RequestItemBuilder withAccessPeriod(int accessPeriod) {
|
||||
this.accessPeriod = accessPeriod;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RequestItemBuilder withAllFiles(boolean allFiles) {
|
||||
this.allFiles = allFiles;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestItem build() {
|
||||
LOG.atDebug()
|
||||
.withLocation()
|
||||
.log("Building request with item ID {} and bitstream ID {}",
|
||||
.log("Building request with item ID {} and bitstream ID {} and allfiles {}",
|
||||
() -> item.getID().toString(),
|
||||
() -> bitstream.getID().toString());
|
||||
() -> (bitstream == null ? "" : bitstream.getID().toString()),
|
||||
() -> Boolean.toString(allFiles));
|
||||
|
||||
String token;
|
||||
try {
|
||||
@@ -106,6 +125,11 @@ public class RequestItemBuilder
|
||||
requestItem = requestItemService.findByToken(context, token);
|
||||
requestItem.setAccept_request(accepted);
|
||||
requestItem.setDecision_date(decisionDate);
|
||||
if (accessToken != null) {
|
||||
requestItem.setAccess_token(accessToken);
|
||||
}
|
||||
requestItem.setAccess_period(accessPeriod);
|
||||
requestItem.setAllfiles(allFiles);
|
||||
|
||||
requestItemService.update(context, requestItem);
|
||||
|
||||
|
Reference in New Issue
Block a user