private static ContentValues getContentValues_goal(Goal goal) { ContentValues values = new ContentValues(); values.put(Schema.GoalTable.Cols.STATUS, goal.getStatus().toString()); values.put(Schema.GoalTable.Cols.PROGRESS, goal.getProgress()); values.put(Schema.GoalTable.Cols.NAME, goal.getName()); return values; }
// returns the current status of the goal of given name public GoalStatus checkStatus(String name) { GoalStatus status = null; try (DatabaseCursorWrapper wrapper = queryGoal("NAME=?", new String[] {name})) { wrapper.moveToFirst(); while (!wrapper.isAfterLast()) { Goal goal = wrapper.getGoal(); status = goal.getStatus(); wrapper.moveToNext(); } } return status; }