Skip to content

Commit

Permalink
Prov: Save context cases added #4343
Browse files Browse the repository at this point in the history
Fixes a bug where:
- User uploads DataFile and saves it
- User goes to editDatafilePage after save and uploads prov/sets entity.
- Entity is not saved because editDatafilePage did not think it needed to save the context.

Logic was added to save context if the page wasn't saved otherwise.
  • Loading branch information
matthew-a-dunlap committed May 1, 2018
1 parent 730bb8d commit 891f6f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -1263,11 +1263,11 @@ public String save() {

workingVersion = dataset.getEditVersion();
logger.fine("working version id: "+workingVersion.getId());

if(systemConfig.isProvCollectionEnabled()) {
try {
provPopupFragmentBean.saveStagedProvJson(false);

//If datasetUpdateRequired did not trigger save the prov code will need to save its staged changes.
provPopupFragmentBean.saveStagedProvJson(!datasetUpdateRequired);
} catch (AbstractApiBean.WrappedResponse ex) {
JsfHelper.addErrorMessage(getBundleString("file.metadataTab.provenance.error"));
Logger.getLogger(EditDatafilesPage.class.getName()).log(Level.SEVERE, null, ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public void saveStagedProvJson(boolean saveContext) throws AbstractApiBean.Wrapp
df = execCommand(new PersistProvJsonCommand(dvRequestService.getDataverseRequest(), df, provString, df.getProvEntityName(), saveContext));
}
mapEntry.dataFile = df;
provenanceUpdates.put(mapEntry.dataFile.getChecksumValue(), mapEntry); //MAD: Modifying the set as we go through it is probably causing errors
provenanceUpdates.put(mapEntry.dataFile.getChecksumValue(), mapEntry); //Updates the datafile to the latest.
}
}

Expand Down

0 comments on commit 891f6f9

Please sign in to comment.