|
@@ -1854,6 +1854,7 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
|
|
* @param includeMissing boolean
|
|
* @param includeMissing boolean
|
|
* @return array of {@link de.tudarmstadt.informatik.hostage.logging.SyncDevice}s
|
|
* @return array of {@link de.tudarmstadt.informatik.hostage.logging.SyncDevice}s
|
|
*/
|
|
*/
|
|
|
|
+ /*
|
|
public ArrayList<SyncDevice> getUpdatedDevicesFor(List<SyncDevice> oldDevices, boolean includeMissing){
|
|
public ArrayList<SyncDevice> getUpdatedDevicesFor(List<SyncDevice> oldDevices, boolean includeMissing){
|
|
|
|
|
|
HashMap<String, Long> oldDeviceMap = new HashMap<String, Long>();
|
|
HashMap<String, Long> oldDeviceMap = new HashMap<String, Long>();
|
|
@@ -1888,7 +1889,7 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
|
|
// return record list
|
|
// return record list
|
|
db.close();
|
|
db.close();
|
|
return recordList;
|
|
return recordList;
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1904,11 +1905,20 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
|
|
SQLiteDatabase db = this.getReadableDatabase();
|
|
SQLiteDatabase db = this.getReadableDatabase();
|
|
Cursor cursor = db.rawQuery(selectQuery, null);
|
|
Cursor cursor = db.rawQuery(selectQuery, null);
|
|
|
|
|
|
|
|
+ boolean actualiseOwnDevice = false;
|
|
|
|
+ if (oldDeviceMap.keySet().contains(currentDevice().getDeviceID()) || includeMissing){
|
|
|
|
+ actualiseOwnDevice = true;
|
|
|
|
+ }
|
|
|
|
+
|
|
// looping through all rows and adding to list
|
|
// looping through all rows and adding to list
|
|
if (cursor.moveToFirst()) {
|
|
if (cursor.moveToFirst()) {
|
|
do {
|
|
do {
|
|
SyncDevice record = createSyncDevice(cursor);
|
|
SyncDevice record = createSyncDevice(cursor);
|
|
// Adding record to list
|
|
// Adding record to list
|
|
|
|
+
|
|
|
|
+ if (record.getDeviceID().equals(record.getDeviceID()) && actualiseOwnDevice)
|
|
|
|
+ record.setHighest_attack_id(currentDevice().getHighest_attack_id());
|
|
|
|
+
|
|
if (oldDeviceMap.containsKey(record.getDeviceID())){
|
|
if (oldDeviceMap.containsKey(record.getDeviceID())){
|
|
Long oldSyncId = oldDeviceMap.get(record.getDeviceID());
|
|
Long oldSyncId = oldDeviceMap.get(record.getDeviceID());
|
|
if (oldSyncId < record.getHighest_attack_id()){
|
|
if (oldSyncId < record.getHighest_attack_id()){
|
|
@@ -1918,6 +1928,7 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
|
|
if (includeMissing)
|
|
if (includeMissing)
|
|
recordList.add(record);
|
|
recordList.add(record);
|
|
}
|
|
}
|
|
|
|
+
|
|
} while (cursor.moveToNext());
|
|
} while (cursor.moveToNext());
|
|
}
|
|
}
|
|
cursor.close();
|
|
cursor.close();
|