Cloud sync: account sync

This commit is contained in:
M66B
2023-01-18 11:04:23 +01:00
parent a026a6221e
commit f64983b929
6 changed files with 367 additions and 131 deletions

View File

@@ -422,55 +422,61 @@ public class EntityAccount extends EntityOrder implements Serializable {
public boolean equals(Object obj) {
if (obj instanceof EntityAccount) {
EntityAccount other = (EntityAccount) obj;
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) &&
this.insecure == other.insecure &&
this.port.equals(other.port) &&
this.auth_type.equals(other.auth_type) &&
this.user.equals(other.user) &&
this.password.equals(other.password) &&
Objects.equals(this.realm, other.realm) &&
Objects.equals(this.name, other.name) &&
Objects.equals(this.category, other.category) &&
Objects.equals(this.color, other.color) &&
Objects.equals(this.calendar, other.calendar) &&
this.synchronize.equals(other.synchronize) &&
this.primary.equals(other.primary) &&
this.notify.equals(other.notify) &&
this.browse.equals(other.browse) &&
this.leave_on_server.equals(other.leave_on_server) &&
this.leave_on_device.equals(other.leave_on_device) &&
Objects.equals(this.max_messages, other.max_messages) &&
this.auto_seen.equals(other.auto_seen) &&
Objects.equals(this.swipe_left, other.swipe_left) &&
Objects.equals(this.swipe_right, other.swipe_right) &&
this.poll_interval.equals(other.poll_interval) &&
this.partial_fetch == other.partial_fetch &&
this.ignore_size == other.ignore_size &&
this.use_date == other.use_date &&
this.use_received == other.use_received &&
this.unicode == other.unicode &&
Objects.equals(this.conditions, other.conditions) &&
Objects.equals(this.quota_usage, other.quota_usage) &&
Objects.equals(this.quota_limit, other.quota_limit) &&
Objects.equals(this.created, other.created) &&
Objects.equals(this.tbd, other.tbd) &&
Objects.equals(this.state, other.state) &&
Objects.equals(this.warning, other.warning) &&
Objects.equals(this.error, other.error) &&
Objects.equals(this.last_connected, other.last_connected) &&
Objects.equals(this.backoff_until, other.backoff_until) &&
Objects.equals(this.max_size, other.max_size) &&
Objects.equals(this.capabilities, other.capabilities) &&
Objects.equals(this.capability_idle, other.capability_idle) &&
Objects.equals(this.capability_utf8, other.capability_utf8));
return areEqual(this, other, true, true);
} else
return false;
}
public static boolean areEqual(EntityAccount a1, EntityAccount other, boolean auth, boolean state) {
return (Objects.equals(a1.uuid, other.uuid) &&
Objects.equals(a1.order, other.order) &&
a1.protocol.equals(other.protocol) &&
a1.host.equals(other.host) &&
a1.encryption.equals(other.encryption) &&
a1.insecure == other.insecure &&
a1.port.equals(other.port) &&
a1.auth_type.equals(other.auth_type) &&
Objects.equals(a1.provider, other.provider) &&
a1.user.equals(other.user) &&
(!auth || a1.password.equals(other.password)) &&
Objects.equals(a1.certificate_alias, other.certificate_alias) &&
Objects.equals(a1.realm, other.realm) &&
Objects.equals(a1.name, other.name) &&
Objects.equals(a1.category, other.category) &&
Objects.equals(a1.color, other.color) &&
Objects.equals(a1.calendar, other.calendar) &&
a1.synchronize.equals(other.synchronize) &&
a1.primary.equals(other.primary) &&
a1.notify.equals(other.notify) &&
a1.browse.equals(other.browse) &&
a1.leave_on_server.equals(other.leave_on_server) &&
a1.leave_on_device.equals(other.leave_on_device) &&
Objects.equals(a1.max_messages, other.max_messages) &&
a1.auto_seen.equals(other.auto_seen) &&
Objects.equals(a1.swipe_left, other.swipe_left) &&
Objects.equals(a1.swipe_right, other.swipe_right) &&
a1.poll_interval.equals(other.poll_interval) &&
a1.partial_fetch == other.partial_fetch &&
a1.ignore_size == other.ignore_size &&
a1.use_date == other.use_date &&
a1.use_received == other.use_received &&
a1.unicode == other.unicode &&
Objects.equals(a1.conditions, other.conditions) &&
(!state || Objects.equals(a1.quota_usage, other.quota_usage)) &&
(!state || Objects.equals(a1.quota_limit, other.quota_limit)) &&
(!state || Objects.equals(a1.created, other.created)) &&
Objects.equals(a1.tbd, other.tbd) &&
(!state || Objects.equals(a1.state, other.state)) &&
(!state || Objects.equals(a1.warning, other.warning)) &&
(!state || Objects.equals(a1.error, other.error)) &&
(!state || Objects.equals(a1.last_connected, other.last_connected)) &&
(!state || Objects.equals(a1.backoff_until, other.backoff_until)) &&
(!state || Objects.equals(a1.max_size, other.max_size)) &&
(!state || Objects.equals(a1.capabilities, other.capabilities)) &&
(!state || Objects.equals(a1.capability_idle, other.capability_idle)) &&
(!state || Objects.equals(a1.capability_utf8, other.capability_utf8)));
}
@Override
Comparator getComparator(final Context context) {
final Collator collator = Collator.getInstance(Locale.getDefault());