AutorÃa | Ultima modificación | Ver Log |
package com.cesams.twogetskills.entity;import android.text.TextUtils;import androidx.room.ColumnInfo;import androidx.room.Entity;import androidx.room.Ignore;import androidx.room.PrimaryKey;import org.json.JSONException;import org.json.JSONObject;@Entity(tableName = "tb_progress" )public class Progress {@PrimaryKey(autoGenerate = true)@ColumnInfo(name="id")private long id;@ColumnInfo(name="company_uuid")private String companyUuid;@ColumnInfo(name="topic_uuid")private String topicUuid;@ColumnInfo(name="capsule_uuid")private String capsuleUuid;@ColumnInfo(name="slide_uuid")private String slideUuid;@ColumnInfo(name="user_uuid")private String userUuid;@ColumnInfo(name="progress")private double progress;@ColumnInfo(name="total_slides")private int totalSlides;@ColumnInfo(name="view_slides")private int viewSlides;@ColumnInfo(name="returning")private int returning;@ColumnInfo(name="returning_after_completed")private int returningAfterCompleted;@ColumnInfo(name="type")private String type;@ColumnInfo(name="completed")private int completed;@ColumnInfo(name="added_on")private String addedOn;@ColumnInfo(name="updated_on")private String updatedOn;public long getId() {return id;}public void setId(long id) {this.id = id;}public String getCompanyUuid() {return companyUuid;}public void setCompanyUuid(String companyUuid) {this.companyUuid = companyUuid;}public String getTopicUuid() {return topicUuid;}public void setTopicUuid(String topicUuid) {this.topicUuid = topicUuid;}public String getCapsuleUuid() {return capsuleUuid;}public void setCapsuleUuid(String capsuleUuid) {this.capsuleUuid = capsuleUuid;}public String getSlideUuid() {return slideUuid;}public void setSlideUuid(String slideUuid) {this.slideUuid = slideUuid;}public String getUserUuid() {return userUuid;}public void setUserUuid(String userUuid) {this.userUuid = userUuid;}public double getProgress() {return progress;}public void setProgress(double progress) {this.progress = progress;}public int getTotalSlides() {return totalSlides;}public void setTotalSlides(int totalSlides) {this.totalSlides = totalSlides;}public int getViewSlides() {return viewSlides;}public void setViewSlides(int viewSlides) {this.viewSlides = viewSlides;}public int getReturning() {return returning;}public void setReturning(int returning) {this.returning = returning;}public int getReturningAfterCompleted() {return returningAfterCompleted;}public void setReturningAfterCompleted(int returningAfterCompleted) {this.returningAfterCompleted = returningAfterCompleted;}public String getType() {return type;}public void setType(String type) {this.type = type;}public int getCompleted() {return completed;}public void setCompleted(int completed) {this.completed = completed;}public String getAddedOn() {return addedOn;}public void setAddedOn(String addedOn) {this.addedOn = addedOn;}public String getUpdatedOn() {return updatedOn;}public void setUpdatedOn(String updatedOn) {this.updatedOn = updatedOn;}public Progress(long id, String companyUuid, String topicUuid, String capsuleUuid,String slideUuid, String userUuid, double progress, int totalSlides,int viewSlides, int returning, int returningAfterCompleted,String type, int completed, String addedOn, String updatedOn){this.id = id;this.companyUuid = companyUuid;this.topicUuid = topicUuid;this.capsuleUuid = capsuleUuid;this.slideUuid = slideUuid;this.userUuid = userUuid;this.progress = progress;this.totalSlides = totalSlides;this.viewSlides = viewSlides;this.returning = returning;this.returningAfterCompleted = returningAfterCompleted;this.type = type;this.completed = completed;this.addedOn = addedOn;this.updatedOn = updatedOn;}@Ignorepublic Progress(){this.companyUuid = "";this.topicUuid = "";this.capsuleUuid = "";this.slideUuid = "";this.userUuid = "";this.progress = 0;this.totalSlides = 0;this.viewSlides = 0;this.returning = 0;this.returningAfterCompleted = 0;this.type = "";this.completed = 0;this.addedOn = "";this.updatedOn = "";}public JSONObject toJson() throws JSONException{JSONObject jsonObject = new JSONObject();jsonObject.put("user_uuid", userUuid);jsonObject.put("company_uuid", companyUuid);jsonObject.put("topic_uuid", topicUuid);jsonObject.put("capsule_uuid", capsuleUuid);jsonObject.put("slide_uuid", slideUuid);jsonObject.put("progress", progress);jsonObject.put("total_slides", totalSlides);jsonObject.put("view_slides", viewSlides);jsonObject.put("returning", returning);jsonObject.put("returning_after_completed", returningAfterCompleted);jsonObject.put("completed", completed);jsonObject.put("type", type);jsonObject.put("added_on", addedOn);if(TextUtils.isEmpty(updatedOn)) {jsonObject.put("updated_on", addedOn);} else {jsonObject.put("updated_on", updatedOn);}return jsonObject;}}