diff --git a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/snapshot/getdoc/GetDocResult.java b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/snapshot/getdoc/GetDocResult.java index 6b47a3985d..9ccdc4a6ec 100644 --- a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/snapshot/getdoc/GetDocResult.java +++ b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/snapshot/getdoc/GetDocResult.java @@ -19,6 +19,7 @@ public class GetDocResult extends Result { private int error; private int versionID; + private String migratedFromID; private String createdAt; private WLUser user; @@ -37,7 +38,8 @@ public class GetDocResult extends Result { int versionID, String createdAt, String email, - String name + String name, + String migratedFromID ) { if (error == null) { this.error = -1; @@ -47,6 +49,17 @@ public class GetDocResult extends Result { this.versionID = versionID; this.createdAt = createdAt; this.user = new WLUser(name, email); + this.migratedFromID = migratedFromID; + } + + public GetDocResult( + JsonElement error, + int versionID, + String createdAt, + String email, + String name + ) { + this(error, versionID, createdAt, email, name, null); } @Override @@ -59,6 +72,9 @@ public class GetDocResult extends Result { latestVerBy.addProperty("email", getEmail()); latestVerBy.addProperty("name", getName()); jsonThis.add("latestVerBy", latestVerBy); + if (migratedFromID != null) { + jsonThis.addProperty("migratedFromId", migratedFromID); + } } else { jsonThis.addProperty("status", error); String message; @@ -93,6 +109,11 @@ public class GetDocResult extends Result { } else { versionID = jsonObject.get("latestVerId").getAsInt(); createdAt = jsonObject.get("latestVerAt").getAsString(); + if (jsonObject.has("migratedFromId")) { + migratedFromID = jsonObject.get("migratedFromId").getAsString(); + } else { + migratedFromID = null; + } String name = null; String email = null; JsonElement latestVerBy = jsonObject.get("latestVerBy"); @@ -126,4 +147,6 @@ public class GetDocResult extends Result { return user.getEmail(); } + public String getMigratedFromID() { return migratedFromID; } + }