1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
package it.niedermann.nextcloud.deck.model;
import androidx.room.Entity;
import androidx.room.ForeignKey;
import androidx.room.Ignore;
import androidx.room.Index;
import java.io.Serializable;
import java.util.Objects;
import it.niedermann.nextcloud.deck.model.interfaces.AbstractRemoteEntity;
@Entity(inheritSuperIndices = true,
indices = {
@Index(value = "uid", name = "user_uid")
},
foreignKeys = {
@ForeignKey(
entity = Account.class,
parentColumns = "id",
childColumns = "accountId", onDelete = ForeignKey.CASCADE
)
}
)
public class User extends AbstractRemoteEntity implements Serializable {
private String primaryKey;
private String uid;
private String displayname;
public User() {
super();
}
@Ignore
public User(String primaryKey, String uid, String displayname) {
this.primaryKey = primaryKey;
this.uid = uid;
this.displayname = displayname;
}
public User(User user) {
super(user);
this.primaryKey = user.getPrimaryKey();
this.uid = user.getUid();
this.displayname = user.getDisplayname();
}
public String getPrimaryKey() {
return primaryKey;
}
public void setPrimaryKey(String primaryKey) {
this.primaryKey = primaryKey;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getDisplayname() {
return displayname;
}
public void setDisplayname(String displayname) {
this.displayname = displayname;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
if (!Objects.equals(primaryKey, user.primaryKey))
return false;
if (!Objects.equals(uid, user.uid)) return false;
return Objects.equals(displayname, user.displayname);
}
@Override
public int hashCode() {
int result = primaryKey != null ? primaryKey.hashCode() : 0;
result = 31 * result + (uid != null ? uid.hashCode() : 0);
result = 31 * result + (displayname != null ? displayname.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "User{" +
"primaryKey='" + primaryKey + '\'' +
", uid='" + uid + '\'' +
", displayname='" + displayname + '\'' +
", localId=" + localId +
", accountId=" + accountId +
", id=" + id +
", status=" + status +
", lastModified=" + lastModified +
", lastModifiedLocal=" + lastModifiedLocal +
"} " + super.toString();
}
}
|