@@ -0,0 +1,3070 @@
+package com.satsumasoftware.timetable.db;%0A%0Aimport android.content.ContentValues;%0Aimport android.content.Context;%0Aimport android.database.Cursor;%0Aimport android.database.sqlite.SQLiteDatabase;%0Aimport android.util.Log;%0A%0Aimport com.satsumasoftware.timetable.framework.Assignment;%0A%0Aimport java.util.ArrayList;%0A%0Apublic final class AssignmentsUtils %7B%0A%0A    private static final String LOG_TAG = %22AssignmentsUtils%22;%0A%0A    public static ArrayList%3CAssignment%3E getAssignments(Context context) %7B%0A        ArrayList%3CAssignment%3E assignments = new ArrayList%3C%3E();%0A        TimetableDbHelper dbHelper = TimetableDbHelper.getInstance(context);%0A        Cursor cursor = dbHelper.getReadableDatabase().query(%0A                AssignmentsSchema.TABLE_NAME, null, null, null, null, null, null);%0A        cursor.moveToFirst();%0A        while (!cursor.isAfterLast()) %7B%0A            assignments.add(new Assignment(cursor));%0A            cursor.moveToNext();%0A        %7D%0A        cursor.close();%0A        return assignments;%0A    %7D%0A%0A    public static void addAssignment(Context context, Assignment assignment) %7B%0A        ContentValues values = new ContentValues();%0A        values.put(AssignmentsSchema._ID, assignment.getId());%0A        values.put(AssignmentsSchema.COL_CLASS_ID, assignment.getClassId());%0A        values.put(AssignmentsSchema.COL_TITLE, assignment.getTitle());%0A        values.put(AssignmentsSchema.COL_DETAIL, assignment.getDetail());%0A        values.put(AssignmentsSchema.COL_DUE_DATE_DAY_OF_MONTH, assignment.getDueDate().getDayOfMonth());%0A        values.put(AssignmentsSchema.COL_DUE_DATE_MONTH, assignment.getDueDate().getMonthValue());%0A        values.put(AssignmentsSchema.COL_DUE_DATE_YEAR, assignment.getDueDate().getYear());%0A        values.put(AssignmentsSchema.COL_COMPLETION_PROGRESS, assignment.getCompletionProgress());%0A%0A        SQLiteDatabase db = TimetableDbHelper.getInstance(context).getWritableDatabase();%0A        db.insert(AssignmentsSchema.TABLE_NAME, null, values);%0A        Log.i(LOG_TAG, %22Added Assignment with id %22 + assignment.getId());%0A    %7D%0A%0A    public static void deleteAssignment(Context context, int assignmentId) %7B%0A        SQLiteDatabase db = TimetableDbHelper.getInstance(context).getWritableDatabase();%0A        db.delete(AssignmentsSchema.TABLE_NAME,%0A                AssignmentsSchema._ID + %22=?%22,%0A                new String%5B%5D %7BString.valueOf(assignmentId)%7D);%0A        Log.i(LOG_TAG, %22Deleted Assignment with id %22 + assignmentId);%0A    %7D%0A%0A    public static void replaceAssignment(Context context, int oldAssignmentId, Assignment newAssignment) %7B%0A        Log.i(LOG_TAG, %22Replacing Assignment...%22);%0A        deleteAssignment(context, oldAssignmentId);%0A        addAssignment(context, newAssignment);%0A    %7D%0A%0A    public static int getHighestAssignmentId(Context context) %7B%0A        SQLiteDatabase db = TimetableDbHelper.getInstance(context).getReadableDatabase();%0A        Cursor cursor = db.query(%0A                AssignmentsSchema.TABLE_NAME, null, null, null, null, null, null);%0A        int count = cursor.getCount();%0A        cursor.close();%0A        return count;%0A    %7D%0A%0A%7D%0A

Create a db utils class for assignments