Skip to content

Commit

Permalink
cleaned a little bit: don't isPidPrePublished
Browse files Browse the repository at this point in the history
  • Loading branch information
ffritze committed Mar 11, 2024
1 parent 215af54 commit 360d0ad
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,12 @@ public class FinalizeDatasetArchiveCommand extends AbstractPublishDatasetCommand



/**
* mirror field from {@link PublishDatasetCommand} of same name
*/
final boolean datasetExternallyReleased;

List<Dataverse> 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
Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 360d0ad

Please sign in to comment.