use of ch.hsr.sa.radiotour.dataaccess.models.Rider 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;
}
use of ch.hsr.sa.radiotour.dataaccess.models.Rider in project app by TourLive.
the class RiderRepository method removeRider.
@Override
public void removeRider(Rider rider, OnSaveRiderCallback callback) {
Realm realm = Realm.getInstance(RadioTourApplication.getInstance());
realm.beginTransaction();
Rider foundRider = realm.where(Rider.class).equalTo("id", rider.getId()).findFirst();
foundRider.deleteFromRealm();
realm.commitTransaction();
if (callback != null) {
callback.onSuccess();
}
}
use of ch.hsr.sa.radiotour.dataaccess.models.Rider 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;
}
use of ch.hsr.sa.radiotour.dataaccess.models.Rider in project app by TourLive.
the class RiderRepository method updateRiderStageConnection.
@Override
public void updateRiderStageConnection(Rider rider, RealmList<RiderStageConnection> connections, OnUpdateRiderStageCallback callback) {
Realm realm = Realm.getInstance(RadioTourApplication.getInstance());
realm.beginTransaction();
Rider res = realm.where(Rider.class).equalTo("startNr", rider.getStartNr()).findFirst();
res.removeStages();
realm.commitTransaction();
realm.beginTransaction();
Rider realmRider = realm.where(Rider.class).equalTo("startNr", rider.getStartNr()).findFirst();
realmRider.appendStages(connections);
realm.commitTransaction();
if (callback != null) {
callback.onSuccess();
}
}
use of ch.hsr.sa.radiotour.dataaccess.models.Rider in project app by TourLive.
the class RiderStageConnectionRepository method updateRiderState.
@Override
public void updateRiderState(final RiderStateType type, final Rider rider, OnUpdateRiderStateCallBack callback) {
Realm realm = Realm.getInstance(RadioTourApplication.getInstance());
realm.beginTransaction();
Rider res = realm.where(Rider.class).equalTo("id", rider.getId()).findFirst();
for (RiderStageConnection sC : res.getRiderStages()) {
if (sC.getType() == type) {
sC.setType(RiderStateType.AKTIVE);
} else {
sC.setType(type);
}
}
realm.commitTransaction();
RiderStageConnection state = realm.where(RiderStageConnection.class).equalTo("riders.id", rider.getId()).findFirst();
if (callback != null)
callback.onSuccess(state);
}
Aggregations