Added new ArbitraryResourceStatus "NOT_PUBLISHED" - for when a non-existent resource is attempted to be loaded.

This commit is contained in:
CalDescent 2023-01-28 14:15:54 +00:00
parent 4a42dc2d00
commit 5e750b4283
2 changed files with 6 additions and 0 deletions

View File

@ -63,6 +63,11 @@ public class ArbitraryDataResource {
this.calculateChunkCounts(); this.calculateChunkCounts();
} }
if (this.totalChunkCount == 0) {
// Assume not published
return new ArbitraryResourceStatus(Status.NOT_PUBLISHED, this.localChunkCount, this.totalChunkCount);
}
if (resourceIdType != ResourceIdType.NAME) { if (resourceIdType != ResourceIdType.NAME) {
// We only support statuses for resources with a name // We only support statuses for resources with a name
return new ArbitraryResourceStatus(Status.UNSUPPORTED, this.localChunkCount, this.totalChunkCount); return new ArbitraryResourceStatus(Status.UNSUPPORTED, this.localChunkCount, this.totalChunkCount);

View File

@ -8,6 +8,7 @@ public class ArbitraryResourceStatus {
public enum Status { public enum Status {
PUBLISHED("Published", "Published but not yet downloaded"), PUBLISHED("Published", "Published but not yet downloaded"),
NOT_PUBLISHED("Not published", "Resource does not exist"),
DOWNLOADING("Downloading", "Locating and downloading files..."), DOWNLOADING("Downloading", "Locating and downloading files..."),
DOWNLOADED("Downloaded", "Files downloaded"), DOWNLOADED("Downloaded", "Files downloaded"),
BUILDING("Building", "Building..."), BUILDING("Building", "Building..."),