Implement changeStoredSamplesType()

This commit is contained in:
cpfeiffer 2016-05-16 23:45:21 +02:00
parent 876bdac918
commit 4b374e3f7e
2 changed files with 14 additions and 4 deletions

View File

@ -98,14 +98,20 @@ public abstract class AbstractSampleProvider<T extends AbstractActivitySample> i
// //
public void changeStoredSamplesType(int timestampFrom, int timestampTo, int kind) { public void changeStoredSamplesType(int timestampFrom, int timestampTo, int kind) {
// TODO: implement List<T> samples = getAllActivitySamples(timestampFrom, timestampTo);
for (T sample : samples) {
sample.setRawKind(kind);
}
getSampleDao().updateInTx(samples);
} }
public void changeStoredSamplesType(int timestampFrom, int timestampTo, int fromKind, int toKind) { public void changeStoredSamplesType(int timestampFrom, int timestampTo, int fromKind, int toKind) {
// TODO: implement List<T> samples = getGBActivitySamples(timestampFrom, timestampTo, fromKind);
for (T sample : samples) {
sample.setRawKind(toKind);
}
getSampleDao().updateInTx(samples);
} }
//// SQLiteDatabase getWritableDatabase();
protected List<T> getGBActivitySamples(int timestamp_from, int timestamp_to, int activityType) { protected List<T> getGBActivitySamples(int timestamp_from, int timestamp_to, int activityType) {
QueryBuilder<T> qb = getSampleDao().queryBuilder(); QueryBuilder<T> qb = getSampleDao().queryBuilder();

View File

@ -26,6 +26,10 @@ public abstract class AbstractActivitySample implements ActivitySample {
return getProvider().normalizeIntensity(getRawIntensity()); return getProvider().normalizeIntensity(getRawIntensity());
} }
public abstract void setRawKind(int kind);
public abstract void setRawIntensity(int intensity);
@Override @Override
public String toString() { public String toString() {
return getClass().getSimpleName() + "{" + return getClass().getSimpleName() + "{" +