Search in sources :

Example 26 with RealmList

use of io.realm.RealmList in project app by TourLive.

the class RaceGroupRepository method getAllRaceGroups.

@Override
public void getAllRaceGroups(OnGetAllRaceGroupsCallback callback) {
    Realm realm = Realm.getInstance(RadioTourApplication.getInstance());
    RealmResults<RaceGroup> results = realm.where(RaceGroup.class).findAll();
    RealmList<RaceGroup> res = new RealmList<>();
    res.addAll(results);
    if (callback != null) {
        callback.onSuccess(res);
    }
}
Also used : RaceGroup(ch.hsr.sa.radiotour.dataaccess.models.RaceGroup) RealmList(io.realm.RealmList) Realm(io.realm.Realm)

Example 27 with RealmList

use of io.realm.RealmList in project app by TourLive.

the class RiderRepository method getAllRiders.

@Override
public void getAllRiders(OnGetAllRidersCallback callback) {
    Realm realm = Realm.getInstance(RadioTourApplication.getInstance());
    RealmResults<Rider> results = realm.where(Rider.class).findAll();
    RealmList<Rider> res = new RealmList<>();
    res.addAll(results);
    if (callback != null)
        callback.onSuccess(res);
}
Also used : RealmList(io.realm.RealmList) Realm(io.realm.Realm) Rider(ch.hsr.sa.radiotour.dataaccess.models.Rider)

Example 28 with RealmList

use of io.realm.RealmList in project app by TourLive.

the class RiderRepository method getAllActiveRidersReturned.

@Override
public RealmList<Rider> getAllActiveRidersReturned() {
    Realm realm = Realm.getInstance(RadioTourApplication.getInstance());
    RealmResults<Rider> results = realm.where(Rider.class).isNotEmpty("raceGroups").findAll();
    RealmList<Rider> res = new RealmList<>();
    res.addAll(results);
    return res;
}
Also used : RealmList(io.realm.RealmList) Realm(io.realm.Realm) Rider(ch.hsr.sa.radiotour.dataaccess.models.Rider)

Example 29 with RealmList

use of io.realm.RealmList in project app by TourLive.

the class RiderRepository method getAllRidersReturned.

@Override
public RealmList<Rider> getAllRidersReturned() {
    Realm realm = Realm.getInstance(RadioTourApplication.getInstance());
    RealmResults<Rider> results = realm.where(Rider.class).findAll();
    RealmList<Rider> res = new RealmList<>();
    res.addAll(results);
    return res;
}
Also used : RealmList(io.realm.RealmList) Realm(io.realm.Realm) Rider(ch.hsr.sa.radiotour.dataaccess.models.Rider)

Example 30 with RealmList

use of io.realm.RealmList in project app by TourLive.

the class JudgmentRiderConnectionInstrumentedTest method addRewardRiderConnection.

@Test
public void addRewardRiderConnection() {
    addRider();
    addJudgment();
    RealmList<Rider> riderList = new RealmList<>();
    RealmList<Judgement> judgementList = new RealmList<>();
    riderList.add(RiderPresenter.getInstance().getRiderByStartNr(15));
    judgementList.add(JudgmentPresenter.getInstance().getJudgmentsById(93).first());
    JudgmentRiderConnection judgmentRiderConnection = new JudgmentRiderConnection();
    judgmentRiderConnection.setRank(1);
    judgmentRiderConnection.setJudgements(judgementList);
    judgmentRiderConnection.setRider(riderList);
    synchronized (this) {
        judgmentRiderConnectionRepository.addJudgmentRiderConnection(judgmentRiderConnection, onSaveJudgmentRiderConnectionCallback);
    }
    Assert.assertEquals(1, realm.where(JudgmentRiderConnection.class).findAll().first().getRank());
}
Also used : RealmList(io.realm.RealmList) Judgement(ch.hsr.sa.radiotour.dataaccess.models.Judgement) Rider(ch.hsr.sa.radiotour.dataaccess.models.Rider) JudgmentRiderConnection(ch.hsr.sa.radiotour.dataaccess.models.JudgmentRiderConnection) Test(org.junit.Test)

Aggregations

RealmList (io.realm.RealmList)39 Realm (io.realm.Realm)23 Rider (ch.hsr.sa.radiotour.dataaccess.models.Rider)17 Test (org.junit.Test)8 RaceGroup (ch.hsr.sa.radiotour.dataaccess.models.RaceGroup)7 Judgement (ch.hsr.sa.radiotour.dataaccess.models.Judgement)6 RiderStageConnection (ch.hsr.sa.radiotour.dataaccess.models.RiderStageConnection)6 JudgmentRiderConnection (ch.hsr.sa.radiotour.dataaccess.models.JudgmentRiderConnection)4 Scheduler (io.reactivex.Scheduler)4 DynamicRealm (io.realm.DynamicRealm)4 RealmConfiguration (io.realm.RealmConfiguration)4 DialogInterface (android.content.DialogInterface)2 View (android.view.View)2 Maillot (ch.hsr.sa.radiotour.dataaccess.models.Maillot)2 Reward (ch.hsr.sa.radiotour.dataaccess.models.Reward)2 EmailRealm (com.xabber.android.data.database.realm.EmailRealm)2 SocialBindingRealm (com.xabber.android.data.database.realm.SocialBindingRealm)2 SyncStateRealm (com.xabber.android.data.database.realm.SyncStateRealm)2 XMPPUserRealm (com.xabber.android.data.database.realm.XMPPUserRealm)2 XabberAccountRealm (com.xabber.android.data.database.realm.XabberAccountRealm)2