Added account UUID

This commit is contained in:
M66B
2021-07-29 18:59:05 +02:00
parent 134071850a
commit 9fbb996e69
5 changed files with 2548 additions and 3 deletions

View File

@@ -42,6 +42,7 @@ import java.text.Collator;
import java.util.Comparator;
import java.util.Locale;
import java.util.Objects;
import java.util.UUID;
@Entity(
tableName = EntityAccount.TABLE_NAME,
@@ -62,6 +63,9 @@ public class EntityAccount extends EntityOrder implements Serializable {
@PrimaryKey(autoGenerate = true)
public Long id;
@NonNull
public String uuid = UUID.randomUUID().toString();
@NonNull
@ColumnInfo(name = "pop")
public Integer protocol = TYPE_IMAP;
@@ -221,6 +225,7 @@ public class EntityAccount extends EntityOrder implements Serializable {
public JSONObject toJSON() throws JSONException {
JSONObject json = new JSONObject();
json.put("id", id);
json.put("uuid", uuid);
json.put("order", order);
json.put("protocol", protocol);
json.put("host", host);
@@ -276,6 +281,9 @@ public class EntityAccount extends EntityOrder implements Serializable {
if (json.has("id"))
account.id = json.getLong("id");
if (json.has("uuid"))
account.uuid = json.getString("uuid");
if (json.has("order"))
account.order = json.getInt("order");
@@ -352,7 +360,8 @@ public class EntityAccount extends EntityOrder implements Serializable {
public boolean equals(Object obj) {
if (obj instanceof EntityAccount) {
EntityAccount other = (EntityAccount) obj;
return (Objects.equals(this.order, other.order) &&
return (Objects.equals(this.uuid, other.uuid) &&
Objects.equals(this.order, other.order) &&
this.protocol.equals(other.protocol) &&
this.host.equals(other.host) &&
this.encryption.equals(other.encryption) &&