| 1 |
efrain |
1 |
package com.cesams.twogetskills.entity;
|
|
|
2 |
|
|
|
3 |
import android.text.TextUtils;
|
|
|
4 |
|
|
|
5 |
import androidx.room.ColumnInfo;
|
|
|
6 |
import androidx.room.Entity;
|
|
|
7 |
import androidx.room.Ignore;
|
|
|
8 |
import androidx.room.PrimaryKey;
|
|
|
9 |
|
|
|
10 |
import org.json.JSONException;
|
|
|
11 |
import org.json.JSONObject;
|
|
|
12 |
|
|
|
13 |
@Entity(tableName = "tb_progress" )
|
|
|
14 |
public class Progress {
|
|
|
15 |
|
|
|
16 |
@PrimaryKey(autoGenerate = true)
|
|
|
17 |
@ColumnInfo(name="id")
|
|
|
18 |
private long id;
|
|
|
19 |
|
|
|
20 |
@ColumnInfo(name="company_uuid")
|
|
|
21 |
private String companyUuid;
|
|
|
22 |
|
|
|
23 |
@ColumnInfo(name="topic_uuid")
|
|
|
24 |
private String topicUuid;
|
|
|
25 |
|
|
|
26 |
@ColumnInfo(name="capsule_uuid")
|
|
|
27 |
private String capsuleUuid;
|
|
|
28 |
|
|
|
29 |
@ColumnInfo(name="slide_uuid")
|
|
|
30 |
private String slideUuid;
|
|
|
31 |
|
|
|
32 |
@ColumnInfo(name="user_uuid")
|
|
|
33 |
private String userUuid;
|
|
|
34 |
|
|
|
35 |
@ColumnInfo(name="progress")
|
|
|
36 |
private double progress;
|
|
|
37 |
|
|
|
38 |
@ColumnInfo(name="total_slides")
|
|
|
39 |
private int totalSlides;
|
|
|
40 |
|
|
|
41 |
@ColumnInfo(name="view_slides")
|
|
|
42 |
private int viewSlides;
|
|
|
43 |
|
|
|
44 |
@ColumnInfo(name="returning")
|
|
|
45 |
private int returning;
|
|
|
46 |
|
|
|
47 |
@ColumnInfo(name="returning_after_completed")
|
|
|
48 |
private int returningAfterCompleted;
|
|
|
49 |
|
|
|
50 |
@ColumnInfo(name="type")
|
|
|
51 |
private String type;
|
|
|
52 |
|
|
|
53 |
@ColumnInfo(name="completed")
|
|
|
54 |
private int completed;
|
|
|
55 |
|
|
|
56 |
@ColumnInfo(name="added_on")
|
|
|
57 |
private String addedOn;
|
|
|
58 |
|
|
|
59 |
@ColumnInfo(name="updated_on")
|
|
|
60 |
private String updatedOn;
|
|
|
61 |
|
|
|
62 |
public long getId() {
|
|
|
63 |
return id;
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
public void setId(long id) {
|
|
|
67 |
this.id = id;
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
public String getCompanyUuid() {
|
|
|
71 |
return companyUuid;
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
public void setCompanyUuid(String companyUuid) {
|
|
|
75 |
this.companyUuid = companyUuid;
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
public String getTopicUuid() {
|
|
|
79 |
return topicUuid;
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
public void setTopicUuid(String topicUuid) {
|
|
|
83 |
this.topicUuid = topicUuid;
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
public String getCapsuleUuid() {
|
|
|
87 |
return capsuleUuid;
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
public void setCapsuleUuid(String capsuleUuid) {
|
|
|
91 |
this.capsuleUuid = capsuleUuid;
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
public String getSlideUuid() {
|
|
|
95 |
return slideUuid;
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
public void setSlideUuid(String slideUuid) {
|
|
|
99 |
this.slideUuid = slideUuid;
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
public String getUserUuid() {
|
|
|
103 |
return userUuid;
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
public void setUserUuid(String userUuid) {
|
|
|
107 |
this.userUuid = userUuid;
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
public double getProgress() {
|
|
|
111 |
return progress;
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
public void setProgress(double progress) {
|
|
|
115 |
this.progress = progress;
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
public int getTotalSlides() {
|
|
|
119 |
return totalSlides;
|
|
|
120 |
}
|
|
|
121 |
|
|
|
122 |
public void setTotalSlides(int totalSlides) {
|
|
|
123 |
this.totalSlides = totalSlides;
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
public int getViewSlides() {
|
|
|
127 |
return viewSlides;
|
|
|
128 |
}
|
|
|
129 |
|
|
|
130 |
public void setViewSlides(int viewSlides) {
|
|
|
131 |
this.viewSlides = viewSlides;
|
|
|
132 |
}
|
|
|
133 |
|
|
|
134 |
public int getReturning() {
|
|
|
135 |
return returning;
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
public void setReturning(int returning) {
|
|
|
139 |
this.returning = returning;
|
|
|
140 |
}
|
|
|
141 |
|
|
|
142 |
public int getReturningAfterCompleted() {
|
|
|
143 |
return returningAfterCompleted;
|
|
|
144 |
}
|
|
|
145 |
|
|
|
146 |
public void setReturningAfterCompleted(int returningAfterCompleted) {
|
|
|
147 |
this.returningAfterCompleted = returningAfterCompleted;
|
|
|
148 |
}
|
|
|
149 |
|
|
|
150 |
public String getType() {
|
|
|
151 |
return type;
|
|
|
152 |
}
|
|
|
153 |
|
|
|
154 |
public void setType(String type) {
|
|
|
155 |
this.type = type;
|
|
|
156 |
}
|
|
|
157 |
|
|
|
158 |
public int getCompleted() {
|
|
|
159 |
return completed;
|
|
|
160 |
}
|
|
|
161 |
|
|
|
162 |
public void setCompleted(int completed) {
|
|
|
163 |
this.completed = completed;
|
|
|
164 |
}
|
|
|
165 |
|
|
|
166 |
public String getAddedOn() {
|
|
|
167 |
return addedOn;
|
|
|
168 |
}
|
|
|
169 |
|
|
|
170 |
public void setAddedOn(String addedOn) {
|
|
|
171 |
this.addedOn = addedOn;
|
|
|
172 |
}
|
|
|
173 |
|
|
|
174 |
public String getUpdatedOn() {
|
|
|
175 |
return updatedOn;
|
|
|
176 |
}
|
|
|
177 |
|
|
|
178 |
public void setUpdatedOn(String updatedOn) {
|
|
|
179 |
this.updatedOn = updatedOn;
|
|
|
180 |
}
|
|
|
181 |
|
|
|
182 |
public Progress(long id, String companyUuid, String topicUuid, String capsuleUuid,
|
|
|
183 |
String slideUuid, String userUuid, double progress, int totalSlides,
|
|
|
184 |
int viewSlides, int returning, int returningAfterCompleted,
|
|
|
185 |
String type, int completed, String addedOn, String updatedOn)
|
|
|
186 |
{
|
|
|
187 |
this.id = id;
|
|
|
188 |
this.companyUuid = companyUuid;
|
|
|
189 |
this.topicUuid = topicUuid;
|
|
|
190 |
this.capsuleUuid = capsuleUuid;
|
|
|
191 |
this.slideUuid = slideUuid;
|
|
|
192 |
this.userUuid = userUuid;
|
|
|
193 |
this.progress = progress;
|
|
|
194 |
this.totalSlides = totalSlides;
|
|
|
195 |
this.viewSlides = viewSlides;
|
|
|
196 |
this.returning = returning;
|
|
|
197 |
this.returningAfterCompleted = returningAfterCompleted;
|
|
|
198 |
this.type = type;
|
|
|
199 |
this.completed = completed;
|
|
|
200 |
this.addedOn = addedOn;
|
|
|
201 |
this.updatedOn = updatedOn;
|
|
|
202 |
|
|
|
203 |
}
|
|
|
204 |
|
|
|
205 |
@Ignore
|
|
|
206 |
public Progress()
|
|
|
207 |
{
|
|
|
208 |
this.companyUuid = "";
|
|
|
209 |
this.topicUuid = "";
|
|
|
210 |
this.capsuleUuid = "";
|
|
|
211 |
this.slideUuid = "";
|
|
|
212 |
this.userUuid = "";
|
|
|
213 |
this.progress = 0;
|
|
|
214 |
this.totalSlides = 0;
|
|
|
215 |
this.viewSlides = 0;
|
|
|
216 |
this.returning = 0;
|
|
|
217 |
this.returningAfterCompleted = 0;
|
|
|
218 |
this.type = "";
|
|
|
219 |
this.completed = 0;
|
|
|
220 |
this.addedOn = "";
|
|
|
221 |
this.updatedOn = "";
|
|
|
222 |
|
|
|
223 |
}
|
|
|
224 |
|
|
|
225 |
|
|
|
226 |
public JSONObject toJson() throws JSONException
|
|
|
227 |
{
|
|
|
228 |
JSONObject jsonObject = new JSONObject();
|
|
|
229 |
jsonObject.put("user_uuid", userUuid);
|
|
|
230 |
jsonObject.put("company_uuid", companyUuid);
|
|
|
231 |
jsonObject.put("topic_uuid", topicUuid);
|
|
|
232 |
jsonObject.put("capsule_uuid", capsuleUuid);
|
|
|
233 |
jsonObject.put("slide_uuid", slideUuid);
|
|
|
234 |
jsonObject.put("progress", progress);
|
|
|
235 |
jsonObject.put("total_slides", totalSlides);
|
|
|
236 |
jsonObject.put("view_slides", viewSlides);
|
|
|
237 |
jsonObject.put("returning", returning);
|
|
|
238 |
jsonObject.put("returning_after_completed", returningAfterCompleted);
|
|
|
239 |
jsonObject.put("completed", completed);
|
|
|
240 |
jsonObject.put("type", type);
|
|
|
241 |
jsonObject.put("added_on", addedOn);
|
|
|
242 |
|
|
|
243 |
if(TextUtils.isEmpty(updatedOn)) {
|
|
|
244 |
jsonObject.put("updated_on", addedOn);
|
|
|
245 |
} else {
|
|
|
246 |
jsonObject.put("updated_on", updatedOn);
|
|
|
247 |
}
|
|
|
248 |
|
|
|
249 |
return jsonObject;
|
|
|
250 |
}
|
|
|
251 |
|
|
|
252 |
}
|