Add migratedFromID property to GetDocResult

This commit is contained in:
Shane Kilkelly 2018-11-22 12:01:28 +00:00
parent 859a4b03b3
commit 19075f18bc

View file

@ -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; }
}