package de.mygrades.database.dao;

// THIS CODE IS GENERATED BY greenDAO, EDIT ONLY INSIDE THE "KEEP"-SECTIONS

// KEEP INCLUDES - put your custom includes here
// KEEP INCLUDES END
/**
 * Entity mapped to table "GRADE_ENTRY".
 */
public class GradeEntry {

    /** Not-null value. */
    private String name;
    private Double grade;
    private String examId;
    private String semester;
    private String state;
    private Double creditPoints;
    private String annotation;
    private String attempt;
    private String examDate;
    private Integer semesterNumber;
    private String hash;

    // KEEP FIELDS - put your custom fields here
    // KEEP FIELDS END

    public GradeEntry() {
    }

    public GradeEntry(String hash) {
        this.hash = hash;
    }

    public GradeEntry(String name, Double grade, String examId, String semester, String state, Double creditPoints, String annotation, String attempt, String examDate, Integer semesterNumber, String hash) {
        this.name = name;
        this.grade = grade;
        this.examId = examId;
        this.semester = semester;
        this.state = state;
        this.creditPoints = creditPoints;
        this.annotation = annotation;
        this.attempt = attempt;
        this.examDate = examDate;
        this.semesterNumber = semesterNumber;
        this.hash = hash;
    }

    /** Not-null value. */
    public String getName() {
        return name;
    }

    /** Not-null value; ensure this value is available before it is saved to the database. */
    public void setName(String name) {
        this.name = name;
    }

    public Double getGrade() {
        return grade;
    }

    public void setGrade(Double grade) {
        this.grade = grade;
    }

    public String getExamId() {
        return examId;
    }

    public void setExamId(String examId) {
        this.examId = examId;
    }

    public String getSemester() {
        return semester;
    }

    public void setSemester(String semester) {
        this.semester = semester;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public Double getCreditPoints() {
        return creditPoints;
    }

    public void setCreditPoints(Double creditPoints) {
        this.creditPoints = creditPoints;
    }

    public String getAnnotation() {
        return annotation;
    }

    public void setAnnotation(String annotation) {
        this.annotation = annotation;
    }

    public String getAttempt() {
        return attempt;
    }

    public void setAttempt(String attempt) {
        this.attempt = attempt;
    }

    public String getExamDate() {
        return examDate;
    }

    public void setExamDate(String examDate) {
        this.examDate = examDate;
    }

    public Integer getSemesterNumber() {
        return semesterNumber;
    }

    public void setSemesterNumber(Integer semesterNumber) {
        this.semesterNumber = semesterNumber;
    }

    public String getHash() {
        return hash;
    }

    public void setHash(String hash) {
        this.hash = hash;
    }

    // KEEP METHODS - put your custom methods here

    /**
     * The hash is used as the primary key.
     */
    public void updateHash() {
        this.hash = (examId == null ? "" : examId) +
                    (semester == null ? "" : semester) +
                    name;
    }

    @Override
    public String toString() {
        return "GradeEntry{" +
                "name='" + name + '\'' +
                ", grade=" + grade +
                ", examId='" + examId + '\'' +
                ", semester='" + semester + '\'' +
                ", state='" + state + '\'' +
                ", creditPoints=" + creditPoints +
                ", annotation='" + annotation + '\'' +
                ", attempt='" + attempt + '\'' +
                ", examDate='" + examDate + '\'' +
                ", semesterNumber=" + semesterNumber +
                ", hash='" + hash + '\'' +
                '}';
    }

    // KEEP METHODS END

}

@@ -175,16 +175,92 @@
 DES END%0A
+%0Aimport android.util.Base64;%0A%0Aimport java.io.UnsupportedEncodingException;%0A%0A
 /**%0A * E
@@ -3358,29 +3358,24 @@
 ) %7B%0A        
-this.
 hash = (exam
@@ -3398,29 +3398,24 @@
 : examId) +%0A
-     
             
@@ -3473,18 +3473,246 @@
     
-     
 name;
+%0A%0A        try %7B%0A            byte%5B%5D data = hash.getBytes(%22UTF-8%22);%0A            hash = Base64.encodeToString(data, Base64.DEFAULT);%0A        %7D catch (UnsupportedEncodingException e) %7B%0A            // ignore, normal hash is used%0A        %7D
 %0A   

Use base64 strings for grade_entry hashes