Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/main/java/org/icatproject/topcat/web/rest/AdminResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,19 @@ public Response setDownloadStatus(
throw new NotFoundException("could not find download");
}

if (download.getStatus().equals(DownloadStatus.QUEUED) && value.equals("RESTORING")) {
DownloadStatus downloadStatus = DownloadStatus.valueOf(value);
if (download.getStatus().equals(DownloadStatus.QUEUED) && downloadStatus.equals(DownloadStatus.RESTORING)) {
// Queued jobs need to be marked PREPARING first to generate a preparedId before RESTORING
download.setStatus(DownloadStatus.PREPARING);
} else {
download.setStatus(DownloadStatus.valueOf(value));
downloadStatus = DownloadStatus.PREPARING;
}
if(value.equals("COMPLETE")){
download.setStatus(downloadStatus);
if (downloadStatus.equals(DownloadStatus.PREPARING)) {
// Downloads in the preparing state will result in a call to the ids which requires an active sessionId.
// The contents of the Download should have already been authorized when it was created, and the /prepare
// method also uses the admin's sessionId in the call to the IDS.
download.setSessionId(sessionId);
}
if(downloadStatus.equals(DownloadStatus.COMPLETE)){
download.setCompletedAt(new Date());
if (customValue != null && !customValue.equals("")) {
StatusCheck.sendDownloadReadyEmail(mailSession, download, null, customValue);
Expand Down
22 changes: 22 additions & 0 deletions src/site/markdown/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Release Notes

## 3.2.0

* Catch exceptions in CacheRepository.prune()
* Upgrade to JUnit 5.
* Support authenticator prefix as a factor for priority and whether individual transport mechanisms are allowed.
* Persist priority for queued Downloads.
* Implement endpoint to POST /queue/dataCollection.
* Support transport mechanisms which require email to be set.
* Add error handling to UserResource.login().
* Enforce cart size and count limits in the submitCart endpoint.
* Use admin's sessionId when setting DownloadStatus to PREPARING.

## 3.1.0 (19th May 2025)

* Implement endpoints for queuing and chunking of large Downloads for lists of filepaths or visit IDs.
* Implement login endpoint.
* Implement endpoint to GET /downloads/status.
* Implement endpoint to GET /queue/allowed for the requesting user.
* Configuration option to block anonymous users from submitting carts.
* Implement endpoint to POST /admin/download/{id}/prepare and refactor corresponding functionality out of admin script.
* Add new options to admins scripts to (re)submit, cancel, and query for queued Downloads

## 3.0.1 (3rd July 2023)

* Update logback-classic to 2.1.12
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/org/icatproject/topcat/AdminResourceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public void testSetDownloadStatus() throws Exception {
Download testDownload = new Download();
String facilityName = "LILS";
testDownload.setFacilityName(facilityName);
testDownload.setSessionId(adminSessionId);
testDownload.setSessionId("sessionId");
testDownload.setStatus(DownloadStatus.QUEUED);
testDownload.setIsDeleted(false);
testDownload.setUserName("simple/root");
Expand All @@ -265,6 +265,7 @@ public void testSetDownloadStatus() throws Exception {

testDownload = findDownload(downloads, downloadId);
assertEquals(DownloadStatus.PREPARING, testDownload.getStatus());
assertEquals(adminSessionId, testDownload.getSessionId());
} finally {
if (downloadId != null) {
downloadRepository.removeDownload(downloadId);
Expand Down