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
|
package it.niedermann.owncloud.notes.persistence.entity;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.room.Entity;
import androidx.room.ForeignKey;
import androidx.room.Ignore;
import androidx.room.Index;
import java.util.Objects;
import it.niedermann.owncloud.notes.widget.AbstractWidgetData;
@Entity(
foreignKeys = {
@ForeignKey(
entity = Account.class,
parentColumns = "id",
childColumns = "accountId",
onDelete = ForeignKey.CASCADE
)
},
indices = {
@Index(name = "IDX_NOTESLISTWIDGETDATA_ACCOUNTID", value = "accountId"),
@Index(name = "IDX_NOTESLISTWIDGETDATA_CATEGORY", value = "category"),
@Index(name = "IDX_NOTESLISTWIDGETDATA_ACCOUNT_CATEGORY", value = {"accountId", "category"})
}
)
public class NotesListWidgetData extends AbstractWidgetData {
@Ignore
public static final int MODE_DISPLAY_ALL = 0;
@Ignore
public static final int MODE_DISPLAY_STARRED = 1;
@Ignore
public static final int MODE_DISPLAY_CATEGORY = 2;
@IntRange(from = 0, to = 2)
private int mode;
@Nullable
private String category;
@Nullable
public String getCategory() {
return category;
}
public void setCategory(@Nullable String category) {
this.category = category;
}
public void setMode(@IntRange(from = 0, to = 2) int mode) {
this.mode = mode;
}
@IntRange(from = 0, to = 2)
public int getMode() {
return mode;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof NotesListWidgetData that)) return false;
if (!super.equals(o)) return false;
if (mode != that.mode) return false;
return Objects.equals(category, that.category);
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + mode;
result = 31 * result + (category != null ? category.hashCode() : 0);
return result;
}
@NonNull
@Override
public String toString() {
return "NotesListWidgetData{" +
"mode=" + mode +
", category='" + category + '\'' +
'}';
}
}
|