Skip to content

Commit

Permalink
check for existing datasetversion id when updating with parsed json (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ekraffmiller committed Mar 5, 2015
1 parent 3eb3c8d commit 9c25094
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,12 @@ public DatasetVersion parseDatasetVersion(JsonObject obj, DatasetVersion dsv) th
dsv.setDeaccessionLink(obj.getString("deaccessionLink", null));
dsv.setVersionNumber((long) obj.getInt("versionNumber", -1));
dsv.setMinorVersionNumber(parseLong(obj.getString("minorVersionNumber", null)));
dsv.setId(parseLong(obj.getString("id", null)));

// if the existing datasetversion doesn not have an id
// use the id from the json object.
if (dsv.getId()==null) {
dsv.setId(parseLong(obj.getString("id", null)));
}

String versionStateStr = obj.getString("versionState", null);
if (versionStateStr != null) {
dsv.setVersionState(DatasetVersion.VersionState.valueOf(versionStateStr));
Expand Down

0 comments on commit 9c25094

Please sign in to comment.