Browse Source

fixed creating syncrecords

Julien Clauter 9 years ago
parent
commit
9614838f96

+ 8 - 2
src/de/tudarmstadt/informatik/hostage/persistence/HostageDBOpenHelper.java

@@ -1221,7 +1221,13 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
 
         record.setId(Integer.parseInt(cursor.getString(11)));
         //record.setAttack_id(cursor.getLong(12));
-        record.setType(MessageRecord.TYPE.valueOf(cursor.getString(13)));
+        String v = cursor.getString(13);
+        if (v != null && !v.equals("RECEIVE")) {
+            record.setType(TYPE.SEND);
+            //record.setType(MessageRecord.TYPE.valueOf(v));
+        } else {
+            record.setType(TYPE.RECEIVE);
+        }
         record.setTimestamp(cursor.getLong(14));
         record.setPacket(cursor.getString(15));
 
@@ -1883,7 +1889,7 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
         for (SyncDevice sDevice : updatedDevices){
             String deviceID = sDevice.getDeviceID();
             Long maxID = deviceMap.get(deviceID);
-            String selectQuery = "SELECT * FROM " + AttackEntry.TABLE_NAME + " A " + " NATURAL JOIN " + PacketEntry.TABLE_NAME + " P "
+            String selectQuery = "SELECT * FROM " + AttackEntry.TABLE_NAME + " A " + " , " + PacketEntry.TABLE_NAME + " P "
                     + " WHERE "
                     +" ( "
                     + "A." + AttackEntry.COLUMN_NAME_ATTACK_ID + " = " + " P."+ PacketEntry.COLUMN_NAME_ATTACK_ID

+ 2 - 2
src/de/tudarmstadt/informatik/hostage/ui/fragment/RecordOverviewFragment.java

@@ -153,7 +153,7 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
 
 	    // Get the message from the intent
         // this.addRecordToDB(4,4,4);
-        /* Synchronizer s = new Synchronizer(this.dbh);
+         Synchronizer s = new Synchronizer(this.dbh);
          si = s.getSyncInfo();
         HashMap<String, Long> map = new HashMap<String, Long>();
         map.put(SyncDevice.currentDevice().getDeviceID(), new Long(-1));
@@ -161,7 +161,7 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
          sd = s.getSyncData(si);
 
          s.updateFromSyncData(sd);
-        */
+
         if (this.filter == null){
             Intent intent = this.getActivity().getIntent();
             LogFilter filter = intent.getParcelableExtra(LogFilter.LOG_FILTER_INTENT_KEY);