use of com.marshalchen.common.uimodule.standuptimer.model.Meeting in project UltimateAndroid by cymcsg.
the class MeetingDAO method findAllByTeam.
public List<Meeting> findAllByTeam(Team team) {
List<Meeting> meetings = new ArrayList<Meeting>();
Cursor cursor = null;
try {
SQLiteDatabase db = getReadableDatabase();
cursor = db.query(MEETINGS_TABLE_NAME, MEETINGS_ALL_COLUMS, MEETINGS_TEAM_NAME + " = ?", new String[] { team.getName() }, null, null, MEETINGS_MEETING_TIME);
while (cursor.moveToNext()) {
meetings.add(createMeetingFromCursorData(cursor));
}
} finally {
closeCursor(cursor);
}
Logger.d("Found " + meetings.size() + " meetings");
Collections.reverse(meetings);
return meetings;
}
use of com.marshalchen.common.uimodule.standuptimer.model.Meeting in project UltimateAndroid by cymcsg.
the class MeetingDAO method findById.
public Meeting findById(Long id) {
Cursor cursor = null;
Meeting meeting = null;
try {
SQLiteDatabase db = getReadableDatabase();
cursor = db.query(MEETINGS_TABLE_NAME, MEETINGS_ALL_COLUMS, _ID + " = ?", new String[] { id.toString() }, null, null, null);
if (cursor.getCount() == 1) {
if (cursor.moveToFirst()) {
meeting = createMeetingFromCursorData(cursor);
}
}
} finally {
closeCursor(cursor);
}
return meeting;
}
use of com.marshalchen.common.uimodule.standuptimer.model.Meeting in project UltimateAndroid by cymcsg.
the class MeetingDAO method createNewMeeting.
private Meeting createNewMeeting(SQLiteDatabase db, Meeting meeting) {
Logger.d("Creating new meeting for " + meeting.getTeam().getName() + " with a date/time of '" + meeting.getDateTime() + "'");
ContentValues values = createContentValues(meeting);
long id = db.insertOrThrow(MEETINGS_TABLE_NAME, null, values);
return new Meeting(id, meeting);
}
use of com.marshalchen.common.uimodule.standuptimer.model.Meeting in project UltimateAndroid by cymcsg.
the class MeetingDAO method createMeetingFromCursorData.
private Meeting createMeetingFromCursorData(Cursor cursor) {
long id = cursor.getLong(0);
String teamName = cursor.getString(1);
Date meetingTime = new Date(cursor.getLong(2));
int numParticipants = cursor.getInt(3);
int individualStatusLength = cursor.getInt(4);
int meetingLength = cursor.getInt(5);
int quickestStatus = cursor.getInt(6);
int longestStatus = cursor.getInt(7);
return new Meeting(id, new Team(teamName), meetingTime, numParticipants, individualStatusLength, meetingLength, quickestStatus, longestStatus);
}
use of com.marshalchen.common.uimodule.standuptimer.model.Meeting in project UltimateAndroid by cymcsg.
the class MeetingDAO method findByTeamAndDate.
public Meeting findByTeamAndDate(Team team, Date date) {
Cursor cursor = null;
Meeting meeting = null;
try {
long startTime = date.getTime();
Date endDate = new Date(date.getTime());
endDate.setSeconds(endDate.getSeconds() + 1);
long endTime = endDate.getTime();
SQLiteDatabase db = getReadableDatabase();
cursor = db.query(MEETINGS_TABLE_NAME, MEETINGS_ALL_COLUMS, MEETINGS_TEAM_NAME + " = ? and " + MEETINGS_MEETING_TIME + " >= ? and " + MEETINGS_MEETING_TIME + " < ?", new String[] { team.getName(), Long.toString(startTime), Long.toString(endTime) }, null, null, null);
if (cursor.getCount() == 1) {
if (cursor.moveToFirst()) {
meeting = createMeetingFromCursorData(cursor);
}
}
} finally {
closeCursor(cursor);
}
return meeting;
}
Aggregations