Skip to content

Commit

Permalink
merge dataset after version create
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers committed Oct 9, 2024
1 parent 32d2188 commit 60919f5
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ public Dataset execute(CommandContext ctxt) throws CommandException {
} else {
logger.log(Level.WARNING, "Failed to lock the dataset (dataset id={0})", getDataset().getId());
}
// Now merge the dataset
theDataset = ctxt.em().merge(theDataset);
setDataset(theDataset);
logger.fine("Dataset merge done at: " + (System.currentTimeMillis() - startTime) + " ms");

DatasetVersion persistedVersion = clone;
/*
Expand All @@ -143,13 +139,21 @@ public Dataset execute(CommandContext ctxt) throws CommandException {
// Get or create (currently only when called with fmVarMet != null) a new edit
// version
DatasetVersion editVersion = theDataset.getOrCreateEditVersion(fmVarMet);


// Now merge the dataset
theDataset = ctxt.em().merge(theDataset);
setDataset(theDataset);
logger.fine("Dataset merge done at: " + (System.currentTimeMillis() - startTime) + " ms");

if (!latestVersion.isWorkingCopy()) {
logger.info("Edit Version had to be created");
if (!ctxt.em().contains(editVersion)) {
logger.info("Edit Version had to be merged");
editVersion = ctxt.em().merge(editVersion);
}
}

for (FileMetadata fmd : editVersion.getFileMetadatas()) {
if (!ctxt.em().contains(fmd)) {
logger.info("FMD " + fmd.getLabel() + " was not merged " + fmd.getId());
Expand Down

0 comments on commit 60919f5

Please sign in to comment.