Skip to content

Commit

Permalink
Do not overwrite deposit status ref is set during transport. Only loo…
Browse files Browse the repository at this point in the history
…kup repository by repositoryKey
  • Loading branch information
markpatton committed Dec 16, 2024
1 parent d750107 commit 7f4b552
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,11 @@ static Function<Deposit, TransportResponse> performDeposit(DepositWorkerContext
try (TransportSession transportSession = transport.open(packagerConfig)) {
TransportResponse tr = transportSession.send(packageStream, packagerConfig, deposit);
deposit.setDepositStatus(DepositStatus.SUBMITTED);
deposit.setDepositStatusRef(packageStream.metadata().packageDepositStatusRef());

// Only set deposit status ref if not already set during transport
if (deposit.getDepositStatus() == null) {
deposit.setDepositStatusRef(packageStream.metadata().packageDepositStatusRef());
}
return tr;
} catch (Exception e) {
throw new RuntimeException("Error closing transport session for deposit " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,7 @@ private static boolean isSubmittedByUser(Submission submission) {
static Collection<String> getLookupKeys(Repository repo) {
final List<String> keys = new ArrayList<>();

ofNullable(repo.getName()).ifPresent(keys::add);
ofNullable(repo.getRepositoryKey()).ifPresent(keys::add);
ofNullable(repo.getId()).map(Object::toString).ifPresent(keys::add);

return keys;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ public TransportResponse send(PackageStream packageStream, Map<String, String> m

// Use the deposit status ref to mark that the workspace item was created
deposit.setDepositStatusRef(String.valueOf(workspaceItemId));

// TODO what about packageStream.metadata() package ref, it will overwrite?

passClient.updateObject(deposit);

LOG.debug("Created WorkspaceItem: {}", workspaceItemId);
Expand Down

0 comments on commit 7f4b552

Please sign in to comment.