Search in sources :

Example 1 with Meeting

use of com.marshalchen.common.usefulModule.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);
}
Also used : ContentValues(android.content.ContentValues) Meeting(com.marshalchen.common.usefulModule.standuptimer.model.Meeting)

Example 2 with Meeting

use of com.marshalchen.common.usefulModule.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;
}
Also used : Meeting(com.marshalchen.common.usefulModule.standuptimer.model.Meeting) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) Cursor(android.database.Cursor) Date(java.util.Date)

Example 3 with Meeting

use of com.marshalchen.common.usefulModule.standuptimer.model.Meeting in project UltimateAndroid by cymcsg.

the class TeamDetails method createMeetingListAdapter.

private ArrayAdapter<String> createMeetingListAdapter() {
    List<String> meetingDescriptions = new ArrayList<String>();
    if (team != null) {
        List<Meeting> meetings = team.findAllMeetings(TeamDetails.this);
        for (Meeting meeting : meetings) {
            meetingDescriptions.add(meeting.getDescription());
        }
    }
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(TeamDetails.this, android.R.layout.simple_list_item_1, meetingDescriptions);
    return adapter;
}
Also used : Meeting(com.marshalchen.common.usefulModule.standuptimer.model.Meeting) ArrayList(java.util.ArrayList)

Example 4 with Meeting

use of com.marshalchen.common.usefulModule.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;
}
Also used : Meeting(com.marshalchen.common.usefulModule.standuptimer.model.Meeting) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) Cursor(android.database.Cursor)

Example 5 with Meeting

use of com.marshalchen.common.usefulModule.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;
}
Also used : Meeting(com.marshalchen.common.usefulModule.standuptimer.model.Meeting) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) ArrayList(java.util.ArrayList) Cursor(android.database.Cursor)

Aggregations

Meeting (com.marshalchen.common.usefulModule.standuptimer.model.Meeting)8 Date (java.util.Date)4 Cursor (android.database.Cursor)3 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)3 ArrayList (java.util.ArrayList)2 ContentValues (android.content.ContentValues)1 Team (com.marshalchen.common.usefulModule.standuptimer.model.Team)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1