1 |
|
|
2 |
|
package pl.magot.vetch.ancal.database; |
3 |
|
|
4 |
|
|
5 |
|
import java.util.*; |
6 |
|
|
7 |
|
|
8 |
|
|
|
|
| 96,7% |
Uncovered Elements: 2 (60) |
Complexity: 20 |
Complexity Density: 0,56 |
|
9 |
|
public class DataRowTask extends DataRow |
10 |
|
{ |
11 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 0 |
Complexity Density: - |
|
12 |
|
public static class fid |
13 |
|
{ |
14 |
|
public static final int ID = 0; |
15 |
|
public static final int Subject = 1; |
16 |
|
public static final int Done = 2; |
17 |
|
public static final int Priority = 3; |
18 |
|
public static final int Alarm = 4; |
19 |
|
public static final int DueDate = 5; |
20 |
|
}; |
21 |
|
|
22 |
|
|
23 |
|
private final DataField[] TableDef = { |
24 |
|
new DataField(fid.ID, "_ID", DataField.Type.INT, true, true), |
25 |
|
new DataField(fid.Subject, "Subject", DataField.Type.TEXT, true, false), |
26 |
|
new DataField(fid.Done, "Done", DataField.Type.BOOL, true, false), |
27 |
|
new DataField(fid.Priority, "Priority", DataField.Type.INT, true, false), |
28 |
|
new DataField(fid.Alarm, "Alarm", DataField.Type.BOOL, true, false), |
29 |
|
new DataField(fid.DueDate, "DueDate", DataField.Type.INT, true, false), |
30 |
|
}; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
private String sSubject = ""; |
35 |
|
private boolean bDone = false; |
36 |
|
private int iPriority = 1; |
37 |
|
private boolean bAlarm = false; |
38 |
|
private Calendar calDueDate = Calendar.getInstance(); |
39 |
|
|
40 |
|
|
41 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
42 |
35
|
public DataRowTask(Database userdb)... |
43 |
|
{ |
44 |
35
|
super(userdb); |
45 |
35
|
SetTableDefinition(TableDef); |
46 |
|
} |
47 |
|
|
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
49 |
9
|
public void SetSubject(String value)... |
50 |
|
{ |
51 |
9
|
sSubject = new String(value.trim()); |
52 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
53 |
9
|
public void SetDone(boolean value)... |
54 |
|
{ |
55 |
9
|
bDone = value; |
56 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
9
|
public void SetPriority(long value)... |
58 |
|
{ |
59 |
9
|
iPriority = (int)value; |
60 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
61 |
9
|
public void SetAlarm(boolean value)... |
62 |
|
{ |
63 |
9
|
bAlarm = value; |
64 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0,4 |
|
65 |
9
|
public void SetDueDate(Calendar value)... |
66 |
|
{ |
67 |
9
|
if (value == null) |
68 |
|
{ |
69 |
4
|
calDueDate.setTimeInMillis(0); |
70 |
|
} else { |
71 |
5
|
calDueDate.setTimeInMillis(value.getTimeInMillis()); |
72 |
5
|
calDueDate.set(Calendar.SECOND, 0); |
73 |
5
|
calDueDate.set(Calendar.MILLISECOND, 0); |
74 |
|
} |
75 |
|
} |
76 |
|
|
77 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
78 |
9
|
public String GetSubject()... |
79 |
|
{ |
80 |
9
|
return sSubject; |
81 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
82 |
9
|
public boolean GetDone()... |
83 |
|
{ |
84 |
9
|
return bDone; |
85 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
86 |
9
|
public int GetPriority()... |
87 |
|
{ |
88 |
9
|
return iPriority; |
89 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
90 |
9
|
public boolean GetAlarm()... |
91 |
|
{ |
92 |
9
|
return bAlarm; |
93 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
94 |
11
|
public boolean UsingDueDate()... |
95 |
|
{ |
96 |
11
|
return (calDueDate.getTimeInMillis() > 0); |
97 |
|
} |
98 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
99 |
8
|
public Calendar GetDueDate()... |
100 |
|
{ |
101 |
8
|
return calDueDate; |
102 |
|
} |
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0,67 |
|
115 |
6
|
@Override... |
116 |
|
public boolean Validate() |
117 |
|
{ |
118 |
6
|
if (sSubject.length() > 0) |
119 |
|
{ |
120 |
6
|
return true; |
121 |
|
} |
122 |
0
|
return false; |
123 |
|
} |
124 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 2 |
Complexity Density: 0,25 |
|
125 |
6
|
@Override... |
126 |
|
public void SetValuesForDataRow() |
127 |
|
{ |
128 |
6
|
ClearContentValues(); |
129 |
|
|
130 |
6
|
Value(fid.Subject).set(GetSubject()); |
131 |
6
|
Value(fid.Done).set(GetDone()); |
132 |
6
|
Value(fid.Priority).set(GetPriority()); |
133 |
6
|
Value(fid.Alarm).set(GetAlarm()); |
134 |
|
|
135 |
6
|
Value(fid.DueDate).setNull(); |
136 |
6
|
if (UsingDueDate()) |
137 |
3
|
Value(fid.DueDate).set(GetDueDate()); |
138 |
|
} |
139 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0,29 |
|
140 |
3
|
@Override... |
141 |
|
public void GetValuesFromDataRow() |
142 |
|
{ |
143 |
3
|
SetSubject(Value(fid.Subject).asString()); |
144 |
3
|
SetDone(Value(fid.Done).asBoolean()); |
145 |
3
|
SetPriority(Value(fid.Priority).asLong()); |
146 |
3
|
SetAlarm(Value(fid.Alarm).asBoolean()); |
147 |
|
|
148 |
3
|
if (Value(fid.DueDate).isNull()) |
149 |
|
{ |
150 |
1
|
SetDueDate(null); |
151 |
|
} else { |
152 |
2
|
SetDueDate(Value(fid.DueDate).asCalendar()); |
153 |
|
} |
154 |
|
} |
155 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
156 |
51
|
@Override... |
157 |
|
public String GetTableName() |
158 |
|
{ |
159 |
51
|
return Database.sTableNameTasks; |
160 |
|
} |
161 |
|
|
162 |
|
} |