From 360d0adc2c7093a3ba31fb69878eb82b4c05c3b7 Mon Sep 17 00:00:00 2001 From: Florian Fritze Date: Mon, 11 Mar 2024 13:53:54 +0100 Subject: [PATCH] cleaned a little bit: don't isPidPrePublished --- .../edu/harvard/iq/dataverse/DatasetServiceBean.java | 4 ++-- .../engine/command/impl/ArchiveDatasetCommand.java | 2 +- .../command/impl/FinalizeDatasetArchiveCommand.java | 12 ------------ .../iq/dataverse/workflow/WorkflowServiceBean.java | 2 +- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/DatasetServiceBean.java index 806d4d21aa8..93c991c5e1b 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetServiceBean.java @@ -942,7 +942,7 @@ public void callFinalizePublishCommandAsynchronously(Long datasetId, CommandCont @Asynchronous @TransactionAttribute(TransactionAttributeType.SUPPORTS) - public void callFinalizeArchiveCommandAsynchronously(Long datasetId, CommandContext ctxt, DataverseRequest request, boolean isPidPrePublished) { + public void callFinalizeArchiveCommandAsynchronously(Long datasetId, CommandContext ctxt, DataverseRequest request) { // Since we are calling the next command asynchronously anyway - sleep here // for a few seconds, just in case, to make sure the database update of @@ -960,7 +960,7 @@ public void callFinalizeArchiveCommandAsynchronously(Long datasetId, CommandCont logger.fine("Running FinalizeDatasetPublicationCommand, asynchronously"); Dataset theDataset = find(datasetId); try { - commandEngine.submit(new FinalizeDatasetArchiveCommand(theDataset, request, isPidPrePublished)); + commandEngine.submit(new FinalizeDatasetArchiveCommand(theDataset, request)); } catch (CommandException cex) { logger.warning("CommandException caught when executing the asynchronous portion of the Dataset Publication Command."); } diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ArchiveDatasetCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ArchiveDatasetCommand.java index 34948694b34..3fb657da53c 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ArchiveDatasetCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ArchiveDatasetCommand.java @@ -232,7 +232,7 @@ public boolean onSuccess(CommandContext ctxt, Object r) { //A pre-publication workflow will call FinalizeDatasetPublicationCommand itself when it completes if (! prePubWf.isPresent() ) { logger.fine("From onSuccess, calling FinalizeArchiveCommand for dataset " + dataset.getGlobalId().asString()); - ctxt.datasets().callFinalizeArchiveCommandAsynchronously(dataset.getId(), ctxt, request, datasetExternallyReleased); + ctxt.datasets().callFinalizeArchiveCommandAsynchronously(dataset.getId(), ctxt, request); } return true; } diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/FinalizeDatasetArchiveCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/FinalizeDatasetArchiveCommand.java index e9d9d78869b..e16b1b4e946 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/FinalizeDatasetArchiveCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/FinalizeDatasetArchiveCommand.java @@ -52,21 +52,12 @@ public class FinalizeDatasetArchiveCommand extends AbstractPublishDatasetCommand - /** - * mirror field from {@link PublishDatasetCommand} of same name - */ - final boolean datasetExternallyReleased; - List dataversesToIndex = new ArrayList<>(); public static final String FILE_VALIDATION_ERROR = "FILE VALIDATION ERROR"; public FinalizeDatasetArchiveCommand(Dataset aDataset, DataverseRequest aRequest) { - this( aDataset, aRequest, false ); - } - public FinalizeDatasetArchiveCommand(Dataset aDataset, DataverseRequest aRequest, boolean isPidPrePublished) { super(aDataset, aRequest); - datasetExternallyReleased = isPidPrePublished; } @Override @@ -188,14 +179,11 @@ public Dataset execute(CommandContext ctxt) throws CommandException { if (theDataset.getLatestVersion().getVersionState() != LONGTERM_ARCHIVED) { // some imported datasets may already be released. - if (!datasetExternallyReleased) { - publicizeExternalIdentifier(theDataset, ctxt); // Will throw a CommandException, unless successful. // This will end the execution of the command, but the method // above takes proper care to "clean up after itself" in case of // a failure - it will remove any locks, and it will send a // proper notification to the user(s). - } theDataset.getLatestVersion().setVersionState(LONGTERM_ARCHIVED); } diff --git a/src/main/java/edu/harvard/iq/dataverse/workflow/WorkflowServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/workflow/WorkflowServiceBean.java index 67f30a607ff..7425a2c0f8b 100644 --- a/src/main/java/edu/harvard/iq/dataverse/workflow/WorkflowServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/workflow/WorkflowServiceBean.java @@ -430,7 +430,7 @@ private void workflowCompleted(Workflow wf, WorkflowContext ctxt) { //Refreshing merges the dataset ctxt = refresh(ctxt); //Then call Finalize - engine.submit(new FinalizeDatasetArchiveCommand(ctxt.getDataset(), ctxt.getRequest(), ctxt.getDatasetExternallyReleased())); + engine.submit(new FinalizeDatasetArchiveCommand(ctxt.getDataset(), ctxt.getRequest())); } else { logger.fine("Removing workflow lock"); unlockDataset(ctxt);