blob: 98c0ee69125da840ae4863705e293e365b858939 (
plain)
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
|
package it.niedermann.nextcloud.deck.model;
import androidx.annotation.NonNull;
import androidx.room.Entity;
import androidx.room.ForeignKey;
import androidx.room.Index;
import it.niedermann.nextcloud.deck.model.interfaces.AbstractJoinEntity;
@Entity(
primaryKeys = {"userId", "cardId"},
indices = {@Index("cardId"), @Index("userId")},
foreignKeys = {
@ForeignKey(entity = User.class,
parentColumns = "localId",
childColumns = "userId", onDelete = ForeignKey.CASCADE),
@ForeignKey(entity = Card.class,
parentColumns = "localId",
childColumns = "cardId", onDelete = ForeignKey.CASCADE)
})
public class JoinCardWithUser extends AbstractJoinEntity {
@NonNull
private Long userId;
@NonNull
private Long cardId;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getCardId() {
return cardId;
}
public void setCardId(Long cardId) {
this.cardId = cardId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
JoinCardWithUser that = (JoinCardWithUser) o;
if (!userId.equals(that.userId)) return false;
return cardId.equals(that.cardId);
}
@Override
public int hashCode() {
int result = userId.hashCode();
result = 31 * result + cardId.hashCode();
return result;
}
}
|