Search in sources :

Example 1 with TeamDAO

use of net.johnpwood.android.standuptimer.dao.TeamDAO in project standup-timer by jwood.

the class Team method delete.

public void delete(Context context) {
    TeamDAO dao = null;
    try {
        Meeting.deleteAllByTeam(this, context);
        dao = daoFactory.getTeamDAO(context);
        dao.delete(this);
    } finally {
        if (dao != null) {
            dao.close();
        }
    }
}
Also used : TeamDAO(net.johnpwood.android.standuptimer.dao.TeamDAO)

Example 2 with TeamDAO

use of net.johnpwood.android.standuptimer.dao.TeamDAO in project standup-timer by jwood.

the class Team method create.

public static Team create(String name, Context context) {
    TeamDAO dao = null;
    Team team = null;
    try {
        dao = daoFactory.getTeamDAO(context);
        team = dao.save(new Team(name));
    } catch (Exception e) {
        Logger.e(e.getMessage());
    } finally {
        dao.close();
    }
    return team;
}
Also used : TeamDAO(net.johnpwood.android.standuptimer.dao.TeamDAO)

Example 3 with TeamDAO

use of net.johnpwood.android.standuptimer.dao.TeamDAO in project standup-timer by jwood.

the class TeamDetailsTest method createTestData.

private void createTestData() {
    Context context = new RenamingDelegatingContext(getInstrumentation().getTargetContext(), "test_");
    TeamDAO teamFixturesDao = daoFactory.getTeamDAO(context);
    MeetingDAO meetingFixturesDao = daoFactory.getMeetingDAO(context);
    Team team = teamFixturesDao.save(new Team("Test Team"));
    meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 301, 343, 30, 65));
    meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 1, 6, 10, 17, 0).getTime(), 8, 534, 550, 32, 120));
    meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 1, 7, 10, 16, 0).getTime(), 2, 234, 300, 23, 122));
    meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 1, 8, 10, 14, 0).getTime(), 3, 765, 765, 15, 78));
    meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 1, 9, 10, 12, 0).getTime(), 9, 444, 445, 10, 93));
}
Also used : Context(android.content.Context) RenamingDelegatingContext(android.test.RenamingDelegatingContext) RenamingDelegatingContext(android.test.RenamingDelegatingContext) Meeting(net.johnpwood.android.standuptimer.model.Meeting) GregorianCalendar(java.util.GregorianCalendar) Team(net.johnpwood.android.standuptimer.model.Team) TeamDAO(net.johnpwood.android.standuptimer.dao.TeamDAO) MeetingDAO(net.johnpwood.android.standuptimer.dao.MeetingDAO)

Example 4 with TeamDAO

use of net.johnpwood.android.standuptimer.dao.TeamDAO in project standup-timer by jwood.

the class MeetingDetailsTest method createTestData.

private void createTestData() {
    Context context = new RenamingDelegatingContext(getInstrumentation().getTargetContext(), "test_");
    TeamDAO teamFixturesDao = daoFactory.getTeamDAO(context);
    MeetingDAO meetingFixturesDao = daoFactory.getMeetingDAO(context);
    Team team = teamFixturesDao.save(new Team("Test Team"));
    meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 0, 5, 10, 15, 0).getTime(), 5, 301, 343, 30, 65));
    meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 0, 6, 10, 17, 0).getTime(), 8, 534, 550, 32, 120));
    meetingToDelete = meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 0, 7, 10, 16, 0).getTime(), 2, 234, 300, 23, 122));
    meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 0, 8, 10, 14, 0).getTime(), 3, 765, 765, 15, 78));
    meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 0, 9, 10, 12, 0).getTime(), 9, 444, 445, 10, 93));
}
Also used : Context(android.content.Context) RenamingDelegatingContext(android.test.RenamingDelegatingContext) RenamingDelegatingContext(android.test.RenamingDelegatingContext) Meeting(net.johnpwood.android.standuptimer.model.Meeting) GregorianCalendar(java.util.GregorianCalendar) Team(net.johnpwood.android.standuptimer.model.Team) TeamDAO(net.johnpwood.android.standuptimer.dao.TeamDAO) MeetingDAO(net.johnpwood.android.standuptimer.dao.MeetingDAO)

Aggregations

TeamDAO (net.johnpwood.android.standuptimer.dao.TeamDAO)4 Context (android.content.Context)2 RenamingDelegatingContext (android.test.RenamingDelegatingContext)2 GregorianCalendar (java.util.GregorianCalendar)2 MeetingDAO (net.johnpwood.android.standuptimer.dao.MeetingDAO)2 Meeting (net.johnpwood.android.standuptimer.model.Meeting)2 Team (net.johnpwood.android.standuptimer.model.Team)2